-
Notifications
You must be signed in to change notification settings - Fork 21.5k
cmd, core, eth, triedb/pathdb: track node origins in the path database #32418
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
Conversation
fd1f3a2 to
51844b4
Compare
| } | ||
| } | ||
| } | ||
| for _, addr := range deletes { |
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.
Apply trie insert/update before deletions to avoid loading siblings of deleted nodes within fullNode.
| deletes = append(deletes, tkey) | ||
| } else { | ||
| err = st.Update(tkey.Bytes(), val) | ||
| err := st.Update(tkey.Bytes(), val) |
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.
Apply trie insert/update before deletions to avoid loading siblings of deleted nodes within fullNode.
| return err | ||
| } | ||
| // Short circuit if the origins are not tracked | ||
| if len(s.nodeOrigin) == 0 { |
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 original values are not encoded into the journal if they are not provided.
51844b4 to
cbfa10d
Compare
cbfa10d to
ca8006f
Compare
ca8006f to
ada22c6
Compare
|
|
||
| // sanitize checks the provided user configurations and changes anything that's | ||
| // unreasonable or unworkable. | ||
| func (c *Config) sanitize() *Config { |
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.
Do you think we should sanitize the state history flag as well? Limit it to 90k or something?
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 no, state history is not only for deep reorg resilience, but also the data for historical state.
Normally people will choose to keep the full history since the genesis with statehistory=0.
MariusVanDerWijden
left a comment
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
| func (s *nodeSetWithOrigin) hasOrigin(r *rlp.Stream) (bool, error) { | ||
| kind, _, err := r.Kind() | ||
| if err != nil { | ||
| if errors.Is(err, io.EOF) { |
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.
You could add a comment here that error being EOF means that we have a legacy nodeSet without 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.
I can add it in a following PR, to not lose your approval :)
ethereum#32418) This PR is the first step in the trienode history series. It introduces the `nodeWithOrigin` struct in the path database, which tracks the original values of dirty nodes to support trienode history construction. Note, the original value is always empty in this PR, so it won't break the existing journal for encoding and decoding. The compatibility of journal should be handled in the following PR.
This PR is the first step in the trienode history series.
It introduces the
nodeWithOriginstruct in the path database, which tracks the originalvalues of dirty nodes to support trienode history construction.
Note, the original value is always empty in this PR, so it won't break the existing journal
for encoding and decoding. But the compatibility of journal should be handled in the
following PR.