Skip to content

test_invalid_auth_signature()

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

Generate fixtures for these test cases for Amsterdam with:

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

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
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
@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 3 forks.