Skip to main content

reth_engine_tree/tree/payload_processor/bal/
error.rs

1//! Errors for the BAL execution path.
2
3use reth_engine_primitives::BlockAccessListDecodeError;
4use reth_errors::{BlockExecutionError, ConsensusError, ProviderError};
5
6/// Errors surfaced by `execute_block`.
7#[derive(Debug, thiserror::Error)]
8pub enum BalExecutionError {
9    /// Block violated consensus rules while running the BAL path.
10    #[error(transparent)]
11    Consensus(#[from] ConsensusError),
12    /// The block access list could not be decoded for execution.
13    #[error(transparent)]
14    BlockAccessListDecode(#[from] BlockAccessListDecodeError),
15    /// Worker or canonical EVM failure.
16    #[error("evm execution failed: {0}")]
17    Execution(#[from] BlockExecutionError),
18    /// Provider setup failed before EVM execution could start.
19    #[error("provider setup failed: {0}")]
20    Provider(#[from] ProviderError),
21    /// BAL execution failed before it reached EVM execution.
22    #[error(transparent)]
23    Other(#[from] Box<dyn core::error::Error + Send + Sync + 'static>),
24}
25
26impl BalExecutionError {
27    /// Create an [`Self::Other`] error from any boxed-error-compatible value.
28    pub(crate) fn other<E>(error: E) -> Self
29    where
30        E: Into<Box<dyn core::error::Error + Send + Sync + 'static>>,
31    {
32        Self::Other(error.into())
33    }
34}