Skip to content

test_calldata_floor_independent_of_state_gas()

Documentation for tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_calldata_floor.py::test_calldata_floor_independent_of_state_gas@636b5f17.

Generate fixtures for these test cases for Bogota with:

fill -v tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_calldata_floor.py::test_calldata_floor_independent_of_state_gas --fork Bogota

Test calldata floor applies only to execution gas dimension.

The calldata floor applies only to the sender's bill and does not affect the state gas dimension. A transaction with high calldata and no state operations should succeed even when the floor exceeds actual execution gas.

Source code in tests/amsterdam/eip8037_state_creation_gas_cost_increase/test_state_gas_calldata_floor.py
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
@pytest.mark.valid_from("EIP8037")
def test_calldata_floor_independent_of_state_gas(
    state_test: StateTestFiller,
    pre: Alloc,
    fork: Fork,
) -> None:
    """
    Test calldata floor applies only to execution gas dimension.

    The calldata floor applies only to the sender's bill and does not
    affect the state gas dimension. A transaction with high calldata
    and no state operations should succeed even when the floor exceeds
    actual execution gas.
    """
    contract = pre.deploy_contract(code=Op.STOP)

    calldata = b"\xff" * 512
    floor = fork.transaction_data_floor_cost_calculator()(data=calldata)
    tx_execution = fork.transaction_intrinsic_cost_calculator()(
        calldata=calldata,
        return_cost_deducted_prior_execution=True,
    )
    assert tx_execution < floor, "calldata floor must bind"

    tx = Transaction(
        to=contract,
        data=calldata,
        state_gas_reservoir=0,
        sender=pre.fund_eoa(),
        expected_receipt=TransactionReceipt(cumulative_gas_used=floor),
    )

    state_test(
        pre=pre,
        post={},
        tx=tx,
        blockchain_test_header_verify=Header(gas_used=floor),
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 2 forks.