@pytest.mark.parametrize("exceed_tx_gas_limit",[pytest.param(True),pytest.param(False),],)@pytest.mark.valid_from("Osaka")deftest_tx_gas_limit_cap_contract_creation(state_test:StateTestFiller,pre:Alloc,total_cost_floor_per_token:int,exceed_tx_gas_limit:bool,fork:Fork,)->None:"""Test the transaction gas limit cap behavior for contract creation."""intrinsic_cost=fork.transaction_intrinsic_cost_calculator()tx_gas_limit_cap=fork.transaction_gas_limit_cap()asserttx_gas_limit_capisnotNone,"Fork does not have a transaction gas limit cap"gas_available=tx_gas_limit_cap-intrinsic_cost(contract_creation=True)max_tokens_in_calldata=gas_available//total_cost_floor_per_tokennum_of_bytes=(max_tokens_in_calldata//4)+int(exceed_tx_gas_limit)# Cannot exceed max contract code sizenum_of_bytes=min(num_of_bytes,fork.max_code_size())code=Op.JUMPDEST*num_of_bytes# Craft a contract creation transaction that exceeds the transaction gas# limit cap## Total cost =# intrinsic cost (base tx cost + contract creation cost)# + calldata cost + init code execution cost## The contract body is filled with JUMPDEST instructions, so:# total cost = intrinsic cost + calldata cost + (num_of_jumpdest * 1 gas)## If the total cost exceeds the tx limit cap, the transaction should failtotal_cost=intrinsic_cost(contract_creation=True,calldata=code)+num_of_bytestx=Transaction(to=None,data=code,gas_limit=tx_gas_limit_cap,sender=pre.fund_eoa(),error=TransactionException.INTRINSIC_GAS_BELOW_FLOOR_GAS_COSTiftotal_cost>tx_gas_limit_capelseNone,)state_test(pre=pre,post={},tx=tx,)