Skip to content

Commit

Permalink
bug(tests): fix typos in self-destruct collision test (#608)
Browse files Browse the repository at this point in the history
* fix typo in selfdestruct test

* docs: add changelog.

---------

Co-authored-by: spencer-tb <[email protected]>
  • Loading branch information
winsvega and spencer-tb authored Jun 10, 2024
1 parent 9786d5a commit 5c590c6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Test fixtures for use by clients are available for each release on the [Github r
- ✨ 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)).
- ✨ 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)).
- ✨ 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)).
- 🐞 Fix typos in self-destruct collision test from erroneous pytest parametrization ([#608](https://github.com/ethereum/execution-spec-tests/pull/608)).

### 🛠️ Framework

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,7 @@ def test_dynamic_create2_selfdestruct_collision(
)
@pytest.mark.parametrize(
"call_create2_contract_at_the_end",
[
(True, False),
],
(True, False),
)
def test_dynamic_create2_selfdestruct_collision_two_different_transactions(
env: Environment,
Expand Down Expand Up @@ -374,7 +372,11 @@ def test_dynamic_create2_selfdestruct_collision_two_different_transactions(
post[create2_address] = (
Account(balance=0, nonce=1, code=deploy_code, storage={create2_constructor_worked: 0x00})
if create2_dest_already_in_state and fork >= Cancun
else Account.NONEXISTENT
else (
Account.NONEXISTENT
if call_create2_contract_at_the_end
else Account(balance=1000, nonce=1, code=deploy_code)
)
)

# after Cancun Create2 initcode is only executed if the contract did not already exist
Expand Down Expand Up @@ -419,11 +421,15 @@ def test_dynamic_create2_selfdestruct_collision_two_different_transactions(
else:
# first create2 fails, first calls totally removes the account
# in the second transaction second create2 is successful
sendall_destination_balance += first_call_value + second_create2_value
sendall_destination_balance += first_call_value
if call_create2_contract_at_the_end:
sendall_destination_balance += second_create2_value
else:
# if no account in the state, first create2 successful, first call successful and removes
# because it is removed in the next transaction second create2 successful
sendall_destination_balance = first_create2_value + first_call_value + second_create2_value
sendall_destination_balance = first_create2_value + first_call_value
if call_create2_contract_at_the_end:
sendall_destination_balance += second_create2_value

if call_create2_contract_at_the_end:
sendall_destination_balance += second_call_value
Expand Down

0 comments on commit 5c590c6

Please sign in to comment.