From 25507e068ad2af8b95eaa439e38f3c7f0a6999a5 Mon Sep 17 00:00:00 2001 From: halo3mic Date: Wed, 14 Feb 2024 03:33:10 +0000 Subject: [PATCH 1/2] bb: add ParentBeaconBlockRoot param to BuildBlockArgs --- core/types/suave_structs.go | 1 + miner/worker.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/core/types/suave_structs.go b/core/types/suave_structs.go index 849acfcf9b0d..dbf1b5ef25c3 100644 --- a/core/types/suave_structs.go +++ b/core/types/suave_structs.go @@ -18,6 +18,7 @@ type BuildBlockArgs struct { GasLimit uint64 Random common.Hash Withdrawals []*Withdrawal + ParentBeaconBlockRoot common.Hash Extra []byte FillPending bool } diff --git a/miner/worker.go b/miner/worker.go index 6282aecc5b1b..bcf0ae470f8c 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -1291,6 +1291,7 @@ func (w *worker) buildBlockFromTxs(ctx context.Context, args *types.BuildBlockAr random: args.Random, extra: args.Extra, withdrawals: args.Withdrawals, + beaconRoot: &args.ParentBeaconBlockRoot, // noUncle: true, noTxs: false, } @@ -1339,6 +1340,7 @@ func (w *worker) buildBlockFromBundles(ctx context.Context, args *types.BuildBlo random: args.Random, extra: args.Extra, withdrawals: args.Withdrawals, + beaconRoot: &args.ParentBeaconBlockRoot, // noUncle: true, noTxs: false, } From c812ada6fd14b5ba8644e7be9b75f4428cb25653 Mon Sep 17 00:00:00 2001 From: halo3mic Date: Wed, 14 Feb 2024 06:06:09 +0000 Subject: [PATCH 2/2] optional external extra field --- miner/worker.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/miner/worker.go b/miner/worker.go index bcf0ae470f8c..2aa418f062c3 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -937,7 +937,11 @@ func (w *worker) prepareWork(genParams *generateParams) (*environment, error) { } // Set the extra field. if len(w.extra) != 0 { - header.Extra = w.extra + if len(genParams.extra) != 0 { + header.Extra = genParams.extra + } else { + header.Extra = w.extra + } } // Set the randomness field from the beacon chain if it's available. if genParams.random != (common.Hash{}) {