Skip to content

Commit b4a5c3b

Browse files
committed
docs(tests): clarify test_inner_create_fail_refunds_in_creation_tx docstring
Expand the docstring to explicitly reference the geth bal-devnet-3 behavior the test codifies, spell out the regression signal, and justify the `outer_halts` omission by pointing to PR ethereum#2689's `test_creation_tx_failure_preserves_intrinsic_state_gas`.
1 parent e706d04 commit b4a5c3b

1 file changed

Lines changed: 18 additions & 17 deletions

File tree

tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_create.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2115,28 +2115,31 @@ def test_inner_create_fail_refunds_in_creation_tx(
21152115
21162116
The original closed PR #2639 test asserted inner CREATE's
21172117
`GAS_NEW_ACCOUNT` PERSISTS on child failure (targeting a
2118-
bal-devnet-3 geth behavior). PR #2704 subsequently changed the
2119-
spec to refund that charge, inverting the original premise.
2120-
This test covers the CURRENT spec behavior in a scenario not
2121-
exercised by PR #2704's own tests (which all use non-creation
2122-
factories):
2118+
bal-devnet-3 geth behavior where geth incorrectly refunded).
2119+
PR #2704 later changed the spec to refund the charge, which
2120+
codifies what geth was already doing and inverts the original
2121+
test's premise. This test covers the CURRENT spec behavior in
2122+
a scenario not exercised by PR #2704's own tests (which all
2123+
use non-creation factories):
21232124
21242125
A creation tx (to=None) whose initcode performs `num_inner_ops`
21252126
inner CREATE/CREATE2 calls with REVERT initcode. Each inner
21262127
CREATE charges `GAS_NEW_ACCOUNT` state then refunds it via the
21272128
child-error branch (PR #2704). The outer initcode then
21282129
terminates via RETURN (succeeds) or REVERT.
21292130
2130-
Both outcomes yield `block_state = outer intrinsic` because
2131-
inner refunds net the state gas back to zero; PR #2689's top
2132-
level refund (applied on revert) is a no-op over an already
2133-
zeroed `state_gas_used`.
2131+
Both outcomes yield `block_state = outer intrinsic` because inner
2132+
refunds net the state gas back to zero; PR #2689's top-level
2133+
refund (applied on revert) is a no-op over an already-zeroed
2134+
`state_gas_used`. A client regressing to the pre-#2704 "persist"
2135+
behavior would inflate `block_state` by
2136+
`num_inner_ops * GAS_NEW_ACCOUNT` and fail both variants.
21342137
2135-
A client that regresses to the pre-#2704 "persist" behavior
2136-
would inflate `block_state` by `num_inner_ops * GAS_NEW_ACCOUNT`.
2137-
The `outer_halts` variant is omitted because `INVALID` absorbs
2138-
all remaining gas into `regular_gas_used`, letting `block_regular`
2139-
dominate the header and dilute the state dimension signal.
2138+
The `outer_halts` variant is omitted: INVALID absorbs remaining
2139+
gas into `regular_gas_used`, making `block_regular` dominate the
2140+
header and dilute the state-dimension signal. PR #2689's
2141+
`test_creation_tx_failure_preserves_intrinsic_state_gas` already
2142+
covers the creation-tx + top-level halt interaction.
21402143
"""
21412144
gas_costs = fork.gas_costs()
21422145
outer_state_gas = fork.create_state_gas(code_size=0)
@@ -2158,10 +2161,8 @@ def test_inner_create_fail_refunds_in_creation_tx(
21582161

21592162
if outer_outcome == "succeeds":
21602163
termination = Op.RETURN(0, 0)
2161-
elif outer_outcome == "reverts":
2162-
termination = Op.REVERT(0, 0)
21632164
else:
2164-
termination = Op.INVALID
2165+
termination = Op.REVERT(0, 0)
21652166

21662167
initcode = setup + inner_ops + termination
21672168

0 commit comments

Comments
 (0)