Skip to content

Commit

Permalink
fix: avoid capping warnings for gas set by internal system transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
anshalshukla committed Sep 4, 2024
1 parent 693d8ae commit 3cb949f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion internal/ethapi/transaction_args.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 3cb949f

Please sign in to comment.