Skip to content

test_set_code_multiple_valid_authorization_tuples_same_signer_increasing_nonce()

Documentation for tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_set_code_multiple_valid_authorization_tuples_same_signer_increasing_nonce@343274cc.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_set_code_multiple_valid_authorization_tuples_same_signer_increasing_nonce --fork Amsterdam

Test setting the code of an account with multiple authorization tuples from the same signer and each authorization tuple has an increasing nonce, therefore the last tuple is executed.

Source code in tests/prague/eip7702_set_code_tx/test_set_code_txs.py
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
@pytest.mark.xdist_group(name="bigmem")
def test_set_code_multiple_valid_authorization_tuples_same_signer_increasing_nonce(  # noqa: E501
    state_test: StateTestFiller,
    pre: Alloc,
) -> None:
    """
    Test setting the code of an account with multiple authorization tuples from
    the same signer and each authorization tuple has an increasing nonce,
    therefore the last tuple is executed.
    """
    auth_signer = pre.fund_eoa(auth_account_start_balance)

    tuple_count = 10

    success_slot = tuple_count - 1

    addresses = [
        pre.deploy_contract(Op.SSTORE(i, 1) + Op.STOP)
        for i in range(tuple_count)
    ]

    tx = Transaction(
        to=auth_signer,
        value=0,
        authorization_list=[
            AuthorizationTuple(
                address=address,
                nonce=i,
                signer=auth_signer,
            )
            for i, address in enumerate(addresses)
        ],
        sender=pre.fund_eoa(),
    )

    state_test(
        env=Environment(),
        pre=pre,
        tx=tx,
        post={
            auth_signer: Account(
                nonce=10,
                code=Spec.delegation_designation(addresses[success_slot]),
                storage={
                    success_slot: 1,
                },
            ),
        },
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 3 forks.