From bbed5bc27fc8f01e134d77917f1960f8425c94e8 Mon Sep 17 00:00:00 2001 From: sprites0 <199826320+sprites0@users.noreply.github.com> Date: Mon, 10 Mar 2025 23:49:47 +0000 Subject: [PATCH] perf: Skip state root calculation --- crates/engine/tree/src/tree/root.rs | 9 ++------- crates/storage/db-common/src/init.rs | 26 -------------------------- 2 files changed, 2 insertions(+), 33 deletions(-) diff --git a/crates/engine/tree/src/tree/root.rs b/crates/engine/tree/src/tree/root.rs index 0e59b8fbd..e4be54dfa 100644 --- a/crates/engine/tree/src/tree/root.rs +++ b/crates/engine/tree/src/tree/root.rs @@ -587,14 +587,9 @@ where /// Returns a state hook to be used to send state updates to this task. pub fn state_hook(&self) -> impl OnStateHook { - let state_hook = self.state_hook_sender(); + let _state_hook = self.state_hook_sender(); - move |source: StateChangeSource, state: &EvmState| { - if let Err(error) = - state_hook.send(StateRootMessage::StateUpdate(source, state.clone())) - { - error!(target: "engine::root", ?error, "Failed to send state update"); - } + move |_source: StateChangeSource, _state: &EvmState| { } } diff --git a/crates/storage/db-common/src/init.rs b/crates/storage/db-common/src/init.rs index 8d728090d..58a8f960e 100644 --- a/crates/storage/db-common/src/init.rs +++ b/crates/storage/db-common/src/init.rs @@ -19,8 +19,6 @@ use reth_provider::{ StateWriter, StaticFileProviderFactory, StorageLocation, TrieWriter, }; use reth_stages_types::{StageCheckpoint, StageId}; -use reth_trie::{IntermediateStateRootState, StateRoot as StateRootComputer, StateRootProgress}; -use reth_trie_db::DatabaseStateRoot; use serde::{Deserialize, Serialize}; use std::io::BufRead; use tracing::{debug, error, info, trace}; @@ -39,9 +37,6 @@ pub const DEFAULT_SOFT_LIMIT_BYTE_LEN_ACCOUNTS_CHUNK: usize = 1_000_000_000; // account) pub const AVERAGE_COUNT_ACCOUNTS_PER_GB_STATE_DUMP: usize = 285_228; -/// Soft limit for the number of flushed updates after which to log progress summary. -const SOFT_LIMIT_COUNT_FLUSHED_UPDATES: usize = 1_000_000; - /// Storage initialization error type. #[derive(Debug, thiserror::Error, Clone)] pub enum InitStorageError { @@ -415,27 +410,6 @@ where // write state to db dump_state(collector, provider_rw, block)?; - // compute and compare state root. this advances the stage checkpoints. - let computed_state_root = compute_state_root(provider_rw)?; - if computed_state_root == expected_state_root { - info!(target: "reth::cli", - ?computed_state_root, - "Computed state root matches state root in state dump" - ); - } else { - error!(target: "reth::cli", - ?computed_state_root, - ?expected_state_root, - "Computed state root does not match state root in state dump" - ); - - return Err(InitStorageError::StateRootMismatch(GotExpected { - got: computed_state_root, - expected: expected_state_root, - }) - .into()) - } - // insert sync stages for stages that require state for stage in StageId::STATE_REQUIRED { provider_rw.save_stage_checkpoint(stage, StageCheckpoint::new(block))?;