Skip to content

test_blob_tx_attribute_value_opcode()

Documentation for tests/cancun/eip4844_blobs/test_blob_txs.py::test_blob_tx_attribute_value_opcode@88e9fb8f.

Generate fixtures for these test cases for Osaka with:

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

Test the VALUE opcode with different blob type transaction value amounts.

Source code in tests/cancun/eip4844_blobs/test_blob_txs.py
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
@pytest.mark.parametrize("opcode", [Op.CALLVALUE], indirect=["opcode"])
@pytest.mark.parametrize("tx_value", [0, 1, int(1e18)])
@pytest.mark.parametrize("tx_gas", [500_000])
@pytest.mark.valid_from("Cancun")
def test_blob_tx_attribute_value_opcode(
    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 the VALUE opcode with different blob type transaction value amounts.
    """
    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,
            balance=tx_value,
        )
    }
    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_value opcode
...fork_Cancun-state_test-tx_gas_500000-tx_value_0-opcode_CALLVALUE 500000 0 CALLVALUE
...fork_Cancun-state_test-tx_gas_500000-tx_value_1-opcode_CALLVALUE 500000 1 CALLVALUE
...fork_Cancun-state_test-tx_gas_500000-tx_value_1000000000000000000-opcode_CALLVALUE 500000 1000000000000000000 CALLVALUE
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-tx_value_0-opcode_CALLVALUE 500000 0 CALLVALUE
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-tx_value_1-opcode_CALLVALUE 500000 1 CALLVALUE
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-tx_value_1000000000000000000-opcode_CALLVALUE 500000 1000000000000000000 CALLVALUE
...fork_Prague-state_test-tx_gas_500000-tx_value_0-opcode_CALLVALUE 500000 0 CALLVALUE
...fork_Prague-state_test-tx_gas_500000-tx_value_1-opcode_CALLVALUE 500000 1 CALLVALUE
...fork_Prague-state_test-tx_gas_500000-tx_value_1000000000000000000-opcode_CALLVALUE 500000 1000000000000000000 CALLVALUE
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-tx_value_0-opcode_CALLVALUE 500000 0 CALLVALUE
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-tx_value_1-opcode_CALLVALUE 500000 1 CALLVALUE
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-tx_value_1000000000000000000-opcode_CALLVALUE 500000 1000000000000000000 CALLVALUE
...fork_Osaka-state_test-tx_gas_500000-tx_value_0-opcode_CALLVALUE 500000 0 CALLVALUE
...fork_Osaka-state_test-tx_gas_500000-tx_value_1-opcode_CALLVALUE 500000 1 CALLVALUE
...fork_Osaka-state_test-tx_gas_500000-tx_value_1000000000000000000-opcode_CALLVALUE 500000 1000000000000000000 CALLVALUE
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-tx_value_0-opcode_CALLVALUE 500000 0 CALLVALUE
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-tx_value_1-opcode_CALLVALUE 500000 1 CALLVALUE
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-tx_value_1000000000000000000-opcode_CALLVALUE 500000 1000000000000000000 CALLVALUE