Skip to content

test_invalid_transaction_after_authorization()

Documentation for tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_invalid_transaction_after_authorization@01f496f4.

Generate fixtures for these test cases for Prague with:

fill -v tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_invalid_transaction_after_authorization --fork Prague

Test an invalid block due to a transaction reusing the same nonce as an authorization included in a prior transaction.

Source code in tests/prague/eip7702_set_code_tx/test_set_code_txs.py
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
def test_invalid_transaction_after_authorization(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
):
    """
    Test an invalid block due to a transaction reusing the same nonce as an authorization
    included in a prior transaction.
    """
    auth_signer = pre.fund_eoa()

    txs = [
        Transaction(
            sender=pre.fund_eoa(),
            gas_limit=500_000,
            to=Address(0),
            value=0,
            authorization_list=[
                AuthorizationTuple(
                    address=Address(1),
                    nonce=0,
                    signer=auth_signer,
                ),
            ],
        ),
        Transaction(
            sender=auth_signer,
            nonce=0,
            gas_limit=21_000,
            to=Address(0),
            value=1,
            error=TransactionException.NONCE_MISMATCH_TOO_LOW,
        ),
    ]

    blockchain_test(
        pre=pre,
        blocks=[
            Block(
                txs=txs,
                exception=TransactionException.NONCE_MISMATCH_TOO_LOW,
            )
        ],
        post={
            Address(0): None,
        },
    )

Parametrized Test Cases

This test case is only parametrized by fork.

Test ID (Abbreviated)
...fork_Prague-blockchain_test
...fork_Osaka-blockchain_test