-
Notifications
You must be signed in to change notification settings - Fork 20.1k
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
snapshotter/tests: verify snapdb post-state against trie #20812
Conversation
core/state/snapshot/account.go
Outdated
} | ||
|
||
// SlimToFull converts data on the 'slim RLP' format into the full RLP-format | ||
func SlimToFull(data []byte) []byte { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please return an error if rlp.Decode fails. We'll need it when parsing data from the snap protocol.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd move this and conversionAccount
into conversion.go
until it's clear where it goes. Don't want to litter the package. I'm unsure this is a method we want to keep long term, seems weird to do three ops in on (decode, convert, recode).
core/state/snapshot/conversion.go
Outdated
"github.com/ethereum/go-ethereum/trie" | ||
) | ||
|
||
type leaf struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a leaf. Its a key/value entry in the trie.
core/state/snapshot/conversion.go
Outdated
|
||
// StdGenerate is a very basic hexary trie builder which uses the same Trie | ||
// as the rest of geth, with no enhancements or optimizations | ||
func StdGenerate(in chan (leaf), out chan (common.Hash)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be public?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, not in this PR. I'm changing it.
It was public because we later might want to expose it to the geth cli command, so we can do snaphash
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM
This PR implements a snapshot vs trie reconciliation after running blockchain tests, to ensure that the state-according-to-snapshot is consistent with the state-according-to-trie.