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

fix(provider): latest provider proof method #5695

Merged
merged 1 commit into from
Dec 5, 2023
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
20 changes: 6 additions & 14 deletions crates/storage/provider/src/providers/state/latest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ use reth_db::{
};
use reth_interfaces::provider::{ProviderError, ProviderResult};
use reth_primitives::{
keccak256, trie::AccountProof, Account, Address, BlockNumber, Bytecode, StorageKey,
StorageValue, B256,
trie::AccountProof, Account, Address, BlockNumber, Bytecode, StorageKey, StorageValue, B256,
};
use reth_trie::updates::TrieUpdates;
use reth_trie::{proof::Proof, updates::TrieUpdates};

/// State provider over latest state that takes tx reference.
#[derive(Debug)]
Expand Down Expand Up @@ -95,17 +94,10 @@ impl<'b, TX: DbTx> StateProvider for LatestStateProviderRef<'b, TX> {
self.db.get::<tables::Bytecodes>(code_hash).map_err(Into::into)
}

fn proof(&self, address: Address, _keys: &[B256]) -> ProviderResult<AccountProof> {
let _hashed_address = keccak256(address);
let _root = self
.db
.cursor_read::<tables::Headers>()?
.last()?
.ok_or_else(|| ProviderError::HeaderNotFound(0.into()))?
.1
.state_root;

unimplemented!()
fn proof(&self, address: Address, slots: &[B256]) -> ProviderResult<AccountProof> {
Ok(Proof::new(self.db)
.account_proof(address, slots)
.map_err(Into::<reth_db::DatabaseError>::into)?)
}
}

Expand Down
Loading