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.
Generate proof for resharding (retain_multi_range) and check that it is valid against existing retain tests, already including memtrie and disktrie.
Surprisingly, #12390 allows to make the change almost invisible. The actual work here is to move
&mut TrieRecorder
insideTrieChangesTracker
which is insideMemTrieUpdate
.Reasoning: when we work with
MemTrieUpdate
, it is in fact unique owner of the logic to record proof (what I called "2nd stage" in the previous PR, after "1st stage" of trie lookups). And now, if we are sure that proof doesn't need values,MemTrieUpdate
can fully hold the&mut
, because memtrie has all the necessary information, and we can record nodes directly on node access instead of doing it retroactively (which was really bad).TrieRecorder
now is passed as a separate mode to process memtrie updates. We indeed need three modes - on loading we don't record anything, for non-validators we save trie changes, for validators we also save proofs. And after that, all we need to do forretain_split_shard
is to createTrieRecorder
and in the end get recorded storage from it.Next step will be to validate this proof in the actual state witness processing...