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@892e6d1e.

Generate fixtures for these test cases for Amsterdam with:

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

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
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
@pytest.mark.exception_test
def test_invalid_transaction_after_authorization(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
) -> None:
    """
    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()
    recipient = pre.fund_eoa(amount=0)

    txs = [
        Transaction(
            sender=pre.fund_eoa(),
            gas_limit=500_000,
            to=recipient,
            value=0,
            authorization_list=[
                AuthorizationTuple(
                    address=Address(1),
                    nonce=0,
                    signer=auth_signer,
                ),
            ],
        ),
        Transaction(
            sender=auth_signer,
            nonce=0,
            gas_limit=21_000,
            to=recipient,
            value=1,
            error=TransactionException.NONCE_MISMATCH_TOO_LOW,
        ),
    ]

    blockchain_test(
        pre=pre,
        blocks=[
            Block(
                txs=txs,
                exception=TransactionException.NONCE_MISMATCH_TOO_LOW,
            )
        ],
        post={
            recipient: None,
        },
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 3 forks.