Skip to content

fix(rpc): keep omitted-gas calls within the RPC gas cap (v2.5.2 backport) - #46

Merged
haardikk21 merged 1 commit into
backport/v2.5.2/mainfrom
backport/v2.5.2/rpc-gascap-omitted-gas
Nov 25, 2026
Merged

haardikk21 merged 1 commit into
backport/v2.5.2/mainfrom
backport/v2.5.2/rpc-gascap-omitted-gas

Conversation

@haardikk21

Copy link
Copy Markdown

Why

Backports paradigmxyz#27586 (upstream commit 5b68630) onto backport/v2.5.2/main for the Base releases/v1.5.x line.

When a priced call (eth_call, trace_call, and related methods) omits gas, the request gas limit is first set to --rpc.gascap. It is then replaced by the caller's gas allowance (balance / gas price), capped only by the block gas limit. The allowance can be far larger than the RPC gas cap, so callers can get past the cap and drive excessive execution and memory use.

releases/v2.8.1, the fork line pinned by base/base main and releases/v1.6.0, already contains the upstream fix. The base-v2.5.2.* line used by releases/v1.5.x does not.

What

Cherry-picked with -x, upstream authorship kept. The production change in crates/rpc/rpc-eth-api/src/helpers/call.rs applied cleanly and matches upstream: when an RPC gas cap is set, the allowance is clamped to the gas limit already capped by the RPC gas cap.

The only conflict was in the crates/rpc/rpc/src/eth/core.rs test module. The upstream hunk also carried tests from upstream PRs that are not on v2.5.2 (estimate_gas_* from paradigmxyz#27384, header size from later PRs). Only the new call_allowance_respects_rpc_gas_cap test is kept, unchanged. Two additions support it: the build_test_eth_api_with_gas_cap helper (from paradigmxyz#27384) and the imports the test needs.

Testing

  • cargo +1.96.0 test -p reth-rpc --lib -- eth::core::tests: 9 passed, including call_allowance_respects_rpc_gas_cap.
  • With the production change reverted, the new test fails (left: 78998, right: 28998). It catches the bypassed cap.
  • cargo +1.96.0 clippy -p reth-rpc -p reth-rpc-eth-api --lib --tests --locked -- -D warnings: clean.
  • cargo +nightly fmt --check: clean.

Notes

Not tagged yet. After merge, the next tag in the series is base-v2.5.2.12.

…27586)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>

(cherry picked from commit 5b68630)
Co-authored-by: Toshi <toshi-noreply@coinbase.com>
@haardikk21
haardikk21 merged commit c7fb401 into backport/v2.5.2/main Nov 25, 2026
10 of 12 checks passed
haardikk21 added a commit to base/base that referenced this pull request Nov 25, 2026
….7 (#6733)

* fix(deps): backport reth omitted-gas RPC gas cap fix (#27586)

Moves the reth pin on releases/v1.5.7 to base/reth#46, which cherry-picks
paradigmxyz/reth#27586 onto backport/v2.5.2/main.

Co-authored-by: Toshi <toshi-noreply@coinbase.com>

* chore(deps): pin base/reth to base-v2.5.2.12

Co-authored-by: Toshi <toshi-noreply@coinbase.com>

---------

Co-authored-by: Toshi <toshi-noreply@coinbase.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants