-
Notifications
You must be signed in to change notification settings - Fork 37
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
all: introduce trie owner notion #553
all: introduce trie owner notion #553
Conversation
8f93c3f
to
3420080
Compare
@Francesco4203 Could u put some description about the concept of trie owner here from go-ethereum team ? |
* cmd, core/state, light, trie, eth: add trie owner notion * all: refactor * tests: fix goimports * core/state/snapshot: fix ineffasigns Co-authored-by: Martin Holst Swende <[email protected]>
3420080
to
8bd0193
Compare
@huyngopt1994 Added. |
func newTriePrefetcher(db Database, root common.Hash, namespace string) *triePrefetcher { | ||
prefix := triePrefetchMetricsPrefix + namespace | ||
p := &triePrefetcher{ | ||
db: db, | ||
root: root, | ||
fetchers: make(map[common.Hash]*subfetcher), // Active prefetchers use the fetchers map | ||
fetchers: make(map[string]*subfetcher), // Active prefetchers use the fetchers map |
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.
func (p *triePrefetcher) trieID(owner common.Hash, root common.Hash) string {
return string(append(owner.Bytes(), root.Bytes()...))
}
so the new key will be changed from the root to string(append(owner.Bytes(), root.Bytes()...))
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.
return &tracer{ | ||
insert: insert, | ||
delete: delete, | ||
origin: origin, |
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.
then we will have the other PR for tracking this map data ?
LGTM, let merge to next Implementing. |
b413887
into
axieinfinity:path-base-implementing
* cmd, core/state, light, trie, eth: add trie owner notion * all: refactor * tests: fix goimports * core/state/snapshot: fix ineffasigns Co-authored-by: rjl493456442 <[email protected]> Co-authored-by: Martin Holst Swende <[email protected]>
* cmd, core/state, light, trie, eth: add trie owner notion * all: refactor * tests: fix goimports * core/state/snapshot: fix ineffasigns Co-authored-by: rjl493456442 <[email protected]> Co-authored-by: Martin Holst Swende <[email protected]>
* cmd, core/state, light, trie, eth: add trie owner notion * all: refactor * tests: fix goimports * core/state/snapshot: fix ineffasigns Co-authored-by: rjl493456442 <[email protected]> Co-authored-by: Martin Holst Swende <[email protected]>
* cmd, core/state, light, trie, eth: add trie owner notion * all: refactor * tests: fix goimports * core/state/snapshot: fix ineffasigns Co-authored-by: rjl493456442 <[email protected]> Co-authored-by: Martin Holst Swende <[email protected]>
This PR is to:
prefetcher
. Currently, each trie is represented by its root hash. There will be a case when two accounts have exactly the same storage information, and thus the same root hash of storage trie. Adding the owner information helps distinguishing them correctly, and each account has its own storage trie now.(t *Trie) Commit()
, if the trie is clean (maybe committed earlier) and nothing-dirty-to-commit now, there might still be some resolved nodes (maybe retrieved earlier), but the tracer isReset()
, so it will lose the information regarding those nodes. This PR set the root to its hash to ensure that all nodes are released afterCommit()
.