arbos/arbos_state/
error.rs

1use arb_storage::StorageError;
2
3use crate::{
4    address_set::AddressSetError, address_table::AddressTableError, blockhash::BlockhashesError,
5    features::FeaturesError, filtered_transactions::FilteredTxError, l1_pricing::L1PricingError,
6    l2_pricing::L2PricingError, merkle_accumulator::MerkleAccumulatorError,
7    programs::ProgramsError, retryables::RetryableError,
8};
9
10/// Top-level error for `arbos_state` operations that orchestrate multiple
11/// subsystems.
12///
13/// Each subsystem owns its own error type; this enum aggregates them via
14/// `#[from]` so cross-module call chains in `arbos_state` (e.g. running an
15/// ArbOS version upgrade hook that touches programs, l2 pricing, and the
16/// transaction filtering address set in one go) can use `?` ergonomically.
17#[derive(Clone, thiserror::Error, Debug)]
18pub enum ArbosStateError {
19    /// Underlying storage failure.
20    #[error(transparent)]
21    Storage(#[from] StorageError),
22
23    /// Surfaced from a retryable-state operation.
24    #[error(transparent)]
25    Retryable(#[from] RetryableError),
26
27    /// Surfaced from an L1 pricing operation.
28    #[error(transparent)]
29    L1Pricing(#[from] L1PricingError),
30
31    /// Surfaced from an L2 pricing operation.
32    #[error(transparent)]
33    L2Pricing(#[from] L2PricingError),
34
35    /// Surfaced from an address-set operation.
36    #[error(transparent)]
37    AddressSet(#[from] AddressSetError),
38
39    /// Surfaced from an address-table operation.
40    #[error(transparent)]
41    AddressTable(#[from] AddressTableError),
42
43    /// Surfaced from a blockhashes operation.
44    #[error(transparent)]
45    Blockhashes(#[from] BlockhashesError),
46
47    /// Surfaced from a features operation.
48    #[error(transparent)]
49    Features(#[from] FeaturesError),
50
51    /// Surfaced from a merkle-accumulator operation.
52    #[error(transparent)]
53    MerkleAccumulator(#[from] MerkleAccumulatorError),
54
55    /// Surfaced from a programs operation.
56    #[error(transparent)]
57    Programs(#[from] ProgramsError),
58
59    /// Surfaced from a filtered-transactions operation.
60    #[error(transparent)]
61    FilteredTx(#[from] FilteredTxError),
62
63    /// `ArbosState::open` found `version == 0` in storage. Expected only at
64    /// genesis before `initialize` runs.
65    #[error("ArbOS state has not been initialised (version=0)")]
66    Uninitialised,
67
68    /// `ArbosState::open` found a version word this build does not recognise.
69    #[error("unsupported ArbOS version: {0}")]
70    UnsupportedVersion(u64),
71
72    /// A scheduled upgrade targets an ArbOS version this node does not
73    /// support.
74    #[error("scheduled ArbOS version {version} exceeds maximum supported {max}")]
75    UnsupportedScheduledVersion {
76        /// Version the upgrade points at.
77        version: u64,
78        /// Maximum version this build of arbreth supports.
79        max: u64,
80    },
81
82    /// The state is currently running an ArbOS version this build does not
83    /// know how to apply per-block hooks for.
84    #[error("unsupported running ArbOS version: {0}")]
85    UnsupportedRunningVersion(u64),
86
87    /// Genesis initialisation found the address table already populated.
88    #[error("address table must be empty during genesis initialisation")]
89    AddressTableNotEmpty,
90
91    /// During genesis initialisation, a freshly registered address received a
92    /// slot index that did not match its position in the input list.
93    #[error("address table slot mismatch during genesis initialisation")]
94    AddressTableSlotMismatch,
95
96    /// A brotli compression level above the maximum was supplied.
97    #[error("invalid brotli compression level")]
98    InvalidBrotliCompressionLevel,
99}