Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: resharding proof #12418

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

feat: resharding proof #12418

wants to merge 1 commit into from

Conversation

Longarithm
Copy link
Member

@Longarithm Longarithm commented Nov 8, 2024

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 inside TrieChangesTracker which is inside MemTrieUpdate.

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 for retain_split_shard is to create TrieRecorder and in the end get recorded storage from it.

Next step will be to validate this proof in the actual state witness processing...

@Longarithm Longarithm changed the title draft: resharding proof feat: resharding proof Nov 8, 2024
@Longarithm Longarithm linked an issue Nov 8, 2024 that may be closed by this pull request
@Longarithm Longarithm marked this pull request as ready for review November 8, 2024 19:28
@Longarithm Longarithm requested a review from a team as a code owner November 8, 2024 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ReshardingV3] State Witness - new state root generation
1 participant