Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading