fix(kona): spend all gas on precompile halt in fpvm provider#21634
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Follow-up to #21582. The fpvm precompile provider's hand-rolled
runleft all gas asremainingwhen a precompile halts, unlike revm'sprecompile_output_to_interpreter_result, whichspend_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_gasregisters a mock accelerated precompile that halts and assertsrunreturnsPrecompileOOGwith all gas spent. Red without the fix (remaining == gas_limit), green with it.