From 4b0431c87907d5e9aa0c848eb5b544238618925a Mon Sep 17 00:00:00 2001 From: Roshan <48975233+pythonberg1997@users.noreply.github.com> Date: Tue, 10 Sep 2024 18:10:07 +0800 Subject: [PATCH] chore: add debug logs when state root mismatched (#142) --- crates/blockchain-tree/src/chain.rs | 7 +++++++ crates/engine/tree/src/tree/mod.rs | 7 +++++++ crates/stages/stages/src/stages/merkle.rs | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/crates/blockchain-tree/src/chain.rs b/crates/blockchain-tree/src/chain.rs index d6fab95cfa..6c28cd7212 100644 --- a/crates/blockchain-tree/src/chain.rs +++ b/crates/blockchain-tree/src/chain.rs @@ -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(), ) diff --git a/crates/engine/tree/src/tree/mod.rs b/crates/engine/tree/src/tree/mod.rs index 8eebf960b9..2db8ff8cbc 100644 --- a/crates/engine/tree/src/tree/mod.rs +++ b/crates/engine/tree/src/tree/mod.rs @@ -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(), ) diff --git a/crates/stages/stages/src/stages/merkle.rs b/crates/stages/stages/src/stages/merkle.rs index 4fd9f4c1ab..bfd6b9c229 100644 --- a/crates/stages/stages/src/stages/merkle.rs +++ b/crates/stages/stages/src/stages/merkle.rs @@ -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