perf: Skip state root calculation

This commit is contained in:
sprites0
2025-03-10 23:49:47 +00:00
parent c76ae4e1fb
commit bbed5bc27f
2 changed files with 2 additions and 33 deletions

View File

@ -587,14 +587,9 @@ where
/// Returns a state hook to be used to send state updates to this task. /// Returns a state hook to be used to send state updates to this task.
pub fn state_hook(&self) -> impl OnStateHook { 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| { 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");
}
} }
} }

View File

@ -19,8 +19,6 @@ use reth_provider::{
StateWriter, StaticFileProviderFactory, StorageLocation, TrieWriter, StateWriter, StaticFileProviderFactory, StorageLocation, TrieWriter,
}; };
use reth_stages_types::{StageCheckpoint, StageId}; use reth_stages_types::{StageCheckpoint, StageId};
use reth_trie::{IntermediateStateRootState, StateRoot as StateRootComputer, StateRootProgress};
use reth_trie_db::DatabaseStateRoot;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::io::BufRead; use std::io::BufRead;
use tracing::{debug, error, info, trace}; 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) // account)
pub const AVERAGE_COUNT_ACCOUNTS_PER_GB_STATE_DUMP: usize = 285_228; 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. /// Storage initialization error type.
#[derive(Debug, thiserror::Error, Clone)] #[derive(Debug, thiserror::Error, Clone)]
pub enum InitStorageError { pub enum InitStorageError {
@ -415,27 +410,6 @@ where
// write state to db // write state to db
dump_state(collector, provider_rw, block)?; 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 // insert sync stages for stages that require state
for stage in StageId::STATE_REQUIRED { for stage in StageId::STATE_REQUIRED {
provider_rw.save_stage_checkpoint(stage, StageCheckpoint::new(block))?; provider_rw.save_stage_checkpoint(stage, StageCheckpoint::new(block))?;