Skip to content

Comments

feat(rpc-types-eth): add max_used_gas to SimCallResult#3707

Open
gakonst wants to merge 1 commit intomainfrom
mattsse/add-max-used-gas
Open

feat(rpc-types-eth): add max_used_gas to SimCallResult#3707
gakonst wants to merge 1 commit intomainfrom
mattsse/add-max-used-gas

Conversation

@gakonst
Copy link
Member

@gakonst gakonst commented Feb 17, 2026

Summary

Adds optional maxUsedGas field to SimCallResult for eth_simulateV1 responses.

Motivation

Mirrors ethereum/execution-apis#746 and ethereum/go-ethereum#32789.

The maxUsedGas field represents the maximum gas consumed during transaction execution before refunds are applied. This is valuable for DeFi applications that need accurate gas limit estimation for complex transaction sequences (e.g. approve + swap flows), where gasUsed (post-refund) can underestimate the required gas limit.

Changes

  • Added max_used_gas: Option<u64> to SimCallResult in crates/rpc-types-eth/src/simulate.rs
  • Serialized as "maxUsedGas" (camelCase), quantity-encoded, optional (skipped if None)

Prompted by: mattsse

Add optional `maxUsedGas` field to `SimCallResult`, mirroring
ethereum/execution-apis#746 and ethereum/go-ethereum#32789.

This field represents the maximum gas consumed during execution
before refunds are applied, enabling more accurate gas limit
estimation for complex transaction sequences.

Amp-Thread-ID: https://ampcode.com/threads/T-019c6b14-bfd0-71df-bce9-533057940778
Co-authored-by: Amp <[email protected]>
gakonst added a commit to paradigmxyz/reth that referenced this pull request Feb 17, 2026
Wire up the new `max_used_gas` field from alloy SimCallResult:
- For Success: gas_used + gas_refunded (peak gas before refunds)
- For Halt/Revert: same as gas_used (no refunds apply)

Uses patched alloy branch: alloy-rs/alloy#3707

Amp-Thread-ID: https://ampcode.com/threads/T-019c6b14-bfd0-71df-bce9-533057940778
Co-authored-by: Amp <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants