Skip to content

WIP 2 Improve snapshot generation #22500

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

Closed
wants to merge 35 commits into from
Closed

Conversation

holiman
Copy link
Contributor

@holiman holiman commented Mar 15, 2021

Not to be merged!

This is a version of #22465, just posting it here so people can more easily try it out. At one point it should be merged back to @rjl493456442 's branch, but it's deviated so far now so I might aswell postpone it a bit longer.

rjl493456442 and others added 30 commits March 9, 2021 13:11
* core/state/snapshot: refactor

* core/state/snapshot: tiny fix and polish

Co-authored-by: rjl493456442 <[email protected]>
// This is an odd case. How can this happen? It means our snap data
// is correct, but not compelete? Maybe we can just continue here without
// deleting the existing data.
// We definitely need a testcase for this path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a special case that: all the snap states in the disk are iterated and verified, but there are some extra states on the right side in the trie. So the data is loss in the snap. Actually In my PR I have a testcase for it. https://github.com/ethereum/go-ethereum/pull/22465/files#diff-692791523abdbacf9c463a59f5ceffc649df9c6cc646ab1fdab0d6c1a4fa9ac8R193

// to check validity. We can just feed the key/vals into a stacktrie and obtain the
// root hash
if len(origin) == 0 && !aborted {
stackTr := trie.NewStackTrie(nil)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually in this case, we don't need the stacktrie. For tiny storage trie, we don't need to build the edge proofs at all. We can pass the nil proof and the entire key/val set to the range prover.

Regarding the standard trie VS stacktrie, I think there is no big difference in the performance. StackTrie is more memory friendly, but for the tiny trie it's unnecessary to introduce the stacktrie.

@holiman holiman closed this Mar 16, 2021
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.

2 participants