From cdc3100cb3c428369240195258279eed820b9215 Mon Sep 17 00:00:00 2001 From: CPerezz Date: Fri, 27 Mar 2026 23:39:18 +0100 Subject: [PATCH] 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(). --- core/state/statedb.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/state/statedb.go b/core/state/statedb.go index 59ad3cdfef..5c55d66734 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -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) } } }