feat(durable-storage): support persisting node without its key value#954
Merged
vapourismo merged 1 commit intomainfrom Mar 30, 2026
Merged
feat(durable-storage): support persisting node without its key value#954vapourismo merged 1 commit intomainfrom
vapourismo merged 1 commit intomainfrom
Conversation
f44c0b8 to
128dfe0
Compare
|
Benchmark results for revision 7732c06:
Full results
Compare the results above with those for the default branch. |
128dfe0 to
6768542
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #954 +/- ##
==========================================
- Coverage 89.70% 89.69% -0.02%
==========================================
Files 110 110
Lines 22136 22136
Branches 22136 22136
==========================================
- Hits 19857 19854 -3
- Misses 1884 1887 +3
Partials 395 395 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
6768542 to
488d4cd
Compare
NSant215
approved these changes
Mar 27, 2026
d077284 to
8aee2fb
Compare
NSant215
approved these changes
Mar 30, 2026
8aee2fb to
6eb9a7a
Compare
victor-dumitrescu
approved these changes
Mar 30, 2026
6eb9a7a to
4c31640
Compare
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.
What
This PR changes the stored representation for MAVL nodes. The key's value from the node is no longer eagerly stored in the KV store.
That means we access these things using
KeyValueStore::blob_get/KeyValueStore::blob_set:The key's value is optionally stored using
KeyValueStore::set, and will always be loaded viaKeyValueStore::get.Why
We would rather not store the value twice in the KV store.
How
This change includes a sizeable refactor to ensure tests continue to work. This is necessary because not all commit operations are equal. In the presence of a
Database, the commit operation of theMerkleLayerwould not need to write the node key's value. However, when testing theMerkleLayerin isolation, we need to flush those node values as no other component would do it otherwise.To make this work cleanly, I have added two traits
StorableandLoadablewhich abstract over things that can be accessed in a KV store.Let's first look at notable
Loadableimplementations:Node<TreeId, Normal>: This instance loads the key, value, and balance factor. The left and right tree are loaded viaLoadable for TreeId.Tree<NodeId>: Loads the optional hash from the KV store and then delegates further loading of the inner node toLoadable for NodeId.LazyNodeId/LazyTreeId: Accepts the requested hash and then does nothing. The value will be loaded lazily.ArcNodeId/ArcTreeId: Eagerly loads the inner value using the correspondingLoadable for Node<...>orLoadable for Tree<...>implementation.Notable implementations of
Storableare:Node<TreeId, Normal>: Always stores key, balance factor, and the hashes of the left and right tree. The left and right tree are optionally persisted. Same for the node's key value.Tree<NodeId>: If the tree isn't empty, it stores the optional hash. Optionally, the nested node will be stored as well viaStorable for NodeId.LazyNodeId/LazyTreeId: When either of these contain a value (not blinded) then they delegate to theStorableimplementation of that value.ArcNodeId/ArcTreeId: The storing is delegated to the innerNodeorTree.Manually Testing
Tasks for the Author