Trait Database
pub trait Database {
type Error: DBErrorMarker + 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: DBErrorMarker + Error
type Error: DBErrorMarker + Error
The database error type.
Required Methods§
fn basic(
&mut self,
address: Address,
) -> Result<Option<AccountInfo>, Self::Error>
fn basic( &mut self, address: Address, ) -> Result<Option<AccountInfo>, Self::Error>
Gets basic account information.
fn code_by_hash(
&mut self,
code_hash: FixedBytes<32>,
) -> Result<Bytecode, Self::Error>
fn code_by_hash( &mut self, code_hash: FixedBytes<32>, ) -> Result<Bytecode, Self::Error>
Gets account code by its hash.
fn storage(
&mut self,
address: Address,
index: Uint<256, 4>,
) -> Result<Uint<256, 4>, Self::Error>
fn storage( &mut self, address: Address, index: Uint<256, 4>, ) -> Result<Uint<256, 4>, Self::Error>
Gets storage value of address at index.
fn block_hash(&mut self, number: u64) -> Result<FixedBytes<32>, Self::Error>
fn block_hash(&mut self, number: u64) -> Result<FixedBytes<32>, Self::Error>
Gets block hash by block number.
Implementations on Foreign Types§
§impl Database for BenchmarkDB
impl Database for BenchmarkDB
§fn basic(
&mut self,
address: Address,
) -> Result<Option<AccountInfo>, <BenchmarkDB as Database>::Error>
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>
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>
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>
§impl<'a, T> Database for &'a mut T
impl<'a, T> Database for &'a mut T
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<ExtDB> Database for CacheDB<ExtDB>where
ExtDB: DatabaseRef,
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>
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.