From 76c4bc99bbadf13daa7bccd96428d66bc5e71afa Mon Sep 17 00:00:00 2001 From: Islam El-Ashi Date: Fri, 26 Apr 2024 11:41:58 +0200 Subject: [PATCH] chore: reduce block ingestion instruction limit from 2B to 1B --- canister/src/heartbeat.rs | 4 ++-- canister/src/tests.rs | 2 +- canister/src/utxo_set.rs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/canister/src/heartbeat.rs b/canister/src/heartbeat.rs index 54cb152c..6cc2b1ff 100644 --- a/canister/src/heartbeat.rs +++ b/canister/src/heartbeat.rs @@ -391,7 +391,7 @@ mod test { // Set a large step for the performance_counter to exceed the instructions limit quickly. // This value allows ingesting 3 inputs/outputs per round. - runtime::set_performance_counter_step(500_000_000); + runtime::set_performance_counter_step(250_000_000); // Fetch blocks. heartbeat().await; @@ -508,7 +508,7 @@ mod test { // Set a large step for the performance_counter to exceed the instructions limit quickly. // This value allows ingesting 3 transactions inputs/outputs per round. - runtime::set_performance_counter_step(500_000_000); + runtime::set_performance_counter_step(250_000_000); // Fetch blocks. heartbeat().await; diff --git a/canister/src/tests.rs b/canister/src/tests.rs index 195b7019..3f1c8d4d 100644 --- a/canister/src/tests.rs +++ b/canister/src/tests.rs @@ -461,7 +461,7 @@ async fn time_slices_large_block_with_multiple_transactions() { // Set a large step for the performance_counter to exceed the instructions limit quickly. // This value allows ingesting 2 transactions inputs/outputs per round. - runtime::set_performance_counter_step(750_000_000); + runtime::set_performance_counter_step(375_000_000); // Fetch blocks. heartbeat().await; diff --git a/canister/src/utxo_set.rs b/canister/src/utxo_set.rs index 48949de3..d5367ebd 100644 --- a/canister/src/utxo_set.rs +++ b/canister/src/utxo_set.rs @@ -555,9 +555,9 @@ impl PartialEq for UtxoSet { // Checks that we're not approaching the instructions limit. fn default_should_time_slice() -> Box bool> { // The threshold at which time slicing kicks in. - // At the time of this writing it is equivalent to 40% of the maximum instructions limit. - // NOTE: We've reduced this limit from 4B to 2B in an effort to keep the FR stable. - const MAX_INSTRUCTIONS_THRESHOLD: u64 = 2_000_000_000; + // At the time of this writing it is equivalent to 20% of the maximum instructions limit. + // NOTE: We've reduced this limit from 4B to 1B in an effort to keep the FR stable. + const MAX_INSTRUCTIONS_THRESHOLD: u64 = 1_000_000_000; // NOTE: We're using `inc_performance_counter` here to also increment the mock performance // counter in the unit tests.