Test SELFDESTRUCT Finalization¶
Documentation for tests/cancun/eip6780_selfdestruct/test_selfdestruct_finalization.py@49633827.
Generate fixtures for these test cases for Amsterdam with:
fill -v tests/cancun/eip6780_selfdestruct/test_selfdestruct_finalization.py --fork Amsterdam
What is left of a contract that self-destructs in the transaction that created it.
Tests for EIP-6780: SELFDESTRUCT only in same transaction.
Such a contract may self-destruct more than once, and may receive more value afterwards. At the end of the transaction, before EIP-8246 the account is deleted and any balance it still holds is burned; from EIP-8246 on its nonce, code and storage are cleared but the balance stays, leaving a balance-only account behind.
Test Functions Overview¶
| Name | Type | Cases (Amsterdam) | Description |
|---|---|---|---|
test_recreate_in_later_block |
blockchain_test | 2 | A contract is created and self-destructs in one block, then the same |
test_selfdestruct_clears_nonce_and_storage |
state_test | 12 | Cases 13-16 of the EIP-8246 test list: a contract created in this |
test_selfdestruct_in_delegate_context |
state_test | 8 | The account destroyed is the one whose context runs SELFDESTRUCT, not |
test_selfdestruct_sequences |
state_test | 48 | Cases 1-12 of the EIP-8246 test list: a contract created in this |
test_selfdestruct_static_context_same_tx |
state_test | 4 | SELFDESTRUCT to self inside a static call aborts the frame, so the |
test_selfdestruct_to_self_keeps_existing_balance |
state_test | 2 | A contract is created at an address that already held a balance, with |