-
Notifications
You must be signed in to change notification settings - Fork 659
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Memtrie] (3/n) Implement memtrie update logic. (#10015)
This is a complete implementation of the insertion and deletion logic on top of the in-memory trie. Originally coming from @Longarithm's prototype, it's been cleaned up, thoroughly reviewed, and thoroughly tested. The MemTrieChanges data structure, similar to the existing TrieChanges data structure, describes all that is needed to apply changes to an in-memory trie. Additionally, MemTrieChanges can be embedded within TrieChanges to apply both in-memory and on-disk changes together. When an in-memory trie is updated, the mutations (insertions and deletions of key-value pairs) go through only the MemTrieUpdate<'a> struct. This struct is responsible for calculating both the MemTrieChanges as well as the TrieChanges. By accessing only the existing in-memory trie nodes, it is able to compute both in-memory changes and on-disk changes. (There is also an option to compute only in-memory changes, which is useful during initial loading when we need to apply flat state deltas). Extensive testing has been implemented to assert that the following are all completely consistent with one another: - Computing the on-disk trie changes using the previously existing logic implemented in Trie::update; - Computing the in-memory trie changes using the newly implemented MemTrieUpdate; - Computing both in-memory and on-disk trie changes together using MemTrieUpdate. Also, a manual test plus a randomized test both independently achieve effectively 100% coverage of all code paths in updating.rs.
- Loading branch information
1 parent
3fcd356
commit eeaf208
Showing
9 changed files
with
1,409 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.