Skip to main content

tempo_consensus/
error.rs

1use alloy_primitives::{Address, B256};
2use reth_consensus::ConsensusError;
3
4/// Tempo-specific consensus errors.
5#[derive(Debug, thiserror::Error)]
6pub enum TempoConsensusError {
7    /// Timestamp milliseconds part is out of range (must be < 1000).
8    #[error("timestamp milliseconds part {millis_part} must be less than 1000")]
9    InvalidTimestampMillisPart { millis_part: u64 },
10
11    /// Shared gas limit does not match the expected value derived from block gas limit.
12    #[error("shared gas limit {actual} does not match expected {expected}")]
13    SharedGasLimitMismatch { expected: u64, actual: u64 },
14
15    /// General gas limit does not match the expected value.
16    #[error("general gas limit {actual} does not match expected {expected}")]
17    GeneralGasLimitMismatch { expected: u64, actual: u64 },
18
19    /// A system transaction in the block is invalid.
20    #[error("invalid system transaction: {tx_hash}")]
21    InvalidSystemTransaction { tx_hash: B256 },
22
23    /// Block does not contain the required end-of-block system transactions.
24    #[error("block must contain {expected} end-of-block system txs, found {actual}")]
25    MissingEndOfBlockSystemTxs { expected: usize, actual: usize },
26
27    /// End-of-block system transactions are in the wrong order.
28    #[error("invalid end-of-block system tx order: expected {expected}, got {actual}")]
29    InvalidEndOfBlockSystemTxOrder { expected: Address, actual: Address },
30}
31
32impl From<TempoConsensusError> for ConsensusError {
33    fn from(err: TempoConsensusError) -> Self {
34        Self::other(err)
35    }
36}