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@49a16fac.

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
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
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
@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-blockchain_test-tx_gas_500000-empty-opcode_CALLDATALOAD CALLDATALOAD 500000
...fork_Cancun-blockchain_test-tx_gas_500000-empty-opcode_CALLDATASIZE CALLDATASIZE 500000
...fork_Cancun-blockchain_test-tx_gas_500000-empty-opcode_CALLDATACOPY CALLDATACOPY 500000
...fork_Cancun-blockchain_test-tx_gas_500000-single_byte-opcode_CALLDATALOAD CALLDATALOAD 500000 01
...fork_Cancun-blockchain_test-tx_gas_500000-single_byte-opcode_CALLDATASIZE CALLDATASIZE 500000 01
...fork_Cancun-blockchain_test-tx_gas_500000-single_byte-opcode_CALLDATACOPY CALLDATACOPY 500000 01
...fork_Cancun-blockchain_test-tx_gas_500000-word-opcode_CALLDATALOAD CALLDATALOAD 500000 00010001000100010001000100010001 00010001000100010001000100010001
...fork_Cancun-blockchain_test-tx_gas_500000-word-opcode_CALLDATASIZE CALLDATASIZE 500000 00010001000100010001000100010001 00010001000100010001000100010001
...fork_Cancun-blockchain_test-tx_gas_500000-word-opcode_CALLDATACOPY CALLDATACOPY 500000 00010001000100010001000100010001 00010001000100010001000100010001
...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_Prague-blockchain_test-tx_gas_500000-empty-opcode_CALLDATALOAD CALLDATALOAD 500000
...fork_Prague-blockchain_test-tx_gas_500000-empty-opcode_CALLDATASIZE CALLDATASIZE 500000
...fork_Prague-blockchain_test-tx_gas_500000-empty-opcode_CALLDATACOPY CALLDATACOPY 500000
...fork_Prague-blockchain_test-tx_gas_500000-single_byte-opcode_CALLDATALOAD CALLDATALOAD 500000 01
...fork_Prague-blockchain_test-tx_gas_500000-single_byte-opcode_CALLDATASIZE CALLDATASIZE 500000 01
...fork_Prague-blockchain_test-tx_gas_500000-single_byte-opcode_CALLDATACOPY CALLDATACOPY 500000 01
...fork_Prague-blockchain_test-tx_gas_500000-word-opcode_CALLDATALOAD CALLDATALOAD 500000 00010001000100010001000100010001 00010001000100010001000100010001
...fork_Prague-blockchain_test-tx_gas_500000-word-opcode_CALLDATASIZE CALLDATASIZE 500000 00010001000100010001000100010001 00010001000100010001000100010001
...fork_Prague-blockchain_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_Osaka-blockchain_test-tx_gas_500000-empty-opcode_CALLDATALOAD CALLDATALOAD 500000
...fork_Osaka-blockchain_test-tx_gas_500000-empty-opcode_CALLDATASIZE CALLDATASIZE 500000
...fork_Osaka-blockchain_test-tx_gas_500000-empty-opcode_CALLDATACOPY CALLDATACOPY 500000
...fork_Osaka-blockchain_test-tx_gas_500000-single_byte-opcode_CALLDATALOAD CALLDATALOAD 500000 01
...fork_Osaka-blockchain_test-tx_gas_500000-single_byte-opcode_CALLDATASIZE CALLDATASIZE 500000 01
...fork_Osaka-blockchain_test-tx_gas_500000-single_byte-opcode_CALLDATACOPY CALLDATACOPY 500000 01
...fork_Osaka-blockchain_test-tx_gas_500000-word-opcode_CALLDATALOAD CALLDATALOAD 500000 00010001000100010001000100010001 00010001000100010001000100010001
...fork_Osaka-blockchain_test-tx_gas_500000-word-opcode_CALLDATASIZE CALLDATASIZE 500000 00010001000100010001000100010001 00010001000100010001000100010001
...fork_Osaka-blockchain_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