[WIP] feat: migrate account state to trie#391
Closed
fmoletta wants to merge 17 commits into
Closed
Conversation
mpaulucci
reviewed
Sep 16, 2024
| assert_eq!( | ||
| test_state_root, | ||
| db.clone().world_state_root(), | ||
| db.clone().world_state_root().unwrap(), |
Collaborator
There was a problem hiding this comment.
Can't we do the unwrap inside the world_state_root function?
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Sep 16, 2024
**Motivation** Being able to create a `Trie` struct representing the world state based on the engine's internal value store (reading from a specific table in the case of libmdbx or map in the case of in_memory). The created trie would also use the given block's state root as its root in order to query historical data build new blocks based on the previous block's state, and easily process re-orgs <!-- Why does this pull request exist? What are its goals? --> **Description** Added features: * Add `world_state` method to `StoreEngine` api, which builds a `Trie` from a block number and the engine's internal database (or value store) Code refactors: * Remove `DB` generic from `Trie` and instead store `Box<dyn TrieDB>` (This is because the generic wouldn't allow us to return a single generic `Trie<DB>` from different `StoreEngine` implementations) * Store `Arc<Database>` instead of `&'a Database` in libmdbx impl of `TrieDB` (This is so we can box it) * Store `Arc<Database>` instead of `Database` in `engine::libmdbx::Store` (Complies with above change) Misc: * Add `Trie::new_temp` test-feature gated method to simplify trie creation in tests <!-- A clear and concise general description of the changes this PR introduces --> <!-- Link to issues: Resolves #111, Resolves #222 --> Closes None, but is needed for #391 --------- Co-authored-by: Tomás Arjovsky <t.arjovsky@gmail.com>
Contributor
Author
|
Replaced by #407 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
STATUS: Working with temporary DBs, working on creating tries from the engine using the DB trait in a separate PR (#399)
Motivation
Description
Closes #issue_number