-
Notifications
You must be signed in to change notification settings - Fork 34
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
trie: refactor tracer #581
trie: refactor tracer #581
Conversation
order = append(order, owner) | ||
} | ||
if _, ok := nodes.sets[common.Hash{}]; ok { | ||
order = append(order, 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.
Here, the trie with owner empty representing the account trie is pushed to the back of the array so that all the storage dirty nodes are flushed first.
Reference: ethereum/go-ethereum@5758d1f
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.
Add this like comment in the source code too ?
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.
There is a comment like this above
// Note, the storage tries must be flushed before the account trie to
// retain the invariant that children go into the dirty cache first.
Do you think this is clear enough?
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.
the trie with owner empty representing the account trie is pushed to the back of the array so that all the storage dirty nodes are flushed first.
I think u can add those blocks for showing why we use common.Hash{} here.
@@ -628,16 +630,16 @@ func (t *Trie) Commit(collectLeaf bool) (common.Hash, *NodeSet, error) { | |||
} | |||
|
|||
// hashRoot calculates the root hash of the given trie | |||
func (t *Trie) hashRoot() (node, node, error) { | |||
func (t *Trie) hashRoot() (node, node) { |
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 error will ever be returned, so just not return error here.
b58387d
to
defda57
Compare
One thing note here in PR is tracer is enabled by default
|
I think u should spit one commit in the PR into more commits for easily reviewing, merging into one 's hard for understanding the purpose of changes. |
// but not present in database previously), for example the node was | ||
// embedded in the parent and now deleted from the trie. In this case | ||
// it's noop from database's perspective. | ||
val := c.tracer.getPrev(path) |
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.
hm that's interested, so they don't need to track the deleted nodes any more from trie in tracer, and mark it deleted 🤔
8fc5346
to
babdb0b
Compare
45ee924
into
axieinfinity:path-base-implementing
* trie: refactor tracer * fix: add description
* trie: refactor tracer * fix: add description
* trie: refactor tracer * fix: add description
Reference: ethereum/go-ethereum#26763
Also applied some related changes from this PR: ethereum/go-ethereum#27160
Changes:
trie/utils.go
totrie/tracer.go
origin
field intracer
toaccessList
, still the same functionmarkUpdated
andmarkDeleted
intoaddNode
committer
: move logic to mark deleted nodes tocommitter.store
for consistency with the mark update logic