fix(provider): latest provider proof method (#5695)

This commit is contained in:
Roman Krasiuk
2023-12-05 02:30:37 -08:00
committed by GitHub
parent dc56078919
commit 074d7c7945

View File

@ -9,10 +9,9 @@ use reth_db::{
}; };
use reth_interfaces::provider::{ProviderError, ProviderResult}; use reth_interfaces::provider::{ProviderError, ProviderResult};
use reth_primitives::{ use reth_primitives::{
keccak256, trie::AccountProof, Account, Address, BlockNumber, Bytecode, StorageKey, trie::AccountProof, Account, Address, BlockNumber, Bytecode, StorageKey, StorageValue, B256,
StorageValue, B256,
}; };
use reth_trie::updates::TrieUpdates; use reth_trie::{proof::Proof, updates::TrieUpdates};
/// State provider over latest state that takes tx reference. /// State provider over latest state that takes tx reference.
#[derive(Debug)] #[derive(Debug)]
@ -95,17 +94,10 @@ impl<'b, TX: DbTx> StateProvider for LatestStateProviderRef<'b, TX> {
self.db.get::<tables::Bytecodes>(code_hash).map_err(Into::into) self.db.get::<tables::Bytecodes>(code_hash).map_err(Into::into)
} }
fn proof(&self, address: Address, _keys: &[B256]) -> ProviderResult<AccountProof> { fn proof(&self, address: Address, slots: &[B256]) -> ProviderResult<AccountProof> {
let _hashed_address = keccak256(address); Ok(Proof::new(self.db)
let _root = self .account_proof(address, slots)
.db .map_err(Into::<reth_db::DatabaseError>::into)?)
.cursor_read::<tables::Headers>()?
.last()?
.ok_or_else(|| ProviderError::HeaderNotFound(0.into()))?
.1
.state_root;
unimplemented!()
} }
} }