Skip to content

Commit

Permalink
Fix some bugs identified in the code review
Browse files Browse the repository at this point in the history
Co-authored-by: Ignacio Hagopian <[email protected]>
  • Loading branch information
gballet and jsign authored Apr 21, 2023
1 parent 7ec6764 commit 22334e5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/state/trie_prefetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ func (sf *subfetcher) loop() {
}
sf.trie = trie
} else {
trie, err := sf.db.OpenStorageTrie(sf.state, sf.owner, sf.root, nil /* safe to set since there is no prefecter for verkle */)
trie, err := sf.db.OpenStorageTrie(sf.state, sf.owner, sf.root, nil /* safe to set since there is no prefetcher for verkle */)
if err != nil {
log.Warn("Trie prefetcher failed opening trie", "root", sf.root, "err", err)
return
Expand Down
2 changes: 1 addition & 1 deletion core/state_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
allLogs = append(allLogs, receipt.Logs...)
}

// verkle transition: if the conversoin process is in progress, move
// verkle transition: if the conversion process is in progress, move
// N values from the MPT into the verkle tree.
if fdb, ok := statedb.Database().(*state.ForkingDB); ok {
if fdb.InTransition() {
Expand Down
8 changes: 4 additions & 4 deletions trie/transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ func (t *TransitionTrie) Base() *SecureTrie {
//
// TODO(fjl): remove this when StateTrie is removed
func (t *TransitionTrie) GetKey(key []byte) []byte {
if t.overlay.GetKey(key) != nil {
return t.overlay.GetKey(key)
if key := t.overlay.GetKey(key); key != nil {
return key
}
return t.base.GetKey(key)
}
Expand All @@ -53,8 +53,8 @@ func (t *TransitionTrie) GetKey(key []byte) []byte {
// not be modified by the caller. If a node was not found in the database, a
// trie.MissingNodeError is returned.
func (t *TransitionTrie) TryGet(addr, key []byte) ([]byte, error) {
if t.overlay.GetKey(key) != nil {
return t.overlay.TryGet(addr, key)
if val, err := t.overlay.TryGet(addr, key); len(val) != 0 || err != nil {
return val, nil
}
// TODO also insert value into overlay
return t.base.TryGet(nil, key)
Expand Down

0 comments on commit 22334e5

Please sign in to comment.