ethapi: deref gasUsed pointer in eth_simulate log (#33192)

Show the actual gas used in the block limit error so RPC clients see
useful numbers.
This commit is contained in:
David Klank 2025-11-15 16:04:21 +02:00 committed by Alvarez
parent 4fbfa0cc1b
commit 6f44b29696

View file

@ -377,7 +377,7 @@ func (sim *simulator) sanitizeCall(call *TransactionArgs, state vm.StateDB, head
call.Gas = (*hexutil.Uint64)(&remaining) call.Gas = (*hexutil.Uint64)(&remaining)
} }
if *gasUsed+uint64(*call.Gas) > blockContext.GasLimit { if *gasUsed+uint64(*call.Gas) > blockContext.GasLimit {
return &blockGasLimitReachedError{fmt.Sprintf("block gas limit reached: %d >= %d", gasUsed, blockContext.GasLimit)} return &blockGasLimitReachedError{fmt.Sprintf("block gas limit reached: %d >= %d", *gasUsed, blockContext.GasLimit)}
} }
if err := call.CallDefaults(sim.gp.Gas(), header.BaseFee, sim.chainConfig.ChainID); err != nil { if err := call.CallDefaults(sim.gp.Gas(), header.BaseFee, sim.chainConfig.ChainID); err != nil {
return err return err