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 alloy_primitives::B256;
5use reth_provider::ProviderError;
6
7/// Errors surfaced by `execute_block`.
8#[derive(Debug, thiserror::Error)]
9pub enum BalExecutionError {
10    /// BAL-specific rejection.
11    #[error("BAL rejection: {0:?}")]
12    Reject(RejectReason),
13    /// Worker or canonical EVM failure.
14    ///
15    /// This includes revm `BalError` for undeclared accesses. Revm does not yet report the
16    /// offending address or storage slot here.
17    #[error("evm execution failed: {0}")]
18    Evm(#[from] BlockExecutionError),
19    /// Provider setup failed before EVM execution could start.
20    #[error("provider setup failed: {0}")]
21    Provider(#[from] ProviderError),
22    /// The received BAL could not be converted from alloy-format to revm-format.
23    #[error("alloy→revm BAL conversion failed: {0}")]
24    BalConversion(String),
25}
26
27impl From<RejectReason> for BalExecutionError {
28    fn from(r: RejectReason) -> Self {
29        Self::Reject(r)
30    }
31}
32
33/// Reasons a block may be rejected on the BAL execution path.
34#[derive(Clone, Debug, PartialEq, Eq)]
35pub enum RejectReason {
36    /// The rebuilt BAL disagrees with the received BAL at end-of-block.
37    FinalHashMismatch {
38        /// Hash of the rebuilt BAL.
39        rebuilt: B256,
40        /// Hash of the received BAL.
41        expected: B256,
42    },
43}