go-ethereum/core/state
CPerezz 3f5e27e7b0
core, core/state: instrument BAL slow-block metrics
Populates per-block state read/write counts in slow-block JSON for BAL
blocks (which #34892 left as TBD), and adds reader-level read timing.
Builds on top of bal-devnet-3 — most of the PR's earlier slow-block log
infrastructure was adapted into upstream by that commit, so this change
is now scoped to the metric population that the BAL alone can derive.

- BAL helpers: BlockAccessList.{UniqueAccountCount, UniqueStorageSlotCount,
  WrittenCounts}. WrittenCounts walks the BAL once and returns the
  block-aggregate write counts.

- Reader-level read timing: *reader times all synchronous Account/Storage/
  Code/CodeSize calls via atomic counters; exposed via ReadTimes()
  ReadDurations and the new state.ReadTimer interface. Replaces StateDB-
  level AccountReads/StorageReads/CodeReads tracking (the StateDB shouldn't
  time its dependencies — the reader is where the I/O happens).

- Reader-level code-load dedup: *reader.codeLoaded sync.Map records the
  first-seen byte length per address; CodeLoads() returns (count, bytes).
  Exposed via state.CodeLoadTracker. Replaces StateDB CodeLoaded/
  CodeLoadBytes tracking and the SnapshotCodeLoads aggregation pattern.

- BALStateTransition: caches BlockAccessList.WrittenCounts() once at
  construction; tracks accountDeleted/storageDeleted atomics for the
  parallel root-pass (the BAL alone can't distinguish a selfdestruct from
  a balance/nonce reset). Exposes Deletions() DeletionCounts. Drops the
  older accountUpdated/storageUpdated/codeUpdated/codeUpdateBytes counters
  (now derived from WrittenCounts).

- BAL block stats path (blockchain.go): populates StateCounts directly —
  AccountUpdated = WrittenCounts.Accounts - Deletions.Accounts (same for
  storage). AccountLoaded/StorageLoaded come from BAL. CodeLoaded/
  CodeLoadBytes come from the shared *reader (deduplicated across phase
  StateDBs naturally because they share one reader instance).

- Non-BAL block stats path: read durations come from the reader; counts
  from StateDB fields. StorageUpdated/StorageDeleted unified to int width.

- Hard type assertions: state.ReadTimer / state.CodeLoadTracker /
  state.ReaderStater consumers use direct casts (no silent zero
  fallback) — every Reader chain in production satisfies these
  interfaces.

- Meter alignment: account/storage Updated meters subtract Deletions to
  avoid double-reporting blocks under both Update and Delete dashboards.
2026-05-07 00:12:51 +02:00
..
pruner all: improve ETA calculation across all progress indicators (#32521) 2025-09-01 13:47:02 +08:00
snapshot crypto/keccak: vendor in golang.org/x/crypto/sha3 (#33323) 2026-02-03 14:55:27 -07:00
access_events.go trie, go.mod: remove all references to go-verkle and go-ipa (#33461) 2025-12-30 20:44:04 +08:00
access_events_test.go trie, go.mod: remove all references to go-verkle and go-ipa (#33461) 2025-12-30 20:44:04 +08:00
access_list.go core/state: improve accessList copy (#33024) 2025-10-26 16:13:59 +08:00
bal_state_transition.go core, core/state: instrument BAL slow-block metrics 2026-05-07 00:12:51 +02:00
database.go cmd,core,tests: introduce new BAL execution flags, log BAL slow blocks, surface more metrics including prefetcher time (#34892) 2026-05-06 15:39:52 -04:00
database_code.go all: implement eip 7928 block access lists 2026-03-31 17:49:49 -04:00
database_history.go core, miner, tests: introduce codedb and simplify cachingDB (#33816) 2026-03-10 08:29:21 +01:00
dump.go cmd/evm/internal/t8ntool, trie: support for verkle-at-genesis, use UBT, and move the transition tree to its own package (#32445) 2025-11-14 15:25:30 +01:00
iterator.go all: implement eip 7928 block access lists 2026-03-31 17:49:49 -04:00
iterator_test.go core/state: state reader abstraction (#29761) 2024-09-05 13:10:47 +03:00
journal.go all: implement eip 7928 block access lists 2026-03-31 17:49:49 -04:00
metrics.go core/rawdb,state: add preimage miss metric (#31295) 2025-03-07 11:23:19 +01:00
reader.go core, core/state: instrument BAL slow-block metrics 2026-05-07 00:12:51 +02:00
reader_eip_7928.go core, core/state: instrument BAL slow-block metrics 2026-05-07 00:12:51 +02:00
reader_eip_7928_test.go core, core/state: instrument BAL slow-block metrics 2026-05-07 00:12:51 +02:00
reader_stater.go core, core/state: instrument BAL slow-block metrics 2026-05-07 00:12:51 +02:00
state_object.go core, core/state: instrument BAL slow-block metrics 2026-05-07 00:12:51 +02:00
state_object_test.go core/state: using testing.B.Loop (#32658) 2025-09-19 16:57:43 -06:00
state_sizer.go core/state: add bounds check in heap eviction loop (#33712) 2026-01-29 21:08:04 +08:00
state_sizer_test.go core/state: fix incorrect contract code state metrics (#33376) 2025-12-10 11:33:59 +08:00
state_test.go core, consensus/beacon: defer trie resolution (#31725) 2025-06-25 09:42:11 +08:00
statedb.go core, core/state: instrument BAL slow-block metrics 2026-05-07 00:12:51 +02:00
statedb_fuzz_test.go core, miner, tests: introduce codedb and simplify cachingDB (#33816) 2026-03-10 08:29:21 +01:00
statedb_hooked.go all: implement eip 7928 block access lists 2026-03-31 17:49:49 -04:00
statedb_hooked_test.go core: invoke selfdestruct tracer hooks during finalisation (#32919) 2026-01-16 15:10:08 -07:00
statedb_test.go fix some lint errors (TODO: merge this commit into the 7928 changes 2026-03-31 17:49:53 -04:00
stateupdate.go core, miner, tests: introduce codedb and simplify cachingDB (#33816) 2026-03-10 08:29:21 +01:00
sync.go core,eth,internal: fix typo (#29024) 2024-02-20 19:42:48 +08:00
sync_test.go core, miner, tests: introduce codedb and simplify cachingDB (#33816) 2026-03-10 08:29:21 +01:00
transient_storage.go core/state: improve PrettyPrint function (#32293) 2025-07-30 10:39:03 +08:00
trie_prefetcher.go trie, core/state: introduce trie Prefetch for optimizing preload (#32134) 2025-08-20 21:45:27 +08:00
trie_prefetcher_test.go core/tracing: add code change reason (#32525) 2025-09-02 12:44:47 +02:00