Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions crates/iota-core/src/overload_monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,27 +276,27 @@ fn compute_latency_load_shedding_percentage(
// First, we calculate based on the current `txn_ready_rate` and
// `execution_rate`, what's the percentage of traffic to shed from
// `txn_ready_rate`.
let additional_load_shedding_percentage;
if queueing_latency > config.execution_queue_latency_hard_limit {
let calculated_load_shedding_percentage =
calculate_load_shedding_percentage(txn_ready_rate, execution_rate);

additional_load_shedding_percentage = if calculated_load_shedding_percentage > 0
|| txn_ready_rate >= config.safe_transaction_ready_rate as f64
{
max(
calculated_load_shedding_percentage,
config.min_load_shedding_percentage_above_hard_limit,
)
let additional_load_shedding_percentage =
if queueing_latency > config.execution_queue_latency_hard_limit {
let calculated_load_shedding_percentage =
calculate_load_shedding_percentage(txn_ready_rate, execution_rate);

if calculated_load_shedding_percentage > 0
|| txn_ready_rate >= config.safe_transaction_ready_rate as f64
{
max(
calculated_load_shedding_percentage,
config.min_load_shedding_percentage_above_hard_limit,
)
} else {
0
}
} else if queueing_latency > config.execution_queue_latency_soft_limit {
calculate_load_shedding_percentage(txn_ready_rate, execution_rate)
} else {
0
};
} else if queueing_latency > config.execution_queue_latency_soft_limit {
additional_load_shedding_percentage =
calculate_load_shedding_percentage(txn_ready_rate, execution_rate);
} else {
additional_load_shedding_percentage = 0;
}

// Next, we calculate the new load shedding percentage.
let load_shedding_percentage = if additional_load_shedding_percentage > 0 {
Expand Down
16 changes: 8 additions & 8 deletions crates/iota-json-rpc-types/src/iota_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1087,45 +1087,45 @@ impl Display for IotaTransactionBlockEffects {
builder.push_record(vec![format!("Executed Epoch: {}", self.executed_epoch())]);

if !self.created().is_empty() {
builder.push_record(vec![format!("\nCreated Objects: ")]);
builder.push_record(vec!["\nCreated Objects: ".to_string()]);

for oref in self.created() {
builder.push_record(vec![owned_objref_string(oref)]);
}
}

if !self.mutated().is_empty() {
builder.push_record(vec![format!("Mutated Objects: ")]);
builder.push_record(vec!["Mutated Objects: ".to_string()]);
for oref in self.mutated() {
builder.push_record(vec![owned_objref_string(oref)]);
}
}

if !self.shared_objects().is_empty() {
builder.push_record(vec![format!("Shared Objects: ")]);
builder.push_record(vec!["Shared Objects: ".to_string()]);
for oref in self.shared_objects() {
builder.push_record(vec![objref_string(oref)]);
}
}

if !self.deleted().is_empty() {
builder.push_record(vec![format!("Deleted Objects: ")]);
builder.push_record(vec!["Deleted Objects: ".to_string()]);

for oref in self.deleted() {
builder.push_record(vec![objref_string(oref)]);
}
}

if !self.wrapped().is_empty() {
builder.push_record(vec![format!("Wrapped Objects: ")]);
builder.push_record(vec!["Wrapped Objects: ".to_string()]);

for oref in self.wrapped() {
builder.push_record(vec![objref_string(oref)]);
}
}

if !self.unwrapped().is_empty() {
builder.push_record(vec![format!("Unwrapped Objects: ")]);
builder.push_record(vec!["Unwrapped Objects: ".to_string()]);
for oref in self.unwrapped() {
builder.push_record(vec![owned_objref_string(oref)]);
}
Expand Down Expand Up @@ -1153,7 +1153,7 @@ impl Display for IotaTransactionBlockEffects {

let dependencies = self.dependencies();
if !dependencies.is_empty() {
builder.push_record(vec![format!("\nTransaction Dependencies:")]);
builder.push_record(vec!["\nTransaction Dependencies:".to_string()]);
for dependency in dependencies {
builder.push_record(vec![format!(" {dependency}")]);
}
Expand Down Expand Up @@ -1812,7 +1812,7 @@ impl Display for IotaTransactionBlock {
let mut builder = TableBuilder::default();

builder.push_record(vec![format!("{}", self.data)]);
builder.push_record(vec![format!("Signatures:")]);
builder.push_record(vec!["Signatures:".to_string()]);
for tx_sig in &self.tx_signatures {
builder.push_record(vec![format!(
" {}\n",
Expand Down
4 changes: 2 additions & 2 deletions crates/iota-json-rpc/src/coin_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ mod tests {

mod get_balance_tests {

use super::{super::*, *};
use super::*;
// Success scenarios
#[tokio::test]
async fn test_gas_coin() {
Expand Down Expand Up @@ -1241,7 +1241,7 @@ mod tests {
}

mod get_all_balances_tests {
use super::{super::*, *};
use super::*;

// Success scenarios
#[tokio::test]
Expand Down
4 changes: 3 additions & 1 deletion crates/iota-replay/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,9 @@ fn parse_configs_versions(
);
Some(
configs_and_versions
.chunks_exact(2)
.as_chunks::<2>()
.0
.iter()
.map(|chunk| {
let object_id =
ObjectId::from_str(&chunk[0]).expect("Invalid object id for config");
Expand Down
8 changes: 4 additions & 4 deletions crates/typed-store/tests/macro_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ async fn macro_test() {
// Test pagination
let m = tbls_secondary.dump("table1", 2, 0).unwrap();
assert_eq!(2, m.len());
assert_eq!(format!("\"1\""), *m.get("\"1\"").unwrap());
assert_eq!(format!("\"2\""), *m.get("\"2\"").unwrap());
assert_eq!("\"1\"".to_string(), *m.get("\"1\"").unwrap());
assert_eq!("\"2\"".to_string(), *m.get("\"2\"").unwrap());

let m = tbls_secondary.dump("table1", 3, 2).unwrap();
assert_eq!(3, m.len());
assert_eq!(format!("\"7\""), *m.get("\"7\"").unwrap());
assert_eq!(format!("\"8\""), *m.get("\"8\"").unwrap());
assert_eq!("\"7\"".to_string(), *m.get("\"7\"").unwrap());
assert_eq!("\"8\"".to_string(), *m.get("\"8\"").unwrap());
}

#[tokio::test]
Expand Down
22 changes: 10 additions & 12 deletions iota-execution/latest/iota-move-natives/src/crypto/groth16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,13 @@ pub fn prepare_verifying_key_internal(
native_charge_gas_early_exit!(context, base_cost);
let cost = context.gas_used();

let result;
if curve == BLS12381 {
result = fastcrypto_zkp::bls12381::api::prepare_pvk_bytes(&verifying_key);
let result = if curve == BLS12381 {
fastcrypto_zkp::bls12381::api::prepare_pvk_bytes(&verifying_key)
} else if curve == BN254 {
result = fastcrypto_zkp::bn254::api::prepare_pvk_bytes(&verifying_key);
fastcrypto_zkp::bn254::api::prepare_pvk_bytes(&verifying_key)
} else {
return Ok(NativeResult::err(cost, INVALID_CURVE));
}
};

match result {
Ok(pvk) => Ok(NativeResult::ok(
Expand Down Expand Up @@ -231,36 +230,35 @@ pub fn verify_groth16_proof_internal(

let cost = context.gas_used();

let result;
if curve == BLS12381 {
let result = if curve == BLS12381 {
if public_proof_inputs.len()
> fastcrypto::groups::bls12381::SCALAR_LENGTH * MAX_PUBLIC_INPUTS
{
return Ok(NativeResult::err(cost, TOO_MANY_PUBLIC_INPUTS));
}
result = fastcrypto_zkp::bls12381::api::verify_groth16_in_bytes(
fastcrypto_zkp::bls12381::api::verify_groth16_in_bytes(
&vk_gamma_abc_g1,
&alpha_g1_beta_g2,
&gamma_g2_neg_pc,
&delta_g2_neg_pc,
&public_proof_inputs,
&proof_points,
);
)
} else if curve == BN254 {
if public_proof_inputs.len() > fastcrypto_zkp::bn254::api::SCALAR_SIZE * MAX_PUBLIC_INPUTS {
return Ok(NativeResult::err(cost, TOO_MANY_PUBLIC_INPUTS));
}
result = fastcrypto_zkp::bn254::api::verify_groth16_in_bytes(
fastcrypto_zkp::bn254::api::verify_groth16_in_bytes(
&vk_gamma_abc_g1,
&alpha_g1_beta_g2,
&gamma_g2_neg_pc,
&delta_g2_neg_pc,
&public_proof_inputs,
&proof_points,
);
)
} else {
return Ok(NativeResult::err(cost, INVALID_CURVE));
}
};

Ok(NativeResult::ok(
cost,
Expand Down
Loading