reth::revm::database

Trait EvmStateProvider

pub trait EvmStateProvider: Send + Sync {
    // Required methods
    fn basic_account(
        &self,
        address: Address,
    ) -> Result<Option<Account>, ProviderError>;
    fn block_hash(
        &self,
        number: u64,
    ) -> Result<Option<FixedBytes<32>>, ProviderError>;
    fn bytecode_by_hash(
        &self,
        code_hash: FixedBytes<32>,
    ) -> Result<Option<Bytecode>, ProviderError>;
    fn storage(
        &self,
        account: Address,
        storage_key: FixedBytes<32>,
    ) -> Result<Option<Uint<256, 4>>, ProviderError>;
}
Expand description

A helper trait responsible for providing state necessary for EVM execution.

This serves as the data layer for Database.

Required Methods§

fn basic_account( &self, address: Address, ) -> Result<Option<Account>, ProviderError>

Get basic account information.

Returns None if the account doesn’t exist.

fn block_hash( &self, number: u64, ) -> Result<Option<FixedBytes<32>>, ProviderError>

Get the hash of the block with the given number. Returns None if no block with this number exists.

fn bytecode_by_hash( &self, code_hash: FixedBytes<32>, ) -> Result<Option<Bytecode>, ProviderError>

Get account code by hash.

fn storage( &self, account: Address, storage_key: FixedBytes<32>, ) -> Result<Option<Uint<256, 4>>, ProviderError>

Get storage of the given account.

Implementors§

§

impl<T> EvmStateProvider for T
where T: StateProvider,