Skip to content

test_blob_tx_attribute_calldata_opcodes()

Documentation for tests/cancun/eip4844_blobs/test_blob_txs.py::test_blob_tx_attribute_calldata_opcodes@5e681944.

Generate fixtures for these test cases for Prague with:

fill -v tests/cancun/eip4844_blobs/test_blob_txs.py::test_blob_tx_attribute_calldata_opcodes --fork Prague

Test calldata related opcodes to verify their behavior is not affected by blobs.

  • CALLDATALOAD
  • CALLDATASIZE
  • CALLDATACOPY
Source code in tests/cancun/eip4844_blobs/test_blob_txs.py
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
@pytest.mark.parametrize(
    "opcode",
    [
        Op.CALLDATALOAD,
        Op.CALLDATASIZE,
        Op.CALLDATACOPY,
    ],
    indirect=True,
)
@pytest.mark.parametrize(
    "tx_calldata",
    [
        b"",
        b"\x01",
        b"\x00\x01" * 16,
    ],
    ids=["empty", "single_byte", "word"],
)
@pytest.mark.parametrize("tx_gas", [500_000])
@pytest.mark.valid_from("Cancun")
def test_blob_tx_attribute_calldata_opcodes(
    state_test: StateTestFiller,
    pre: Alloc,
    sender: EOA,
    tx_value: int,
    tx_gas: int,
    tx_calldata: bytes,
    tx_max_fee_per_gas: int,
    tx_max_fee_per_blob_gas: int,
    tx_max_priority_fee_per_gas: int,
    tx_access_list: List[AccessList],
    blob_hashes_per_tx: List[List[bytes]],
    opcode: Tuple[Bytecode, Storage.StorageDictType],
    state_env: Environment,
):
    """
    Test calldata related opcodes to verify their behavior is not affected by blobs.

    - CALLDATALOAD
    - CALLDATASIZE
    - CALLDATACOPY
    """
    code, storage = opcode
    destination_account = pre.deploy_contract(code=code)
    tx = Transaction(
        ty=Spec.BLOB_TX_TYPE,
        sender=sender,
        to=destination_account,
        value=tx_value,
        gas_limit=tx_gas,
        data=tx_calldata,
        max_fee_per_gas=tx_max_fee_per_gas,
        max_priority_fee_per_gas=tx_max_priority_fee_per_gas,
        max_fee_per_blob_gas=tx_max_fee_per_blob_gas,
        access_list=tx_access_list,
        blob_versioned_hashes=blob_hashes_per_tx[0],
    )
    post = {
        destination_account: Account(
            storage=storage,
        )
    }
    state_test(
        pre=pre,
        post=post,
        tx=tx,
        env=state_env,
    )

Parametrized Test Cases

The interactive table below is also available as a standalone page.

Test ID (Abbreviated) tx_gas tx_calldata opcode
...fork_Cancun-state_test-tx_gas_500000-empty-opcode_CALLDATALOAD 500000 CALLDATALOAD
...fork_Cancun-state_test-tx_gas_500000-empty-opcode_CALLDATASIZE 500000 CALLDATASIZE
...fork_Cancun-state_test-tx_gas_500000-empty-opcode_CALLDATACOPY 500000 CALLDATACOPY
...fork_Cancun-state_test-tx_gas_500000-single_byte-opcode_CALLDATALOAD 500000 01 CALLDATALOAD
...fork_Cancun-state_test-tx_gas_500000-single_byte-opcode_CALLDATASIZE 500000 01 CALLDATASIZE
...fork_Cancun-state_test-tx_gas_500000-single_byte-opcode_CALLDATACOPY 500000 01 CALLDATACOPY
...fork_Cancun-state_test-tx_gas_500000-word-opcode_CALLDATALOAD 500000 00010001000100010001000100010001 00010001000100010001000100010001 CALLDATALOAD
...fork_Cancun-state_test-tx_gas_500000-word-opcode_CALLDATASIZE 500000 00010001000100010001000100010001 00010001000100010001000100010001 CALLDATASIZE
...fork_Cancun-state_test-tx_gas_500000-word-opcode_CALLDATACOPY 500000 00010001000100010001000100010001 00010001000100010001000100010001 CALLDATACOPY
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-empty-opcode_CALLDATALOAD 500000 CALLDATALOAD
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-empty-opcode_CALLDATASIZE 500000 CALLDATASIZE
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-empty-opcode_CALLDATACOPY 500000 CALLDATACOPY
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-single_byte-opcode_CALLDATALOAD 500000 01 CALLDATALOAD
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-single_byte-opcode_CALLDATASIZE 500000 01 CALLDATASIZE
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-single_byte-opcode_CALLDATACOPY 500000 01 CALLDATACOPY
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-word-opcode_CALLDATALOAD 500000 00010001000100010001000100010001 00010001000100010001000100010001 CALLDATALOAD
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-word-opcode_CALLDATASIZE 500000 00010001000100010001000100010001 00010001000100010001000100010001 CALLDATASIZE
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-word-opcode_CALLDATACOPY 500000 00010001000100010001000100010001 00010001000100010001000100010001 CALLDATACOPY
...fork_Prague-state_test-tx_gas_500000-empty-opcode_CALLDATALOAD 500000 CALLDATALOAD
...fork_Prague-state_test-tx_gas_500000-empty-opcode_CALLDATASIZE 500000 CALLDATASIZE
...fork_Prague-state_test-tx_gas_500000-empty-opcode_CALLDATACOPY 500000 CALLDATACOPY
...fork_Prague-state_test-tx_gas_500000-single_byte-opcode_CALLDATALOAD 500000 01 CALLDATALOAD
...fork_Prague-state_test-tx_gas_500000-single_byte-opcode_CALLDATASIZE 500000 01 CALLDATASIZE
...fork_Prague-state_test-tx_gas_500000-single_byte-opcode_CALLDATACOPY 500000 01 CALLDATACOPY
...fork_Prague-state_test-tx_gas_500000-word-opcode_CALLDATALOAD 500000 00010001000100010001000100010001 00010001000100010001000100010001 CALLDATALOAD
...fork_Prague-state_test-tx_gas_500000-word-opcode_CALLDATASIZE 500000 00010001000100010001000100010001 00010001000100010001000100010001 CALLDATASIZE
...fork_Prague-state_test-tx_gas_500000-word-opcode_CALLDATACOPY 500000 00010001000100010001000100010001 00010001000100010001000100010001 CALLDATACOPY
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-empty-opcode_CALLDATALOAD 500000 CALLDATALOAD
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-empty-opcode_CALLDATASIZE 500000 CALLDATASIZE
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-empty-opcode_CALLDATACOPY 500000 CALLDATACOPY
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-single_byte-opcode_CALLDATALOAD 500000 01 CALLDATALOAD
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-single_byte-opcode_CALLDATASIZE 500000 01 CALLDATASIZE
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-single_byte-opcode_CALLDATACOPY 500000 01 CALLDATACOPY
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-word-opcode_CALLDATALOAD 500000 00010001000100010001000100010001 00010001000100010001000100010001 CALLDATALOAD
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-word-opcode_CALLDATASIZE 500000 00010001000100010001000100010001 00010001000100010001000100010001 CALLDATASIZE
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-word-opcode_CALLDATACOPY 500000 00010001000100010001000100010001 00010001000100010001000100010001 CALLDATACOPY
...fork_Osaka-state_test-tx_gas_500000-empty-opcode_CALLDATALOAD 500000 CALLDATALOAD
...fork_Osaka-state_test-tx_gas_500000-empty-opcode_CALLDATASIZE 500000 CALLDATASIZE
...fork_Osaka-state_test-tx_gas_500000-empty-opcode_CALLDATACOPY 500000 CALLDATACOPY
...fork_Osaka-state_test-tx_gas_500000-single_byte-opcode_CALLDATALOAD 500000 01 CALLDATALOAD
...fork_Osaka-state_test-tx_gas_500000-single_byte-opcode_CALLDATASIZE 500000 01 CALLDATASIZE
...fork_Osaka-state_test-tx_gas_500000-single_byte-opcode_CALLDATACOPY 500000 01 CALLDATACOPY
...fork_Osaka-state_test-tx_gas_500000-word-opcode_CALLDATALOAD 500000 00010001000100010001000100010001 00010001000100010001000100010001 CALLDATALOAD
...fork_Osaka-state_test-tx_gas_500000-word-opcode_CALLDATASIZE 500000 00010001000100010001000100010001 00010001000100010001000100010001 CALLDATASIZE
...fork_Osaka-state_test-tx_gas_500000-word-opcode_CALLDATACOPY 500000 00010001000100010001000100010001 00010001000100010001000100010001 CALLDATACOPY
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-empty-opcode_CALLDATALOAD 500000 CALLDATALOAD
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-empty-opcode_CALLDATASIZE 500000 CALLDATASIZE
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-empty-opcode_CALLDATACOPY 500000 CALLDATACOPY
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-single_byte-opcode_CALLDATALOAD 500000 01 CALLDATALOAD
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-single_byte-opcode_CALLDATASIZE 500000 01 CALLDATASIZE
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-single_byte-opcode_CALLDATACOPY 500000 01 CALLDATACOPY
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-word-opcode_CALLDATALOAD 500000 00010001000100010001000100010001 00010001000100010001000100010001 CALLDATALOAD
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-word-opcode_CALLDATASIZE 500000 00010001000100010001000100010001 00010001000100010001000100010001 CALLDATASIZE
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-word-opcode_CALLDATACOPY 500000 00010001000100010001000100010001 00010001000100010001000100010001 CALLDATACOPY