Skip to content

test_blob_tx_attribute_opcodes()

Documentation for tests/cancun/eip4844_blobs/test_blob_txs.py::test_blob_tx_attribute_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_opcodes --fork Osaka

Test opcodes that read transaction attributes work properly for blob type transactions.

  • ORIGIN
  • CALLER
Source code in tests/cancun/eip4844_blobs/test_blob_txs.py
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
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
@pytest.mark.parametrize(
    "opcode",
    [Op.ORIGIN, Op.CALLER],
    indirect=["opcode"],
)
@pytest.mark.parametrize("tx_gas", [500_000])
@pytest.mark.valid_from("Cancun")
def test_blob_tx_attribute_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 opcodes that read transaction attributes work properly for blob type
    transactions.

    - ORIGIN
    - CALLER
    """
    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 opcode
...fork_Cancun-state_test-tx_gas_500000-opcode_ORIGIN 500000 ORIGIN
...fork_Cancun-state_test-tx_gas_500000-opcode_CALLER 500000 CALLER
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-opcode_ORIGIN 500000 ORIGIN
...fork_Cancun-blockchain_test_from_state_test-tx_gas_500000-opcode_CALLER 500000 CALLER
...fork_Prague-state_test-tx_gas_500000-opcode_ORIGIN 500000 ORIGIN
...fork_Prague-state_test-tx_gas_500000-opcode_CALLER 500000 CALLER
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-opcode_ORIGIN 500000 ORIGIN
...fork_Prague-blockchain_test_from_state_test-tx_gas_500000-opcode_CALLER 500000 CALLER
...fork_Osaka-state_test-tx_gas_500000-opcode_ORIGIN 500000 ORIGIN
...fork_Osaka-state_test-tx_gas_500000-opcode_CALLER 500000 CALLER
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-opcode_ORIGIN 500000 ORIGIN
...fork_Osaka-blockchain_test_from_state_test-tx_gas_500000-opcode_CALLER 500000 CALLER