feat: abstract over Evm::Error (#14085)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Arsenii Kulikov
2025-01-30 17:02:20 +04:00
committed by GitHub
parent 6b13409812
commit 98a021ee7d
40 changed files with 298 additions and 247 deletions

View File

@ -18,8 +18,6 @@ reth-errors.workspace = true
reth-primitives.workspace = true
reth-chain-state.workspace = true
revm-primitives.workspace = true
# alloy
alloy-eips.workspace = true
alloy-primitives.workspace = true
@ -39,7 +37,6 @@ default = ["std"]
std = [
"reth-chainspec/std",
"reth-primitives/std",
"revm-primitives/std",
"alloy-eips/std",
"alloy-primitives/std",
"alloy-rpc-types-engine/std",

View File

@ -4,7 +4,6 @@ use alloc::boxed::Box;
use alloy_primitives::B256;
use alloy_rpc_types_engine::ForkchoiceUpdateError;
use reth_errors::{ProviderError, RethError};
use revm_primitives::EVMError;
use tokio::sync::oneshot;
/// Possible error variants during payload building.
@ -27,13 +26,21 @@ pub enum PayloadBuilderError {
Internal(#[from] RethError),
/// Unrecoverable error during evm execution.
#[error("evm execution error: {0}")]
EvmExecutionError(EVMError<ProviderError>),
EvmExecutionError(Box<dyn core::error::Error + Send + Sync>),
/// Any other payload building errors.
#[error(transparent)]
Other(Box<dyn core::error::Error + Send + Sync>),
}
impl PayloadBuilderError {
/// Create a new EVM error from a boxed error.
pub fn evm<E>(error: E) -> Self
where
E: core::error::Error + Send + Sync + 'static,
{
Self::EvmExecutionError(Box::new(error))
}
/// Create a new error from a boxed error.
pub fn other<E>(error: E) -> Self
where