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.
|
||
|---|---|---|
| .. | ||
| filtermaps | ||
| forkid | ||
| history | ||
| overlay | ||
| rawdb | ||
| state | ||
| stateless | ||
| tracing | ||
| txpool | ||
| types | ||
| vm | ||
| .gitignore | ||
| bench_test.go | ||
| bintrie_transition_test.go | ||
| bintrie_witness_test.go | ||
| block_validator.go | ||
| block_validator_test.go | ||
| blockchain.go | ||
| blockchain_insert.go | ||
| blockchain_reader.go | ||
| blockchain_repair_test.go | ||
| blockchain_sethead_test.go | ||
| blockchain_snapshot_test.go | ||
| blockchain_stats.go | ||
| blockchain_test.go | ||
| chain_makers.go | ||
| chain_makers_test.go | ||
| dao_test.go | ||
| error.go | ||
| eth_transfer_logs_test.go | ||
| events.go | ||
| evm.go | ||
| gaspool.go | ||
| gen_genesis.go | ||
| genesis.go | ||
| genesis_alloc.go | ||
| genesis_test.go | ||
| headerchain.go | ||
| headerchain_test.go | ||
| mkalloc.go | ||
| rlp_test.go | ||
| sender_cacher.go | ||
| state_prefetcher.go | ||
| state_processor.go | ||
| state_processor_test.go | ||
| state_transition.go | ||
| stateless.go | ||
| transition_registry.go | ||
| txindexer.go | ||
| txindexer_test.go | ||
| types.go | ||