Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(interfaces): move BlockHashNotFoundInChain to BlockchainTreeError #4697

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading