Skip to content

Commit

Permalink
refactor(revm): simplify Database impl for StateProviderDatabase (p…
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger authored Nov 1, 2024
1 parent 8d31b65 commit 39bc8ce
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/revm/src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,29 +101,29 @@ 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.
///
/// 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)
}
}

Expand Down

0 comments on commit 39bc8ce

Please sign in to comment.