Skip to content

test_selfdestruct_to_system_address()

Documentation for tests/amsterdam/eip7708_eth_transfer_logs/test_transfer_logs.py::test_selfdestruct_to_system_address@5c024cbb.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip7708_eth_transfer_logs/test_transfer_logs.py::test_selfdestruct_to_system_address --fork Amsterdam

Test SELFDESTRUCT sending ETH to the EIP-7708 system address.

Edge case: beneficiary is the same address (0xff...fe) that emits logs.

Source code in tests/amsterdam/eip7708_eth_transfer_logs/test_transfer_logs.py
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
def test_selfdestruct_to_system_address(
    state_test: StateTestFiller,
    env: Environment,
    pre: Alloc,
    sender: EOA,
    fork: Fork,
) -> None:
    """
    Test SELFDESTRUCT sending ETH to the EIP-7708 system address.

    Edge case: beneficiary is the same address (0xff...fe) that emits logs.
    """
    contract_code = Op.SELFDESTRUCT(Spec.SYSTEM_ADDRESS)
    contract = pre.deploy_contract(contract_code, balance=1)

    tx = Transaction(
        sender=sender,
        to=contract,
        value=0,
        expected_receipt=TransactionReceipt(
            logs=[transfer_log(contract, Spec.SYSTEM_ADDRESS, 1)]
        ),
    )

    post = {Spec.SYSTEM_ADDRESS: Account(balance=1)}
    state_test(env=env, pre=pre, post=post, tx=tx)

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.