Skip to content

Commit 8a369f5

Browse files
jwasingerziogaschr
authored andcommitted
internal/ethapi/api: for simulated calls, set gaspool to max value if global gascap is 0 (#30474)
In #27720, we introduced RPC global gas cap. A value of `0` means an unlimited gas cap. However, this was not the case for simulated calls. This PR fixes the behaviour.
1 parent 7dcc4de commit 8a369f5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal/ethapi/api.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,13 @@ func doCall(ctx context.Context, b Backend, args TransactionArgs, state *state.S
12871287
// Make sure the context is cancelled when the call has completed
12881288
// this makes sure resources are cleaned up.
12891289
defer cancel()
1290-
return applyMessage(ctx, b, args, state, header, timeout, new(core.GasPool).AddGas(globalGasCap), &blockCtx, &vm.Config{NoBaseFee: true}, precompiles, true)
1290+
gp := new(core.GasPool)
1291+
if globalGasCap == 0 {
1292+
gp.AddGas(math.MaxUint64)
1293+
} else {
1294+
gp.AddGas(globalGasCap)
1295+
}
1296+
return applyMessage(ctx, b, args, state, header, timeout, gp, &blockCtx, &vm.Config{NoBaseFee: true}, precompiles, true)
12911297
}
12921298

12931299
func applyMessage(ctx context.Context, b Backend, args TransactionArgs, state *state.StateDB, header *types.Header, timeout time.Duration, gp *core.GasPool, blockContext *vm.BlockContext, vmConfig *vm.Config, precompiles vm.PrecompiledContracts, skipChecks bool) (*core.ExecutionResult, error) {

0 commit comments

Comments
 (0)