From 3cb949f6745c11671efd5952efe67238e9cfde43 Mon Sep 17 00:00:00 2001 From: anshalshukla Date: Wed, 4 Sep 2024 13:12:14 +0530 Subject: [PATCH] fix: avoid capping warnings for gas set by internal system transactions --- internal/ethapi/transaction_args.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/internal/ethapi/transaction_args.go b/internal/ethapi/transaction_args.go index c84dea80b5..a06a499b98 100644 --- a/internal/ethapi/transaction_args.go +++ b/internal/ethapi/transaction_args.go @@ -398,7 +398,18 @@ func (args *TransactionArgs) CallDefaults(globalGasCap uint64, baseFee *big.Int, } args.Gas = (*hexutil.Uint64)(&gas) } else { - if globalGasCap > 0 && globalGasCap < uint64(*args.Gas) { + // Gas set for system calls + systemCallGas := (hexutil.Uint64)(uint64(math.MaxUint64 / 2)) + + gas := globalGasCap + if gas == 0 { + gas = uint64(math.MaxUint64 / 2) + } + if args.Gas != nil && *args.Gas != systemCallGas { + gas = uint64(*args.Gas) + } + + if globalGasCap > 0 && globalGasCap < gas { log.Warn("Caller gas above allowance, capping", "requested", args.Gas, "cap", globalGasCap) args.Gas = (*hexutil.Uint64)(&globalGasCap) }