Skip to content

test_intrinsic_gas_floor_boundary_all_tx_types()

Documentation for tests/amsterdam/eip2780_reduce_intrinsic_tx_gas/test_intrinsic_gas_boundary.py::test_intrinsic_gas_floor_boundary_all_tx_types@8acae1b0.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip2780_reduce_intrinsic_tx_gas/test_intrinsic_gas_boundary.py::test_intrinsic_gas_floor_boundary_all_tx_types --fork Amsterdam

Reject every transaction type when gas_limit = intrinsic_gas - 1.

Each type layers its own intrinsic components on the shared value-transfer shape -- EXECUTION_PER_AUTH_BASE_COST for type 4 -- and the pre-execution check must reject one gas below the per-type total. Blob gas is priced in its own dimension, so a type-3 transaction's execution-gas boundary is identical to type 2.

Source code in tests/amsterdam/eip2780_reduce_intrinsic_tx_gas/test_intrinsic_gas_boundary.py
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
@EIPChecklist.GasCostChanges.Test.OutOfGas()
@pytest.mark.inclusion_test
@pytest.mark.exception_test
@pytest.mark.with_all_tx_types
def test_intrinsic_gas_floor_boundary_all_tx_types(
    fork: Fork,
    pre: Alloc,
    state_test: StateTestFiller,
    tx_type: int,
) -> None:
    """
    Reject every transaction type when ``gas_limit = intrinsic_gas - 1``.

    Each type layers its own intrinsic components on the shared
    value-transfer shape -- ``EXECUTION_PER_AUTH_BASE_COST`` for type 4 --
    and the pre-execution check must reject one gas below the per-type
    total. Blob gas is priced in its own dimension, so a type-3
    transaction's execution-gas boundary is identical to type 2.
    """
    value = 1
    sender = pre.fund_eoa()
    target = pre.fund_eoa(amount=EOA_INITIAL_BALANCE)

    scenario = (
        build_authorization(pre, AuthorizationAction.SETS_NEW_DELEGATION)
        if tx_type == 4
        else None
    )
    authorizations = [scenario.authorization] if scenario else []

    blob_versioned_hashes = (
        add_kzg_version([Hash(1)], EIP4844_Spec.BLOB_COMMITMENT_VERSION_KZG)
        if tx_type == 3
        else None
    )

    intrinsic_gas = fork.transaction_intrinsic_cost_calculator()(
        sends_value=True,
        recipient_type=RecipientType.EOA,
        authorization_list_or_count=authorizations,
        return_cost_deducted_prior_execution=True,
    )

    tx = Transaction(
        ty=tx_type,
        sender=sender,
        to=target,
        value=value,
        authorization_list=authorizations or None,
        blob_versioned_hashes=blob_versioned_hashes,
        gas_limit=intrinsic_gas - 1,
        error=TransactionException.INTRINSIC_GAS_TOO_LOW,
    )

    state_test(pre=pre, tx=tx, post=pre)

Parametrized Test Cases

This test generates 5 parametrized test cases across 1 fork.