diff --git a/beacon/engine/types.go b/beacon/engine/types.go index 826e02384c..88c52ec471 100644 --- a/beacon/engine/types.go +++ b/beacon/engine/types.go @@ -305,32 +305,30 @@ func ExecutableDataToBlockNoHash(data ExecutableData, versionedHashes []common.H requestsHash = &h } - var blockAccessListHash *common.Hash body := types.Body{Transactions: txs, Uncles: nil, Withdrawals: data.Withdrawals} header := &types.Header{ - ParentHash: data.ParentHash, - UncleHash: types.EmptyUncleHash, - Coinbase: data.FeeRecipient, - Root: data.StateRoot, - TxHash: types.DeriveSha(types.Transactions(txs), trie.NewStackTrie(nil)), - ReceiptHash: data.ReceiptsRoot, - Bloom: types.BytesToBloom(data.LogsBloom), - Difficulty: common.Big0, - Number: new(big.Int).SetUint64(data.Number), - GasLimit: data.GasLimit, - GasUsed: data.GasUsed, - Time: data.Timestamp, - BaseFee: data.BaseFeePerGas, - Extra: data.ExtraData, - MixDigest: data.Random, - WithdrawalsHash: withdrawalsRoot, - ExcessBlobGas: data.ExcessBlobGas, - BlobGasUsed: data.BlobGasUsed, - ParentBeaconRoot: beaconRoot, - RequestsHash: requestsHash, - BlockAccessListHash: blockAccessListHash, - SlotNumber: data.SlotNumber, + ParentHash: data.ParentHash, + UncleHash: types.EmptyUncleHash, + Coinbase: data.FeeRecipient, + Root: data.StateRoot, + TxHash: types.DeriveSha(types.Transactions(txs), trie.NewStackTrie(nil)), + ReceiptHash: data.ReceiptsRoot, + Bloom: types.BytesToBloom(data.LogsBloom), + Difficulty: common.Big0, + Number: new(big.Int).SetUint64(data.Number), + GasLimit: data.GasLimit, + GasUsed: data.GasUsed, + Time: data.Timestamp, + BaseFee: data.BaseFeePerGas, + Extra: data.ExtraData, + MixDigest: data.Random, + WithdrawalsHash: withdrawalsRoot, + ExcessBlobGas: data.ExcessBlobGas, + BlobGasUsed: data.BlobGasUsed, + ParentBeaconRoot: beaconRoot, + RequestsHash: requestsHash, + SlotNumber: data.SlotNumber, } if data.BlockAccessList != nil { diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 31965af45e..9aabaaba98 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -160,7 +160,6 @@ var ( utils.BeaconCheckpointFlag, utils.BeaconCheckpointFileFlag, utils.LogSlowBlockFlag, - utils.ExperimentalBALFlag, }, utils.NetworkFlags, utils.DatabaseFlags) rpcFlags = []cli.Flag{ diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 9bbdcd0818..844397b734 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1042,14 +1042,6 @@ Please note that --` + MetricsHTTPFlag.Name + ` must be set to start the server. Value: metrics.DefaultConfig.InfluxDBOrganization, Category: flags.MetricsCategory, } - - // Block Access List flags - - ExperimentalBALFlag = &cli.BoolFlag{ - Name: "experimental.bal", - Usage: "Enable generation of EIP-7928 block access lists when importing post-Cancun blocks which lack them. When this flag is specified, importing blocks containing access lists triggers validation of their correctness and execution based off them. The header block access list field is not set with blocks created when this flag is specified, nor is it validated when importing blocks that contain access lists. This is used for development purposes only. Do not enable it otherwise.", - Category: flags.MiscCategory, - } ) var ( @@ -1990,8 +1982,6 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { cfg.VMTraceJsonConfig = ctx.String(VMTraceJsonConfigFlag.Name) } } - - cfg.ExperimentalBAL = ctx.Bool(ExperimentalBALFlag.Name) } // MakeBeaconLightConfig constructs a beacon light client config based on the @@ -2401,7 +2391,6 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh } options.VmConfig = vmcfg - options.EnableBALForTesting = ctx.Bool(ExperimentalBALFlag.Name) chain, err := core.NewBlockChain(chainDb, gspec, engine, options) if err != nil { Fatalf("Can't create BlockChain: %v", err) diff --git a/consensus/beacon/consensus.go b/consensus/beacon/consensus.go index c458cbe21c..8d3a73d9ea 100644 --- a/consensus/beacon/consensus.go +++ b/consensus/beacon/consensus.go @@ -384,8 +384,10 @@ func (beacon *Beacon) FinalizeAndAssemble(chain consensus.ChainHeaderReader, hea if onFinalizeAccessList != nil { al := onFinalizeAccessList() alHash := al.Hash() + header.BlockAccessListHash = &alHash - return types.NewBlock(header, body, receipts, trie.NewStackTrie(nil)).WithAccessList(al), nil + block := types.NewBlock(header, body, receipts, trie.NewStackTrie(nil)).WithAccessList(al) + return block, nil } else { return types.NewBlock(header, body, receipts, trie.NewStackTrie(nil)), nil } diff --git a/core/block_validator.go b/core/block_validator.go index 5707e940c4..60804e5a03 100644 --- a/core/block_validator.go +++ b/core/block_validator.go @@ -123,14 +123,6 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error { return fmt.Errorf("invalid block access list: %v", err) } } - } else if v.bc.cfg.EnableBALForTesting { - // If experimental.bal is enabled, the BAL hash is not allowed in the header - // but can optionally be in the body. - // This is in order that Geth can import preexisting chains augmented with BALs - // and not have a hash mismatch. - if block.Header().BlockAccessListHash != nil { - return fmt.Errorf("access list hash in block header not allowed preamsterdam") - } } else { // if experimental.bal is not enabled, block headers cannot have access list hash and bodies cannot have access lists. if block.AccessList() != nil { diff --git a/core/blockchain.go b/core/blockchain.go index b532d5de93..a49653ffd4 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -231,11 +231,6 @@ type BlockChainConfig struct { // SlowBlockThreshold is the block execution time threshold beyond which // detailed statistics will be logged. SlowBlockThreshold time.Duration - - // If EnableBALForTesting is enabled, block access lists will be created - // from block execution and embedded in the body. The block access list - // hash will not be set in the header. - EnableBALForTesting bool } // DefaultConfig returns the default config. diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index ef057b05c9..e58c4b884a 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -208,12 +208,6 @@ type Config struct { // RangeLimit restricts the maximum range (end - start) for range queries. RangeLimit uint64 `toml:",omitempty"` - // ExperimentalBAL enables EIP-7928 block access list creation during execution - // of post Cancun blocks, and persistence via embedding the BAL in the block body. - // - // TODO: also note that it will cause execution of blocks with access lists to base - // their execution on the BAL. - ExperimentalBAL bool `toml:",omitempty"` } // CreateConsensusEngine creates a consensus engine for the given chain config. diff --git a/miner/worker.go b/miner/worker.go index d589c8513e..7547fe0d4e 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -182,12 +182,12 @@ func (miner *Miner) generateWork(genParam *generateParams, witness bool) *newPay // I considered trying to instantiate the beacon consensus engine with a tracer. // however, the BAL tracer instance is used once per block, while the engine object // lives for the entire time the client is running. - onBlockFinalization := func() *bal.BlockAccessList { - if miner.chainConfig.IsAmsterdam(work.header.Number, work.header.Time) { + var onBlockFinalization func() *bal.BlockAccessList + if miner.chainConfig.IsAmsterdam(work.header.Number, work.header.Time) { + onBlockFinalization = func() *bal.BlockAccessList { work.alTracer.OnBlockFinalization() return work.alTracer.AccessList().ToEncodingObj() } - return nil } block, err := miner.engine.FinalizeAndAssemble(miner.chain, work.header, work.state, &body, work.receipts, onBlockFinalization)