diff --git a/book/cli/reth/node.md b/book/cli/reth/node.md index f63981766a..9b3a866990 100644 --- a/book/cli/reth/node.md +++ b/book/cli/reth/node.md @@ -735,7 +735,10 @@ Engine: Enable legacy state root --engine.caching-and-prewarming - Enable cross-block caching and parallel prewarming + CAUTION: This CLI flag has no effect anymore, use --engine.disable-caching-and-prewarming if you want to disable caching and prewarming + + --engine.disable-caching-and-prewarming + Disable cross-block caching and parallel prewarming --engine.cross-block-cache-size Configure the size of cross-block cache in megabytes diff --git a/crates/engine/primitives/src/config.rs b/crates/engine/primitives/src/config.rs index 9315ed1158..b8cf24583c 100644 --- a/crates/engine/primitives/src/config.rs +++ b/crates/engine/primitives/src/config.rs @@ -58,13 +58,13 @@ pub struct TreeConfig { /// a batch of downloaded blocks. max_execute_block_batch_size: usize, /// Whether to use the legacy state root calculation method instead of the - /// new state root task + /// new state root task. legacy_state_root: bool, /// Whether to always compare trie updates from the state root task to the trie updates from /// the regular state root calculation. always_compare_trie_updates: bool, - /// Whether to use cross-block caching and parallel prewarming - use_caching_and_prewarming: bool, + /// Whether to disable cross-block caching and parallel prewarming. + disable_caching_and_prewarming: bool, /// Cross-block cache size in bytes. cross_block_cache_size: u64, /// Whether the host has enough parallelism to run state root task. @@ -85,7 +85,7 @@ impl Default for TreeConfig { max_execute_block_batch_size: DEFAULT_MAX_EXECUTE_BLOCK_BATCH_SIZE, legacy_state_root: false, always_compare_trie_updates: false, - use_caching_and_prewarming: false, + disable_caching_and_prewarming: false, cross_block_cache_size: DEFAULT_CROSS_BLOCK_CACHE_SIZE, has_enough_parallelism: has_enough_parallelism(), max_proof_task_concurrency: DEFAULT_MAX_PROOF_TASK_CONCURRENCY, @@ -105,7 +105,7 @@ impl TreeConfig { max_execute_block_batch_size: usize, legacy_state_root: bool, always_compare_trie_updates: bool, - use_caching_and_prewarming: bool, + disable_caching_and_prewarming: bool, cross_block_cache_size: u64, has_enough_parallelism: bool, max_proof_task_concurrency: u64, @@ -119,7 +119,7 @@ impl TreeConfig { max_execute_block_batch_size, legacy_state_root, always_compare_trie_updates, - use_caching_and_prewarming, + disable_caching_and_prewarming, cross_block_cache_size, has_enough_parallelism, max_proof_task_concurrency, @@ -169,8 +169,8 @@ impl TreeConfig { } /// Returns whether or not cross-block caching and parallel prewarming should be used. - pub const fn use_caching_and_prewarming(&self) -> bool { - self.use_caching_and_prewarming + pub const fn disable_caching_and_prewarming(&self) -> bool { + self.disable_caching_and_prewarming } /// Returns whether to always compare trie updates from the state root task to the trie updates @@ -229,9 +229,12 @@ impl TreeConfig { self } - /// Setter for whether to use the new state root task calculation method. - pub const fn with_caching_and_prewarming(mut self, use_caching_and_prewarming: bool) -> Self { - self.use_caching_and_prewarming = use_caching_and_prewarming; + /// Setter for whether to disable cross-block caching and parallel prewarming. + pub const fn without_caching_and_prewarming( + mut self, + disable_caching_and_prewarming: bool, + ) -> Self { + self.disable_caching_and_prewarming = disable_caching_and_prewarming; self } diff --git a/crates/engine/tree/src/tree/payload_processor/mod.rs b/crates/engine/tree/src/tree/payload_processor/mod.rs index 9ea3772697..8558a7479e 100644 --- a/crates/engine/tree/src/tree/payload_processor/mod.rs +++ b/crates/engine/tree/src/tree/payload_processor/mod.rs @@ -53,8 +53,8 @@ pub struct PayloadProcessor { trie_metrics: MultiProofTaskMetrics, /// Cross-block cache size in bytes. cross_block_cache_size: u64, - /// Whether transactions should be executed on prewarming task. - use_transaction_prewarming: bool, + /// Whether transactions should not be executed on prewarming task. + disable_transaction_prewarming: bool, /// Determines how to configure the evm for execution. evm_config: Evm, _marker: std::marker::PhantomData, @@ -68,7 +68,7 @@ impl PayloadProcessor { execution_cache: Default::default(), trie_metrics: Default::default(), cross_block_cache_size: config.cross_block_cache_size(), - use_transaction_prewarming: config.use_caching_and_prewarming(), + disable_transaction_prewarming: config.disable_caching_and_prewarming(), evm_config, _marker: Default::default(), } @@ -236,7 +236,7 @@ where + Clone + 'static, { - if !self.use_transaction_prewarming { + if self.disable_transaction_prewarming { // if no transactions should be executed we clear them but still spawn the task for // caching updates transactions.clear(); diff --git a/crates/node/core/src/args/engine.rs b/crates/node/core/src/args/engine.rs index d288780b7f..5be007389e 100644 --- a/crates/node/core/src/args/engine.rs +++ b/crates/node/core/src/args/engine.rs @@ -24,10 +24,15 @@ pub struct EngineArgs { #[arg(long = "engine.legacy-state-root", default_value = "false")] pub legacy_state_root_task_enabled: bool, - /// Enable cross-block caching and parallel prewarming - #[arg(long = "engine.caching-and-prewarming")] + /// CAUTION: This CLI flag has no effect anymore, use --engine.disable-caching-and-prewarming + /// if you want to disable caching and prewarming. + #[arg(long = "engine.caching-and-prewarming", default_value = "true")] pub caching_and_prewarming_enabled: bool, + /// Disable cross-block caching and parallel prewarming + #[arg(long = "engine.disable-caching-and-prewarming")] + pub caching_and_prewarming_disabled: bool, + /// Configure the size of cross-block cache in megabytes #[arg(long = "engine.cross-block-cache-size", default_value_t = DEFAULT_CROSS_BLOCK_CACHE_SIZE_MB)] pub cross_block_cache_size: u64, @@ -57,7 +62,8 @@ impl Default for EngineArgs { memory_block_buffer_target: DEFAULT_MEMORY_BLOCK_BUFFER_TARGET, legacy_state_root_task_enabled: false, state_root_task_compare_updates: false, - caching_and_prewarming_enabled: false, + caching_and_prewarming_enabled: true, + caching_and_prewarming_disabled: false, cross_block_cache_size: DEFAULT_CROSS_BLOCK_CACHE_SIZE_MB, accept_execution_requests_hash: false, max_proof_task_concurrency: DEFAULT_MAX_PROOF_TASK_CONCURRENCY, @@ -73,7 +79,7 @@ impl EngineArgs { .with_persistence_threshold(self.persistence_threshold) .with_memory_block_buffer_target(self.memory_block_buffer_target) .with_legacy_state_root(self.legacy_state_root_task_enabled) - .with_caching_and_prewarming(self.caching_and_prewarming_enabled) + .without_caching_and_prewarming(self.caching_and_prewarming_disabled) .with_always_compare_trie_updates(self.state_root_task_compare_updates) .with_cross_block_cache_size(self.cross_block_cache_size * 1024 * 1024) .with_max_proof_task_concurrency(self.max_proof_task_concurrency)