kona_sources/sync/
error.rs

1//! Contains the error types used for finding the starting forkchoice state.
2
3use alloy_eips::BlockId;
4use alloy_primitives::B256;
5use alloy_transport::{RpcError, TransportErrorKind};
6use kona_protocol::FromBlockError;
7use thiserror::Error;
8
9/// An error that can occur during the sync start process.
10#[derive(Error, Debug)]
11pub enum SyncStartError {
12    /// An rpc error occurred
13    #[error("An RPC error occurred: {0}")]
14    RpcError(#[from] RpcError<TransportErrorKind>),
15    /// An error occurred while converting a block to [`L2BlockInfo`].
16    ///
17    /// [`L2BlockInfo`]: kona_protocol::L2BlockInfo
18    #[error(transparent)]
19    FromBlock(#[from] FromBlockError),
20    /// A block could not be found.
21    #[error("Block not found: {0}")]
22    BlockNotFound(BlockId),
23    /// Invalid L1 genesis hash.
24    #[error("Invalid L1 genesis hash. Expected {0}, Got {1}")]
25    InvalidL1GenesisHash(B256, B256),
26    /// Invalid L2 genesis hash.
27    #[error("Invalid L2 genesis hash. Expected {0}, Got {1}")]
28    InvalidL2GenesisHash(B256, B256),
29    /// Finalized block mismatch
30    #[error("Finalized block mismatch. Expected {0}, Got {1}")]
31    MismatchedFinalizedBlock(B256, B256),
32    /// L1 origin mismatch.
33    #[error("L1 origin mismatch")]
34    L1OriginMismatch,
35    /// Non-zero sequence number.
36    #[error("Non-zero sequence number for block with different L1 origin")]
37    NonZeroSequenceNumber,
38    /// Inconsistent sequence number.
39    #[error("Inconsistent sequence number; Must monotonically increase.")]
40    InconsistentSequenceNumber,
41}