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@14a7429a.

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
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
@pytest.mark.exception_test
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