From 7cc64024d9e3c03f6d1d4c3147128331609ab8c5 Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Wed, 1 Nov 2023 16:03:01 -0400 Subject: [PATCH] chore(tree): remove redundant BlockchainTree RethError variant (#5269) --- crates/consensus/beacon/src/engine/mod.rs | 4 +++- crates/interfaces/src/blockchain_tree/error.rs | 1 - crates/interfaces/src/error.rs | 9 ++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/crates/consensus/beacon/src/engine/mod.rs b/crates/consensus/beacon/src/engine/mod.rs index 54e98eb8a..111a4e42d 100644 --- a/crates/consensus/beacon/src/engine/mod.rs +++ b/crates/consensus/beacon/src/engine/mod.rs @@ -955,7 +955,9 @@ where }) .with_latest_valid_hash(B256::ZERO) } - RethError::BlockchainTree(BlockchainTreeError::BlockHashNotFoundInChain { .. }) => { + RethError::Canonical(CanonicalError::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 diff --git a/crates/interfaces/src/blockchain_tree/error.rs b/crates/interfaces/src/blockchain_tree/error.rs index 43dedf40b..c3b9f6063 100644 --- a/crates/interfaces/src/blockchain_tree/error.rs +++ b/crates/interfaces/src/blockchain_tree/error.rs @@ -330,7 +330,6 @@ impl From 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), } } } diff --git a/crates/interfaces/src/error.rs b/crates/interfaces/src/error.rs index 85d0cdca6..47057a56a 100644 --- a/crates/interfaces/src/error.rs +++ b/crates/interfaces/src/error.rs @@ -23,13 +23,16 @@ 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), } +impl From for RethError { + fn from(error: crate::blockchain_tree::error::BlockchainTreeError) -> Self { + RethError::Canonical(error.into()) + } +} + impl From for RethError { fn from(err: reth_nippy_jar::NippyJarError) -> Self { RethError::Custom(err.to_string())