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@bfe359d3.

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
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
@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