Skip to content

Commit

Permalink
move BlockHashNotFoundInChain from BlockExecutionError to BlockchainT…
Browse files Browse the repository at this point in the history
…reeError
  • Loading branch information
tcoratger committed Sep 20, 2023
1 parent a52b433 commit 2282c2d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion crates/consensus/beacon/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ where
})
.with_latest_valid_hash(H256::zero())
}
RethError::Execution(BlockExecutionError::BlockHashNotFoundInChain { .. }) => {
RethError::BlockchainTree(BlockchainTreeError::BlockHashNotFoundInChain { .. }) => {
// This just means we couldn't find the block when attempting to make it canonical,
// so we should not warn the user, since this will result in us attempting to sync
// to a new target and is considered normal operation during sync
Expand Down
6 changes: 5 additions & 1 deletion crates/interfaces/src/blockchain_tree/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ pub enum InsertBlockErrorKind {
/// Canonical error.
#[error(transparent)]
Canonical(CanonicalError),
/// BlockchainTree error.
#[error(transparent)]
BlockchainTree(BlockchainTreeError),
}

impl InsertBlockErrorKind {
Expand Down Expand Up @@ -238,7 +241,6 @@ impl InsertBlockErrorKind {
BlockExecutionError::Pruning(_) |
BlockExecutionError::CanonicalRevert { .. } |
BlockExecutionError::CanonicalCommit { .. } |
BlockExecutionError::BlockHashNotFoundInChain { .. } |
BlockExecutionError::AppendChainDoesntConnect { .. } |
BlockExecutionError::UnavailableForTest => false,
}
Expand Down Expand Up @@ -266,6 +268,7 @@ impl InsertBlockErrorKind {
CanonicalError::CanonicalRevert { .. } => false,
CanonicalError::Validation(_) => true,
},
InsertBlockErrorKind::BlockchainTree(_) => false,
}
}

Expand Down Expand Up @@ -327,6 +330,7 @@ impl From<crate::RethError> for InsertBlockErrorKind {
RethError::Network(err) => InsertBlockErrorKind::Internal(Box::new(err)),
RethError::Custom(err) => InsertBlockErrorKind::Internal(err.into()),
RethError::Canonical(err) => InsertBlockErrorKind::Canonical(err),
RethError::BlockchainTree(err) => InsertBlockErrorKind::BlockchainTree(err),
}
}
}
3 changes: 3 additions & 0 deletions crates/interfaces/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ pub enum RethError {
#[error(transparent)]
Canonical(#[from] crate::blockchain_tree::error::CanonicalError),

#[error(transparent)]
BlockchainTree(#[from] crate::blockchain_tree::error::BlockchainTreeError),

#[error("{0}")]
Custom(String),
}
5 changes: 1 addition & 4 deletions crates/interfaces/src/executor.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use reth_primitives::{BlockHash, BlockNumHash, Bloom, PrunePartError, H256};
use reth_primitives::{BlockNumHash, Bloom, PrunePartError, H256};
use thiserror::Error;

/// Transaction validation errors
Expand Down Expand Up @@ -52,9 +52,6 @@ pub enum BlockExecutionError {
CanonicalCommit { inner: String },

// === tree errors ===
// TODO(mattsse): move this to tree error
#[error("Block hash {block_hash} not found in blockchain tree chain")]
BlockHashNotFoundInChain { block_hash: BlockHash },
#[error(
"Appending chain on fork (other_chain_fork:?) is not possible as the tip is {chain_tip:?}"
)]
Expand Down

0 comments on commit 2282c2d

Please sign in to comment.