Skip to content

Commit 922eb03

Browse files
authored
core/state: pull the verkle trie from prefetcher for empty storage root (ethereum#30369)
This pull request fixes a flaw in prefetcher. In verkle tree world, both accounts and storage slots are committed into a single tree instance for state hashing. If the prefetcher is activated, we will try to pull the trie for the prefetcher for performance speedup. However, we had a special logic to skip pulling storage trie if the storage root is empty. While it's true for merkle as we have nothing to do with an empty storage trie, it's totally wrong for verkle. The consequences for skipping pulling is the storage changes are committed into trie A, while the account changes are committed into trie B (pulled from the prefetcher), boom.
1 parent 36a7134 commit 922eb03

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/state/state_object.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func (s *stateObject) getTrie() (Trie, error) {
143143
func (s *stateObject) getPrefetchedTrie() Trie {
144144
// If there's nothing to meaningfully return, let the user figure it out by
145145
// pulling the trie from disk.
146-
if s.data.Root == types.EmptyRootHash || s.db.prefetcher == nil {
146+
if (s.data.Root == types.EmptyRootHash && !s.db.db.TrieDB().IsVerkle()) || s.db.prefetcher == nil {
147147
return nil
148148
}
149149
// Attempt to retrieve the trie from the prefetcher

0 commit comments

Comments
 (0)