Skip to content

test_authorization_reusing_nonce()

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

Generate fixtures for these test cases for Amsterdam with:

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

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
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
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 generates 1 parametrized test case across 3 forks.