Commit 136312e
committed
feat(tests): CREATE failure refunds account state gas to reservoir
Adds six tests in `test_state_gas_create.py` covering every failure
branch in `generic_create` (silent failure, address collision, child
revert, child exceptional halt, code deposit OOG) plus block level
accounting with a mixed success and failure transaction:
test_create_silent_failure_refunds_state_gas
test_create_child_revert_refunds_state_gas
test_create_child_halt_refunds_state_gas
test_create_mixed_success_and_failure_block_accounting
test_create_collision_refunds_state_gas
test_create_code_deposit_oog_refunds_state_gas
All six are strict discriminators of the spec change (24 out of 24
variants fail when the refund is reverted, all pass when applied).
Tests that depend on a narrow gas window (child halt, collision,
code deposit OOG) use a caller wrapper with tight gas tuning so the
probe SSTORE can only succeed via the refunded reservoir. Tests that
verify block header `gas_used` compute the expected value as
`max(tx_regular, tx_state)` defensively from
`factory_code.gas_cost(fork)` so the assertion stays correct if the
underlying constants drift.
Adds `init_code_at_high_bytes` helper to `spec.py` for placing short
init code at the high bytes of a 32 byte memory slot, shared across
the new tests.
Removes `test_code_deposit_oog_reservoir_inflation_detection`
because the new refund behavior intentionally inflates the parent
reservoir on child failure, swamping the ordering signal that test
relied on. Code deposit ordering remains covered by
`test_create_oog_reservoir_inflation_detection`.1 parent 2be49b2 commit 136312e
3 files changed
Lines changed: 443 additions & 78 deletions
File tree
- tests/amsterdam/eip8037_state_creation_gas_cost_increase
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
5 | 16 | | |
6 | 17 | | |
7 | 18 | | |
| |||
0 commit comments