core/state: increment storage counters in binary trie IntermediateRoot path

The binary trie fast path in IntermediateRoot() directly iterates
uncommittedStorage and calls UpdateStorage/DeleteStorage, bypassing the
per-account updateTrie() method. However, it omitted the StorageUpdated
and StorageDeleted counter increments that updateTrie() performs, causing
the "Slow block" JSON log to always report storage_slots_written=0 in
binary trie mode.

Add the missing counter increments to match the behavior in
state_object.go's updateTrie().
This commit is contained in:
CPerezz 2026-03-27 23:39:18 +01:00
parent acdd139717
commit cdc3100cb3
No known key found for this signature in database
GPG key ID: 62045F34B97177DD

View file

@ -881,10 +881,12 @@ func (s *StateDB) IntermediateRoot(deleteEmptyObjects bool) common.Hash {
if err := s.trie.UpdateStorage(addr, key[:], common.TrimLeftZeroes(value[:])); err != nil {
s.setError(err)
}
s.StorageUpdated.Add(1)
} else {
if err := s.trie.DeleteStorage(addr, key[:]); err != nil {
s.setError(err)
}
s.StorageDeleted.Add(1)
}
}
}