mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
perf: Skip state root calculation
This commit is contained in:
@ -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| {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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))?;
|
||||
|
||||
Reference in New Issue
Block a user