Skip to content

fix(rpc): eth_call over-reports gas for native precompiles#1183

Open
mmsqe wants to merge 10 commits into
cosmos:mainfrom
mmsqe:fix_estimate_main
Open

fix(rpc): eth_call over-reports gas for native precompiles#1183
mmsqe wants to merge 10 commits into
cosmos:mainfrom
mmsqe:fix_estimate_main

Conversation

@mmsqe

@mmsqe mmsqe commented May 14, 2026

Copy link
Copy Markdown
Collaborator

Description

Closes: #1182


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • tackled an existing issue or discussed with a team member
  • left instructions on how to review the changes
  • targeted the main branch

* buildTraceCtx installs a finite gas meter so OOM is detected past gasLimit
* preserves KvGasConfig only when to is native precompile, so cosmos state ops charge same as EthCall, pure-EVM keeps KV zeroed for SLOAD/SSTORE
* add recover for cosmos meter OOM panics as "raise gas" signals for binary search
@mmsqe mmsqe requested a review from a team as a code owner May 14, 2026 04:50
@greptile-apps

greptile-apps Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

PR author is not in the allowed authors list.

@codecov

codecov Bot commented May 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.96%. Comparing base (008c171) to head (600327e).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1183      +/-   ##
==========================================
- Coverage   66.99%   66.96%   -0.03%     
==========================================
  Files         320      320              
  Lines       23433    23434       +1     
==========================================
- Hits        15698    15692       -6     
- Misses       6578     6583       +5     
- Partials     1157     1159       +2     
Files with missing lines Coverage Δ
x/vm/keeper/grpc_query.go 85.14% <100.00%> (+0.02%) ⬆️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mmsqe mmsqe changed the title fix(rpc): eth_estimateGas under-reports gas for native precompiles fix(rpc): eth_call over-reports gas for native precompiles May 15, 2026
@aljo242

aljo242 commented May 26, 2026

Copy link
Copy Markdown
Contributor

two quick fixes before merge:

  1. CHANGELOG.md: entry links to #1182 (the issue) instead of #1183 (this pr). should be [\#1183](https://github.com/cosmos/evm/pull/1183).

  2. grpc_query_test.go: TestBuildTraceCtxZeroesKVGasConfig tests buildTraceCtx, not the actual fix. the new BuildEvmExecutionCtx call in EthCall has no direct test. ideally add an integration test that calls EthCall against a native precompile and confirms the returned gas matches deliverTx.

@aljo242 aljo242 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changelog links to wrong PR number; EthCall fix has no direct test coverage.

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.

[Bug]: eth_call over-reports gas for native precompiles

3 participants