Skip to content

feat: allow eth_call overrides work with static precompiles#1096

Merged
vladjdk merged 1 commit intocosmos:mainfrom
mmsqe:static_override_main
Apr 23, 2026
Merged

feat: allow eth_call overrides work with static precompiles#1096
vladjdk merged 1 commit intocosmos:mainfrom
mmsqe:static_override_main

Conversation

@mmsqe
Copy link
Copy Markdown
Collaborator

@mmsqe mmsqe commented Apr 1, 2026

Description

for test info


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

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.80%. Comparing base (f93d05c) to head (5141af7).
⚠️ Report is 17 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1096      +/-   ##
==========================================
+ Coverage   63.24%   65.80%   +2.56%     
==========================================
  Files         332      332              
  Lines       23969    23749     -220     
==========================================
+ Hits        15160    15629     +469     
+ Misses       7173     6952     -221     
+ Partials     1636     1168     -468     
Files with missing lines Coverage Δ
x/vm/keeper/state_transition.go 85.71% <100.00%> (+0.21%) ⬆️

... and 20 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.

@vladjdk
Copy link
Copy Markdown
Member

vladjdk commented Apr 23, 2026

@greptile review

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 23, 2026

Greptile Summary

This PR fixes eth_call state overrides (specifically MovePrecompileTo) when targeting cosmos-specific static precompiles (e.g. the distribution precompile), which were previously invisible to the override logic because vm.ActivePrecompiledContracts(rules) only returns the standard go-ethereum precompile set. The fix inserts the keeper's active static precompiles into the map before calling overrides.Apply() and evm.WithPrecompiles().

Confidence Score: 5/5

Safe to merge; the change is small, targeted, and correct.

The only finding is a P2 test coverage gap — the new test case verifies absence of errors but does not call the moved precompile at its destination address. No logic, security, or data-integrity issues were found in the production code path.

tests/integration/x/vm/test_state_transition.go — test could be strengthened to assert the moved precompile is callable.

Important Files Changed

Filename Overview
x/vm/keeper/state_transition.go Adds cosmos active static precompiles to the overrides precompile map so MovePrecompileTo works on them; logic is sound and minimal.
tests/integration/x/vm/test_state_transition.go New test case covers happy-path (no error) but does not assert that the moved precompile is callable at the destination address.
CHANGELOG.md Entry added under the correct section for the new feature.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["ApplyMessageWithConfig (overrides != nil)"] --> B["vm.ActivePrecompiledContracts(rules)\nstandard EVM precompiles map"]
    A --> C["k.GetParams(ctx)\nActiveStaticPrecompiles"]
    C --> D["for each activeStaticPrecompile\nlook up in k.precompiles"]
    D --> E["add to precompiles map"]
    B --> E
    E --> F["overrides.Apply(stateDB, precompiles)\nvalidates MovePrecompileTo against map\nmutates: delete old addr, add new addr"]
    F --> G["evm.WithPrecompiles(precompiles)\nEVM sees standard + cosmos precompiles\nat potentially moved addresses"]
Loading

Reviews (1): Last reviewed commit: "feat: allow eth_call overrides work with..." | Re-trigger Greptile

Comment thread tests/integration/x/vm/test_state_transition.go
@vladjdk vladjdk added this pull request to the merge queue Apr 23, 2026
Merged via the queue into cosmos:main with commit f69dcdc Apr 23, 2026
19 checks passed
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.

2 participants