Skip to content

test_invalid_tx_invalid_address()

Documentation for tests/prague/eip7702_set_code_tx/test_invalid_tx.py::test_invalid_tx_invalid_address@20373115.

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

Test sending a transaction where the address field of an authorization is incorrectly serialized.

Source code in tests/prague/eip7702_set_code_tx/test_invalid_tx.py
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
@pytest.mark.parametrize(
    "address_type",
    [
        pytest.param(
            OversizedAddress,
            id="oversized",
        ),
        pytest.param(
            UndersizedAddress,
            id="undersized",
        ),
    ],
)
@pytest.mark.parametrize(
    "delegate_address",
    [
        pytest.param(
            int.from_bytes(Spec.RESET_DELEGATION_ADDRESS, byteorder="big"),
            id="reset_delegation_address",
        ),
        pytest.param(1, id="non_zero_address"),
    ],
)
def test_invalid_tx_invalid_address(
    transaction_test: TransactionTestFiller,
    pre: Alloc,
    delegate_address: int,
    address_type: Type[FixedSizeBytes],
) -> None:
    """
    Test sending a transaction where the address field of an authorization is
    incorrectly serialized.
    """
    auth_signer = pre.fund_eoa()

    class ModifiedAuthorizationTuple(AuthorizationTuple):
        address: address_type  # type: ignore

    tx = Transaction(
        gas_limit=100_000,
        to=0,
        value=0,
        authorization_list=[
            ModifiedAuthorizationTuple(
                address=delegate_address,
                nonce=0,
                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 4 parametrized test cases across 3 forks.