From 4b5b1cb17bfebe2932ac81707e2e861ee65fe99d Mon Sep 17 00:00:00 2001 From: rhovian Date: Mon, 29 Sep 2025 14:24:19 -0600 Subject: [PATCH 1/2] init max gas --- internal/ethapi/simulate.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/ethapi/simulate.go b/internal/ethapi/simulate.go index 75b5c5ffa8..327ae4df57 100644 --- a/internal/ethapi/simulate.go +++ b/internal/ethapi/simulate.go @@ -59,6 +59,7 @@ type simCallResult struct { ReturnValue hexutil.Bytes `json:"returnData"` Logs []*types.Log `json:"logs"` GasUsed hexutil.Uint64 `json:"gasUsed"` + MaxUsedGas hexutil.Uint64 `json:"maxUsedGas"` Status hexutil.Uint64 `json:"status"` Error *callError `json:"error,omitempty"` } @@ -304,7 +305,7 @@ func (sim *simulator) processBlock(ctx context.Context, block *simBlock, header, receipts[i] = core.MakeReceipt(evm, result, sim.state, blockContext.BlockNumber, common.Hash{}, blockContext.Time, tx, gasUsed, root) blobGasUsed += receipts[i].BlobGasUsed logs := tracer.Logs() - callRes := simCallResult{ReturnValue: result.Return(), Logs: logs, GasUsed: hexutil.Uint64(result.UsedGas)} + callRes := simCallResult{ReturnValue: result.Return(), Logs: logs, GasUsed: hexutil.Uint64(result.UsedGas), MaxUsedGas: *call.Gas} if result.Failed() { callRes.Status = hexutil.Uint64(types.ReceiptStatusFailed) if errors.Is(result.Err, vm.ErrExecutionReverted) { From 44903622457d41af9955423f15bea2759731403d Mon Sep 17 00:00:00 2001 From: rhovian Date: Sat, 31 Jan 2026 16:43:20 -0700 Subject: [PATCH 2/2] use applyMessageWithEVM result for maxGasUsed --- internal/ethapi/simulate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/ethapi/simulate.go b/internal/ethapi/simulate.go index 2dcc94e09c..ce94c16ef4 100644 --- a/internal/ethapi/simulate.go +++ b/internal/ethapi/simulate.go @@ -305,7 +305,7 @@ func (sim *simulator) processBlock(ctx context.Context, block *simBlock, header, receipts[i] = core.MakeReceipt(evm, result, sim.state, blockContext.BlockNumber, common.Hash{}, blockContext.Time, tx, gasUsed, root) blobGasUsed += receipts[i].BlobGasUsed logs := tracer.Logs() - callRes := simCallResult{ReturnValue: result.Return(), Logs: logs, GasUsed: hexutil.Uint64(result.UsedGas), MaxUsedGas: *call.Gas} + callRes := simCallResult{ReturnValue: result.Return(), Logs: logs, GasUsed: hexutil.Uint64(result.UsedGas), MaxUsedGas: hexutil.Uint64(result.MaxUsedGas)} if result.Failed() { callRes.Status = hexutil.Uint64(types.ReceiptStatusFailed) if errors.Is(result.Err, vm.ErrExecutionReverted) {