Skip to content
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

fix OpenStorageTrie: return an error instead of panicking if the account tree not a verkle tree #321

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix OpenStorageTrie: return an error instead of panicking if the acco…
…unt tree not a verkle tree
gballet committed Dec 5, 2023
commit ea5f874c983a9b0b36ff7c128cf4a9b19cba8030
2 changes: 1 addition & 1 deletion core/state/database.go
Original file line number Diff line number Diff line change
@@ -413,7 +413,7 @@ func (db *cachingDB) OpenStorageTrie(stateRoot common.Hash, address common.Addre
case *trie.TransitionTrie:
return trie.NewTransitionTree(mpt.(*trie.SecureTrie), self.Overlay(), true), nil
default:
panic("unexpected trie type")
return nil, errors.New("expected a verkle account tree, and found another type")
}
}
mpt, err := db.openStorageMPTrie(stateRoot, address, root, nil)
2 changes: 1 addition & 1 deletion core/state/trie_prefetcher.go
Original file line number Diff line number Diff line change
@@ -302,7 +302,7 @@ func (sf *subfetcher) loop() {
}
sf.trie = trie
} else {
trie, err := sf.db.OpenStorageTrie(sf.state, sf.addr, sf.root, nil /* safe to set to nil for now, as there is no prefetcher for verkle */)
trie, err := sf.db.OpenStorageTrie(sf.state, sf.addr, sf.root, sf.trie)
if err != nil {
log.Warn("Trie prefetcher failed opening trie", "root", sf.root, "err", err)
return