use alloc::string::String;
use kona_mpt::TrieNodeError;
use revm::primitives::EVMError;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum ExecutorError {
#[error("Gas limit not provided in payload attributes")]
MissingGasLimit,
#[error("Transactions not provided in payload attributes")]
MissingTransactions,
#[error("Missing EIP-1559 parameters in execution payload post-Holocene")]
MissingEIP1559Params,
#[error("Parent beacon block root not provided in payload attributes")]
MissingParentBeaconBlockRoot,
#[error("Invalid `extraData` field in the block header")]
InvalidExtraData,
#[error("Block gas limit exceeded")]
BlockGasLimitExceeded,
#[error("Unsupported transaction type: {0}")]
UnsupportedTransactionType(u8),
#[error("Trie error: {0}")]
TrieDBError(#[from] TrieDBError),
#[error("Execution error: {0}")]
ExecutionError(EVMError<TrieDBError>),
#[error("Signature error: {0}")]
SignatureError(alloy_primitives::SignatureError),
#[error("RLP error: {0}")]
RLPError(alloy_eips::eip2718::Eip2718Error),
#[error("Missing the executor")]
MissingExecutor,
}
pub type ExecutorResult<T> = Result<T, ExecutorError>;
pub type TrieDBResult<T> = Result<T, TrieDBError>;
#[derive(Error, Debug, PartialEq, Eq)]
pub enum TrieDBError {
#[error("Trie root node has not been blinded")]
RootNotBlinded,
#[error("Missing account info for bundle account.")]
MissingAccountInfo,
#[error("Trie node error: {0}")]
TrieNode(#[from] TrieNodeError),
#[error("Trie provider error: {0}")]
Provider(String),
}