revm_primitives::db

Trait DatabaseRef

Source
pub trait DatabaseRef {
    type Error;

    // Required methods
    fn basic_ref(
        &self,
        address: Address,
    ) -> Result<Option<AccountInfo>, Self::Error>;
    fn code_by_hash_ref(&self, code_hash: B256) -> Result<Bytecode, Self::Error>;
    fn storage_ref(
        &self,
        address: Address,
        index: U256,
    ) -> Result<U256, Self::Error>;
    fn block_hash_ref(&self, number: u64) -> Result<B256, Self::Error>;
}
Expand description

EVM database interface.

Contains the same methods as Database, but with &self receivers instead of &mut self.

Use WrapDatabaseRef to provide Database implementation for a type that only implements this trait.

Required Associated Types§

Source

type Error

The database error type.

Required Methods§

Source

fn basic_ref( &self, address: Address, ) -> Result<Option<AccountInfo>, Self::Error>

Get basic account information.

Source

fn code_by_hash_ref(&self, code_hash: B256) -> Result<Bytecode, Self::Error>

Get account code by its hash.

Source

fn storage_ref( &self, address: Address, index: U256, ) -> Result<U256, Self::Error>

Get storage value of address at index.

Source

fn block_hash_ref(&self, number: u64) -> Result<B256, Self::Error>

Get block hash by block number.

Implementations on Foreign Types§

Source§

impl<'a, T: 'a + DatabaseRef + ?Sized> DatabaseRef for &'a T

Source§

type Error = <T as DatabaseRef>::Error

Source§

fn basic_ref( &self, address: Address, ) -> Result<Option<AccountInfo>, Self::Error>

Source§

fn code_by_hash_ref(&self, code_hash: B256) -> Result<Bytecode, Self::Error>

Source§

fn storage_ref( &self, address: Address, index: U256, ) -> Result<U256, Self::Error>

Source§

fn block_hash_ref(&self, number: u64) -> Result<B256, Self::Error>

Source§

impl<'a, T: 'a + DatabaseRef + ?Sized> DatabaseRef for &'a mut T

Source§

type Error = <T as DatabaseRef>::Error

Source§

fn basic_ref( &self, address: Address, ) -> Result<Option<AccountInfo>, Self::Error>

Source§

fn code_by_hash_ref(&self, code_hash: B256) -> Result<Bytecode, Self::Error>

Source§

fn storage_ref( &self, address: Address, index: U256, ) -> Result<U256, Self::Error>

Source§

fn block_hash_ref(&self, number: u64) -> Result<B256, Self::Error>

Source§

impl<T: DatabaseRef + ?Sized> DatabaseRef for Box<T>

Source§

type Error = <T as DatabaseRef>::Error

Source§

fn basic_ref( &self, address: Address, ) -> Result<Option<AccountInfo>, Self::Error>

Source§

fn code_by_hash_ref(&self, code_hash: B256) -> Result<Bytecode, Self::Error>

Source§

fn storage_ref( &self, address: Address, index: U256, ) -> Result<U256, Self::Error>

Source§

fn block_hash_ref(&self, number: u64) -> Result<B256, Self::Error>

Source§

impl<T: DatabaseRef + ?Sized> DatabaseRef for Rc<T>

Source§

type Error = <T as DatabaseRef>::Error

Source§

fn basic_ref( &self, address: Address, ) -> Result<Option<AccountInfo>, Self::Error>

Source§

fn code_by_hash_ref(&self, code_hash: B256) -> Result<Bytecode, Self::Error>

Source§

fn storage_ref( &self, address: Address, index: U256, ) -> Result<U256, Self::Error>

Source§

fn block_hash_ref(&self, number: u64) -> Result<B256, Self::Error>

Source§

impl<T: DatabaseRef + ?Sized> DatabaseRef for Arc<T>

Source§

type Error = <T as DatabaseRef>::Error

Source§

fn basic_ref( &self, address: Address, ) -> Result<Option<AccountInfo>, Self::Error>

Source§

fn code_by_hash_ref(&self, code_hash: B256) -> Result<Bytecode, Self::Error>

Source§

fn storage_ref( &self, address: Address, index: U256, ) -> Result<U256, Self::Error>

Source§

fn block_hash_ref(&self, number: u64) -> Result<B256, Self::Error>

Implementors§