kona_executor/
errors.rs

1//! Errors for the `kona-executor` crate.
2
3use alloc::string::String;
4use kona_mpt::TrieNodeError;
5use revm::primitives::EVMError;
6use thiserror::Error;
7
8/// The error type for the [StatelessL2BlockExecutor].
9///
10/// [StatelessL2BlockExecutor]: crate::StatelessL2BlockExecutor
11#[derive(Error, Debug)]
12pub enum ExecutorError {
13    /// Missing gas limit in the payload attributes.
14    #[error("Gas limit not provided in payload attributes")]
15    MissingGasLimit,
16    /// Missing transactions in the payload attributes.
17    #[error("Transactions not provided in payload attributes")]
18    MissingTransactions,
19    /// Missing EIP-1559 parameters in execution payload post-Holocene.
20    #[error("Missing EIP-1559 parameters in execution payload post-Holocene")]
21    MissingEIP1559Params,
22    /// Missing parent beacon block root in the payload attributes.
23    #[error("Parent beacon block root not provided in payload attributes")]
24    MissingParentBeaconBlockRoot,
25    /// Invalid `extraData` field in the block header.
26    #[error("Invalid `extraData` field in the block header")]
27    InvalidExtraData,
28    /// Block gas limit exceeded.
29    #[error("Block gas limit exceeded")]
30    BlockGasLimitExceeded,
31    /// Unsupported transaction type.
32    #[error("Unsupported transaction type: {0}")]
33    UnsupportedTransactionType(u8),
34    /// Trie DB error.
35    #[error("Trie error: {0}")]
36    TrieDBError(#[from] TrieDBError),
37    /// Execution error.
38    #[error("Execution error: {0}")]
39    ExecutionError(EVMError<TrieDBError>),
40    /// Signature error.
41    #[error("Signature error: {0}")]
42    SignatureError(alloy_primitives::SignatureError),
43    /// RLP error.
44    #[error("RLP error: {0}")]
45    RLPError(alloy_eips::eip2718::Eip2718Error),
46    /// Missing the executor.
47    #[error("Missing the executor")]
48    MissingExecutor,
49}
50
51/// A [Result] type for the [ExecutorError] enum.
52pub type ExecutorResult<T> = Result<T, ExecutorError>;
53
54/// A [Result] type alias where the error is [TrieDBError].
55pub type TrieDBResult<T> = Result<T, TrieDBError>;
56
57/// An error type for [TrieDB] operations.
58///
59/// [TrieDB]: crate::TrieDB
60#[derive(Error, Debug, PartialEq, Eq)]
61pub enum TrieDBError {
62    /// Trie root node has not been blinded.
63    #[error("Trie root node has not been blinded")]
64    RootNotBlinded,
65    /// Missing account info for bundle account.
66    #[error("Missing account info for bundle account.")]
67    MissingAccountInfo,
68    /// Trie node error.
69    #[error("Trie node error: {0}")]
70    TrieNode(#[from] TrieNodeError),
71    /// Trie provider error.
72    #[error("Trie provider error: {0}")]
73    Provider(String),
74}