Skip to content

feat(test): add intermediate revert sstore test for 8037#7

Merged
spencer-tb merged 1 commit into
spencer-tb:feat/eip-8037-create-tx-failure-intrinsic-refundfrom
fselmo:feat/more-testsgs
May 8, 2026
Merged

feat(test): add intermediate revert sstore test for 8037#7
spencer-tb merged 1 commit into
spencer-tb:feat/eip-8037-create-tx-failure-intrinsic-refundfrom
fselmo:feat/more-testsgs

Conversation

@fselmo
Copy link
Copy Markdown
Collaborator

@fselmo fselmo commented May 7, 2026

  • Extended the test here to more *CALL* opcodes
  • Added intermediate revert test:

Claude summary of new test:

The key dimension only the new test covers: the credit is fully deferred in inner (state_gas_used == 0 there, so applied = 0, pending = sstore_state_gas), then bubbles up via incorporate_child_on_success, and lands on a DIFFERENT charge in middle (middle's own slot-1 SSTORE-set, which has nothing to do with
caller's slot-0 set that the refund is keyed to). Middle then REVERTs.

This is the exact code path the PR's state_gas_refund removal rewrites:

  • Under the dropped logic: middle.state_gas_refund += sstore when the credit applied in incorporate_child_on_success. Middle's REVERT then triggered caller.state_gas_left += middle.state_gas_used + middle.state_gas_left - middle.state_gas_refund, burning sstore at the error boundary even though caller's matching
    set is the one persisting. The user double-paid.
  • Under the new logic: no subtraction. The applied amount stays in middle.state_gas_left and flows to caller via incorporate_child_on_error. Caller's reservoir comes back whole; the matching set in caller stays charged once, as it should.

The other revert tests can't catch this regression: they all have the credit landing in the same frame as its matching charge, so OLD and NEW produce the same answer there. The new test creates the only configuration where the dropped subtraction would have stolen sstore_state_gas from the user's reservoir.



@pytest.mark.with_all_call_opcodes(
selector=lambda call_opcode: call_opcode != Op.STATICCALL
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

It would be nice to be able to do this within the parameterizer in the future

@spencer-tb spencer-tb merged commit 1cd18b8 into spencer-tb:feat/eip-8037-create-tx-failure-intrinsic-refund May 8, 2026
15 of 24 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