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

Add storage_root provider function for account #9643

Closed
mattsse opened this issue Jul 19, 2024 · 0 comments · Fixed by #9659
Closed

Add storage_root provider function for account #9643

mattsse opened this issue Jul 19, 2024 · 0 comments · Fixed by #9659
Labels
A-db Related to the database

Comments

@mattsse
Copy link
Collaborator

mattsse commented Jul 19, 2024

In order to obtain a storage root in rpc, we should expose this as part of a provider function, similar to

pub trait StateRootProvider: Send + Sync {

          we would need to expose the interface in `HashedStorage` similar to `HashedPostState::from_revert_range` that only loads storage changes for a single account. then we would be able to initialize storage root with in-memory hashed state

e.g.

let address = ();
let hashed_address = keccack256(address);
let hashed_storage = HashedStorage::from_revert_range(address, &tx, block_range)?;
let hahed_storage_sorted = hashed_storage.into_sorted();
let root = StorageRoot::new_hashed(
    &tx,
    HashedPostStateStorageCursor::new(
        DatabaseHashedStorageCursor::new(
            tx.cursor_dup_read::<tables::HashedStorages>()?,
            hashed_address,
        ),
        Some(&hashed_storage_sorted)
    ),
    hashed_address,
).root()?

Originally posted by @rkrasiuk in #9625 (comment)

@mattsse mattsse changed the title Add storage_root function for account Add storage_root provider function for account Jul 19, 2024
@mattsse mattsse added D-good-first-issue Nice and easy! A great choice to get started A-db Related to the database labels Jul 19, 2024
@mattsse mattsse removed the D-good-first-issue Nice and easy! A great choice to get started label Jul 19, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in Reth Tracker Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-db Related to the database
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant