Skip to main content

reth_engine_tree/tree/payload_processor/bal/
error.rs

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