From 3a11b5497bf6ab24bf02e644443c1792838bca0f Mon Sep 17 00:00:00 2001 From: Minhyuk Kim Date: Thu, 24 Jul 2025 14:22:19 +0900 Subject: [PATCH 1/4] Allow ErrGasLimitTooHigh errors when executing transactions for gas limit estimation to continue estimating with lower caps --- eth/ethconfig/config.go | 2 +- eth/gasestimator/gasestimator.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index 82c3c500a771..c73553acb732 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -65,7 +65,7 @@ var Defaults = Config{ Miner: miner.DefaultConfig, TxPool: legacypool.DefaultConfig, BlobPool: blobpool.DefaultConfig, - RPCGasCap: 50000000, + RPCGasCap: 30000000, RPCEVMTimeout: 5 * time.Second, GPO: FullNodeGPO, RPCTxFeeCap: 1, // 1 ether diff --git a/eth/gasestimator/gasestimator.go b/eth/gasestimator/gasestimator.go index 7e9d8125de8c..724e8cbe8981 100644 --- a/eth/gasestimator/gasestimator.go +++ b/eth/gasestimator/gasestimator.go @@ -62,6 +62,9 @@ func Estimate(ctx context.Context, call *core.Message, opts *Options, gasCap uin if call.GasLimit >= params.TxGas { hi = call.GasLimit } + if hi >= params.MaxTxGas { + hi = params.MaxTxGas + } // Normalize the max fee per gas the call is willing to spend. var feeCap *big.Int if call.GasFeeCap != nil { @@ -209,6 +212,9 @@ func execute(ctx context.Context, call *core.Message, opts *Options, gasLimit ui if errors.Is(err, core.ErrIntrinsicGas) { return true, nil, nil // Special case, raise gas limit } + if errors.Is(err, core.ErrGasLimitTooHigh) { + return true, nil, nil // Special case, lower gas limit + } return true, nil, err // Bail out } return result.Failed(), result, nil From 1bb15004a3228ccb617a05053c2e085587ca974a Mon Sep 17 00:00:00 2001 From: Minhyuk Kim Date: Mon, 28 Jul 2025 17:01:45 +0900 Subject: [PATCH 2/4] Use params.MaxTxGas for RPCGasCap --- eth/ethconfig/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index c73553acb732..b19b3a4502b0 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -65,7 +65,7 @@ var Defaults = Config{ Miner: miner.DefaultConfig, TxPool: legacypool.DefaultConfig, BlobPool: blobpool.DefaultConfig, - RPCGasCap: 30000000, + RPCGasCap: params.MaxTxGas, RPCEVMTimeout: 5 * time.Second, GPO: FullNodeGPO, RPCTxFeeCap: 1, // 1 ether From c0f4b07fa4d479b941a0de3cc1dc1a798a69bd6f Mon Sep 17 00:00:00 2001 From: Minhyuk Kim Date: Thu, 31 Jul 2025 11:45:03 +0900 Subject: [PATCH 3/4] Cap maximum gas allowance to EIP-7825 in gas estimates only for osaka --- eth/gasestimator/gasestimator.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/eth/gasestimator/gasestimator.go b/eth/gasestimator/gasestimator.go index 724e8cbe8981..6e79fbd62b0e 100644 --- a/eth/gasestimator/gasestimator.go +++ b/eth/gasestimator/gasestimator.go @@ -62,9 +62,23 @@ func Estimate(ctx context.Context, call *core.Message, opts *Options, gasCap uin if call.GasLimit >= params.TxGas { hi = call.GasLimit } - if hi >= params.MaxTxGas { - hi = params.MaxTxGas + + // Cap the maximum gas allowance according to EIP-7825 if the estimation targets Osaka + if hi > params.MaxTxGas { + blockNumber, blockTime := opts.Header.Number, opts.Header.Time + if opts.BlockOverrides != nil { + if opts.BlockOverrides.Number != nil { + blockNumber = opts.BlockOverrides.Number.ToInt() + } + if opts.BlockOverrides.Time != nil { + blockTime = uint64(*opts.BlockOverrides.Time) + } + } + if opts.Config.IsOsaka(blockNumber, blockTime) { + hi = params.MaxTxGas + } } + // Normalize the max fee per gas the call is willing to spend. var feeCap *big.Int if call.GasFeeCap != nil { From b3eb1b8310a99a56c9b014d76772be31e8c2168a Mon Sep 17 00:00:00 2001 From: Gary Rong Date: Fri, 1 Aug 2025 20:29:23 +0800 Subject: [PATCH 4/4] core/vm, internal/ethapi: fix lint --- eth/ethconfig/config.go | 2 +- internal/ethapi/override/override_test.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index b19b3a4502b0..82c3c500a771 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -65,7 +65,7 @@ var Defaults = Config{ Miner: miner.DefaultConfig, TxPool: legacypool.DefaultConfig, BlobPool: blobpool.DefaultConfig, - RPCGasCap: params.MaxTxGas, + RPCGasCap: 50000000, RPCEVMTimeout: 5 * time.Second, GPO: FullNodeGPO, RPCTxFeeCap: 1, // 1 ether diff --git a/internal/ethapi/override/override_test.go b/internal/ethapi/override/override_test.go index 02a17c133170..41b4f2c25333 100644 --- a/internal/ethapi/override/override_test.go +++ b/internal/ethapi/override/override_test.go @@ -31,6 +31,10 @@ import ( type precompileContract struct{} +func (p *precompileContract) Name() string { + panic("implement me") +} + func (p *precompileContract) RequiredGas(input []byte) uint64 { return 0 } func (p *precompileContract) Run(input []byte) ([]byte, error) { return nil, nil }