From f2e13c7e333fb9c27bcee62fe18177989c365840 Mon Sep 17 00:00:00 2001 From: Sina M <1591639+s1na@users.noreply.github.com> Date: Tue, 24 Sep 2024 13:14:38 +0200 Subject: [PATCH] internal/ethapi: fix gascap 0 for eth_simulateV1 (#30496) Similar to #30474. --- internal/ethapi/api.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 8c38d7d037..7981f35ae3 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1289,13 +1289,17 @@ func (api *BlockChainAPI) SimulateV1(ctx context.Context, opts simOpts, blockNrO if state == nil || err != nil { return nil, err } + gasCap := api.b.RPCGasCap() + if gasCap == 0 { + gasCap = math.MaxUint64 + } sim := &simulator{ b: api.b, state: state, base: base, chainConfig: api.b.ChainConfig(), // Each tx and all the series of txes shouldn't consume more gas than cap - gp: new(core.GasPool).AddGas(api.b.RPCGasCap()), + gp: new(core.GasPool).AddGas(gasCap), traceTransfers: opts.TraceTransfers, validate: opts.Validation, fullTx: opts.ReturnFullTransactions,