feat(cli): add use-caching-and-prewarming flag (#14114)

This commit is contained in:
Dan Cline
2025-01-30 19:48:35 -05:00
committed by GitHub
parent 4d00627559
commit 4ce5a60c58
3 changed files with 25 additions and 0 deletions

View File

@ -695,6 +695,9 @@ Engine:
--engine.state-root-task
Enable state root task
--engine.caching-and-prewarming
Enable cross-block caching and parallel prewarming
--engine.state-root-task-compare-updates
Enable comparing trie updates from the state root task to the trie updates from the regular state root calculation

View File

@ -46,6 +46,8 @@ pub struct TreeConfig {
/// 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,
}
impl Default for TreeConfig {
@ -58,12 +60,14 @@ impl Default for TreeConfig {
max_execute_block_batch_size: DEFAULT_MAX_EXECUTE_BLOCK_BATCH_SIZE,
use_state_root_task: false,
always_compare_trie_updates: false,
use_caching_and_prewarming: false,
}
}
}
impl TreeConfig {
/// Create engine tree configuration.
#[allow(clippy::too_many_arguments)]
pub const fn new(
persistence_threshold: u64,
memory_block_buffer_target: u64,
@ -72,6 +76,7 @@ impl TreeConfig {
max_execute_block_batch_size: usize,
use_state_root_task: bool,
always_compare_trie_updates: bool,
use_caching_and_prewarming: bool,
) -> Self {
Self {
persistence_threshold,
@ -81,6 +86,7 @@ impl TreeConfig {
max_execute_block_batch_size,
use_state_root_task,
always_compare_trie_updates,
use_caching_and_prewarming,
}
}
@ -114,6 +120,11 @@ impl TreeConfig {
self.use_state_root_task
}
/// 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
}
/// Returns whether to always compare trie updates from the state root task to the trie updates
/// from the regular state root calculation.
pub const fn always_compare_trie_updates(&self) -> bool {
@ -165,6 +176,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;
self
}
/// Setter for whether to always compare trie updates from the state root task to the trie
/// updates from the regular state root calculation.
pub const fn with_always_compare_trie_updates(

View File

@ -20,6 +20,10 @@ pub struct EngineArgs {
#[arg(long = "engine.state-root-task")]
pub state_root_task_enabled: bool,
/// Enable cross-block caching and parallel prewarming
#[arg(long = "engine.caching-and-prewarming")]
pub caching_and_prewarming_enabled: bool,
/// Enable comparing trie updates from the state root task to the trie updates from the regular
/// state root calculation.
#[arg(long = "engine.state-root-task-compare-updates")]
@ -33,6 +37,7 @@ impl Default for EngineArgs {
memory_block_buffer_target: DEFAULT_MEMORY_BLOCK_BUFFER_TARGET,
state_root_task_enabled: false,
state_root_task_compare_updates: false,
caching_and_prewarming_enabled: false,
}
}
}