diff --git a/beacon/engine/types.go b/beacon/engine/types.go index 93aeb5527a..c06c4b44ab 100644 --- a/beacon/engine/types.go +++ b/beacon/engine/types.go @@ -317,11 +317,7 @@ func ExecutableDataToBlockNoHash(data ExecutableData, versionedHashes []common.H } // If Amsterdam is enabled, data.BlockAccessList is always non-nil, - // even for empty blocks with no state transitions. The wire format is - // the RLP-encoded access list; the header hash is keccak256(rlp). - // - // If Amsterdam is not enabled yet, blockAccessListHash is expected - // to be nil. + // even for empty blocks with no state transitions. var blockAccessListHash *common.Hash if data.BlockAccessList != nil { hash := crypto.Keccak256Hash(data.BlockAccessList) @@ -388,8 +384,6 @@ func BlockToExecutableData(block *types.Block, fees *big.Int, sidecars []*types. ExcessBlobGas: block.ExcessBlobGas(), 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 { var buf bytes.Buffer if err := rlp.Encode(&buf, al); err == nil { diff --git a/cmd/geth/config.go b/cmd/geth/config.go index 437babfb8f..8ac9e7f6bd 100644 --- a/cmd/geth/config.go +++ b/cmd/geth/config.go @@ -20,7 +20,6 @@ import ( "bufio" "errors" "fmt" - "github.com/ethereum/go-ethereum/core/types/bal" "os" "reflect" "runtime" @@ -246,28 +245,6 @@ func makeFullNode(ctx *cli.Context) *node.Node { 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. utils.SetupMetrics(&cfg.Metrics) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 09943331f5..14e3a549cb 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -92,9 +92,6 @@ var ( utils.BinTrieGroupDepthFlag, utils.LightKDFFlag, utils.EthRequiredBlocksFlag, - utils.BALExecutionModeFlag, - utils.PrefetchWorkersFlag, - utils.BlockingPrefetchFlag, utils.CacheFlag, utils.CacheDatabaseFlag, utils.CacheTrieFlag, diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index bbe4b8a4ff..c733a5fcbb 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -28,7 +28,6 @@ import ( "net/http" "os" "path/filepath" - "runtime" godebug "runtime/debug" "strconv" "strings" @@ -244,22 +243,6 @@ var ( Usage: "Comma separated block number-to-hash mappings to require for peering (=)", 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{ Name: "bloomfilter.size", Usage: "Megabytes of memory allocated to bloom-filter for pruning", diff --git a/core/blockchain.go b/core/blockchain.go index ea59ff75bd..27776da938 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -226,10 +226,6 @@ type BlockChainConfig struct { // Execution configs StatelessSelfValidation bool // Generate execution witnesses and self-check against them (testing purpose) EnableWitnessStats bool // Whether trie access statistics collection is enabled - - BALExecutionMode bal.BALExecutionMode - BlockingPrefetch bool - PrefetchWorkers int } // 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) - useAsyncReads := bc.cfg.BALExecutionMode != bal.BALExecutionNoBatchIO al := block.AccessList() // Preprocess the access list once for the whole block; the resulting // structure is read-only and shared by the prefetch reader, the state // transition and every per-transaction execution reader. 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 { return nil, err } @@ -2245,7 +2240,7 @@ func (bc *BlockChain) ProcessBlock(ctx context.Context, parentRoot common.Hash, blockHasAccessList = block.AccessList() != nil ) - if blockHasAccessList && bc.cfg.BALExecutionMode != bal.BALExecutionSequential { + if blockHasAccessList { return bc.processBlockWithAccessList(parentRoot, block, config.WriteHead) } defer interrupt.Store(true) // terminate the prefetch at the end diff --git a/core/state/database.go b/core/state/database.go index 273693a2db..277ff60d3a 100644 --- a/core/state/database.go +++ b/core/state/database.go @@ -56,7 +56,7 @@ type Database interface { // ReaderWithPrefetch returns a reader which asynchronously fetches block // 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, // through which the account iterator and storage iterator can be created. diff --git a/core/state/database_history.go b/core/state/database_history.go index ddc6d79238..d7d051874b 100644 --- a/core/state/database_history.go +++ b/core/state/database_history.go @@ -223,7 +223,7 @@ type HistoricDB struct { 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") } diff --git a/core/state/database_mpt.go b/core/state/database_mpt.go index 5e7d278232..228b7eb61b 100644 --- a/core/state/database_mpt.go +++ b/core/state/database_mpt.go @@ -24,6 +24,7 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/trie" "github.com/ethereum/go-ethereum/triedb" + "runtime" ) // 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) } -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) if err != nil { return nil, err @@ -195,12 +196,7 @@ func (db *MPTDatabase) ReaderWithPrefetch(stateRoot common.Hash, accessList map[ r := newStateReaderWithStats(newStateReaderWithCache(base)) // Construct the state reader with background prefetching - pr := newPrefetchStateReader(r, accessList, threads) - if block { - if err := pr.Wait(); err != nil { - panic("this should unreachable") - } - } + pr := newPrefetchStateReader(r, accessList, runtime.NumCPU()) return newReaderWithPrefetch(db.codedb.Reader(), pr, pr), nil } diff --git a/core/state/database_ubt.go b/core/state/database_ubt.go index 0affdea2ed..b088927dea 100644 --- a/core/state/database_ubt.go +++ b/core/state/database_ubt.go @@ -96,7 +96,7 @@ func (db *UBTDatabase) Reader(stateRoot common.Hash) (Reader, error) { 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") } diff --git a/core/types/bal/bal_reader.go b/core/types/bal/bal_reader.go index bb4a97c8d4..a08df17797 100644 --- a/core/types/bal/bal_reader.go +++ b/core/types/bal/bal_reader.go @@ -153,15 +153,12 @@ type StorageKeys map[common.Address][]common.Hash // 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. -func (p *AccessListReader) StorageKeys(reads bool) (keys StorageKeys) { +func (p *AccessListReader) StorageKeys() (keys StorageKeys) { keys = make(StorageKeys) for addr, a := range p.accounts { for _, storageChange := range a.StorageChanges { keys[addr] = append(keys[addr], storageChange.Slot.Bytes32()) } - if !(reads && len(a.StorageReads) > 0) { - continue - } for _, storageRead := range a.StorageReads { keys[addr] = append(keys[addr], storageRead.Bytes32()) } diff --git a/eth/backend.go b/eth/backend.go index 1206ce64f3..366f911785 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -294,10 +294,6 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { } 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) if err != nil { return nil, err diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index a124092f5d..378bb64a1e 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -19,7 +19,6 @@ package ethconfig import ( "errors" - "github.com/ethereum/go-ethereum/core/types/bal" "time" "github.com/ethereum/go-ethereum/common" @@ -225,10 +224,6 @@ type Config struct { // RangeLimit restricts the maximum range (end - start) for range queries. RangeLimit uint64 `toml:",omitempty"` - - BALExecutionMode bal.BALExecutionMode - PrefetchWorkers uint - BlockingPrefetch bool } // CreateConsensusEngine creates a consensus engine for the given chain config.