From 25507e068ad2af8b95eaa439e38f3c7f0a6999a5 Mon Sep 17 00:00:00 2001 From: halo3mic Date: Wed, 14 Feb 2024 03:33:10 +0000 Subject: [PATCH 1/6] 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 849acfcf9b..dbf1b5ef25 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 6282aecc5b..bcf0ae470f 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/6] 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 bcf0ae470f..2aa418f062 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{}) { From eba795de5c01a5b3b4ef6a52bced185aab9f04a4 Mon Sep 17 00:00:00 2001 From: Louis Thibault Date: Wed, 14 Feb 2024 10:02:51 -0500 Subject: [PATCH 3/6] Add beacon root to types.BuildBlockArgs. --- core/types/suave_structs.go | 1 + 1 file changed, 1 insertion(+) diff --git a/core/types/suave_structs.go b/core/types/suave_structs.go index 849acfcf9b..0a7001a386 100644 --- a/core/types/suave_structs.go +++ b/core/types/suave_structs.go @@ -19,6 +19,7 @@ type BuildBlockArgs struct { Random common.Hash Withdrawals []*Withdrawal Extra []byte + BeaconRoot common.Hash FillPending bool } From 46dd095ac1cac942d35319720d655af4769a4804 Mon Sep 17 00:00:00 2001 From: Louis Thibault Date: Wed, 14 Feb 2024 10:03:13 -0500 Subject: [PATCH 4/6] Remove codegen header from suave_structs.go --- core/types/suave_structs.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/core/types/suave_structs.go b/core/types/suave_structs.go index 0a7001a386..7c3db41cae 100644 --- a/core/types/suave_structs.go +++ b/core/types/suave_structs.go @@ -1,6 +1,3 @@ -// Code generated by suave/gen in https://github.com/flashbots/suave-geth. -// DO NOT EDIT. -// Hash: c60f303834fbdbbd940aae7cb3679cf3755a25f7384f1052c20bf6c38d9a0451 package types import "github.com/ethereum/go-ethereum/common" @@ -51,4 +48,4 @@ type SimulatedLog struct { Data []byte Addr common.Address Topics []common.Hash -} \ No newline at end of file +} From 4b6f39ee252697676abb52aa84dafef9dd42e2c3 Mon Sep 17 00:00:00 2001 From: Louis Thibault Date: Wed, 14 Feb 2024 10:07:56 -0500 Subject: [PATCH 5/6] Pass beacon root from build args to block header. --- miner/worker.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/miner/worker.go b/miner/worker.go index 6282aecc5b..05e6965fd8 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -929,11 +929,12 @@ func (w *worker) prepareWork(genParams *generateParams) (*environment, error) { } // Construct the sealing block header. header := &types.Header{ - ParentHash: parent.Hash(), - Number: new(big.Int).Add(parent.Number, common.Big1), - GasLimit: core.CalcGasLimit(parent.GasLimit, w.config.GasCeil), - Time: timestamp, - Coinbase: genParams.coinbase, + ParentHash: parent.Hash(), + Number: new(big.Int).Add(parent.Number, common.Big1), + GasLimit: core.CalcGasLimit(parent.GasLimit, w.config.GasCeil), + Time: timestamp, + Coinbase: genParams.coinbase, + ParentBeaconRoot: genParams.beaconRoot, } // Set the extra field. if len(w.extra) != 0 { @@ -1291,6 +1292,7 @@ func (w *worker) buildBlockFromTxs(ctx context.Context, args *types.BuildBlockAr random: args.Random, extra: args.Extra, withdrawals: args.Withdrawals, + beaconRoot: &args.BeaconRoot, // noUncle: true, noTxs: false, } @@ -1339,6 +1341,7 @@ func (w *worker) buildBlockFromBundles(ctx context.Context, args *types.BuildBlo random: args.Random, extra: args.Extra, withdrawals: args.Withdrawals, + beaconRoot: &args.BeaconRoot, // noUncle: true, noTxs: false, } From 9823ebebd0fcbe94d72f7f68a87c93bdb30e19b2 Mon Sep 17 00:00:00 2001 From: Louis Thibault Date: Wed, 14 Feb 2024 10:40:48 -0500 Subject: [PATCH 6/6] Update CI to use go1.22. Remove go1.20 (EOL). --- .github/workflows/checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index df20ea3876..489a35a61c 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go-version: [ '1.20', '1.21.x' ] + go-version: ['1.21.x', '1.22.x'] # goarch: [amd64, arm64] steps: