Skip to content

test_set_code_multiple_valid_authorization_tuples_first_invalid_same_signer()

Documentation for tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_set_code_multiple_valid_authorization_tuples_first_invalid_same_signer@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_first_invalid_same_signer --fork Amsterdam

Test setting the code of an account with multiple authorization tuples from the same signer but the first tuple is invalid.

Source code in tests/prague/eip7702_set_code_tx/test_set_code_txs.py
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
def test_set_code_multiple_valid_authorization_tuples_first_invalid_same_signer(  # noqa: E501
    state_test: StateTestFiller,
    pre: Alloc,
) -> None:
    """
    Test setting the code of an account with multiple authorization tuples from
    the same signer but the first tuple is invalid.
    """
    auth_signer = pre.fund_eoa(auth_account_start_balance)

    success_slot = 1

    tuple_count = 10

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

    tx = Transaction(
        gas_limit=10_000_000,
        to=auth_signer,
        value=0,
        authorization_list=[
            AuthorizationTuple(
                address=address,
                nonce=1 if i == 0 else 0,
                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=1,
                code=Spec.delegation_designation(addresses[1]),
                storage={
                    success_slot: 1,
                },
            ),
        },
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 3 forks.