mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-29 09:08:05 -05:00
chore(provider): seperate error on unwind root mismatch (#2563)
This commit is contained in:
@@ -584,7 +584,7 @@ where
|
||||
let (state_root, trie_updates) =
|
||||
StateRoot::incremental_root_with_updates(self.deref_mut(), range.clone())?;
|
||||
if state_root != expected_state_root {
|
||||
return Err(TransactionError::StateTrieRootMismatch {
|
||||
return Err(TransactionError::StateRootMismatch {
|
||||
got: state_root,
|
||||
expected: expected_state_root,
|
||||
block_number: *range.end(),
|
||||
@@ -985,7 +985,7 @@ where
|
||||
// but for sake of double verification we will check it again.
|
||||
if new_state_root != parent_state_root {
|
||||
let parent_hash = self.get_block_hash(parent_number)?;
|
||||
return Err(TransactionError::StateTrieRootMismatch {
|
||||
return Err(TransactionError::UnwindStateRootMismatch {
|
||||
got: new_state_root,
|
||||
expected: parent_state_root,
|
||||
block_number: parent_number,
|
||||
@@ -1403,8 +1403,8 @@ pub enum TransactionError {
|
||||
#[error(transparent)]
|
||||
TrieError(#[from] StateRootError),
|
||||
/// Root mismatch
|
||||
#[error("Merkle trie root mismatch on block: #{block_number:?} {block_hash:?}. got: {got:?} expected:{expected:?}")]
|
||||
StateTrieRootMismatch {
|
||||
#[error("Merkle trie root mismatch at #{block_number} ({block_hash:?}). Got: {got:?}. Expected: {expected:?}")]
|
||||
StateRootMismatch {
|
||||
/// Expected root
|
||||
expected: H256,
|
||||
/// Calculated root
|
||||
@@ -1414,6 +1414,18 @@ pub enum TransactionError {
|
||||
/// Block hash
|
||||
block_hash: BlockHash,
|
||||
},
|
||||
/// Root mismatch during unwind
|
||||
#[error("Unwind merkle trie root mismatch at #{block_number} ({block_hash:?}). Got: {got:?}. Expected: {expected:?}")]
|
||||
UnwindStateRootMismatch {
|
||||
/// Expected root
|
||||
expected: H256,
|
||||
/// Calculated root
|
||||
got: H256,
|
||||
/// Target block number
|
||||
block_number: BlockNumber,
|
||||
/// Block hash
|
||||
block_hash: BlockHash,
|
||||
},
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user