From f2ecd7a83305d4a8484bf03d0a37845dadfe8ded Mon Sep 17 00:00:00 2001 From: Giulio Date: Thu, 10 Oct 2024 22:35:43 +0200 Subject: [PATCH 1/5] save --- consensus/misc/eip7783/eip7783.go | 21 +++++++++++++++++++++ consensus/misc/eip7783/eip7783_test.go | 24 ++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 consensus/misc/eip7783/eip7783.go create mode 100644 consensus/misc/eip7783/eip7783_test.go diff --git a/consensus/misc/eip7783/eip7783.go b/consensus/misc/eip7783/eip7783.go new file mode 100644 index 000000000000..47ecd8aa9854 --- /dev/null +++ b/consensus/misc/eip7783/eip7783.go @@ -0,0 +1,21 @@ +package eip7783 + +import "math/big" + +/* +Implementation of EIP-7783: + +def compute_gas_limit(blockNum: int, blockNumStart: int, initialGasLimit: int, r: int, gasLimitCap: int) -> int: + + if blockNum < blockNumStart: + return initialGasLimit + else: + return min(gasLimitCap, initialGasLimit + r * (blockNum - blockNumStart)) +*/ +func CalcGasLimitEIP7783(blockNum, startBlockNum *big.Int, initialGasLimit, gasIncreaseRate, gasLimitCap uint64) uint64 { + if blockNum.Cmp(startBlockNum) < 0 { + return initialGasLimit + } else { + return min(gasLimitCap, initialGasLimit+gasIncreaseRate*(blockNum.Uint64()-startBlockNum.Uint64())) + } +} diff --git a/consensus/misc/eip7783/eip7783_test.go b/consensus/misc/eip7783/eip7783_test.go new file mode 100644 index 000000000000..0fb0a596b496 --- /dev/null +++ b/consensus/misc/eip7783/eip7783_test.go @@ -0,0 +1,24 @@ +package eip7783 + +import ( + "math/big" + "testing" +) + +func TestCalcGasLimitEIP7783Test(t *testing.T) { + // Do multiple tests here + tests := []struct { + blockNum, startBlockNum *big.Int + initialGasLimit, gasIncreaseRate, gasLimitCap, expectedGasLimit uint64 + }{ + {big.NewInt(100), big.NewInt(50), 100000, 10, 200000, 100500}, + {big.NewInt(100), big.NewInt(100), 100000, 10, 200000, 100000}, + {big.NewInt(99), big.NewInt(100), 100000, 10, 200000, 100000}, + } + + for i, test := range tests { + if have, want := CalcGasLimitEIP7783(test.blockNum, test.startBlockNum, test.initialGasLimit, test.gasIncreaseRate, test.gasLimitCap), test.expectedGasLimit; have != want { + t.Errorf("test %d: have %d want %d, ", i, have, want) + } + } +} From 0e200edf9b7462e8831c41efdcf2f48711cd0c3c Mon Sep 17 00:00:00 2001 From: Giulio Date: Thu, 10 Oct 2024 22:51:20 +0200 Subject: [PATCH 2/5] save --- cmd/geth/main.go | 4 ++++ cmd/utils/flags.go | 41 +++++++++++++++++++++++++++++++++++++++-- miner/miner.go | 13 ++++++++++--- miner/worker.go | 12 ++++++++++-- 4 files changed, 63 insertions(+), 7 deletions(-) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 2675a616759c..a1f6dec2a7a3 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -117,6 +117,10 @@ var ( utils.MaxPendingPeersFlag, utils.MiningEnabledFlag, // deprecated utils.MinerGasLimitFlag, + utils.MinerEIP7783BlockNumStartFlag, + utils.MinerEIP7783GasLimitCapFlag, + utils.MinerEIP7783IncreaseRateFlag, + utils.MinerEIP7783InitialGasLimitFlag, utils.MinerGasPriceFlag, utils.MinerEtherbaseFlag, // deprecated utils.MinerExtraDataFlag, diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 6db88ff66183..b53426d4b43e 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -478,7 +478,30 @@ var ( MinerGasLimitFlag = &cli.Uint64Flag{ Name: "miner.gaslimit", Usage: "Target gas ceiling for mined blocks", - Value: ethconfig.Defaults.Miner.GasCeil, + Category: flags.MinerCategory, + } + MinerEIP7783BlockNumStartFlag = &flags.BigFlag{ + Name: "miner.eip7783.blocknumstart", + Usage: "The block number to start using EIP-7783 gas limit calculation", + Value: ethconfig.Defaults.Miner.EIP7783BlockNumStart, + Category: flags.MinerCategory, + } + MinerEIP7783InitialGasLimitFlag = &cli.Uint64Flag{ + Name: "miner.eip7783.initialgaslimit", + Usage: "The initial gas limit to use before EIP-7783 calculation", + Value: ethconfig.Defaults.Miner.EIP7783InitialGasLimit, + Category: flags.MinerCategory, + } + MinerEIP7783IncreaseRateFlag = &cli.Uint64Flag{ + Name: "miner.eip7783.increaserate", + Usage: "The rate of gas limit increase per block", + Value: ethconfig.Defaults.Miner.Eip7783IncreaseRate, + Category: flags.MinerCategory, + } + MinerEIP7783GasLimitCapFlag = &cli.Uint64Flag{ + Name: "miner.eip7783.gaslimitcap", + Usage: "The maximum gas limit to use after EIP-7783 calculation", + Value: ethconfig.Defaults.Miner.EIP7783GasLimitCap, Category: flags.MinerCategory, } MinerGasPriceFlag = &flags.BigFlag{ @@ -1553,8 +1576,22 @@ func setMiner(ctx *cli.Context, cfg *miner.Config) { cfg.ExtraData = []byte(ctx.String(MinerExtraDataFlag.Name)) } if ctx.IsSet(MinerGasLimitFlag.Name) { - cfg.GasCeil = ctx.Uint64(MinerGasLimitFlag.Name) + cfg.GasCeil = new(uint64) + *cfg.GasCeil = ctx.Uint64(MinerGasLimitFlag.Name) + } + if ctx.IsSet(MinerEIP7783BlockNumStartFlag.Name) { + cfg.EIP7783BlockNumStart = flags.GlobalBig(ctx, MinerEIP7783BlockNumStartFlag.Name) + } + if ctx.IsSet(MinerEIP7783GasLimitCapFlag.Name) { + cfg.EIP7783GasLimitCap = ctx.Uint64(MinerEIP7783GasLimitCapFlag.Name) } + if ctx.IsSet(MinerEIP7783IncreaseRateFlag.Name) { + cfg.Eip7783IncreaseRate = ctx.Uint64(MinerEIP7783IncreaseRateFlag.Name) + } + if ctx.IsSet(MinerEIP7783InitialGasLimitFlag.Name) { + cfg.EIP7783InitialGasLimit = ctx.Uint64(MinerEIP7783InitialGasLimitFlag.Name) + } + if ctx.IsSet(MinerGasPriceFlag.Name) { cfg.GasPrice = flags.GlobalBig(ctx, MinerGasPriceFlag.Name) } diff --git a/miner/miner.go b/miner/miner.go index 9892c08ed6e5..295ddb0dbd3b 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -45,14 +45,20 @@ type Config struct { Etherbase common.Address `toml:"-"` // Deprecated PendingFeeRecipient common.Address `toml:"-"` // Address for pending block rewards. ExtraData hexutil.Bytes `toml:",omitempty"` // Block extra data set by the miner - GasCeil uint64 // Target gas ceiling for mined blocks. + GasCeil *uint64 // Target gas ceiling for mined blocks. GasPrice *big.Int // Minimum gas price for mining a transaction Recommit time.Duration // The time interval for miner to re-create mining work. + + // EIP-7783 parameters + EIP7783BlockNumStart *big.Int // The block number to start using EIP-7783 gas limit calculation + EIP7783InitialGasLimit uint64 // The initial gas limit to use before EIP-7783 calculation + Eip7783IncreaseRate uint64 // The rate of gas limit increase per block + EIP7783GasLimitCap uint64 // The maximum gas limit to use after EIP-7783 calculation } // DefaultConfig contains default settings for miner. var DefaultConfig = Config{ - GasCeil: 30_000_000, + //GasCeil: 30_000_000, GasPrice: big.NewInt(params.GWei / 1000), // The default recommit time is chosen as two seconds since @@ -113,7 +119,8 @@ func (miner *Miner) SetExtra(extra []byte) error { // For pre-1559 blocks, it sets the ceiling. func (miner *Miner) SetGasCeil(ceil uint64) { miner.confMu.Lock() - miner.config.GasCeil = ceil + miner.config.GasCeil = new(uint64) + *miner.config.GasCeil = ceil miner.confMu.Unlock() } diff --git a/miner/worker.go b/miner/worker.go index 51df2764fa95..8d08d65662c7 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -26,6 +26,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/consensus/misc/eip1559" "github.com/ethereum/go-ethereum/consensus/misc/eip4844" + "github.com/ethereum/go-ethereum/consensus/misc/eip7783" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/stateless" @@ -171,11 +172,18 @@ func (miner *Miner) prepareWork(genParams *generateParams, witness bool) (*envir } timestamp = parent.Time + 1 } + useEip7783 := miner.config.GasCeil == nil + var gasLimit uint64 + if useEip7783 { + gasLimit = eip7783.CalcGasLimitEIP7783(parent.Number, miner.config.EIP7783BlockNumStart, miner.config.EIP7783InitialGasLimit, miner.config.Eip7783IncreaseRate, miner.config.EIP7783GasLimitCap) + } else { + gasLimit = core.CalcGasLimit(parent.GasLimit, *miner.config.GasCeil) + } // 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, miner.config.GasCeil), + GasLimit: gasLimit, Time: timestamp, Coinbase: genParams.coinbase, } @@ -192,7 +200,7 @@ func (miner *Miner) prepareWork(genParams *generateParams, witness bool) (*envir header.BaseFee = eip1559.CalcBaseFee(miner.chainConfig, parent) if !miner.chainConfig.IsLondon(parent.Number) { parentGasLimit := parent.GasLimit * miner.chainConfig.ElasticityMultiplier() - header.GasLimit = core.CalcGasLimit(parentGasLimit, miner.config.GasCeil) + header.GasLimit = core.CalcGasLimit(parentGasLimit, gasLimit) } } // Run the consensus preparation with the default or customized consensus engine. From 86c3ffd47cd5999e3eec1d6205c9eb1c89a2c139 Mon Sep 17 00:00:00 2001 From: Giulio Date: Thu, 10 Oct 2024 23:21:24 +0200 Subject: [PATCH 3/5] fix test --- accounts/abi/bind/bind_test.go | 10 +++++----- eth/catalyst/api_test.go | 2 ++ ethclient/simulated/backend.go | 2 +- ethclient/simulated/options.go | 3 ++- miner/miner.go | 7 ++++++- miner/payload_building_test.go | 4 ++-- miner/worker.go | 6 +++++- 7 files changed, 23 insertions(+), 11 deletions(-) diff --git a/accounts/abi/bind/bind_test.go b/accounts/abi/bind/bind_test.go index a390a3c47c7e..c6cb6a1ee923 100644 --- a/accounts/abi/bind/bind_test.go +++ b/accounts/abi/bind/bind_test.go @@ -1818,7 +1818,7 @@ var bindTests = []struct { var ( key, _ = crypto.GenerateKey() user, _ = bind.NewKeyedTransactorWithChainID(key, big.NewInt(1337)) - sim = backends.NewSimulatedBackend(types.GenesisAlloc{user.From: {Balance: big.NewInt(1000000000000000000)}}, ethconfig.Defaults.Miner.GasCeil) + sim = backends.NewSimulatedBackend(types.GenesisAlloc{user.From: {Balance: big.NewInt(1000000000000000000)}}, ethconfig.Defaults.Miner.EIP7783InitialGasLimit) ) defer sim.Close() @@ -1889,7 +1889,7 @@ var bindTests = []struct { var ( key, _ = crypto.GenerateKey() user, _ = bind.NewKeyedTransactorWithChainID(key, big.NewInt(1337)) - sim = backends.NewSimulatedBackend(types.GenesisAlloc{user.From: {Balance: big.NewInt(1000000000000000000)}}, ethconfig.Defaults.Miner.GasCeil) + sim = backends.NewSimulatedBackend(types.GenesisAlloc{user.From: {Balance: big.NewInt(1000000000000000000)}}, ethconfig.Defaults.Miner.EIP7783InitialGasLimit) ) defer sim.Close() @@ -1942,7 +1942,7 @@ var bindTests = []struct { var ( key, _ = crypto.GenerateKey() user, _ = bind.NewKeyedTransactorWithChainID(key, big.NewInt(1337)) - sim = backends.NewSimulatedBackend(types.GenesisAlloc{user.From: {Balance: big.NewInt(1000000000000000000)}}, ethconfig.Defaults.Miner.GasCeil) + sim = backends.NewSimulatedBackend(types.GenesisAlloc{user.From: {Balance: big.NewInt(1000000000000000000)}}, ethconfig.Defaults.Miner.EIP7783InitialGasLimit) ) defer sim.Close() @@ -1991,7 +1991,7 @@ var bindTests = []struct { var ( key, _ = crypto.GenerateKey() user, _ = bind.NewKeyedTransactorWithChainID(key, big.NewInt(1337)) - sim = backends.NewSimulatedBackend(types.GenesisAlloc{user.From: {Balance: big.NewInt(1000000000000000000)}}, ethconfig.Defaults.Miner.GasCeil) + sim = backends.NewSimulatedBackend(types.GenesisAlloc{user.From: {Balance: big.NewInt(1000000000000000000)}}, ethconfig.Defaults.Miner.EIP7783InitialGasLimit) ) defer sim.Close() @@ -2032,7 +2032,7 @@ var bindTests = []struct { var ( key, _ = crypto.GenerateKey() user, _ = bind.NewKeyedTransactorWithChainID(key, big.NewInt(1337)) - sim = backends.NewSimulatedBackend(types.GenesisAlloc{user.From: {Balance: big.NewInt(1000000000000000000)}}, ethconfig.Defaults.Miner.GasCeil) + sim = backends.NewSimulatedBackend(types.GenesisAlloc{user.From: {Balance: big.NewInt(1000000000000000000)}}, ethconfig.Defaults.Miner.EIP7783InitialGasLimit) ) _, tx, _, err := DeployRangeKeyword(user, sim) if err != nil { diff --git a/eth/catalyst/api_test.go b/eth/catalyst/api_test.go index c3116cb4b6a7..cdeced9654c9 100644 --- a/eth/catalyst/api_test.go +++ b/eth/catalyst/api_test.go @@ -455,6 +455,8 @@ func startEthService(t *testing.T, genesis *core.Genesis, blocks []*types.Block) mcfg := miner.DefaultConfig mcfg.PendingFeeRecipient = testAddr ethcfg := ðconfig.Config{Genesis: genesis, SyncMode: downloader.FullSync, TrieTimeout: time.Minute, TrieDirtyCache: 256, TrieCleanCache: 256, Miner: mcfg} + ethcfg.Miner.GasCeil = new(uint64) + *ethcfg.Miner.GasCeil = 30_000_000 ethservice, err := eth.New(n, ethcfg) if err != nil { t.Fatal("can't create eth service:", err) diff --git a/ethclient/simulated/backend.go b/ethclient/simulated/backend.go index 6e07aa68d071..0fd3675edd73 100644 --- a/ethclient/simulated/backend.go +++ b/ethclient/simulated/backend.go @@ -82,7 +82,7 @@ func NewBackend(alloc types.GenesisAlloc, options ...func(nodeConf *node.Config, ethConf := ethconfig.Defaults ethConf.Genesis = &core.Genesis{ Config: params.AllDevChainProtocolChanges, - GasLimit: ethconfig.Defaults.Miner.GasCeil, + GasLimit: ethconfig.Defaults.Miner.EIP7783InitialGasLimit, Alloc: alloc, } ethConf.SyncMode = downloader.FullSync diff --git a/ethclient/simulated/options.go b/ethclient/simulated/options.go index 40bcb37bd178..a0689e437ff1 100644 --- a/ethclient/simulated/options.go +++ b/ethclient/simulated/options.go @@ -28,7 +28,8 @@ import ( func WithBlockGasLimit(gaslimit uint64) func(nodeConf *node.Config, ethConf *ethconfig.Config) { return func(nodeConf *node.Config, ethConf *ethconfig.Config) { ethConf.Genesis.GasLimit = gaslimit - ethConf.Miner.GasCeil = gaslimit + ethConf.Miner.GasCeil = new(uint64) + *ethConf.Miner.GasCeil = gaslimit } } diff --git a/miner/miner.go b/miner/miner.go index 295ddb0dbd3b..8790a5c522cb 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -19,6 +19,7 @@ package miner import ( "fmt" + "math" "math/big" "sync" "time" @@ -59,7 +60,11 @@ type Config struct { // DefaultConfig contains default settings for miner. var DefaultConfig = Config{ //GasCeil: 30_000_000, - GasPrice: big.NewInt(params.GWei / 1000), + GasPrice: big.NewInt(params.GWei / 1000), + EIP7783InitialGasLimit: 30_000_000, + Eip7783IncreaseRate: 6, + EIP7783GasLimitCap: 60_000_000, + EIP7783BlockNumStart: big.NewInt(math.MaxInt64), // The default recommit time is chosen as two seconds since // consensus-layer usually will wait a half slot of time(6s) diff --git a/miner/payload_building_test.go b/miner/payload_building_test.go index aad87627e674..6b65a8e7a573 100644 --- a/miner/payload_building_test.go +++ b/miner/payload_building_test.go @@ -52,7 +52,7 @@ var ( testUserKey, _ = crypto.GenerateKey() testUserAddress = crypto.PubkeyToAddress(testUserKey.PublicKey) - + genesisGasLimit = params.GenesisGasLimit // Test transactions pendingTxs []*types.Transaction newTxs []*types.Transaction @@ -60,7 +60,7 @@ var ( testConfig = Config{ PendingFeeRecipient: testBankAddress, Recommit: time.Second, - GasCeil: params.GenesisGasLimit, + GasCeil: &genesisGasLimit, } ) diff --git a/miner/worker.go b/miner/worker.go index 8d08d65662c7..d2b9d35eee62 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -175,7 +175,11 @@ func (miner *Miner) prepareWork(genParams *generateParams, witness bool) (*envir useEip7783 := miner.config.GasCeil == nil var gasLimit uint64 if useEip7783 { - gasLimit = eip7783.CalcGasLimitEIP7783(parent.Number, miner.config.EIP7783BlockNumStart, miner.config.EIP7783InitialGasLimit, miner.config.Eip7783IncreaseRate, miner.config.EIP7783GasLimitCap) + parentNumber := parent.Number + if parentNumber == nil { + parentNumber = common.Big0 + } + gasLimit = eip7783.CalcGasLimitEIP7783(parentNumber, miner.config.EIP7783BlockNumStart, miner.config.EIP7783InitialGasLimit, miner.config.Eip7783IncreaseRate, miner.config.EIP7783GasLimitCap) } else { gasLimit = core.CalcGasLimit(parent.GasLimit, *miner.config.GasCeil) } From 7b825fe87141bd87474eee97e627de559e728c00 Mon Sep 17 00:00:00 2001 From: Giulio Date: Thu, 10 Oct 2024 23:44:19 +0200 Subject: [PATCH 4/5] save --- eth/catalyst/simulated_beacon_test.go | 5 ++++- ethclient/ethclient_test.go | 3 ++- miner/miner_test.go | 1 + miner/worker.go | 12 +++++++----- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/eth/catalyst/simulated_beacon_test.go b/eth/catalyst/simulated_beacon_test.go index 711e8f1d60f3..e1482225e0ba 100644 --- a/eth/catalyst/simulated_beacon_test.go +++ b/eth/catalyst/simulated_beacon_test.go @@ -49,7 +49,10 @@ func startSimulatedBeaconEthService(t *testing.T, genesis *core.Genesis, period t.Fatal("can't create node:", err) } - ethcfg := ðconfig.Config{Genesis: genesis, SyncMode: downloader.FullSync, TrieTimeout: time.Minute, TrieDirtyCache: 256, TrieCleanCache: 256, Miner: miner.DefaultConfig} + m := miner.DefaultConfig + m.GasCeil = new(uint64) + // *m.GasCeil = 30_000_000 + ethcfg := ðconfig.Config{Genesis: genesis, SyncMode: downloader.FullSync, TrieTimeout: time.Minute, TrieDirtyCache: 256, TrieCleanCache: 256, Miner: m} ethservice, err := eth.New(n, ethcfg) if err != nil { t.Fatal("can't create eth service:", err) diff --git a/ethclient/ethclient_test.go b/ethclient/ethclient_test.go index 1b7e26fb74f5..f648d2398fd7 100644 --- a/ethclient/ethclient_test.go +++ b/ethclient/ethclient_test.go @@ -33,6 +33,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/eth/ethconfig" + "github.com/ethereum/go-ethereum/miner" "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" @@ -219,7 +220,7 @@ func newTestBackend(t *testing.T) (*node.Node, []*types.Block) { t.Fatalf("can't create new node: %v", err) } // Create Ethereum Service - config := ðconfig.Config{Genesis: genesis, RPCGasCap: 1000000} + config := ðconfig.Config{Genesis: genesis, RPCGasCap: 1000000, Miner: miner.Config{GasCeil: new(uint64)}} ethservice, err := eth.New(n, config) if err != nil { t.Fatalf("can't create new ethereum service: %v", err) diff --git a/miner/miner_test.go b/miner/miner_test.go index b92febdd1254..ca9d5531d357 100644 --- a/miner/miner_test.go +++ b/miner/miner_test.go @@ -164,6 +164,7 @@ func createMiner(t *testing.T) *Miner { // Create Miner backend := NewMockBackend(bc, txpool) + config.GasCeil = new(uint64) miner := New(backend, config, engine) return miner } diff --git a/miner/worker.go b/miner/worker.go index d2b9d35eee62..56d32cdcabc2 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -173,21 +173,23 @@ func (miner *Miner) prepareWork(genParams *generateParams, witness bool) (*envir timestamp = parent.Time + 1 } useEip7783 := miner.config.GasCeil == nil - var gasLimit uint64 + var gasCeil uint64 + if useEip7783 { parentNumber := parent.Number if parentNumber == nil { parentNumber = common.Big0 } - gasLimit = eip7783.CalcGasLimitEIP7783(parentNumber, miner.config.EIP7783BlockNumStart, miner.config.EIP7783InitialGasLimit, miner.config.Eip7783IncreaseRate, miner.config.EIP7783GasLimitCap) + gasCeil = eip7783.CalcGasLimitEIP7783(new(big.Int).Add(parentNumber, common.Big1), miner.config.EIP7783BlockNumStart, miner.config.EIP7783InitialGasLimit, miner.config.Eip7783IncreaseRate, miner.config.EIP7783GasLimitCap) } else { - gasLimit = core.CalcGasLimit(parent.GasLimit, *miner.config.GasCeil) + gasCeil = *miner.config.GasCeil } + // Construct the sealing block header. header := &types.Header{ ParentHash: parent.Hash(), Number: new(big.Int).Add(parent.Number, common.Big1), - GasLimit: gasLimit, + GasLimit: core.CalcGasLimit(parent.GasLimit, gasCeil), Time: timestamp, Coinbase: genParams.coinbase, } @@ -204,7 +206,7 @@ func (miner *Miner) prepareWork(genParams *generateParams, witness bool) (*envir header.BaseFee = eip1559.CalcBaseFee(miner.chainConfig, parent) if !miner.chainConfig.IsLondon(parent.Number) { parentGasLimit := parent.GasLimit * miner.chainConfig.ElasticityMultiplier() - header.GasLimit = core.CalcGasLimit(parentGasLimit, gasLimit) + header.GasLimit = core.CalcGasLimit(parentGasLimit, gasCeil) } } // Run the consensus preparation with the default or customized consensus engine. From abe247438d34e9cd5f35cd4b4e7bf5cb0c42178f Mon Sep 17 00:00:00 2001 From: Giulio Date: Fri, 11 Oct 2024 11:42:41 +0200 Subject: [PATCH 5/5] save --- miner/miner.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/miner/miner.go b/miner/miner.go index 8790a5c522cb..1a3295901cd5 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -124,8 +124,7 @@ func (miner *Miner) SetExtra(extra []byte) error { // For pre-1559 blocks, it sets the ceiling. func (miner *Miner) SetGasCeil(ceil uint64) { miner.confMu.Lock() - miner.config.GasCeil = new(uint64) - *miner.config.GasCeil = ceil + miner.config.GasCeil = &ceil miner.confMu.Unlock() }