Repository navigation
Conversation
Geth reports cost 0 for the failing step of an exceptional halt since ethereum/go-ethereum#36166 (44577c84), as ethereum/execution-apis#986 proposes: the attempted cost depends on where each client detects the failure. evm2 reported the gas it had charged, or all the gas left on out of gas (alloy-rs#1102, item 1). Struct logs now report `gasCost` 0 and no `stateGasCost` on a step with an error. In the JS tracer, the hook that reports the halt sees cost 0: `step` for a halt before the opcode runs, `fault` for one while it runs. REVERT and the Parity `vmTrace` costs do not change. Co-authored-by: Mablr <59505383+mablr@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a1f9ae-ff93-76bf-aa19-45fd3b65cb83
mablr
requested review from
DaniPopes,
mattsse,
onbjerg and
rakita
as code owners
November 20, 2026 17:13
mattsse
approved these changes
Nov 21, 2026
mattsse
left a comment
Member
There was a problem hiding this comment.
Matches geth after go-ethereum#36166: an exceptional halt reports cost 0 (and no stateGasCost) in the struct logger and the JS fault hook, while the preceding step keeps the opcode's cost. Pushed a test assertion for that step cost; RETURNDATACOPY reports 3 there where geth reports 9, a pre-existing ordering difference documented in the test.
This branch was previously deployed
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.
Since ethereum/go-ethereum#36166 (
44577c84), geth reports cost 0 for the step of an exceptional halt, as ethereum/execution-apis#986 proposes: the attempted cost depends on where each client detects the failure. evm2 reported the gas it had charged before the check, or all the gas left on out of gas. This is item 1 of #1102.Struct logs now report
gasCost0 and omitstateGasCoston a step with an error. In the JS tracer, the hook that reports the halt seeslog.getCost()0:stepfor a halt before the opcode runs (stack checks, out of gas, static CREATE, SSTORE, SELFDESTRUCT and CALL with value), andfaultfor one while it runs (JUMP, RETURNDATACOPY, INVALID, static LOG and TSTORE). Astepbefore afaultkeeps the opcode's cost, as in geth. REVERT, the ParityvmTracecosts and the opcode gas inspector do not change.44577c84mainfaulthook)The new test checks both tracers on these cases and on cold CALL out of gas, PUSH0 overflow, EXTCODESIZE underflow, RETURNDATACOPY out of bounds and LOG0 and SELFDESTRUCT in a static call, with values from
debug_traceTransactionon geth44577c84. It fails onmain. I also ran #859's harness against geth44577c84binaries on its corpus (342 case and fork pairs): struct loggasCostdifferences go from 127 to 0, and no new difference appears. In Amsterdam CREATE out of state gas, geth callsstepwith the cost and thenfault, while evm2 callsstepwith the error. That classification difference was there before and is not part of this PR.This overlaps #1110 in
crates/inspectors/src/tracing/js/mod.rs, so whichever lands second needs a small rebase. With both, the DUPN, SWAPN and EXCHANGE faults of #1110 report cost 0 through this change.