mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-12 09:51:36 +00:00
core/state,triedb/pathdb: doc accuracy sweep — remove stale temporal markers
Addresses review suggestion S2/S7/S22. Remove "NOT wired in yet", "in a later commit", and "Commit N" references that were accurate at the time of their original commit but became stale after subsequent commits landed on the same branch. Update cross-references to name the actual functions and files rather than commit numbers. Specific fixes: * flat_codec_bintrie.go:50-57: "NOT wired" → "wired when isVerkle" * flat_codec_bintrie.go:360: "in a later commit" → "generate_bintrie.go" * database_hasher_binary.go:132: "in a later commit" → "StateDB.commit()" * journal.go:53-56: v4 comment updated from "reserved for" → actual description
This commit is contained in:
parent
2915a9c30d
commit
23736be800
3 changed files with 19 additions and 19 deletions
|
|
@ -129,10 +129,11 @@ func (tr *warpBinTrie) copy() *warpBinTrie {
|
||||||
//
|
//
|
||||||
// binaryHasher also implements LeafProducer: alongside every trie mutation
|
// binaryHasher also implements LeafProducer: alongside every trie mutation
|
||||||
// it records the corresponding (stem, offset, value) write into an
|
// it records the corresponding (stem, offset, value) write into an
|
||||||
// internal buffer. The caller (StateDB.Commit in a later commit) drains
|
// internal buffer. StateDB.commit() drains this buffer once per block
|
||||||
// this buffer once per block and hands the writes to the pathdb flat-state
|
// via LeafProducer.DrainStemWrites and hands the writes to the pathdb
|
||||||
// layer via the stateUpdate, keeping the bintrie trie and its flat-state
|
// flat-state layer via stateUpdate.encodeBinary, keeping the bintrie
|
||||||
// mirror consistent without recomputing the bintrie key derivation twice.
|
// trie and its flat-state mirror consistent without recomputing the
|
||||||
|
// bintrie key derivation twice.
|
||||||
type binaryHasher struct {
|
type binaryHasher struct {
|
||||||
db *triedb.Database
|
db *triedb.Database
|
||||||
root common.Hash
|
root common.Hash
|
||||||
|
|
|
||||||
|
|
@ -47,15 +47,13 @@ import (
|
||||||
// reads the stem from the store (not from the in-flight batch), so a
|
// reads the stem from the store (not from the in-flight batch), so a
|
||||||
// second write at the same stem would re-read the pre-flush state and
|
// second write at the same stem would re-read the pre-flush state and
|
||||||
// clobber the first write. The codec's public surface area is designed
|
// clobber the first write. The codec's public surface area is designed
|
||||||
// around this assumption; Commit 8 of the bintrie flat-state plan
|
// around this assumption; the Flush method pre-aggregates per-stem
|
||||||
// restructures writeStates to pre-aggregate per-stem writes so callers
|
// writes so callers do not have to handle this manually.
|
||||||
// do not have to handle this manually.
|
|
||||||
//
|
//
|
||||||
// This codec is NOT wired into pathdb.Database.New yet — that happens in a
|
// This codec is wired into pathdb.Database.New when isVerkle is true
|
||||||
// later commit once the leaf-production hook in binaryHasher and the
|
// (see database.go). The leaf-production hook in binaryHasher emits
|
||||||
// stateUpdate wiring are in place. Until then, all call sites still
|
// per-offset writes via DrainStemWrites, which encodeBinary routes
|
||||||
// dispatch through merkleFlatCodec and bintrie mode continues to use the
|
// into the per-offset accountData map consumed by Flush.
|
||||||
// (soon to be replaced) keccak-shaped flat-state layout.
|
|
||||||
type bintrieFlatCodec struct {
|
type bintrieFlatCodec struct {
|
||||||
// db is the underlying key-value store used by applyWrites to read
|
// db is the underlying key-value store used by applyWrites to read
|
||||||
// the current stem blob before merging in new (offset, value) pairs.
|
// the current stem blob before merging in new (offset, value) pairs.
|
||||||
|
|
@ -357,9 +355,10 @@ func (c *bintrieFlatCodec) AccountPrefix() []byte {
|
||||||
|
|
||||||
// StoragePrefix returns the same prefix as AccountPrefix because bintrie
|
// StoragePrefix returns the same prefix as AccountPrefix because bintrie
|
||||||
// flat-state entries are stored in a single namespace (stems contain
|
// flat-state entries are stored in a single namespace (stems contain
|
||||||
// both account and storage data). The generator in a later commit uses
|
// both account and storage data). The bintrie generator
|
||||||
// a single iterator over this prefix rather than the two-tier
|
// (generate_bintrie.go) uses a single iterator over this prefix
|
||||||
// account-then-storage walk used by the merkle generator.
|
// rather than the two-tier account-then-storage walk used by the
|
||||||
|
// merkle generator.
|
||||||
func (c *bintrieFlatCodec) StoragePrefix() []byte {
|
func (c *bintrieFlatCodec) StoragePrefix() []byte {
|
||||||
return rawdb.BinTrieStemPrefix
|
return rawdb.BinTrieStemPrefix
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,10 +50,10 @@ var (
|
||||||
// - Version 1: storage.Incomplete field is removed
|
// - Version 1: storage.Incomplete field is removed
|
||||||
// - Version 2: add post-modification state values
|
// - Version 2: add post-modification state values
|
||||||
// - Version 3: a flag has been added to indicate whether the storage slot key is the raw key or a hash
|
// - Version 3: a flag has been added to indicate whether the storage slot key is the raw key or a hash
|
||||||
// - Version 4: reserved for bintrie flat-state (per-stem layout). Bumping now
|
// - Version 4: bintrie flat-state per-stem layout. The journalGenerator
|
||||||
// discards any v3 journals belonging to a bintrie database so
|
// struct gains an IsBintrie flag (rlp:"optional", defaults to
|
||||||
// that the new layout can be introduced cleanly in follow-up
|
// false) so the loader can discard journals from a mismatched
|
||||||
// commits without a migration path.
|
// scheme and trigger a full flat-state regeneration.
|
||||||
const journalVersion uint64 = 4
|
const journalVersion uint64 = 4
|
||||||
|
|
||||||
// loadJournal tries to parse the layer journal from the disk.
|
// loadJournal tries to parse the layer journal from the disk.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue