Skip to main content

reth_engine_tree/tree/payload_processor/bal/
error.rs

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