Crate arb_storage

Crate arb_storage 

Source
Expand description

Storage-backed types for ArbOS state.

Provides typed wrappers over raw storage slots — integers, addresses, byte arrays, queues, and vectors that persist in the state trie — and re-exports the StorageError surface from arb_storage_errors.

All read and write paths propagate database failures as typed StorageError::Database so callers can distinguish a genuine storage-level fault from a logical condition such as “slot is zero”.

Re-exports§

pub use queue::Queue;
pub use queue::initialize_queue;
pub use queue::open_queue;
pub use vector::SubStorageVector;
pub use vector::open_sub_storage_vector;

Modules§

layout
ArbOS storage layout primitives — subspace keys and slot derivation.
queue
vector

Structs§

AnyError
Cloneable wrapper around any Error type.
DatabaseErrorInfo
Implementation-agnostic information about a database failure.
Storage
Hierarchical storage abstraction over EVM account state.
StorageBackedAddress
Storage-backed Ethereum address (20 bytes, right-aligned in 32-byte slot).
StorageBackedAddressOrNil
Storage-backed optional address, using 1 << 255 to represent None.
StorageBackedBigInt
Storage-backed signed 256-bit integer using two’s complement.
StorageBackedBigUint
Storage-backed 256-bit unsigned integer.
StorageBackedBips
Basis points stored as signed i64. 10000 bips = 100%.
StorageBackedBytes
Variable-length byte storage.
StorageBackedInt64
Storage-backed signed 64-bit integer, bit-reinterpreting i64 as u64.
StorageBackedUBips
Unsigned basis points stored as u64. 10000 ubips = 100%.
StorageBackedUint16
Storage-backed 16-bit unsigned integer.
StorageBackedUint24
Storage-backed 24-bit unsigned integer.
StorageBackedUint32
Storage-backed 32-bit unsigned integer.
StorageBackedUint64
Storage-backed 64-bit unsigned integer.

Enums§

DatabaseError
Errors surfaced by the underlying state database when arb-storage reads or writes a slot.
Detached
Phantom backend used by read paths that drive ArbOS accessors through a [StorageBackend] (such as the precompile handlers reading via EvmInternals). Direct state-pointer I/O on a Storage<Detached> is unreachable by construction — the type does not implement [Database].
StorageError
Errors raised by the arb-storage layer.

Constants§

ARBOS_STATE_ADDRESS
ArbOS state address — the fictional account that stores all ArbOS state.
FILTERED_TX_STATE_ADDRESS
Filtered transactions state address — a separate account for tracking filtered tx hashes.
STORAGE_READ_GAS
Gas for reading one storage slot.
STORAGE_WRITE_GAS
Gas for writing a non-zero value to one storage slot.
STORAGE_WRITE_ZERO_GAS
Gas for clearing one storage slot to zero.

Traits§

StorageBackend
Abstraction over the two backing stores arb-storage accessor types are driven from: the block executor’s &mut State<D> and the precompile handler’s &mut EvmInternals<'_>.
SystemStateBackend
Non-journaled read access to system state.

Functions§

get_account_balance
Reads the balance of an account from the state.
read_storage_at
Reads a storage slot from an arbitrary account, checking cache -> bundle -> database.
set_account_code
Sets the code of an account, loading it into cache if needed.
set_account_nonce
Sets the nonce of an account, loading it into cache if needed.
storage_key_map
Computes a storage slot using the keccak256-based mapAddress algorithm.
write_arbos_storage
Writes a storage slot to the ArbOS account using the transition mechanism.
write_cost
Gas for one storage write, priced lower when the slot is cleared to zero.
write_storage_at
Writes a storage slot to an arbitrary account using the transition mechanism.