This commit is contained in:
Jared Wasinger 2026-01-29 13:44:55 -05:00
parent 5a88101fa8
commit 33c864e227
8 changed files with 27 additions and 58 deletions

View file

@ -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 {

View file

@ -160,7 +160,6 @@ var (
utils.BeaconCheckpointFlag,
utils.BeaconCheckpointFileFlag,
utils.LogSlowBlockFlag,
utils.ExperimentalBALFlag,
}, utils.NetworkFlags, utils.DatabaseFlags)
rpcFlags = []cli.Flag{

View file

@ -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)

View file

@ -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
}

View file

@ -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 {

View file

@ -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.

View file

@ -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.

View file

@ -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)