Skip to main content

LevmDatabase

Trait LevmDatabase 

Source
pub trait LevmDatabase: Send + Sync {
    // Required methods
    fn get_account_state(
        &self,
        address: H160,
    ) -> Result<AccountState, DatabaseError>;
    fn get_storage_value(
        &self,
        address: H160,
        key: H256,
    ) -> Result<U256, DatabaseError>;
    fn get_block_hash(&self, block_number: u64) -> Result<H256, DatabaseError>;
    fn get_chain_config(&self) -> Result<ChainConfig, DatabaseError>;
    fn get_account_code(&self, code_hash: H256) -> Result<Code, DatabaseError>;
    fn get_code_metadata(
        &self,
        code_hash: H256,
    ) -> Result<CodeMetadata, DatabaseError>;

    // Provided methods
    fn precompile_cache(&self) -> Option<&PrecompileCache> { ... }
    fn prefetch_accounts(&self, addresses: &[H160]) -> Result<(), DatabaseError> { ... }
    fn prefetch_storage(
        &self,
        keys: &[(H160, H256)],
    ) -> Result<(), DatabaseError> { ... }
}

Required Methods§

Provided Methods§

Source

fn precompile_cache(&self) -> Option<&PrecompileCache>

Access the precompile cache, if available at this database layer.

Source

fn prefetch_accounts(&self, addresses: &[H160]) -> Result<(), DatabaseError>

Prefetch a batch of accounts into the cache. Default: sequential fallback.

Source

fn prefetch_storage(&self, keys: &[(H160, H256)]) -> Result<(), DatabaseError>

Prefetch a batch of storage slots into the cache. Default: sequential fallback.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§