Skip to content

test_invalid_tx_invalid_nonce()

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

Test sending a transaction where the nonce field of an authorization overflows the maximum value.

Source code in tests/prague/eip7702_set_code_tx/test_invalid_tx.py
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
@pytest.mark.parametrize(
    "nonce",
    [
        pytest.param(Spec.MAX_NONCE + 1, id="nonce=2**64"),
        pytest.param(2**256, id="nonce=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_tx_invalid_nonce(
    transaction_test: TransactionTestFiller,
    pre: Alloc,
    nonce: int,
    delegate_address: Address,
) -> None:
    """
    Test sending a transaction where the nonce field of an authorization
    overflows the maximum value.
    """
    auth_signer = pre.fund_eoa()

    tx = Transaction(
        gas_limit=100_000,
        to=0,
        value=0,
        authorization_list=[
            AuthorizationTuple(
                address=delegate_address,
                nonce=nonce,
                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.