feat(engine): allow configuring tree to always use state root fallback (#16569)

This commit is contained in:
Federico Gimenez
2025-05-30 20:07:01 +02:00
committed by GitHub
parent 6b5a4b2a66
commit aecf5e321c
4 changed files with 35 additions and 3 deletions

View File

@@ -77,6 +77,8 @@ pub struct TreeConfig {
reserved_cpu_cores: usize,
/// Whether to enable the precompile cache
precompile_cache_enabled: bool,
/// Whether to use state root fallback for testing
state_root_fallback: bool,
}
impl Default for TreeConfig {
@@ -96,6 +98,7 @@ impl Default for TreeConfig {
max_proof_task_concurrency: DEFAULT_MAX_PROOF_TASK_CONCURRENCY,
reserved_cpu_cores: DEFAULT_RESERVED_CPU_CORES,
precompile_cache_enabled: false,
state_root_fallback: false,
}
}
}
@@ -118,6 +121,7 @@ impl TreeConfig {
max_proof_task_concurrency: u64,
reserved_cpu_cores: usize,
precompile_cache_enabled: bool,
state_root_fallback: bool,
) -> Self {
Self {
persistence_threshold,
@@ -134,6 +138,7 @@ impl TreeConfig {
max_proof_task_concurrency,
reserved_cpu_cores,
precompile_cache_enabled,
state_root_fallback,
}
}
@@ -204,6 +209,11 @@ impl TreeConfig {
self.precompile_cache_enabled
}
/// Returns whether to use state root fallback.
pub const fn state_root_fallback(&self) -> bool {
self.state_root_fallback
}
/// Setter for persistence threshold.
pub const fn with_persistence_threshold(mut self, persistence_threshold: u64) -> Self {
self.persistence_threshold = persistence_threshold;
@@ -307,6 +317,12 @@ impl TreeConfig {
self
}
/// Setter for whether to use state root fallback, useful for testing.
pub const fn with_state_root_fallback(mut self, state_root_fallback: bool) -> Self {
self.state_root_fallback = state_root_fallback;
self
}
/// Whether or not to use state root task
pub const fn use_state_root_task(&self) -> bool {
self.has_enough_parallelism && !self.legacy_state_root