Skip to content

fix(kona): spend all gas on precompile halt in fpvm provider#21634

Merged
wwared merged 1 commit into
developfrom
fix/kona-precompile-halt-spend-all
Jul 7, 2026
Merged

fix(kona): spend all gas on precompile halt in fpvm provider#21634
wwared merged 1 commit into
developfrom
fix/kona-precompile-halt-spend-all

Conversation

@wwared

@wwared wwared commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What

Follow-up to #21582. The fpvm precompile provider's hand-rolled run left all gas as remaining when a precompile halts, unlike revm's precompile_output_to_interpreter_result, which spend_all()s on the not-success-or-revert path (revm-handler 20.0.3, precompile_provider.rs#L111). Align the halt branch by spending all gas.

Why

Keeps the FPVM aligned with op-reth by construction. This is currently unobservable — on a non-ok-or-revert result the caller frame and the top-level handler discard the callee's remaining gas and force-consume the forwarded/limit gas anyway — so it's hardening, not a consensus fix, matching the spirit of #21582.

Test

test_run_halting_precompile_spends_all_gas registers a mock accelerated precompile that halts and asserts run returns PrecompileOOG with all gas spent. Red without the fix (remaining == gas_limit), green with it.

Follow-up to #21582. The fpvm precompile provider's hand-rolled run left
all gas as remaining on a precompile halt, unlike revm's
precompile_output_to_interpreter_result (which spend_all()s on the
not-success-or-revert path). Align the halt branch by spending all gas.

Currently unobservable: on a non-ok-or-revert result the caller frame and
top-level handler discard the callee's remaining gas and force-consume the
forwarded/limit gas anyway. This keeps the FPVM aligned with op-reth by
construction rather than relying on that downstream behavior.

test_run_halting_precompile_spends_all_gas registers a mock accelerated
precompile that halts and asserts run returns PrecompileOOG with all gas
spent. Red without the fix (remaining == gas_limit), green with it.
@wwared wwared requested a review from a team as a code owner July 7, 2026 19:48

@ajsutton ajsutton 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.

LGTM.

@wwared wwared enabled auto-merge July 7, 2026 20:04
@wwared wwared added this pull request to the merge queue Jul 7, 2026
Merged via the queue into develop with commit 4cdfbce Jul 7, 2026
134 checks passed
@wwared wwared deleted the fix/kona-precompile-halt-spend-all branch July 7, 2026 20:58
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