mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
refactor(revm): simplify Database impl for StateProviderDatabase (#12241)
This commit is contained in:
@ -101,21 +101,21 @@ impl<DB: EvmStateProvider> Database for StateProviderDatabase<DB> {
|
||||
/// Returns `Ok` with `Some(AccountInfo)` if the account exists,
|
||||
/// `None` if it doesn't, or an error if encountered.
|
||||
fn basic(&mut self, address: Address) -> Result<Option<AccountInfo>, Self::Error> {
|
||||
DatabaseRef::basic_ref(self, address)
|
||||
self.basic_ref(address)
|
||||
}
|
||||
|
||||
/// Retrieves the bytecode associated with a given code hash.
|
||||
///
|
||||
/// Returns `Ok` with the bytecode if found, or the default bytecode otherwise.
|
||||
fn code_by_hash(&mut self, code_hash: B256) -> Result<Bytecode, Self::Error> {
|
||||
DatabaseRef::code_by_hash_ref(self, code_hash)
|
||||
self.code_by_hash_ref(code_hash)
|
||||
}
|
||||
|
||||
/// 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 storage(&mut self, address: Address, index: U256) -> Result<U256, Self::Error> {
|
||||
DatabaseRef::storage_ref(self, address, index)
|
||||
self.storage_ref(address, index)
|
||||
}
|
||||
|
||||
/// Retrieves the block hash for a given block number.
|
||||
@ -123,7 +123,7 @@ impl<DB: EvmStateProvider> Database for StateProviderDatabase<DB> {
|
||||
/// Returns `Ok` with the block hash if found, or the default hash otherwise.
|
||||
/// Note: It safely casts the `number` to `u64`.
|
||||
fn block_hash(&mut self, number: u64) -> Result<B256, Self::Error> {
|
||||
DatabaseRef::block_hash_ref(self, number)
|
||||
self.block_hash_ref(number)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user