cmd, core, eth, triedb/pathdb: track node origins in the path database#32418
cmd, core, eth, triedb/pathdb: track node origins in the path database#32418rjl493456442 merged 1 commit intoethereum:masterfrom
Conversation
fd1f3a2 to
51844b4
Compare
| } | ||
| } | ||
| } | ||
| for _, addr := range deletes { |
There was a problem hiding this comment.
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.
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.
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.
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.
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.
| 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.
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.
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.