Skip to content

test_invalid_auth_signature()

Documentation for tests/prague/eip7702_set_code_tx/test_invalid_tx.py::test_invalid_auth_signature@ffe48572.

Generate fixtures for these test cases for Bogota with:

fill -v tests/prague/eip7702_set_code_tx/test_invalid_tx.py::test_invalid_auth_signature --fork Bogota

Test sending a transaction where one of the signature elements is out of range.

Source code in tests/prague/eip7702_set_code_tx/test_invalid_tx.py
@pytest.mark.parametrize(
    "v,r,s",
    [
        pytest.param(2**8, 1, 1, id="v=2**8"),
        pytest.param(1, 2**256, 1, id="r=2**256"),
        pytest.param(1, 1, 2**256, id="s=2**256"),
        pytest.param(2**8, 2**256, 2**256, id="v=2**8,r=s=2**256"),
    ],
)
@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_auth_signature(
    chain_config: ChainConfig,
    transaction_test: TransactionTestFiller,
    pre: Alloc,
    v: int,
    r: int,
    s: int,
    delegate_address: Address,
) -> None:
    """
    Test sending a transaction where one of the signature elements is out of
    range.
    """
    tx = Transaction(
        gas_limit=100_000,
        to=0,
        value=0,
        authorization_list=[
            AuthorizationTuple(
                address=delegate_address,
                nonce=0,
                chain_id=chain_config.chain_id,
                v=v,
                r=r,
                s=s,
            ),
        ],
        error=[
            TransactionException.TYPE_4_INVALID_AUTHORITY_SIGNATURE,
            TransactionException.TYPE_4_INVALID_AUTHORITY_SIGNATURE_S_TOO_HIGH,
        ],
        sender=pre.fund_eoa(),
    )

    transaction_test(
        pre=pre,
        tx=tx,
    )

Parametrized Test Cases

This test generates 8 parametrized test cases across 4 forks.