Skip to content

test_intrinsic_gas_floor_boundary()

Documentation for tests/amsterdam/eip2780_reduce_intrinsic_tx_gas/test_intrinsic_gas_boundary.py::test_intrinsic_gas_floor_boundary@87aba1a3.

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 --fork Amsterdam

Reject when gas_limit = intrinsic_gas - 1.

The transaction never enters the EVM; it is rejected by the pre-execution intrinsic gas check.

Source code in tests/amsterdam/eip2780_reduce_intrinsic_tx_gas/test_intrinsic_gas_boundary.py
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
@pytest.mark.exception_test
@pytest.mark.parametrize("recipient_type", RECIPIENT_TYPES_NON_CREATE)
@pytest.mark.parametrize(
    "value",
    [
        pytest.param(0, id="zero_value"),
        pytest.param(1, id="non-zero_value"),
    ],
)
def test_intrinsic_gas_floor_boundary(
    fork: Fork,
    pre: Alloc,
    state_test: StateTestFiller,
    recipient_type: RecipientType,
    value: int,
) -> None:
    """
    Reject when ``gas_limit = intrinsic_gas - 1``.

    The transaction never enters the EVM; it is rejected by the
    pre-execution intrinsic gas check.
    """
    sender = pre.fund_eoa(10**18)
    target = setup_target(pre, recipient_type, sender)

    intrinsic_gas = fork.transaction_intrinsic_cost_calculator()(
        sends_value=bool(value),
        recipient_type=recipient_type,
        return_cost_deducted_prior_execution=True,
    )

    tx = Transaction(
        sender=sender,
        to=target,
        value=value,
        gas_limit=intrinsic_gas - 1,
        gas_price=1_000_000_000,
        error=TransactionException.INTRINSIC_GAS_TOO_LOW,
    )

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

Parametrized Test Cases

This test generates 10 parametrized test cases across 1 fork.