From 4d1264fd0863dbf5796cefbb4a8d92bb504b166a Mon Sep 17 00:00:00 2001 From: Minhyuk Kim Date: Thu, 24 Jul 2025 14:22:19 +0900 Subject: [PATCH] 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 82c3c500a7..c73553acb7 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 7e9d8125de..724e8cbe89 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