op_alloy_protocol/batch/
errors.rs#[derive(Debug, derive_more::Display, Clone, PartialEq, Eq)]
pub enum SpanBatchError {
#[display("The span batch is too big.")]
TooBigSpanBatchSize,
#[display("The bit field is too long")]
BitfieldTooLong,
#[display("Empty span batch")]
EmptySpanBatch,
#[display("Missing L1 origin")]
MissingL1Origin,
#[display("Span batch decoding error: {_0}")]
Decoding(SpanDecodingError),
}
impl From<SpanDecodingError> for SpanBatchError {
fn from(err: SpanDecodingError) -> Self {
Self::Decoding(err)
}
}
impl core::error::Error for SpanBatchError {
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
match self {
Self::Decoding(err) => Some(err),
_ => None,
}
}
}
#[derive(Debug, derive_more::Display, Clone, PartialEq, Eq)]
pub enum BatchDecodingError {
#[display("Empty buffer")]
EmptyBuffer,
#[display("Error decoding an Alloy RLP: {_0}")]
AlloyRlpError(alloy_rlp::Error),
#[display("Error decoding a span batch: {_0}")]
SpanBatchError(SpanBatchError),
}
impl From<alloy_rlp::Error> for BatchDecodingError {
fn from(err: alloy_rlp::Error) -> Self {
Self::AlloyRlpError(err)
}
}
impl From<SpanBatchError> for BatchDecodingError {
fn from(err: SpanBatchError) -> Self {
Self::SpanBatchError(err)
}
}
impl core::error::Error for BatchDecodingError {
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
match self {
Self::SpanBatchError(err) => Some(err),
_ => None,
}
}
}
#[derive(Debug, derive_more::Display, Clone, PartialEq, Eq)]
pub enum SpanDecodingError {
#[display("Failed to decode relative timestamp")]
RelativeTimestamp,
#[display("Failed to decode L1 origin number")]
L1OriginNumber,
#[display("Failed to decode parent check")]
ParentCheck,
#[display("Failed to decode L1 origin check")]
L1OriginCheck,
#[display("Failed to decode block count")]
BlockCount,
#[display("Failed to decode block tx counts")]
BlockTxCounts,
#[display("Failed to decode transaction nonces")]
TxNonces,
#[display("Mismatch in length between the transaction type and signature arrays")]
TypeSignatureLenMismatch,
#[display("Invalid transaction type")]
InvalidTransactionType,
#[display("Invalid transaction data")]
InvalidTransactionData,
#[display("Invalid transaction signature")]
InvalidTransactionSignature,
}
impl core::error::Error for SpanDecodingError {}