StorageBackend

Trait StorageBackend 

Source
pub trait StorageBackend: SystemStateBackend {
    // Required methods
    fn sload(
        &mut self,
        account: Address,
        slot: U256,
    ) -> Result<U256, <Self as SystemStateBackend>::Error>;
    fn sstore(
        &mut self,
        account: Address,
        slot: U256,
        value: U256,
    ) -> Result<(), <Self as SystemStateBackend>::Error>;
}
Expand description

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<'_>.

The trait sits beneath the typed accessor layer (StorageBackedX) so the same descriptors serve both call paths without having to fork the accessor API.

Required Methods§

Source

fn sload( &mut self, account: Address, slot: U256, ) -> Result<U256, <Self as SystemStateBackend>::Error>

Reads the value at (account, slot). Reads through StorageBackend follow the host’s normal storage path (journaled when invoked on EvmInternals); for non-journaled reads see SystemStateBackend.

Source

fn sstore( &mut self, account: Address, slot: U256, value: U256, ) -> Result<(), <Self as SystemStateBackend>::Error>

Writes value to (account, slot).

Implementations on Foreign Types§

Source§

impl StorageBackend for EvmInternals<'_>

Source§

fn sload(&mut self, account: Address, slot: U256) -> Result<U256, StorageError>

Source§

fn sstore( &mut self, account: Address, slot: U256, value: U256, ) -> Result<(), StorageError>

Source§

impl<D: Database> StorageBackend for State<D>

Source§

fn sload(&mut self, account: Address, slot: U256) -> Result<U256, StorageError>

Source§

fn sstore( &mut self, account: Address, slot: U256, value: U256, ) -> Result<(), StorageError>

Implementors§

Source§

impl<D: Database> StorageBackend for Storage<'_, D>