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@ffe48572.

Generate fixtures for these test cases for Bogota with:

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

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
@pytest.mark.inclusion_test
@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 2 forks.