Skip to main content

VmDatabase

Trait VmDatabase 

Source
pub trait VmDatabase:
    Send
    + Sync
    + DynClone {
    // Required methods
    fn get_account_state(
        &self,
        address: Address,
    ) -> Result<Option<AccountState>, EvmError>;
    fn get_storage_slot(
        &self,
        address: Address,
        key: H256,
    ) -> Result<Option<U256>, EvmError>;
    fn get_block_hash(&self, block_number: u64) -> Result<H256, EvmError>;
    fn get_chain_config(&self) -> Result<ChainConfig, EvmError>;
    fn get_account_code(&self, code_hash: H256) -> Result<Code, EvmError>;
    fn get_code_metadata(
        &self,
        code_hash: H256,
    ) -> Result<CodeMetadata, EvmError>;

    // Provided method
    fn get_account_states_batch(
        &self,
        addresses: &[Address],
    ) -> Result<Vec<Option<AccountState>>, EvmError> { ... }
}

Required Methods§

Provided Methods§

Source

fn get_account_states_batch( &self, addresses: &[Address], ) -> Result<Vec<Option<AccountState>>, EvmError>

Batch account-state lookup. Default impl loops get_account_state. Backends that can amortize per-key cost (e.g. rocksdb multi_get_cf on the flat key-value table) should override this.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§