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

trie: refactor tracer #581

Open
wants to merge 3 commits into
base: path-base-implementing
Choose a base branch
from

Conversation

Francesco4203
Copy link
Collaborator

@Francesco4203 Francesco4203 commented Sep 20, 2024

Reference: ethereum/go-ethereum#26763

Also applied some related changes from this PR: ethereum/go-ethereum#27160

Changes:

  • Rename trie/utils.go to trie/tracer.go
  • Rename origin field in tracer to accessList, still the same function
  • Merge updated nodes and deleted nodes to the same list of dirty nodes, still keep track of number of deleted and updated nodes. List of dirty nodes is map from path to node, an empty node meaning a deleted node. Same logic for merging markUpdated and markDeleted into addNode
  • committer: move logic to mark deleted nodes to committer.store for consistency with the mark update logic

order = append(order, owner)
}
if _, ok := nodes.sets[common.Hash{}]; ok {
order = append(order, common.Hash{})
Copy link
Collaborator Author

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

@@ -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) {
Copy link
Collaborator Author

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.

@Francesco4203 Francesco4203 changed the title trie: rework tracer trie: refactor tracer Sep 20, 2024
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.

1 participant