@pytest.mark.valid_from("Prague")@pytest.mark.parametrize("zero_byte",[True,False])deftest_block_full_data(state_test:StateTestFiller,pre:Alloc,zero_byte:bool,intrinsic_cost:int,total_cost_floor_per_token:int,gas_benchmark_value:int,):"""Test a block with empty payload."""# Gas cost calculation based on EIP-7683: (https://eips.ethereum.org/EIPS/eip-7683)## tx.gasUsed = 21000 + max(# STANDARD_TOKEN_COST * tokens_in_calldata# + execution_gas_used# + isContractCreation * (32000 + INITCODE_WORD_COST * words(calldata)),# TOTAL_COST_FLOOR_PER_TOKEN * tokens_in_calldata)## Simplified in this test case:# - No execution gas used (no opcodes are executed)# - Not a contract creation (no initcode)## Therefore:# max_token_cost = max(STANDARD_TOKEN_COST, TOTAL_COST_FLOOR_PER_TOKEN)# tx.gasUsed = 21000 + tokens_in_calldata * max_token_cost## Since max(STANDARD_TOKEN_COST, TOTAL_COST_FLOOR_PER_TOKEN) = 10:# tx.gasUsed = 21000 + tokens_in_calldata * 10## Token accounting:# tokens_in_calldata = zero_bytes + 4 * non_zero_bytes## So we calculate how many bytes we can fit into calldata based on available gas.gas_available=gas_benchmark_value-intrinsic_cost# Calculate the token_in_calldatamax_tokens_in_calldata=gas_available//total_cost_floor_per_token# Calculate the number of bytes that can be stored in the calldatanum_of_bytes=max_tokens_in_calldataifzero_byteelsemax_tokens_in_calldata//4byte_data=b"\x00"ifzero_byteelseb"\xff"tx=Transaction(to=pre.fund_eoa(),data=byte_data*num_of_bytes,gas_limit=gas_benchmark_value,sender=pre.fund_eoa(),)state_test(pre=pre,post={},tx=tx,)