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@bc691d13.

Generate fixtures for these test cases for Prague with:

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

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

Source code in tests/cancun/eip4844_blobs/test_blob_txs.py
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
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
@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,
):
    """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) opcode tx_gas tx_value
...fork_Cancun-state_test-tx_gas_500000-tx_value_0-opcode_CALLVALUE CALLVALUE 500000 0
...fork_Cancun-state_test-tx_gas_500000-tx_value_1-opcode_CALLVALUE CALLVALUE 500000 1
...fork_Cancun-state_test-tx_gas_500000-tx_value_1000000000000000000-opcode_CALLVALUE CALLVALUE 500000 1000000000000000000
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-tx_value_0-opcode_CALLVALUE CALLVALUE 500000 0
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-tx_value_1-opcode_CALLVALUE CALLVALUE 500000 1
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-tx_value_1000000000000000000-opcode_CALLVALUE CALLVALUE 500000 1000000000000000000
...fork_Prague-state_test-tx_gas_500000-tx_value_0-opcode_CALLVALUE CALLVALUE 500000 0
...fork_Prague-state_test-tx_gas_500000-tx_value_1-opcode_CALLVALUE CALLVALUE 500000 1
...fork_Prague-state_test-tx_gas_500000-tx_value_1000000000000000000-opcode_CALLVALUE CALLVALUE 500000 1000000000000000000
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-tx_value_0-opcode_CALLVALUE CALLVALUE 500000 0
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-tx_value_1-opcode_CALLVALUE CALLVALUE 500000 1
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-tx_value_1000000000000000000-opcode_CALLVALUE CALLVALUE 500000 1000000000000000000
...fork_Osaka-state_test-tx_gas_500000-tx_value_0-opcode_CALLVALUE CALLVALUE 500000 0
...fork_Osaka-state_test-tx_gas_500000-tx_value_1-opcode_CALLVALUE CALLVALUE 500000 1
...fork_Osaka-state_test-tx_gas_500000-tx_value_1000000000000000000-opcode_CALLVALUE CALLVALUE 500000 1000000000000000000
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-tx_value_0-opcode_CALLVALUE CALLVALUE 500000 0
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-tx_value_1-opcode_CALLVALUE CALLVALUE 500000 1
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-tx_value_1000000000000000000-opcode_CALLVALUE CALLVALUE 500000 1000000000000000000