Skip to content

test_authorization_reusing_nonce()

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

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
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
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