Skip to content

test_auth_intrinsic_oog_boundary()

Documentation for tests/amsterdam/eip8038_state_access_gas_cost_increase/test_set_code_auth_gas.py::test_auth_intrinsic_oog_boundary@343274cc.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip8038_state_access_gas_cost_increase/test_set_code_auth_gas.py::test_auth_intrinsic_oog_boundary --fork Amsterdam

Reject a set-code transaction one gas below the full intrinsic.

gas_limit is set to full_intrinsic - 1 (full intrinsic = execution + auth state gas). Catches an implementation that omits the repriced execution per-authorization cost from the intrinsic check.

Source code in tests/amsterdam/eip8038_state_access_gas_cost_increase/test_set_code_auth_gas.py
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
@EIPChecklist.GasCostChanges.Test.OutOfGas()
@pytest.mark.exception_test
@pytest.mark.parametrize("n", [1, 3])
def test_auth_intrinsic_oog_boundary(
    state_test: StateTestFiller,
    env: Environment,
    pre: Alloc,
    fork: Fork,
    n: int,
) -> None:
    """
    Reject a set-code transaction one gas below the full intrinsic.

    ``gas_limit`` is set to ``full_intrinsic - 1`` (full intrinsic =
    execution + auth state gas). Catches an implementation that omits the
    repriced execution per-authorization cost from the intrinsic check.
    """
    contract = pre.deploy_contract(code=Op.STOP)
    authorization_list = [
        AuthorizationTuple(address=contract, nonce=0, signer=pre.fund_eoa())
        for _ in range(n)
    ]

    full_intrinsic = fork.transaction_intrinsic_cost_calculator()(
        authorization_list_or_count=authorization_list,
    )

    tx = Transaction(
        to=contract,
        gas_limit=full_intrinsic - 1,
        authorization_list=authorization_list,
        sender=pre.fund_eoa(),
        error=TransactionException.INTRINSIC_GAS_TOO_LOW,
    )

    state_test(env=env, pre=pre, post={}, tx=tx)

Parametrized Test Cases

This test generates 2 parametrized test cases across 1 fork.