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:
CPerezz 2026-04-09 12:25:12 +02:00
parent 2915a9c30d
commit 23736be800
No known key found for this signature in database
GPG key ID: 62045F34B97177DD
3 changed files with 19 additions and 19 deletions

View file

@ -129,10 +129,11 @@ func (tr *warpBinTrie) copy() *warpBinTrie {
//
// binaryHasher also implements LeafProducer: alongside every trie mutation
// it records the corresponding (stem, offset, value) write into an
// internal buffer. The caller (StateDB.Commit in a later commit) drains
// this buffer once per block and hands the writes to the pathdb flat-state
// layer via the stateUpdate, keeping the bintrie trie and its flat-state
// mirror consistent without recomputing the bintrie key derivation twice.
// internal buffer. StateDB.commit() drains this buffer once per block
// via LeafProducer.DrainStemWrites and hands the writes to the pathdb
// flat-state layer via stateUpdate.encodeBinary, keeping the bintrie
// trie and its flat-state mirror consistent without recomputing the
// bintrie key derivation twice.
type binaryHasher struct {
db *triedb.Database
root common.Hash

View file

@ -47,15 +47,13 @@ import (
// 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
// clobber the first write. The codec's public surface area is designed
// around this assumption; Commit 8 of the bintrie flat-state plan
// restructures writeStates to pre-aggregate per-stem writes so callers
// do not have to handle this manually.
// around this assumption; the Flush method pre-aggregates per-stem
// writes so callers do not have to handle this manually.
//
// This codec is NOT wired into pathdb.Database.New yet — that happens in a
// later commit once the leaf-production hook in binaryHasher and the
// stateUpdate wiring are in place. Until then, all call sites still
// dispatch through merkleFlatCodec and bintrie mode continues to use the
// (soon to be replaced) keccak-shaped flat-state layout.
// This codec is wired into pathdb.Database.New when isVerkle is true
// (see database.go). The leaf-production hook in binaryHasher emits
// per-offset writes via DrainStemWrites, which encodeBinary routes
// into the per-offset accountData map consumed by Flush.
type bintrieFlatCodec struct {
// db is the underlying key-value store used by applyWrites to read
// 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
// flat-state entries are stored in a single namespace (stems contain
// both account and storage data). The generator in a later commit uses
// a single iterator over this prefix rather than the two-tier
// account-then-storage walk used by the merkle generator.
// both account and storage data). The bintrie generator
// (generate_bintrie.go) uses a single iterator over this prefix
// rather than the two-tier account-then-storage walk used by the
// merkle generator.
func (c *bintrieFlatCodec) StoragePrefix() []byte {
return rawdb.BinTrieStemPrefix
}

View file

@ -50,10 +50,10 @@ var (
// - Version 1: storage.Incomplete field is removed
// - 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 4: reserved for bintrie flat-state (per-stem layout). Bumping now
// discards any v3 journals belonging to a bintrie database so
// that the new layout can be introduced cleanly in follow-up
// commits without a migration path.
// - Version 4: bintrie flat-state per-stem layout. The journalGenerator
// struct gains an IsBintrie flag (rlp:"optional", defaults to
// false) so the loader can discard journals from a mismatched
// scheme and trigger a full flat-state regeneration.
const journalVersion uint64 = 4
// loadJournal tries to parse the layer journal from the disk.