Skip to content

fix(rpc): match reth for eth_estimateGas gas caps - #7739

Draft
LesnyRumcajs wants to merge 1 commit into
mainfrom
eth-estimate-gas-reth-parity
Draft

LesnyRumcajs wants to merge 1 commit into
mainfrom
eth-estimate-gas-reth-parity

Conversation

@LesnyRumcajs

Copy link
Copy Markdown
Member

Summary of changes

Changes introduced in this pull request:

  1. Fees are always zero during estimation. A sender that can't pay gas fees still gets an estimate, with or without gas.
  2. Calls that revert unless given more gas are searched past even without gas, where before they returned 3. The trace-based out-of-gas check is gone.
  3. The margin is checked. The result is min(found × 1.25, cap) and is re-run. If a contract that checks gasleft() fails with the margin, the tested limit is returned. The result never exceeds the block gas limit.
  4. A price now limits the estimate. The price is maxFeePerGas if sent, otherwise gasPrice; zero means no price. The cap becomes min(gas, (balance − value) / price), with the balance read from the state after the requested tipset. New errors:
    • value > balance: -32003 insufficient funds for gas * price + value: have B want V
    • nothing affordable (including empty contract or non-existent senders): -32000 gas required exceeds allowance (0)
  5. Out of gas at the block gas limit returns -32003 out of gas: gas required exceeds: L for every sender. Before, it was 2, or 3 for contract and non-existent senders.
  6. Sending both a non-zero gasPrice and maxFeePerGas returns -32602. A zero gasPrice counts as absent, because Lotus clients always send gasPrice.
  7. maxFeePerGas is now accepted in EthCallMessage. This changes the OpenRPC snapshots.

Reference issue to close (if applicable)

Closes

Other information and links

Pulls gaps from filecoin-project/lotus#13911

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

Outside contributions

  • This pull request is based on an issue that a maintainer has accepted (see Before Opening a Pull Request).
  • I have read and agree to the CONTRIBUTING document.
  • I have read and agree to the AI Policy document. I understand that failure to comply with the guidelines will lead to rejection of the pull request.

@coderabbitai

coderabbitai Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@LesnyRumcajs LesnyRumcajs added the RPC requires calibnet RPC checks to run on CI label Oct 9, 2026
@LesnyRumcajs
LesnyRumcajs force-pushed the eth-estimate-gas-reth-parity branch from 6e7e3d9 to 2fc07c6 Compare October 9, 2026 16:07
@LesnyRumcajs
LesnyRumcajs force-pushed the eth-estimate-gas-reth-parity branch from 2fc07c6 to 3f7a818 Compare October 9, 2026 16:17

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RPC requires calibnet RPC checks to run on CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant