refactor(revm): simplify Database impl for StateProviderDatabase (#12241)

This commit is contained in:
Thomas Coratger
2024-11-01 11:35:06 +01:00
committed by GitHub
parent 8d31b65242
commit 39bc8ce81a

View File

@ -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)
}
}