Skip to content

test_authorization_reusing_nonce()

Documentation for tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_authorization_reusing_nonce@14a7429a.

Generate fixtures for these test cases for Prague with:

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

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

Source code in tests/prague/eip7702_set_code_tx/test_set_code_txs.py
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
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
def test_authorization_reusing_nonce(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
):
    """
    Test an authorization reusing the same nonce as a prior transaction included in the same
    block.
    """
    auth_signer = pre.fund_eoa()
    sender = pre.fund_eoa()
    txs = [
        Transaction(
            sender=auth_signer,
            nonce=0,
            gas_limit=21_000,
            to=Address(0),
            value=1,
        ),
        Transaction(
            sender=sender,
            gas_limit=500_000,
            to=Address(0),
            value=0,
            authorization_list=[
                AuthorizationTuple(
                    address=Address(1),
                    nonce=0,
                    signer=auth_signer,
                ),
            ],
        ),
    ]

    blockchain_test(
        pre=pre,
        blocks=[Block(txs=txs)],
        post={
            Address(0): Account(balance=1),
            auth_signer: Account(nonce=1, code=b""),
            sender: Account(nonce=1),
        },
    )

Parametrized Test Cases

This test case is only parametrized by fork.

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