go-ethereum/core/state
Ng Wei Han 15f52a2937
core/state: fix code existence not marked correctly (#33415)
When iterating over a map with value types in Go, the loop variable is a
copy. In `markCodeExistence`, assigning to `code.exists` modified only
the local copy, not the actual map entry, causing the existence flag to
always remain false.

This resulted in overcounting contract codes in state size statistics,
as codes that already existed in the database were incorrectly counted
as new.

Fix by changing `codes` from `map[common.Address]contractCode` to
`map[common.Address]*contractCode`, so mutations apply directly to the
struct.
2025-12-15 13:54:26 +08:00
..
pruner all: improve ETA calculation across all progress indicators (#32521) 2025-09-01 13:47:02 +08:00
snapshot core/state: using testing.B.Loop (#32658) 2025-09-19 16:57:43 -06:00
access_events.go core/state, core/vm: update stateless gas costs to follow the verkle-gen-7 testnet (#31014) 2025-05-15 20:43:52 +08:00
access_events_test.go core/state: correct expected value in TestMessageCallGas (#32780) 2025-09-30 10:11:09 +08:00
access_list.go core/state: improve accessList copy (#33024) 2025-10-26 16:13:59 +08:00
database.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
database_history.go core, eth, triedb: serve historical states over RPC (#31161) 2025-06-25 16:50:54 +08: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 core, consensus/beacon: defer trie resolution (#31725) 2025-06-25 09:42:11 +08:00
iterator_test.go core/state: state reader abstraction (#29761) 2024-09-05 13:10:47 +03:00
journal.go core/state: fix copy of storageChange (#31874) 2025-05-23 13:10:10 +02:00
metrics.go core/rawdb,state: add preimage miss metric (#31295) 2025-03-07 11:23:19 +01:00
reader.go core/state: fix incorrect contract code state metrics (#33376) 2025-12-10 11:33:59 +08:00
state_object.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
state_object_test.go core/state: using testing.B.Loop (#32658) 2025-09-19 16:57:43 -06:00
state_sizer.go core/state: fix incorrect contract code state metrics (#33376) 2025-12-10 11:33:59 +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/state: fix incorrect contract code state metrics (#33376) 2025-12-10 11:33:59 +08:00
statedb_fuzz_test.go core/state: fix incorrect contract code state metrics (#33376) 2025-12-10 11:33:59 +08:00
statedb_hooked.go core/state: fixed hooked StateDB handling of OnCodeChangeV2 (#33148) 2025-11-11 14:57:52 +08:00
statedb_hooked_test.go core/state: make test output message readable (#33400) 2025-12-13 11:27:00 +08:00
statedb_test.go core/state: fix committed-state expectations in StateDB tests (#32678) 2025-09-22 10:30:29 +08:00
stateupdate.go core/state: fix code existence not marked correctly (#33415) 2025-12-15 13:54:26 +08:00
sync.go core,eth,internal: fix typo (#29024) 2024-02-20 19:42:48 +08:00
sync_test.go triedb/pathdb, eth: use double-buffer mechanism in pathdb (#30464) 2025-06-22 20:40:54 +08: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