reth_optimism_evm/
error.rs

1//! Error types for the Optimism EVM module.
2
3use reth_evm::execute::BlockExecutionError;
4
5/// L1 Block Info specific errors
6#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
7pub enum L1BlockInfoError {
8    /// Could not find L1 block info transaction in the L2 block
9    #[error("could not find l1 block info tx in the L2 block")]
10    MissingTransaction,
11    /// Invalid L1 block info transaction calldata
12    #[error("invalid l1 block info transaction calldata in the L2 block")]
13    InvalidCalldata,
14    /// Unexpected L1 block info transaction calldata length
15    #[error("unexpected l1 block info tx calldata length found")]
16    UnexpectedCalldataLength,
17    /// Base fee conversion error
18    #[error("could not convert l1 base fee")]
19    BaseFeeConversion,
20    /// Fee overhead conversion error
21    #[error("could not convert l1 fee overhead")]
22    FeeOverheadConversion,
23    /// Fee scalar conversion error
24    #[error("could not convert l1 fee scalar")]
25    FeeScalarConversion,
26    /// Base Fee Scalar conversion error
27    #[error("could not convert base fee scalar")]
28    BaseFeeScalarConversion,
29    /// Blob base fee conversion error
30    #[error("could not convert l1 blob base fee")]
31    BlobBaseFeeConversion,
32    /// Blob base fee scalar conversion error
33    #[error("could not convert l1 blob base fee scalar")]
34    BlobBaseFeeScalarConversion,
35    /// Operator fee scalar conversion error
36    #[error("could not convert operator fee scalar")]
37    OperatorFeeScalarConversion,
38    /// Operator fee constant conversion error
39    #[error("could not convert operator fee constant")]
40    OperatorFeeConstantConversion,
41    /// Optimism hardforks not active
42    #[error("Optimism hardforks are not active")]
43    HardforksNotActive,
44}
45
46/// Optimism Block Executor Errors
47#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
48pub enum OpBlockExecutionError {
49    /// Error when trying to parse L1 block info
50    #[error(transparent)]
51    L1BlockInfo(#[from] L1BlockInfoError),
52    /// Thrown when force deploy of create2deployer code fails.
53    #[error("failed to force create2deployer account code")]
54    ForceCreate2DeployerFail,
55    /// Thrown when a database account could not be loaded.
56    #[error("failed to load account {_0}")]
57    AccountLoadFailed(alloy_primitives::Address),
58}
59
60impl From<OpBlockExecutionError> for BlockExecutionError {
61    fn from(err: OpBlockExecutionError) -> Self {
62        Self::other(err)
63    }
64}