go-ethereum/core/state
Guillaume Ballet d8ed290a40
core, core/state: dual-triedb routing for the MPT-to-UBT transition
This is the wiring that makes the binary transition registry actually
useful. The chain now keeps two trie databases in parallel during the
fork window:

  - bc.triedb stays in MPT mode and holds pre-fork state.
  - bc.bintriedb is a sibling triedb in UBT mode, allocated when
    UBTTime is set and the chain did not start binary at genesis.

Routing happens through the new bc.stateDatabase(parentRoot, header):

  - pre-UBT block: MPTDatabase backed by bc.triedb.
  - post-UBTTransitionEndTime block: plain UBTDatabase with the
    transition tree wrap explicitly disabled.
  - first UBT block (parent is pre-UBT): a transition UBTDatabase
    seeded with the parent root as the frozen MPT base.
  - subsequent UBT block while transitioning: probeTransitionDatabase
    inspects the registry and chooses between the transition variant
    (when slot 5 still records a non-zero base root) and the plain
    variant otherwise.

UBTDatabase grows the supporting fields:
  - mpttriedb + baseRoot for the transition window.
  - NewTransitionUBTDatabase constructor.
  - WithTransitionTreeWrap(bool) toggle for the override path.
  - OpenTrie / OpenStorageTrie now serve TransitionTrie / MPT storage
    tries while the transition is live.
  - Commit substitutes EmptyBinaryHash for the originRoot on the very
    first transition block, so the binary triedb does not reject the
    MPT-rooted parent.

StateAt / StateAtForkBoundary on BlockChain now defer to
stateDatabase, so the miner, ProcessBlock and historical state lookups
all share one routing path.

bc.bintriedb is journaled and closed alongside bc.triedb.

Adds core/chain_makers.go BlockGen.GetState so tests can inspect
storage slots written during block production, and a new
core/bintrie_transition_test.go that walks a chain across the fork
and asserts the registry's started flag and base root are populated
exactly when expected.
2026-04-29 16:55:13 +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
database.go core/state: export StateUpdate struct (#34724) 2026-04-20 17:12:10 +02:00
database_code.go core, miner, tests: introduce codedb and simplify cachingDB (#33816) 2026-03-10 08:29:21 +01:00
database_history.go core/state: export StateUpdate struct (#34724) 2026-04-20 17:12:10 +02:00
database_iterator.go core/state: export StateUpdate struct (#34724) 2026-04-20 17:12:10 +02:00
database_iterator_test.go core/state: export StateUpdate struct (#34724) 2026-04-20 17:12:10 +02:00
database_mpt.go core/state: export StateUpdate struct (#34724) 2026-04-20 17:12:10 +02:00
database_ubt.go core, core/state: dual-triedb routing for the MPT-to-UBT transition 2026-04-29 16:55:13 +02:00
dump.go core/state: export StateUpdate struct (#34724) 2026-04-20 17:12:10 +02:00
iterator.go core, miner, tests: introduce codedb and simplify cachingDB (#33816) 2026-03-10 08:29:21 +01:00
iterator_test.go core/state: state reader abstraction (#29761) 2024-09-05 13:10:47 +03:00
journal.go core: miner: reduce allocations in block building (#33375) 2026-02-03 08:19:16 +01:00
metrics.go core/rawdb,state: add preimage miss metric (#31295) 2025-03-07 11:23:19 +01:00
reader.go core/overlay: load transition state from system contract 2026-04-29 16:21:59 +02:00
reader_stater.go core, miner, tests: introduce codedb and simplify cachingDB (#33816) 2026-03-10 08:29:21 +01:00
state_object.go core: track the state access footprint (#34776) 2026-04-22 13:42:49 +08: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: export StateUpdate struct (#34724) 2026-04-20 17:12:10 +02:00
state_sizer_test.go core/state: export StateUpdate struct (#34724) 2026-04-20 17:12:10 +02:00
state_test.go core, consensus/beacon: defer trie resolution (#31725) 2025-06-25 09:42:11 +08:00
statedb.go core: track the state access footprint (#34776) 2026-04-22 13:42:49 +08:00
statedb_fuzz_test.go core/state: export StateUpdate struct (#34724) 2026-04-20 17:12:10 +02:00
statedb_hooked.go core: track the state access footprint (#34776) 2026-04-22 13:42:49 +08:00
statedb_hooked_test.go core: invoke selfdestruct tracer hooks during finalisation (#32919) 2026-01-16 15:10:08 -07:00
statedb_test.go core/state: handle *bintrie.BinaryTrie in mustCopyTrie (#34758) 2026-04-18 18:47:22 +02:00
stateupdate.go core/state: export StateUpdate struct (#34724) 2026-04-20 17:12:10 +02: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: optimize transient storage (#33695) 2026-04-14 15:39:42 +02:00
trie_prefetcher.go cmd, core, trie, triedb: split CachingDB into merkle + binary dbs. (#34700) 2026-04-17 08:55:54 +08:00
trie_prefetcher_test.go cmd, core, trie, triedb: split CachingDB into merkle + binary dbs. (#34700) 2026-04-17 08:55:54 +08:00