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@14a7429a.

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
1218
1219
1220
1221
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
@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) opcode tx_gas tx_calldata
...fork_Cancun-state_test-tx_gas_500000-empty-opcode_CALLDATALOAD CALLDATALOAD 500000
...fork_Cancun-state_test-tx_gas_500000-empty-opcode_CALLDATASIZE CALLDATASIZE 500000
...fork_Cancun-state_test-tx_gas_500000-empty-opcode_CALLDATACOPY CALLDATACOPY 500000
...fork_Cancun-state_test-tx_gas_500000-single_byte-opcode_CALLDATALOAD CALLDATALOAD 500000 01
...fork_Cancun-state_test-tx_gas_500000-single_byte-opcode_CALLDATASIZE CALLDATASIZE 500000 01
...fork_Cancun-state_test-tx_gas_500000-single_byte-opcode_CALLDATACOPY CALLDATACOPY 500000 01
...fork_Cancun-state_test-tx_gas_500000-word-opcode_CALLDATALOAD CALLDATALOAD 500000 00010001000100010001000100010001 00010001000100010001000100010001
...fork_Cancun-state_test-tx_gas_500000-word-opcode_CALLDATASIZE CALLDATASIZE 500000 00010001000100010001000100010001 00010001000100010001000100010001
...fork_Cancun-state_test-tx_gas_500000-word-opcode_CALLDATACOPY CALLDATACOPY 500000 00010001000100010001000100010001 00010001000100010001000100010001
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-empty-opcode_CALLDATALOAD CALLDATALOAD 500000
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-empty-opcode_CALLDATASIZE CALLDATASIZE 500000
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-empty-opcode_CALLDATACOPY CALLDATACOPY 500000
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-single_byte-opcode_CALLDATALOAD CALLDATALOAD 500000 01
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-single_byte-opcode_CALLDATASIZE CALLDATASIZE 500000 01
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-single_byte-opcode_CALLDATACOPY CALLDATACOPY 500000 01
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-word-opcode_CALLDATALOAD CALLDATALOAD 500000 00010001000100010001000100010001 00010001000100010001000100010001
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-word-opcode_CALLDATASIZE CALLDATASIZE 500000 00010001000100010001000100010001 00010001000100010001000100010001
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-word-opcode_CALLDATACOPY CALLDATACOPY 500000 00010001000100010001000100010001 00010001000100010001000100010001
...fork_Prague-state_test-tx_gas_500000-empty-opcode_CALLDATALOAD CALLDATALOAD 500000
...fork_Prague-state_test-tx_gas_500000-empty-opcode_CALLDATASIZE CALLDATASIZE 500000
...fork_Prague-state_test-tx_gas_500000-empty-opcode_CALLDATACOPY CALLDATACOPY 500000
...fork_Prague-state_test-tx_gas_500000-single_byte-opcode_CALLDATALOAD CALLDATALOAD 500000 01
...fork_Prague-state_test-tx_gas_500000-single_byte-opcode_CALLDATASIZE CALLDATASIZE 500000 01
...fork_Prague-state_test-tx_gas_500000-single_byte-opcode_CALLDATACOPY CALLDATACOPY 500000 01
...fork_Prague-state_test-tx_gas_500000-word-opcode_CALLDATALOAD CALLDATALOAD 500000 00010001000100010001000100010001 00010001000100010001000100010001
...fork_Prague-state_test-tx_gas_500000-word-opcode_CALLDATASIZE CALLDATASIZE 500000 00010001000100010001000100010001 00010001000100010001000100010001
...fork_Prague-state_test-tx_gas_500000-word-opcode_CALLDATACOPY CALLDATACOPY 500000 00010001000100010001000100010001 00010001000100010001000100010001
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-empty-opcode_CALLDATALOAD CALLDATALOAD 500000
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-empty-opcode_CALLDATASIZE CALLDATASIZE 500000
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-empty-opcode_CALLDATACOPY CALLDATACOPY 500000
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-single_byte-opcode_CALLDATALOAD CALLDATALOAD 500000 01
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-single_byte-opcode_CALLDATASIZE CALLDATASIZE 500000 01
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-single_byte-opcode_CALLDATACOPY CALLDATACOPY 500000 01
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-word-opcode_CALLDATALOAD CALLDATALOAD 500000 00010001000100010001000100010001 00010001000100010001000100010001
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-word-opcode_CALLDATASIZE CALLDATASIZE 500000 00010001000100010001000100010001 00010001000100010001000100010001
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-word-opcode_CALLDATACOPY CALLDATACOPY 500000 00010001000100010001000100010001 00010001000100010001000100010001
...fork_Osaka-state_test-tx_gas_500000-empty-opcode_CALLDATALOAD CALLDATALOAD 500000
...fork_Osaka-state_test-tx_gas_500000-empty-opcode_CALLDATASIZE CALLDATASIZE 500000
...fork_Osaka-state_test-tx_gas_500000-empty-opcode_CALLDATACOPY CALLDATACOPY 500000
...fork_Osaka-state_test-tx_gas_500000-single_byte-opcode_CALLDATALOAD CALLDATALOAD 500000 01
...fork_Osaka-state_test-tx_gas_500000-single_byte-opcode_CALLDATASIZE CALLDATASIZE 500000 01
...fork_Osaka-state_test-tx_gas_500000-single_byte-opcode_CALLDATACOPY CALLDATACOPY 500000 01
...fork_Osaka-state_test-tx_gas_500000-word-opcode_CALLDATALOAD CALLDATALOAD 500000 00010001000100010001000100010001 00010001000100010001000100010001
...fork_Osaka-state_test-tx_gas_500000-word-opcode_CALLDATASIZE CALLDATASIZE 500000 00010001000100010001000100010001 00010001000100010001000100010001
...fork_Osaka-state_test-tx_gas_500000-word-opcode_CALLDATACOPY CALLDATACOPY 500000 00010001000100010001000100010001 00010001000100010001000100010001
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-empty-opcode_CALLDATALOAD CALLDATALOAD 500000
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-empty-opcode_CALLDATASIZE CALLDATASIZE 500000
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-empty-opcode_CALLDATACOPY CALLDATACOPY 500000
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-single_byte-opcode_CALLDATALOAD CALLDATALOAD 500000 01
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-single_byte-opcode_CALLDATASIZE CALLDATASIZE 500000 01
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-single_byte-opcode_CALLDATACOPY CALLDATACOPY 500000 01
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-word-opcode_CALLDATALOAD CALLDATALOAD 500000 00010001000100010001000100010001 00010001000100010001000100010001
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-word-opcode_CALLDATASIZE CALLDATASIZE 500000 00010001000100010001000100010001 00010001000100010001000100010001
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-word-opcode_CALLDATACOPY CALLDATACOPY 500000 00010001000100010001000100010001 00010001000100010001000100010001