Skip to content

Commit 564b616

Browse files
authored
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 b805772 commit 564b616

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
@@ -1181,7 +1181,13 @@ func doCall(ctx context.Context, b Backend, args TransactionArgs, state *state.S
11811181
// Make sure the context is cancelled when the call has completed
11821182
// this makes sure resources are cleaned up.
11831183
defer cancel()
1184-
return applyMessage(ctx, b, args, state, header, timeout, new(core.GasPool).AddGas(globalGasCap), &blockCtx, &vm.Config{NoBaseFee: true}, precompiles, true)
1184+
gp := new(core.GasPool)
1185+
if globalGasCap == 0 {
1186+
gp.AddGas(math.MaxUint64)
1187+
} else {
1188+
gp.AddGas(globalGasCap)
1189+
}
1190+
return applyMessage(ctx, b, args, state, header, timeout, gp, &blockCtx, &vm.Config{NoBaseFee: true}, precompiles, true)
11851191
}
11861192

11871193
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)