Trait zksync_vm2::StorageInterface

source ·
pub trait StorageInterface {
    // Required methods
    fn read_storage(&mut self, contract: H160, key: U256) -> Option<U256>;
    fn cost_of_writing_storage(
        &mut self,
        initial_value: Option<U256>,
        new_value: U256,
    ) -> u32;
    fn is_free_storage_slot(&self, contract: &H160, key: &U256) -> bool;
}
Expand description

VM storage access operations.

Required Methods§

source

fn read_storage(&mut self, contract: H160, key: U256) -> Option<U256>

Reads the specified slot from the storage.

There is no write counterpart; WorldDiff::get_storage_changes() gives a list of all storage changes.

source

fn cost_of_writing_storage( &mut self, initial_value: Option<U256>, new_value: U256, ) -> u32

Computes the cost of writing a storage slot.

source

fn is_free_storage_slot(&self, contract: &H160, key: &U256) -> bool

Returns if the storage slot is free both in terms of gas and pubdata.

Implementors§