-
Notifications
You must be signed in to change notification settings - Fork 35
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
core, trie: rework trie commiter #560
Conversation
changed the commit procedure, introduce new struct called nodeSet for returning including all dirty nodes of a trie. Multiple nodeset will be merged to MergedNodeSet struct. then be submitted to in-memory database from block to block
// Merge merges the provided dirty nodes of a trie into the set. The assumption | ||
// is held that no duplicated set belonging to the same trie will be merged twice. | ||
func (set *MergedNodeSet) Merge(other *NodeSet) error { | ||
_, present := set.sets[other.owner] |
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.
Just concerning, account trie does not have owner (owner is empty), will this still work as expected?
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.
As I understood, The account trie will have the empty hash for the owner, but the StorageTrie will use the addrHash for it
// OpenStorageTrie opens the storage trie of an account.
func (db *cachingDB) OpenStorageTrie(addrHash, root common.Hash) (Trie, error) {
tr, err := trie.NewSecure(addrHash, root, db.db)
For account owner, the mergednodeset will be initiated and merged one time when comitting so it's safe for case duplicated.
// Write the account trie changes, measuing the amount of wasted time
var start time.Time
if metrics.EnabledExpensive {
start = time.Now()
}
root, nodeSet, err := s.trie.Commit(true)
if err != nil {
return common.Hash{}, err
}
* core, trie: rework trie commiter changed the commit procedure, introduce new struct called nodeSet for returning including all dirty nodes of a trie. Multiple nodeset will be merged to MergedNodeSet struct. then be submitted to in-memory database from block to block * trie,core: fix comments
* core, trie: rework trie commiter changed the commit procedure, introduce new struct called nodeSet for returning including all dirty nodes of a trie. Multiple nodeset will be merged to MergedNodeSet struct. then be submitted to in-memory database from block to block * trie,core: fix comments
* core, trie: rework trie commiter changed the commit procedure, introduce new struct called nodeSet for returning including all dirty nodes of a trie. Multiple nodeset will be merged to MergedNodeSet struct. then be submitted to in-memory database from block to block * trie,core: fix comments
* core, trie: rework trie commiter changed the commit procedure, introduce new struct called nodeSet for returning including all dirty nodes of a trie. Multiple nodeset will be merged to MergedNodeSet struct. then be submitted to in-memory database from block to block * trie,core: fix comments
Reference in ethereum/go-ethereum#25320.
It's implementing PR prepare for next implementing Path based.
this PR is submitted to adjust the commit procedure. Now all the dirty nodes of a trie will be encapsulated in a struct called nodeSet for return. Multiple nodeSets can be merged together as a MergedNodeSet. Eventually the MergedNodeSet will be submitted to in-memory database as a whole to represent the state transition from block to block.