Trait reth_node_core::primitives::revm_primitives::db::Database

pub trait Database {
    type Error;

    // Required methods
    fn basic(
        &mut self,
        address: Address,
    ) -> Result<Option<AccountInfo>, Self::Error>;
    fn code_by_hash(
        &mut self,
        code_hash: FixedBytes<32>,
    ) -> Result<Bytecode, Self::Error>;
    fn storage(
        &mut self,
        address: Address,
        index: Uint<256, 4>,
    ) -> Result<Uint<256, 4>, Self::Error>;
    fn block_hash(&mut self, number: u64) -> Result<FixedBytes<32>, Self::Error>;
}
Expand description

EVM database interface.

Required Associated Types§

type Error

The database error type.

Required Methods§

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

Get basic account information.

fn code_by_hash( &mut self, code_hash: FixedBytes<32>, ) -> Result<Bytecode, Self::Error>

Get account code by its hash.

fn storage( &mut self, address: Address, index: Uint<256, 4>, ) -> Result<Uint<256, 4>, Self::Error>

Get storage value of address at index.

fn block_hash(&mut self, number: u64) -> Result<FixedBytes<32>, Self::Error>

Get block hash by block number.

Implementations on Foreign Types§

§

impl Database for BenchmarkDB

§

fn basic( &mut self, address: Address, ) -> Result<Option<AccountInfo>, <BenchmarkDB as Database>::Error>

Get basic account information.

§

fn code_by_hash( &mut self, _code_hash: FixedBytes<32>, ) -> Result<Bytecode, <BenchmarkDB as Database>::Error>

Get account code by its hash

§

fn storage( &mut self, _address: Address, _index: Uint<256, 4>, ) -> Result<Uint<256, 4>, <BenchmarkDB as Database>::Error>

Get storage value of address at index.

§

type Error = Infallible

§

fn block_hash( &mut self, _number: u64, ) -> Result<FixedBytes<32>, <BenchmarkDB as Database>::Error>

source§

impl<'a, 'b> Database for StateCacheDbRefMutWrapper<'a, 'b>

source§

type Error = <CacheDB<StateProviderDatabase<StateProviderTraitObjWrapper<'a>>> as Database>::Error

source§

fn basic( &mut self, address: Address, ) -> Result<Option<AccountInfo>, <StateCacheDbRefMutWrapper<'a, 'b> as Database>::Error>

source§

fn code_by_hash( &mut self, code_hash: FixedBytes<32>, ) -> Result<Bytecode, <StateCacheDbRefMutWrapper<'a, 'b> as Database>::Error>

source§

fn storage( &mut self, address: Address, index: Uint<256, 4>, ) -> Result<Uint<256, 4>, <StateCacheDbRefMutWrapper<'a, 'b> as Database>::Error>

source§

fn block_hash( &mut self, number: u64, ) -> Result<FixedBytes<32>, <StateCacheDbRefMutWrapper<'a, 'b> as Database>::Error>

§

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

§

type Error = <T as Database>::Error

§

fn basic( &mut self, address: Address, ) -> Result<Option<AccountInfo>, <&'a mut T as Database>::Error>

§

fn code_by_hash( &mut self, code_hash: FixedBytes<32>, ) -> Result<Bytecode, <&'a mut T as Database>::Error>

§

fn storage( &mut self, address: Address, index: Uint<256, 4>, ) -> Result<Uint<256, 4>, <&'a mut T as Database>::Error>

§

fn block_hash( &mut self, number: u64, ) -> Result<FixedBytes<32>, <&'a mut T as Database>::Error>

§

impl<DB> Database for State<DB>
where DB: Database,

§

type Error = <DB as Database>::Error

§

fn basic( &mut self, address: Address, ) -> Result<Option<AccountInfo>, <State<DB> as Database>::Error>

§

fn code_by_hash( &mut self, code_hash: FixedBytes<32>, ) -> Result<Bytecode, <State<DB> as Database>::Error>

§

fn storage( &mut self, address: Address, index: Uint<256, 4>, ) -> Result<Uint<256, 4>, <State<DB> as Database>::Error>

§

fn block_hash( &mut self, number: u64, ) -> Result<FixedBytes<32>, <State<DB> as Database>::Error>

§

impl<DB> Database for StateProviderDatabase<DB>
where DB: EvmStateProvider,

§

fn basic( &mut self, address: Address, ) -> Result<Option<AccountInfo>, <StateProviderDatabase<DB> as Database>::Error>

Retrieves basic account information for a given address.

Returns Ok with Some(AccountInfo) if the account exists, None if it doesn’t, or an error if encountered.

§

fn code_by_hash( &mut self, code_hash: FixedBytes<32>, ) -> Result<Bytecode, <StateProviderDatabase<DB> as Database>::Error>

Retrieves the bytecode associated with a given code hash.

Returns Ok with the bytecode if found, or the default bytecode otherwise.

§

fn storage( &mut self, address: Address, index: Uint<256, 4>, ) -> Result<Uint<256, 4>, <StateProviderDatabase<DB> as Database>::Error>

Retrieves the storage value at a specific index for a given address.

Returns Ok with the storage value, or the default value if not found.

§

fn block_hash( &mut self, number: u64, ) -> Result<FixedBytes<32>, <StateProviderDatabase<DB> as Database>::Error>

Retrieves the block hash for a given block number.

Returns Ok with the block hash if found, or the default hash otherwise. Note: It safely casts the number to u64.

§

type Error = ProviderError

§

impl<E> Database for EmptyDBTyped<E>

§

type Error = E

§

fn basic( &mut self, address: Address, ) -> Result<Option<AccountInfo>, <EmptyDBTyped<E> as Database>::Error>

§

fn code_by_hash( &mut self, code_hash: FixedBytes<32>, ) -> Result<Bytecode, <EmptyDBTyped<E> as Database>::Error>

§

fn storage( &mut self, address: Address, index: Uint<256, 4>, ) -> Result<Uint<256, 4>, <EmptyDBTyped<E> as Database>::Error>

§

fn block_hash( &mut self, number: u64, ) -> Result<FixedBytes<32>, <EmptyDBTyped<E> as Database>::Error>

§

impl<ExtDB> Database for CacheDB<ExtDB>
where ExtDB: DatabaseRef,

§

fn storage( &mut self, address: Address, index: Uint<256, 4>, ) -> Result<Uint<256, 4>, <CacheDB<ExtDB> as Database>::Error>

Get the value in an account’s storage slot.

It is assumed that account is already loaded.

§

type Error = <ExtDB as DatabaseRef>::Error

§

fn basic( &mut self, address: Address, ) -> Result<Option<AccountInfo>, <CacheDB<ExtDB> as Database>::Error>

§

fn code_by_hash( &mut self, code_hash: FixedBytes<32>, ) -> Result<Bytecode, <CacheDB<ExtDB> as Database>::Error>

§

fn block_hash( &mut self, number: u64, ) -> Result<FixedBytes<32>, <CacheDB<ExtDB> as Database>::Error>

§

impl<T> Database for Box<T>
where T: Database + ?Sized,

§

type Error = <T as Database>::Error

§

fn basic( &mut self, address: Address, ) -> Result<Option<AccountInfo>, <Box<T> as Database>::Error>

§

fn code_by_hash( &mut self, code_hash: FixedBytes<32>, ) -> Result<Bytecode, <Box<T> as Database>::Error>

§

fn storage( &mut self, address: Address, index: Uint<256, 4>, ) -> Result<Uint<256, 4>, <Box<T> as Database>::Error>

§

fn block_hash( &mut self, number: u64, ) -> Result<FixedBytes<32>, <Box<T> as Database>::Error>

Implementors§

§

impl<S, BH> Database for DatabaseComponents<S, BH>
where S: State, BH: BlockHash,

§

impl<T> Database for WrapDatabaseRef<T>
where T: DatabaseRef,

§

type Error = <T as DatabaseRef>::Error