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@88e9fb8f.

Generate fixtures for these test cases for Osaka with:

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

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
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
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
@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,
) -> None:
    """
    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