Skip to content

test_invalid_tx_invalid_nonce_as_list()

Documentation for tests/prague/eip7702_set_code_tx/test_invalid_tx.py::test_invalid_tx_invalid_nonce_as_list@892e6d1e.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/prague/eip7702_set_code_tx/test_invalid_tx.py::test_invalid_tx_invalid_nonce_as_list --fork Amsterdam

Test sending a transaction where the nonce field of an authorization overflows the maximum value.

Source code in tests/prague/eip7702_set_code_tx/test_invalid_tx.py
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
@pytest.mark.parametrize(
    "nonce",
    [
        pytest.param([], id="nonce=empty-list"),
        pytest.param([0], id="nonce=non-empty-list"),
        pytest.param([0, 0], id="nonce=multi-element-list"),
    ],
)
@pytest.mark.parametrize(
    "delegate_address",
    [
        pytest.param(
            Spec.RESET_DELEGATION_ADDRESS, id="reset_delegation_address"
        ),
        pytest.param(Address(1), id="non_zero_address"),
    ],
)
def test_invalid_tx_invalid_nonce_as_list(
    transaction_test: TransactionTestFiller,
    pre: Alloc,
    nonce: List[int],
    delegate_address: Address,
) -> None:
    """
    Test sending a transaction where the nonce field of an authorization
    overflows the maximum value.
    """
    auth_signer = pre.fund_eoa()

    class AuthorizationTupleWithNonceAsList(AuthorizationTuple):
        nonce: List[HexNumber]  # type: ignore

    tx = Transaction(
        gas_limit=100_000,
        to=0,
        value=0,
        authorization_list=[
            AuthorizationTupleWithNonceAsList(
                address=delegate_address,
                nonce=nonce,
                signer=auth_signer,
            ),
        ],
        error=TransactionException.TYPE_4_INVALID_AUTHORIZATION_FORMAT,
        sender=pre.fund_eoa(),
    )

    transaction_test(
        pre=pre,
        tx=tx,
    )

Parametrized Test Cases

This test generates 6 parametrized test cases across 3 forks.