-
Notifications
You must be signed in to change notification settings - Fork 627
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(resharding): generic trie update retain, including trie storage (#…
…12301) Implement `retain_multi_range` for TrieStorage (partial or disk trie), by introducing `GenericTrieUpdate` which works for both trie storage and memtrie. * ~100 lines are caused by changed indents in `squash_node` * ~200 is just a (temporary) copypaste of old trie storage logic to make it compatible with `GenericTrieUpdate` * remaining is the actual logic, including improving the resharding tests to ensure that memtrie and triestorage results are the same. Some notes on the structure. `GenericTrieUpdate` abstracts the way the updated nodes are structured. It doesn't matter what is the node type - it is abstracted to `GenericTrieNodePtr`. `FlatStateValue` is the name for the value update. We can migrate everything to actual `FlatStateValue`, but for now trie storage uses `ValueHandle` and I don't want to touch it yet. The methods of `GenericTrieUpdate` define how to take/put nodes to memory. `GenericNodeOrIndex` stores a reference to old or updated node. For memtrie old node it is `MemTrieNodeId`, for triestorage it is `CryptoHash`. Finally, we are able to call `generic_retain_multi_range_recursive` which uses `GenericTrieUpdate` and recursively descends to the trie, regardless on how it is stored. If we agree on this, I can proceed later with migrating `insert` and `delete` as well, which will eventually lead to removing copypaste code.
- Loading branch information
1 parent
251d636
commit 598a2f4
Showing
7 changed files
with
591 additions
and
166 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
Oops, something went wrong.