Skip to content

test_invalid_tx_invalid_nonce_encoding()

Documentation for tests/prague/eip7702_set_code_tx/test_invalid_tx.py::test_invalid_tx_invalid_nonce_encoding@21507778.

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_encoding --fork Amsterdam

Test sending a transaction where the chain id field of an authorization has an incorrect encoding.

Source code in tests/prague/eip7702_set_code_tx/test_invalid_tx.py
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
@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_encoding(
    transaction_test: TransactionTestFiller,
    pre: Alloc,
    delegate_address: Address,
) -> None:
    """
    Test sending a transaction where the chain id field of an authorization has
    an incorrect encoding.
    """

    class ModifiedAuthorizationTuple(AuthorizationTuple):
        nonce: OversizedInt  # type: ignore

    authorization = ModifiedAuthorizationTuple(
        address=delegate_address,
        nonce=0,
        signer=pre.fund_eoa(auth_account_start_balance),
    )

    tx = Transaction(
        gas_limit=100_000,
        to=0,
        value=0,
        authorization_list=[authorization],
        error=TransactionException.TYPE_4_INVALID_AUTHORIZATION_FORMAT,
        sender=pre.fund_eoa(),
    )

    transaction_test(
        pre=pre,
        tx=tx,
    )

Parametrized Test Cases

This test generates 2 parametrized test cases across 3 forks.