Skip to content

test_set_code_multiple_valid_authorization_tuples_same_signer_increasing_nonce_self_sponsored()

Documentation for tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_set_code_multiple_valid_authorization_tuples_same_signer_increasing_nonce_self_sponsored@892e6d1e.

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_self_sponsored --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, and the transaction is self-sponsored.

Source code in tests/prague/eip7702_set_code_tx/test_set_code_txs.py
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
@pytest.mark.xdist_group(name="bigmem")
def test_set_code_multiple_valid_authorization_tuples_same_signer_increasing_nonce_self_sponsored(  # 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, and the transaction is
    self-sponsored.
    """
    auth_signer = pre.fund_eoa()

    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(
        gas_limit=10_000_000,  # TODO: Reduce gas limit of all tests
        to=auth_signer,
        value=0,
        authorization_list=[
            AuthorizationTuple(
                address=address,
                nonce=i + 1,
                signer=auth_signer,
            )
            for i, address in enumerate(addresses)
        ],
        sender=auth_signer,
    )

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

Parametrized Test Cases

This test generates 1 parametrized test case across 3 forks.