remove some AI comments and BAL perf option flags

This commit is contained in:
Jared Wasinger 2026-06-16 21:05:50 -04:00
parent a5a452512f
commit 504bb79b7b
12 changed files with 10 additions and 80 deletions

View file

@ -317,11 +317,7 @@ func ExecutableDataToBlockNoHash(data ExecutableData, versionedHashes []common.H
} }
// If Amsterdam is enabled, data.BlockAccessList is always non-nil, // If Amsterdam is enabled, data.BlockAccessList is always non-nil,
// even for empty blocks with no state transitions. The wire format is // even for empty blocks with no state transitions.
// the RLP-encoded access list; the header hash is keccak256(rlp).
//
// If Amsterdam is not enabled yet, blockAccessListHash is expected
// to be nil.
var blockAccessListHash *common.Hash var blockAccessListHash *common.Hash
if data.BlockAccessList != nil { if data.BlockAccessList != nil {
hash := crypto.Keccak256Hash(data.BlockAccessList) hash := crypto.Keccak256Hash(data.BlockAccessList)
@ -388,8 +384,6 @@ func BlockToExecutableData(block *types.Block, fees *big.Int, sidecars []*types.
ExcessBlobGas: block.ExcessBlobGas(), ExcessBlobGas: block.ExcessBlobGas(),
SlotNumber: block.SlotNumber(), SlotNumber: block.SlotNumber(),
} }
// Per Engine API spec (Amsterdam): blockAccessList is the RLP-encoded
// access list, serialized as a hex string. Encode it to bytes here.
if al := block.AccessList(); al != nil { if al := block.AccessList(); al != nil {
var buf bytes.Buffer var buf bytes.Buffer
if err := rlp.Encode(&buf, al); err == nil { if err := rlp.Encode(&buf, al); err == nil {

View file

@ -20,7 +20,6 @@ import (
"bufio" "bufio"
"errors" "errors"
"fmt" "fmt"
"github.com/ethereum/go-ethereum/core/types/bal"
"os" "os"
"reflect" "reflect"
"runtime" "runtime"
@ -246,28 +245,6 @@ func makeFullNode(ctx *cli.Context) *node.Node {
cfg.Eth.OverrideUBT = &v cfg.Eth.OverrideUBT = &v
} }
if ctx.IsSet(utils.BALExecutionModeFlag.Name) {
val := ctx.String(utils.BALExecutionModeFlag.Name)
switch val {
case utils.BalExecutionModeOptimized:
cfg.Eth.BALExecutionMode = bal.BALExecutionOptimized
case utils.BalExecutionModeNoBatchIO:
cfg.Eth.BALExecutionMode = bal.BALExecutionNoBatchIO
case utils.BalExecutionModeSequential:
cfg.Eth.BALExecutionMode = bal.BALExecutionSequential
default:
utils.Fatalf("invalid option for --bal.executionmode: %s. acceptable values are full|nobatchio|sequential", val)
}
}
cfg.Eth.BlockingPrefetch = ctx.Bool(utils.BlockingPrefetchFlag.Name)
prefetchWorkers := ctx.Uint(utils.PrefetchWorkersFlag.Name)
if ctx.IsSet(utils.PrefetchWorkersFlag.Name) && prefetchWorkers == 0 {
prefetchWorkers = uint(runtime.NumCPU())
log.Warn(fmt.Sprintf("invalid value for --bal.prefetchworkers. got 0. sanitizing to %d", prefetchWorkers))
}
cfg.Eth.PrefetchWorkers = prefetchWorkers
// Start metrics export if enabled. // Start metrics export if enabled.
utils.SetupMetrics(&cfg.Metrics) utils.SetupMetrics(&cfg.Metrics)

View file

@ -92,9 +92,6 @@ var (
utils.BinTrieGroupDepthFlag, utils.BinTrieGroupDepthFlag,
utils.LightKDFFlag, utils.LightKDFFlag,
utils.EthRequiredBlocksFlag, utils.EthRequiredBlocksFlag,
utils.BALExecutionModeFlag,
utils.PrefetchWorkersFlag,
utils.BlockingPrefetchFlag,
utils.CacheFlag, utils.CacheFlag,
utils.CacheDatabaseFlag, utils.CacheDatabaseFlag,
utils.CacheTrieFlag, utils.CacheTrieFlag,

View file

@ -28,7 +28,6 @@ import (
"net/http" "net/http"
"os" "os"
"path/filepath" "path/filepath"
"runtime"
godebug "runtime/debug" godebug "runtime/debug"
"strconv" "strconv"
"strings" "strings"
@ -244,22 +243,6 @@ var (
Usage: "Comma separated block number-to-hash mappings to require for peering (<number>=<hash>)", Usage: "Comma separated block number-to-hash mappings to require for peering (<number>=<hash>)",
Category: flags.EthCategory, Category: flags.EthCategory,
} }
BALExecutionModeFlag = &cli.StringFlag{
Name: "bal.executionmode",
Usage: "EIP-7928 block-access-list execution mode (no-op placeholder)",
Category: flags.EthCategory,
}
PrefetchWorkersFlag = &cli.UintFlag{
Name: "bal.prefetchworkers",
Usage: "The number of concurrent state loading tasks to perform when prefetching BAL state. Default to the number of cpus",
Value: uint(runtime.NumCPU()),
Category: flags.MiscCategory,
}
BlockingPrefetchFlag = &cli.BoolFlag{
Name: "bal.blockingprefetch",
Usage: "only relevant when executing in parallel with a BAL: if true, the prefetcher will block tx/state-root calculation until all scheduled fetching tasks have completed.",
Category: flags.MiscCategory,
}
BloomFilterSizeFlag = &cli.Uint64Flag{ BloomFilterSizeFlag = &cli.Uint64Flag{
Name: "bloomfilter.size", Name: "bloomfilter.size",
Usage: "Megabytes of memory allocated to bloom-filter for pruning", Usage: "Megabytes of memory allocated to bloom-filter for pruning",

View file

@ -226,10 +226,6 @@ type BlockChainConfig struct {
// Execution configs // Execution configs
StatelessSelfValidation bool // Generate execution witnesses and self-check against them (testing purpose) StatelessSelfValidation bool // Generate execution witnesses and self-check against them (testing purpose)
EnableWitnessStats bool // Whether trie access statistics collection is enabled EnableWitnessStats bool // Whether trie access statistics collection is enabled
BALExecutionMode bal.BALExecutionMode
BlockingPrefetch bool
PrefetchWorkers int
} }
// DefaultConfig returns the default config. // DefaultConfig returns the default config.
@ -2127,13 +2123,12 @@ func (bc *BlockChain) processBlockWithAccessList(parentRoot common.Hash, block *
sdb := state.NewMPTDatabase(bc.triedb, bc.codedb).WithSnapshot(bc.snaps) sdb := state.NewMPTDatabase(bc.triedb, bc.codedb).WithSnapshot(bc.snaps)
useAsyncReads := bc.cfg.BALExecutionMode != bal.BALExecutionNoBatchIO
al := block.AccessList() al := block.AccessList()
// Preprocess the access list once for the whole block; the resulting // Preprocess the access list once for the whole block; the resulting
// structure is read-only and shared by the prefetch reader, the state // structure is read-only and shared by the prefetch reader, the state
// transition and every per-transaction execution reader. // transition and every per-transaction execution reader.
prepared := bal.NewAccessListReader(*al) prepared := bal.NewAccessListReader(*al)
prefetchReader, err := sdb.ReaderWithPrefetch(parentRoot, prepared.StorageKeys(useAsyncReads), bc.cfg.PrefetchWorkers, bc.cfg.BlockingPrefetch) prefetchReader, err := sdb.ReaderWithPrefetch(parentRoot, prepared.StorageKeys())
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -2245,7 +2240,7 @@ func (bc *BlockChain) ProcessBlock(ctx context.Context, parentRoot common.Hash,
blockHasAccessList = block.AccessList() != nil blockHasAccessList = block.AccessList() != nil
) )
if blockHasAccessList && bc.cfg.BALExecutionMode != bal.BALExecutionSequential { if blockHasAccessList {
return bc.processBlockWithAccessList(parentRoot, block, config.WriteHead) return bc.processBlockWithAccessList(parentRoot, block, config.WriteHead)
} }
defer interrupt.Store(true) // terminate the prefetch at the end defer interrupt.Store(true) // terminate the prefetch at the end

View file

@ -56,7 +56,7 @@ type Database interface {
// ReaderWithPrefetch returns a reader which asynchronously fetches block // ReaderWithPrefetch returns a reader which asynchronously fetches block
// access list state in the background. // access list state in the background.
ReaderWithPrefetch(stateRoot common.Hash, accessList map[common.Address][]common.Hash, threads int, block bool) (Reader, error) ReaderWithPrefetch(stateRoot common.Hash, accessList map[common.Address][]common.Hash) (Reader, error)
// Iteratee returns a state iteratee associated with the specified state root, // Iteratee returns a state iteratee associated with the specified state root,
// through which the account iterator and storage iterator can be created. // through which the account iterator and storage iterator can be created.

View file

@ -223,7 +223,7 @@ type HistoricDB struct {
codedb *CodeDB codedb *CodeDB
} }
func (db *HistoricDB) ReaderWithPrefetch(stateRoot common.Hash, accessList map[common.Address][]common.Hash, threads int, block bool) (Reader, error) { func (db *HistoricDB) ReaderWithPrefetch(stateRoot common.Hash, accessList map[common.Address][]common.Hash) (Reader, error) {
panic("not implemented") panic("not implemented")
} }

View file

@ -24,6 +24,7 @@ import (
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/trie" "github.com/ethereum/go-ethereum/trie"
"github.com/ethereum/go-ethereum/triedb" "github.com/ethereum/go-ethereum/triedb"
"runtime"
) )
// MPTDatabase is an implementation of Database interface for Merkle Patricia Tries. // MPTDatabase is an implementation of Database interface for Merkle Patricia Tries.
@ -186,7 +187,7 @@ func (db *MPTDatabase) Iteratee(root common.Hash) (Iteratee, error) {
return newStateIteratee(true, root, db.triedb, db.snap) return newStateIteratee(true, root, db.triedb, db.snap)
} }
func (db *MPTDatabase) ReaderWithPrefetch(stateRoot common.Hash, accessList map[common.Address][]common.Hash, threads int, block bool) (Reader, error) { func (db *MPTDatabase) ReaderWithPrefetch(stateRoot common.Hash, accessList map[common.Address][]common.Hash) (Reader, error) {
base, err := db.StateReader(stateRoot) base, err := db.StateReader(stateRoot)
if err != nil { if err != nil {
return nil, err return nil, err
@ -195,12 +196,7 @@ func (db *MPTDatabase) ReaderWithPrefetch(stateRoot common.Hash, accessList map[
r := newStateReaderWithStats(newStateReaderWithCache(base)) r := newStateReaderWithStats(newStateReaderWithCache(base))
// Construct the state reader with background prefetching // Construct the state reader with background prefetching
pr := newPrefetchStateReader(r, accessList, threads) pr := newPrefetchStateReader(r, accessList, runtime.NumCPU())
if block {
if err := pr.Wait(); err != nil {
panic("this should unreachable")
}
}
return newReaderWithPrefetch(db.codedb.Reader(), pr, pr), nil return newReaderWithPrefetch(db.codedb.Reader(), pr, pr), nil
} }

View file

@ -96,7 +96,7 @@ func (db *UBTDatabase) Reader(stateRoot common.Hash) (Reader, error) {
return newReader(db.codedb.Reader(), sr), nil return newReader(db.codedb.Reader(), sr), nil
} }
func (db *UBTDatabase) ReaderWithPrefetch(stateRoot common.Hash, accessList map[common.Address][]common.Hash, threads int, block bool) (Reader, error) { func (db *UBTDatabase) ReaderWithPrefetch(stateRoot common.Hash, accessList map[common.Address][]common.Hash) (Reader, error) {
panic("not implemented") panic("not implemented")
} }

View file

@ -153,15 +153,12 @@ type StorageKeys map[common.Address][]common.Hash
// StorageKeys returns the set of accounts and storage keys mutated in the access // StorageKeys returns the set of accounts and storage keys mutated in the access
// list. If reads is set, the un-mutated accounts/keys are included in the result. // list. If reads is set, the un-mutated accounts/keys are included in the result.
func (p *AccessListReader) StorageKeys(reads bool) (keys StorageKeys) { func (p *AccessListReader) StorageKeys() (keys StorageKeys) {
keys = make(StorageKeys) keys = make(StorageKeys)
for addr, a := range p.accounts { for addr, a := range p.accounts {
for _, storageChange := range a.StorageChanges { for _, storageChange := range a.StorageChanges {
keys[addr] = append(keys[addr], storageChange.Slot.Bytes32()) keys[addr] = append(keys[addr], storageChange.Slot.Bytes32())
} }
if !(reads && len(a.StorageReads) > 0) {
continue
}
for _, storageRead := range a.StorageReads { for _, storageRead := range a.StorageReads {
keys[addr] = append(keys[addr], storageRead.Bytes32()) keys[addr] = append(keys[addr], storageRead.Bytes32())
} }

View file

@ -294,10 +294,6 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
} }
options.Overrides = &overrides options.Overrides = &overrides
options.BALExecutionMode = config.BALExecutionMode
options.BlockingPrefetch = config.BlockingPrefetch
options.PrefetchWorkers = int(config.PrefetchWorkers)
eth.blockchain, err = core.NewBlockChain(chainDb, config.Genesis, eth.engine, options) eth.blockchain, err = core.NewBlockChain(chainDb, config.Genesis, eth.engine, options)
if err != nil { if err != nil {
return nil, err return nil, err

View file

@ -19,7 +19,6 @@ package ethconfig
import ( import (
"errors" "errors"
"github.com/ethereum/go-ethereum/core/types/bal"
"time" "time"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
@ -225,10 +224,6 @@ type Config struct {
// RangeLimit restricts the maximum range (end - start) for range queries. // RangeLimit restricts the maximum range (end - start) for range queries.
RangeLimit uint64 `toml:",omitempty"` RangeLimit uint64 `toml:",omitempty"`
BALExecutionMode bal.BALExecutionMode
PrefetchWorkers uint
BlockingPrefetch bool
} }
// CreateConsensusEngine creates a consensus engine for the given chain config. // CreateConsensusEngine creates a consensus engine for the given chain config.