diff --git a/internal/params/config.go b/internal/params/config.go index 7cd31bb9df..0258edaf70 100644 --- a/internal/params/config.go +++ b/internal/params/config.go @@ -323,6 +323,7 @@ var ( big.NewInt(1), // LeaderRotationExternalBeaconLeaders big.NewInt(0), // FeeCollectEpoch big.NewInt(0), // ValidatorCodeFixEpoch + big.NewInt(0), // BlockGas30M } // TestChainConfig ... @@ -366,6 +367,7 @@ var ( big.NewInt(1), // LeaderRotationExternalBeaconLeaders big.NewInt(0), // FeeCollectEpoch big.NewInt(0), // ValidatorCodeFixEpoch + big.NewInt(0), // BlockGas30M } // TestRules ... @@ -522,6 +524,8 @@ type ChainConfig struct { // Contracts can check the (presence of) validator code by calling the following: // extcodesize, extcodecopy and extcodehash. ValidatorCodeFixEpoch *big.Int `json:"validator-code-fix-epoch,omitempty"` + + BlockGas30M *big.Int `json:"block-gas-30m,omitempty"` } // String implements the fmt.Stringer interface. @@ -737,6 +741,10 @@ func (c *ChainConfig) IsLeaderRotation(epoch *big.Int) bool { return isForked(c.LeaderRotationExternalNonBeaconLeaders, epoch) } +func (c *ChainConfig) IsBlockGas30M(epoch *big.Int) bool { + return isForked(c.BlockGas30M, epoch) +} + func (c *ChainConfig) IsLeaderRotationExternalValidatorsAllowed(epoch *big.Int, shardID uint32) bool { if !c.IsLeaderRotation(epoch) { return false diff --git a/node/worker/worker.go b/node/worker/worker.go index 5a4234229a..1419477810 100644 --- a/node/worker/worker.go +++ b/node/worker/worker.go @@ -308,7 +308,7 @@ func (w *Worker) UpdateCurrent() error { header := w.factory.NewHeader(epoch).With(). ParentHash(parent.Hash()). Number(num.Add(num, common.Big1)). - GasLimit(core.CalcGasLimit(parent, w.gasFloor, w.gasCeil)). + GasLimit(core.CalcGasLimit(parent, w.GasFloor(epoch), w.gasCeil)). Time(big.NewInt(timestamp)). ShardID(w.chain.ShardID()). Header() @@ -602,3 +602,15 @@ func New( return worker } + +func (w *Worker) GasFloor(epoch *big.Int) uint64 { + if w.chain.Config().IsBlockGas30M(epoch) { + return 30_000_000 + } + + return w.gasFloor +} + +func (w *Worker) GasCeil() uint64 { + return w.gasCeil +}