Skip to content

Commit b4b4068

Browse files
params: update tx gas limit cap (#32230)
Updates the tx gas limit cap to the new parameter (2^24) https://github.com/ethereum/EIPs/pull/9986/files
1 parent 0dacfef commit b4b4068

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

core/state_processor_test.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ func TestStateProcessorErrors(t *testing.T) {
132132
bigNumber := new(big.Int).SetBytes(common.MaxHash.Bytes())
133133
tooBigNumber := new(big.Int).Set(bigNumber)
134134
tooBigNumber.Add(tooBigNumber, common.Big1)
135+
gasLimit := blockchain.CurrentHeader().GasLimit
135136
for i, tt := range []struct {
136137
txs []*types.Transaction
137138
want string
@@ -157,9 +158,9 @@ func TestStateProcessorErrors(t *testing.T) {
157158
},
158159
{ // ErrGasLimitReached
159160
txs: []*types.Transaction{
160-
makeTx(key1, 0, common.Address{}, big.NewInt(0), 21000000, big.NewInt(875000000), nil),
161+
makeTx(key1, 0, common.Address{}, big.NewInt(0), gasLimit+1, big.NewInt(875000000), nil),
161162
},
162-
want: "could not apply tx 0 [0xbd49d8dadfd47fb846986695f7d4da3f7b2c48c8da82dbc211a26eb124883de9]: gas limit reached",
163+
want: "could not apply tx 0 [0xd0fb3ea181e800cd55c4637c55c1f2f78137efb6bb9723e50bda3cad97208db2]: gas limit reached",
163164
},
164165
{ // ErrInsufficientFundsForTransfer
165166
txs: []*types.Transaction{
@@ -185,9 +186,9 @@ func TestStateProcessorErrors(t *testing.T) {
185186
},
186187
{ // ErrGasLimitReached
187188
txs: []*types.Transaction{
188-
makeTx(key1, 0, common.Address{}, big.NewInt(0), params.TxGas*1000, big.NewInt(875000000), nil),
189+
makeTx(key1, 0, common.Address{}, big.NewInt(0), gasLimit+1, big.NewInt(875000000), nil),
189190
},
190-
want: "could not apply tx 0 [0xbd49d8dadfd47fb846986695f7d4da3f7b2c48c8da82dbc211a26eb124883de9]: gas limit reached",
191+
want: "could not apply tx 0 [0xd0fb3ea181e800cd55c4637c55c1f2f78137efb6bb9723e50bda3cad97208db2]: gas limit reached",
191192
},
192193
{ // ErrFeeCapTooLow
193194
txs: []*types.Transaction{
@@ -256,6 +257,12 @@ func TestStateProcessorErrors(t *testing.T) {
256257
},
257258
// ErrSetCodeTxCreate cannot be tested here: it is impossible to create a SetCode-tx with nil `to`.
258259
// The EstimateGas API tests test this case.
260+
{ // ErrGasLimitTooHigh
261+
txs: []*types.Transaction{
262+
makeTx(key1, 0, common.Address{}, big.NewInt(0), params.MaxTxGas+1, big.NewInt(875000000), nil),
263+
},
264+
want: "could not apply tx 0 [0x16505812a6da0b0150593e4d4eb90190ba64816a04b27d19ca926ebd6aff8aa0]: transaction gas limit too high (cap: 16777216, tx: 16777217)",
265+
},
259266
} {
260267
block := GenerateBadBlock(gspec.ToBlock(), beacon.New(ethash.NewFaker()), tt.txs, gspec.Config, false)
261268
_, err := blockchain.InsertChain(types.Blocks{block})

params/protocol_params.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const (
2828
MaxGasLimit uint64 = 0x7fffffffffffffff // Maximum the gas limit (2^63-1).
2929
GenesisGasLimit uint64 = 4712388 // Gas limit of the Genesis block.
3030

31-
MaxTxGas uint64 = 30_000_000 // Maximum transaction gas limit after eip-7825.
31+
MaxTxGas uint64 = 1 << 24 // Maximum transaction gas limit after eip-7825 (16,777,216).
3232

3333
MaximumExtraDataSize uint64 = 32 // Maximum size extra data may be after Genesis.
3434
ExpByteGas uint64 = 10 // Times ceil(log256(exponent)) for the EXP instruction.

0 commit comments

Comments
 (0)