Skip to content

test_invalid_tx_invalid_auth_chain_id()

Documentation for tests/prague/eip7702_set_code_tx/test_invalid_tx.py::test_invalid_tx_invalid_auth_chain_id@892e6d1e.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/prague/eip7702_set_code_tx/test_invalid_tx.py::test_invalid_tx_invalid_auth_chain_id --fork Amsterdam

Test sending a transaction where the chain id field of an authorization overflows the maximum value.

Source code in tests/prague/eip7702_set_code_tx/test_invalid_tx.py
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
@pytest.mark.parametrize(
    "auth_chain_id",
    [
        pytest.param(Spec.MAX_AUTH_CHAIN_ID + 1, id="auth_chain_id=2**256"),
    ],
)
@pytest.mark.parametrize(
    "delegate_address",
    [
        pytest.param(
            Spec.RESET_DELEGATION_ADDRESS, id="reset_delegation_address"
        ),
        pytest.param(Address(1), id="non_zero_address"),
    ],
)
def test_invalid_tx_invalid_auth_chain_id(
    transaction_test: TransactionTestFiller,
    pre: Alloc,
    auth_chain_id: int,
    delegate_address: Address,
) -> None:
    """
    Test sending a transaction where the chain id field of an authorization
    overflows the maximum value.
    """
    authorization = AuthorizationTuple(
        address=delegate_address,
        nonce=0,
        chain_id=auth_chain_id,
        signer=pre.fund_eoa(auth_account_start_balance),
    )

    tx = Transaction(
        gas_limit=100_000,
        to=0,
        value=0,
        authorization_list=[authorization],
        error=TransactionException.TYPE_4_INVALID_AUTHORIZATION_FORMAT,
        sender=pre.fund_eoa(),
    )

    transaction_test(
        pre=pre,
        tx=tx,
    )

Parametrized Test Cases

This test generates 2 parametrized test cases across 3 forks.