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.
Changes
Note: This is based on #2665
v0
state trieQuestions:
Should
Encode
return the too-large values or take in a Database interface to store them directly? How about for proof generation?Should
Decode
take in a database interface to load values directly, or be passed a map of hash<->value? How about for proof verification?How does Substrate retrieves subvalues from hashes? Using database lookup
How to know which version to use to encode/decode nodes in the state trie?
How does Substrate delete subvalues? For 'dumb' KV, they prepend the subvalue hash with the node key to go around the storing another key value in another table from hash subvalue to reference counter.
Regarding the
ESCAPE_HEADER
(aka 'reserved for compact encoding' aka00010000
), is the 'value node' just the scale encoding of the node subvalue bytes? Also why is this header needed if leaf and branch with hashed subvalue already have their own header001
and0001
(or the opposite, why did we need those 2 new headers if we have this compact encoding escape header)?See State trie version v0 vs v1 paritytech/substrate#11607 (comment)
Post checks:
version.V0
and make them test cases with V1 as wellTests
go test ./lib/trie/... ./internal/trie/...
Issues
Primary Reviewer