Skip to content

Commit 8625f06

Browse files
authored
RPC: disable EIP-7825 gas limit check for eth_call and ilk (#17169)
See ethereum/go-ethereum#32641 & https://discord.com/channels/595666850260713488/1416131247251521556
1 parent fc008ec commit 8625f06

File tree

16 files changed

+46
-19
lines changed

16 files changed

+46
-19
lines changed

core/blockchain.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,11 @@ func SysCallContractWithBlockContext(contract common.Address, data []byte, chain
284284
SysCallGasLimit,
285285
u256.Num0,
286286
nil, nil,
287-
data, nil, false,
288-
true, // isFree
289-
nil, // maxFeePerBlobGas
287+
data, nil,
288+
false, // checkNonce
289+
false, // checkGas
290+
true, // isFree
291+
nil, // maxFeePerBlobGas
290292
)
291293
vmConfig := vmCfg
292294
vmConfig.NoReceipts = true
@@ -324,9 +326,11 @@ func SysCreate(contract common.Address, data []byte, chainConfig *chain.Config,
324326
SysCallGasLimit,
325327
u256.Num0,
326328
nil, nil,
327-
data, nil, false,
328-
true, // isFree
329-
nil, // maxFeePerBlobGas
329+
data, nil,
330+
false, // checkNonce
331+
false, // checkGas
332+
true, // isFree
333+
nil, // maxFeePerBlobGas
330334
)
331335
vmConfig := vm.Config{NoReceipts: true}
332336
// Create a new context to be used in the EVM environment

core/state_transition.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ type Message interface {
109109
FeeCap() *uint256.Int
110110
TipCap() *uint256.Int
111111
Gas() uint64
112+
CheckGas() bool
112113
BlobGas() uint64
113114
MaxFeePerBlobGas() *uint256.Int
114115
Value() *uint256.Int
@@ -339,7 +340,7 @@ func (st *StateTransition) preCheck(gasBailout bool) error {
339340
}
340341

341342
// EIP-7825: Transaction Gas Limit Cap
342-
if st.evm.ChainRules().IsOsaka && st.msg.Gas() > params.MaxTxnGasLimit {
343+
if st.msg.CheckGas() && st.evm.ChainRules().IsOsaka && st.msg.Gas() > params.MaxTxnGasLimit {
343344
return fmt.Errorf("%w: address %v, gas limit %d", ErrGasLimitTooHigh, st.msg.From().Hex(), st.msg.Gas())
344345
}
345346

execution/abi/bind/backends/simulated.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,7 @@ func (m callMsg) GasPrice() *uint256.Int { return m.CallMsg.GasPr
843843
func (m callMsg) FeeCap() *uint256.Int { return m.CallMsg.FeeCap }
844844
func (m callMsg) TipCap() *uint256.Int { return m.CallMsg.TipCap }
845845
func (m callMsg) Gas() uint64 { return m.CallMsg.Gas }
846+
func (m callMsg) CheckGas() bool { return true }
846847
func (m callMsg) Value() *uint256.Int { return m.CallMsg.Value }
847848
func (m callMsg) Data() []byte { return m.CallMsg.Data }
848849
func (m callMsg) AccessList() types.AccessList { return m.CallMsg.AccessList }

execution/tests/testutil/state_test_util.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ func toMessage(tx stTransaction, ps stPostState, baseFee *big.Int) (core.Message
486486
data,
487487
accessList,
488488
false, /* checkNonce */
489+
true, /* checkGas */
489490
false, /* isFree */
490491
uint256.MustFromBig(blobFeeCap),
491492
)

execution/types/access_list_tx.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ func (tx *AccessListTx) AsMessage(s Signer, _ *big.Int, rules *chain.Rules) (*Me
423423
data: tx.Data,
424424
accessList: tx.AccessList,
425425
checkNonce: true,
426+
checkGas: true,
426427
}
427428

428429
if !rules.IsBerlin {

execution/types/blob_tx.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ func (stx *BlobTx) AsMessage(s Signer, baseFee *big.Int, rules *chain.Rules) (*M
6060
data: stx.Data,
6161
accessList: stx.AccessList,
6262
checkNonce: true,
63+
checkGas: true,
6364
}
6465
if !rules.IsCancun {
6566
return nil, errors.New("BlobTx transactions require Cancun")

execution/types/dynamic_fee_tx.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ func (tx *DynamicFeeTransaction) AsMessage(s Signer, baseFee *big.Int, rules *ch
344344
data: tx.Data,
345345
accessList: tx.AccessList,
346346
checkNonce: true,
347+
checkGas: true,
347348
}
348349
if !rules.IsLondon {
349350
return nil, errors.New("eip-1559 transactions require London")

execution/types/legacy_tx.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ func (tx *LegacyTx) AsMessage(s Signer, _ *big.Int, _ *chain.Rules) (*Message, e
358358
data: tx.Data,
359359
accessList: nil,
360360
checkNonce: true,
361+
checkGas: true,
361362
}
362363

363364
var err error

execution/types/set_code_tx.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ func (tx *SetCodeTransaction) AsMessage(s Signer, baseFee *big.Int, rules *chain
126126
data: tx.Data,
127127
accessList: tx.AccessList,
128128
checkNonce: true,
129+
checkGas: true,
129130
}
130131
if !rules.IsPrague {
131132
return nil, errors.New("SetCodeTransaction is only supported in Prague")

execution/types/transaction.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,14 +374,15 @@ type Message struct {
374374
data []byte
375375
accessList AccessList
376376
checkNonce bool
377+
checkGas bool
377378
isFree bool
378379
blobHashes []common.Hash
379380
authorizations []Authorization
380381
}
381382

382383
func NewMessage(from common.Address, to *common.Address, nonce uint64, amount *uint256.Int, gasLimit uint64,
383384
gasPrice *uint256.Int, feeCap, tipCap *uint256.Int, data []byte, accessList AccessList, checkNonce bool,
384-
isFree bool, maxFeePerBlobGas *uint256.Int,
385+
checkGas bool, isFree bool, maxFeePerBlobGas *uint256.Int,
385386
) *Message {
386387
m := Message{
387388
from: from,
@@ -392,6 +393,7 @@ func NewMessage(from common.Address, to *common.Address, nonce uint64, amount *u
392393
data: data,
393394
accessList: accessList,
394395
checkNonce: checkNonce,
396+
checkGas: checkGas,
395397
isFree: isFree,
396398
}
397399
if gasPrice != nil {
@@ -430,6 +432,10 @@ func (m *Message) CheckNonce() bool { return m.checkNonce }
430432
func (m *Message) SetCheckNonce(checkNonce bool) {
431433
m.checkNonce = checkNonce
432434
}
435+
func (m *Message) CheckGas() bool { return m.checkGas }
436+
func (m *Message) SetCheckGas(checkGas bool) {
437+
m.checkGas = checkGas
438+
}
433439
func (m *Message) IsFree() bool { return m.isFree }
434440
func (m *Message) SetIsFree(isFree bool) {
435441
m.isFree = isFree

0 commit comments

Comments
 (0)