kona_protocol/batch/
errors.rs

1//! Span Batch Errors
2
3/// Span Batch Errors
4#[derive(Debug, thiserror::Error, Clone, PartialEq, Eq)]
5pub enum SpanBatchError {
6    /// The span batch is too big
7    #[error("The span batch is too big.")]
8    TooBigSpanBatchSize,
9    /// The bit field is too long
10    #[error("The bit field is too long")]
11    BitfieldTooLong,
12    /// Empty Span Batch
13    #[error("Empty span batch")]
14    EmptySpanBatch,
15    /// Missing L1 origin
16    #[error("Missing L1 origin")]
17    MissingL1Origin,
18    /// Decoding errors
19    #[error("Span batch decoding error: {0}")]
20    Decoding(#[from] SpanDecodingError),
21}
22
23/// An error encoding a batch.
24#[derive(Debug, thiserror::Error, Clone, PartialEq, Eq)]
25pub enum BatchEncodingError {
26    /// Error encoding an Alloy RLP
27    #[error("Error encoding an Alloy RLP: {0}")]
28    AlloyRlpError(alloy_rlp::Error),
29    /// Error encoding a span batch
30    #[error("Error encoding a span batch: {0}")]
31    SpanBatchError(#[from] SpanBatchError),
32}
33
34/// An error decoding a batch.
35#[derive(Debug, thiserror::Error, Clone, PartialEq, Eq)]
36pub enum BatchDecodingError {
37    /// Empty buffer
38    #[error("Empty buffer")]
39    EmptyBuffer,
40    /// Error decoding an Alloy RLP
41    #[error("Error decoding an Alloy RLP: {0}")]
42    AlloyRlpError(alloy_rlp::Error),
43    /// Error decoding a span batch
44    #[error("Error decoding a span batch: {0}")]
45    SpanBatchError(#[from] SpanBatchError),
46}
47
48/// Decoding Error
49#[derive(Debug, thiserror::Error, Clone, PartialEq, Eq)]
50pub enum SpanDecodingError {
51    /// Failed to decode relative timestamp
52    #[error("Failed to decode relative timestamp")]
53    RelativeTimestamp,
54    /// Failed to decode L1 origin number
55    #[error("Failed to decode L1 origin number")]
56    L1OriginNumber,
57    /// Failed to decode parent check
58    #[error("Failed to decode parent check")]
59    ParentCheck,
60    /// Failed to decode L1 origin check
61    #[error("Failed to decode L1 origin check")]
62    L1OriginCheck,
63    /// Failed to decode block count
64    #[error("Failed to decode block count")]
65    BlockCount,
66    /// Failed to decode block tx counts
67    #[error("Failed to decode block tx counts")]
68    BlockTxCounts,
69    /// Failed to decode transaction nonces
70    #[error("Failed to decode transaction nonces")]
71    TxNonces,
72    /// Mismatch in length between the transaction type and signature arrays in a span batch
73    /// transaction payload.
74    #[error("Mismatch in length between the transaction type and signature arrays")]
75    TypeSignatureLenMismatch,
76    /// Invalid transaction type
77    #[error("Invalid transaction type")]
78    InvalidTransactionType,
79    /// Invalid transaction data
80    #[error("Invalid transaction data")]
81    InvalidTransactionData,
82    /// Invalid transaction signature
83    #[error("Invalid transaction signature")]
84    InvalidTransactionSignature,
85}