Skip to content
This repository has been archived by the owner on Feb 6, 2025. It is now read-only.

Commit

Permalink
chore: add debug logs when state root mismatched (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonberg1997 authored Sep 10, 2024
1 parent afa32b5 commit 4b0431c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions crates/blockchain-tree/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,13 @@ impl AppendableChain {
(state_root, None)
};
if block.state_root != state_root {
tracing::debug!(
target: "blockchain_tree::chain",
number = block.number,
hash = %block_hash,
receipts = ?&initial_execution_outcome.receipts,
"Mismatched state root"
);
return Err(ConsensusError::BodyStateRootDiff(
GotExpected { got: state_root, expected: block.state_root }.into(),
)
Expand Down
7 changes: 7 additions & 0 deletions crates/engine/tree/src/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1780,6 +1780,13 @@ where
let (state_root, trie_output) =
state_provider.state_root_with_updates(hashed_state.clone())?;
if state_root != block.state_root {
debug!(
target: "engine",
number = block.number,
hash = %block_hash,
receipts = ?output.receipts,
"Mismatched state root"
);
return Err(ConsensusError::BodyStateRootDiff(
GotExpected { got: state_root, expected: block.state_root }.into(),
)
Expand Down
2 changes: 1 addition & 1 deletion crates/stages/stages/src/stages/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Please include the following information in your report:
* The debug logs from __the same time period__. To find the default location for these logs, run:
`reth --help | grep -A 4 'log.file.directory'`
Once you have this information, please submit a github issue at https://github.com/paradigmxyz/reth/issues/new
Once you have this information, please submit a github issue at https://github.com/bnb-chain/reth/issues/new
"#;

/// The default threshold (in number of blocks) for switching from incremental trie building
Expand Down

0 comments on commit 4b0431c

Please sign in to comment.