mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat : add storage_root provider function for account (#9659)
Co-authored-by: Roman Krasiuk <rokrassyuk@gmail.com>
This commit is contained in:
@ -673,7 +673,7 @@ mod tests {
|
||||
use reth_storage_api::{
|
||||
AccountReader, BlockHashReader, StateProofProvider, StateProvider, StateRootProvider,
|
||||
};
|
||||
use reth_trie::AccountProof;
|
||||
use reth_trie::{AccountProof, HashedStorage};
|
||||
|
||||
fn create_mock_state(
|
||||
test_block_builder: &mut TestBlockBuilder,
|
||||
@ -753,6 +753,14 @@ mod tests {
|
||||
) -> ProviderResult<(B256, TrieUpdates)> {
|
||||
Ok((B256::random(), TrieUpdates::default()))
|
||||
}
|
||||
|
||||
fn hashed_storage_root(
|
||||
&self,
|
||||
_address: Address,
|
||||
_hashed_storage: HashedStorage,
|
||||
) -> ProviderResult<B256> {
|
||||
Ok(B256::random())
|
||||
}
|
||||
}
|
||||
|
||||
impl StateProofProvider for MockStateProvider {
|
||||
|
||||
@ -8,7 +8,7 @@ use reth_primitives::{
|
||||
use reth_storage_api::{
|
||||
AccountReader, BlockHashReader, StateProofProvider, StateProvider, StateRootProvider,
|
||||
};
|
||||
use reth_trie::{updates::TrieUpdates, AccountProof, HashedPostState};
|
||||
use reth_trie::{updates::TrieUpdates, AccountProof, HashedPostState, HashedStorage};
|
||||
|
||||
/// A state provider that stores references to in-memory blocks along with their state as well as
|
||||
/// the historical state provider for fallback lookups.
|
||||
@ -101,6 +101,15 @@ impl StateRootProvider for MemoryOverlayStateProvider {
|
||||
state.extend(hashed_state);
|
||||
self.historical.hashed_state_root_with_updates(state)
|
||||
}
|
||||
|
||||
// TODO: Currently this does not reuse available in-memory trie nodes.
|
||||
fn hashed_storage_root(
|
||||
&self,
|
||||
address: Address,
|
||||
storage: HashedStorage,
|
||||
) -> ProviderResult<B256> {
|
||||
self.historical.hashed_storage_root(address, storage)
|
||||
}
|
||||
}
|
||||
|
||||
impl StateProofProvider for MemoryOverlayStateProvider {
|
||||
|
||||
Reference in New Issue
Block a user