Files
reth/crates/payload/builder/src/error.rs
clabby 52670a8b24 feat: op-reth (#4377)
Co-authored-by: Roberto Bayardo <bayardo@alum.mit.edu>
Co-authored-by: refcell.eth <abigger87@gmail.com>
Co-authored-by: Roman Krasiuk <rokrassyuk@gmail.com>
Co-authored-by: refcell <refcell@oplabs.co>
Co-authored-by: nicolas <48695862+merklefruit@users.noreply.github.com>
2023-11-05 17:33:42 +00:00

60 lines
2.2 KiB
Rust

//! Error types emitted by types or implementations of this crate.
use reth_interfaces::RethError;
use reth_primitives::B256;
use reth_transaction_pool::BlobStoreError;
use revm_primitives::EVMError;
use tokio::sync::oneshot;
/// Possible error variants during payload building.
#[derive(Debug, thiserror::Error)]
pub enum PayloadBuilderError {
/// Thrown whe the parent block is missing.
#[error("missing parent block {0}")]
MissingParentBlock(B256),
/// An oneshot channels has been closed.
#[error("sender has been dropped")]
ChannelClosed,
/// Error occurring in the blob store.
#[error(transparent)]
BlobStore(#[from] BlobStoreError),
/// Other internal error
#[error(transparent)]
Internal(#[from] RethError),
/// Unrecoverable error during evm execution.
#[error("evm execution error: {0}")]
EvmExecutionError(EVMError<RethError>),
/// Thrown if the payload requests withdrawals before Shanghai activation.
#[error("withdrawals set before Shanghai activation")]
WithdrawalsBeforeShanghai,
/// Optimism specific payload building errors.
#[cfg(feature = "optimism")]
#[error(transparent)]
Optimism(#[from] OptimismPayloadBuilderError),
}
/// Optimism specific payload building errors.
#[derive(Debug, thiserror::Error)]
pub enum OptimismPayloadBuilderError {
/// Thrown when a transaction fails to convert to a
/// [reth_primitives::TransactionSignedEcRecovered].
#[cfg(feature = "optimism")]
#[error("failed to convert deposit transaction to TransactionSignedEcRecovered")]
TransactionEcRecoverFailed,
/// Thrown when the L1 block info could not be parsed from the calldata of the
/// first transaction supplied in the payload attributes.
#[cfg(feature = "optimism")]
#[error("failed to parse L1 block info from L1 info tx calldata")]
L1BlockInfoParseFailed,
/// Thrown when a database account could not be loaded.
#[error("failed to load account {0:?}")]
#[cfg(feature = "optimism")]
AccountLoadFailed(revm_primitives::Address),
}
impl From<oneshot::error::RecvError> for PayloadBuilderError {
fn from(_: oneshot::error::RecvError) -> Self {
PayloadBuilderError::ChannelClosed
}
}