-
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.
fix: generic trie value updates (#12344)
Preparation step for #12324. Introduce `generic_store_value` and `generic_delete_value`. These are different ways for MemTrie and TrieStorage to process value updates. TLDR: memtries can work with inlined values; trie storages must always have full values. Also the way to record accessed nodes is different. Also, solving some issues on the way. For example, interfaces of `Trie::insert` and `MemTrieUpdate::insert_impl` currently diverge. The latter needs both `FlatStateValue` for memtrie changes and `Option<Vec<u8>>` for disk changes. There is a good reason for that - if memtrie is loaded from flat state, we don't need to produce disk trie changes, so it is enough to load `FlatStateValue`s. However, the current interface is quite loose, so it is a net improvement to make it more strict by requiring everyone to give `ValueUpdate::MemtrieAndDisk` or `::MemtrieOnly`. The drawback is that `Trie::insert` technically can receive `ValueUpdate::MemtrieOnly`, it just will panic. But well... it still looks better than unclear memtrie interface with two values and hashes on the way.
- Loading branch information
1 parent
05f91c6
commit a8158f4
Showing
6 changed files
with
175 additions
and
104 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
Oops, something went wrong.