Skip to content

test_invalid_tx_invalid_authorization_tuple_encoded_as_bytes()

Documentation for tests/prague/eip7702_set_code_tx/test_invalid_tx.py::test_invalid_tx_invalid_authorization_tuple_encoded_as_bytes@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_authorization_tuple_encoded_as_bytes --fork Amsterdam

Test sending a transaction where the authorization tuple field of the type-4 transaction is encoded in the outer element as bytes instead of a list of elements.

Source code in tests/prague/eip7702_set_code_tx/test_invalid_tx.py
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
@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_authorization_tuple_encoded_as_bytes(
    transaction_test: TransactionTestFiller,
    pre: Alloc,
    delegate_address: Address,
) -> None:
    """
    Test sending a transaction where the authorization tuple field of the
    type-4 transaction is encoded in the outer element as bytes instead of a
    list of elements.
    """

    class ModifiedTransaction(Transaction):
        authorization_list: List[Bytes] | None  # type: ignore

    auth_signer = pre.fund_eoa()

    authorization_list = AuthorizationTuple(
        address=delegate_address,
        nonce=0,
        signer=auth_signer,
    )
    tx = ModifiedTransaction(
        gas_limit=100_000,
        to=0,
        value=0,
        authorization_list=[authorization_list.rlp()],
        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.