Chore: move tree config from engine-tree to engine-primitives (#14890)

Co-authored-by: Arsenii Kulikov <klkvrr@gmail.com>
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Sumit
2025-03-12 23:04:04 +05:30
committed by GitHub
parent f5dddffc7e
commit 20bbdd70b9
10 changed files with 52 additions and 55 deletions

View File

@@ -1,6 +1,7 @@
//! clap [Args](clap::Args) for engine purposes
use clap::Args;
use reth_engine_primitives::TreeConfig;
use crate::node_config::{
DEFAULT_CROSS_BLOCK_CACHE_SIZE_MB, DEFAULT_MEMORY_BLOCK_BUFFER_TARGET,
@@ -50,6 +51,19 @@ impl Default for EngineArgs {
}
}
impl EngineArgs {
/// Creates a [`TreeConfig`] from the engine arguments.
pub fn tree_config(&self) -> TreeConfig {
TreeConfig::default()
.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)
.with_always_compare_trie_updates(self.state_root_task_compare_updates)
.with_cross_block_cache_size(self.cross_block_cache_size * 1024 * 1024)
}
}
#[cfg(test)]
mod tests {
use super::*;