From bc2d0d036f0aaf3af4a62fd76e2123fa99264183 Mon Sep 17 00:00:00 2001 From: Roman Krasiuk Date: Thu, 19 Sep 2024 09:47:30 +0200 Subject: [PATCH] chore(engine): disable parallel state root --- crates/engine/tree/src/tree/mod.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/crates/engine/tree/src/tree/mod.rs b/crates/engine/tree/src/tree/mod.rs index 025575eaa064..922ab89f325f 100644 --- a/crates/engine/tree/src/tree/mod.rs +++ b/crates/engine/tree/src/tree/mod.rs @@ -491,10 +491,12 @@ pub struct EngineApiTreeHandler { payload_builder: PayloadBuilderHandle, /// Configuration settings. config: TreeConfig, - /// Metrics for the engine api. - metrics: EngineApiMetrics, /// An invalid block hook. invalid_block_hook: Box, + /// Temporary flag to disable parallel state root. + parallel_state_root_enabled: bool, + /// Metrics for the engine api. + metrics: EngineApiMetrics, } impl std::fmt::Debug for EngineApiTreeHandler { @@ -512,8 +514,9 @@ impl std::fmt::Debug for EngineApiTr .field("canonical_in_memory_state", &self.canonical_in_memory_state) .field("payload_builder", &self.payload_builder) .field("config", &self.config) - .field("metrics", &self.metrics) .field("invalid_block_hook", &format!("{:p}", self.invalid_block_hook)) + .field("parallel_state_root_enabled", &self.parallel_state_root_enabled) + .field("metrics", &self.metrics) .finish() } } @@ -555,9 +558,10 @@ where canonical_in_memory_state, payload_builder, config, - metrics: Default::default(), incoming_tx, invalid_block_hook: Box::new(NoopInvalidBlockHook), + parallel_state_root_enabled: false, + metrics: Default::default(), } } @@ -2178,7 +2182,7 @@ where // we are computing in parallel, because we initialize a different database transaction // per thread and it might end up with a different view of the database. let persistence_in_progress = self.persistence_state.in_progress(); - if !persistence_in_progress { + if self.parallel_state_root_enabled && !persistence_in_progress { state_root_result = match self .compute_state_root_in_parallel(block.parent_hash, &hashed_state) {