Skip to content

test_authorization_reusing_nonce()

Documentation for tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_authorization_reusing_nonce@88e9fb8f.

Generate fixtures for these test cases for Osaka with:

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

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
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
def test_authorization_reusing_nonce(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
) -> None:
    """
    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()
    recipient = pre.fund_eoa(amount=0)
    txs = [
        Transaction(
            sender=auth_signer,
            nonce=0,
            gas_limit=21_000,
            to=recipient,
            value=1,
        ),
        Transaction(
            sender=sender,
            gas_limit=500_000,
            to=recipient,
            value=0,
            authorization_list=[
                AuthorizationTuple(
                    address=Address(1),
                    nonce=0,
                    signer=auth_signer,
                ),
            ],
        ),
    ]

    blockchain_test(
        pre=pre,
        blocks=[Block(txs=txs)],
        post={
            recipient: 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