mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-08 07:58:40 +00:00
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.
|
||
|---|---|---|
| .. | ||
| pruner | ||
| snapshot | ||
| access_events.go | ||
| access_events_test.go | ||
| access_list.go | ||
| database.go | ||
| database_code.go | ||
| database_history.go | ||
| database_iterator.go | ||
| database_iterator_test.go | ||
| database_mpt.go | ||
| database_ubt.go | ||
| dump.go | ||
| iterator.go | ||
| iterator_test.go | ||
| journal.go | ||
| metrics.go | ||
| reader.go | ||
| reader_stater.go | ||
| state_object.go | ||
| state_object_test.go | ||
| state_sizer.go | ||
| state_sizer_test.go | ||
| state_test.go | ||
| statedb.go | ||
| statedb_fuzz_test.go | ||
| statedb_hooked.go | ||
| statedb_hooked_test.go | ||
| statedb_test.go | ||
| stateupdate.go | ||
| sync.go | ||
| sync_test.go | ||
| transient_storage.go | ||
| trie_prefetcher.go | ||
| trie_prefetcher_test.go | ||