Skip to content

Commit 5c590c6

Browse files
winsvegaspencer-tb
andauthored
bug(tests): fix typos in self-destruct collision test (#608)
* fix typo in selfdestruct test * docs: add changelog. --------- Co-authored-by: spencer-tb <[email protected]>
1 parent 9786d5a commit 5c590c6

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

docs/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Test fixtures for use by clients are available for each release on the [Github r
1818
- ✨ Add tests for [EIP-7685: General purpose execution layer requests](https://eips.ethereum.org/EIPS/eip-7685) ([#530](https://github.com/ethereum/execution-spec-tests/pull/530)).
1919
- ✨ Add tests for [EIP-2935: Serve historical block hashes from state](https://eips.ethereum.org/EIPS/eip-2935) ([#564](https://github.com/ethereum/execution-spec-tests/pull/564)).
2020
- ✨ Add tests for [EIP-4200: EOF - Static relative jumps](https://eips.ethereum.org/EIPS/eip-4200) ([#581](https://github.com/ethereum/execution-spec-tests/pull/581)).
21+
- 🐞 Fix typos in self-destruct collision test from erroneous pytest parametrization ([#608](https://github.com/ethereum/execution-spec-tests/pull/608)).
2122

2223
### 🛠️ Framework
2324

tests/cancun/eip6780_selfdestruct/test_dynamic_create2_selfdestruct_collision.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,7 @@ def test_dynamic_create2_selfdestruct_collision(
235235
)
236236
@pytest.mark.parametrize(
237237
"call_create2_contract_at_the_end",
238-
[
239-
(True, False),
240-
],
238+
(True, False),
241239
)
242240
def test_dynamic_create2_selfdestruct_collision_two_different_transactions(
243241
env: Environment,
@@ -374,7 +372,11 @@ def test_dynamic_create2_selfdestruct_collision_two_different_transactions(
374372
post[create2_address] = (
375373
Account(balance=0, nonce=1, code=deploy_code, storage={create2_constructor_worked: 0x00})
376374
if create2_dest_already_in_state and fork >= Cancun
377-
else Account.NONEXISTENT
375+
else (
376+
Account.NONEXISTENT
377+
if call_create2_contract_at_the_end
378+
else Account(balance=1000, nonce=1, code=deploy_code)
379+
)
378380
)
379381

380382
# after Cancun Create2 initcode is only executed if the contract did not already exist
@@ -419,11 +421,15 @@ def test_dynamic_create2_selfdestruct_collision_two_different_transactions(
419421
else:
420422
# first create2 fails, first calls totally removes the account
421423
# in the second transaction second create2 is successful
422-
sendall_destination_balance += first_call_value + second_create2_value
424+
sendall_destination_balance += first_call_value
425+
if call_create2_contract_at_the_end:
426+
sendall_destination_balance += second_create2_value
423427
else:
424428
# if no account in the state, first create2 successful, first call successful and removes
425429
# because it is removed in the next transaction second create2 successful
426-
sendall_destination_balance = first_create2_value + first_call_value + second_create2_value
430+
sendall_destination_balance = first_create2_value + first_call_value
431+
if call_create2_contract_at_the_end:
432+
sendall_destination_balance += second_create2_value
427433

428434
if call_create2_contract_at_the_end:
429435
sendall_destination_balance += second_call_value

0 commit comments

Comments
 (0)