Skip to content

test_transfer_to_delegated_account_emits_log()

Documentation for tests/amsterdam/eip7708_eth_transfer_logs/test_transfer_logs.py::test_transfer_to_delegated_account_emits_log@87aba1a3.

Generate fixtures for these test cases for Amsterdam with:

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

Test that transfer to EIP-7702 delegated account emits correct log.

The transfer log should show the EOA address as recipient, not the delegation target address.

Source code in tests/amsterdam/eip7708_eth_transfer_logs/test_transfer_logs.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
def test_transfer_to_delegated_account_emits_log(
    state_test: StateTestFiller,
    env: Environment,
    pre: Alloc,
    sender: EOA,
) -> None:
    """
    Test that transfer to EIP-7702 delegated account emits correct log.

    The transfer log should show the EOA address as recipient,
    not the delegation target address.
    """
    delegation_target = pre.deploy_contract(code=Op.STOP)
    recipient = pre.fund_eoa(amount=0, delegation=delegation_target)

    tx = Transaction(
        sender=sender,
        to=recipient,
        value=1,
        expected_receipt=TransactionReceipt(
            logs=[transfer_log(sender, recipient, 1)]
        ),
    )

    post = {recipient: 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.