全部经验 · Developer tooling · 从这里开始 · 术语表
Script hash_type selects the VM version: data2 (4) or type (1) for a VM2 target实践来自一次修复
来自一次修复 · 核对结果:正确 · 核对于 2026-11-19
CKB picks the VM version from the Script hash_type: data (0) runs VM0, data1 (2) runs VM1, data2 (4) runs VM2, and type (1) runs the latest activated VM. Code deployed for VM2 and pinned by data hash must be referenced with hash_type data2. The same code hash with data or data1 still resolves to the same cell but runs under an older VM, so tooling should reject those hash types for a VM2 target rather than only checking that the code hash matches.
为什么重要: A script whose code hash matches but whose hash_type is data or data1 still resolves to the code cell, yet it silently runs under an older VM than the code was built for.
代码模式
"ckb" => Some("data2"), "ckb-type-hash" => Some("type"),摘自提交,已缩短。
同一提交中改动了测试
它与修复在一起,我们没有运行它。
- CellScript-Labs/CellScript:
tests/frozen_interface.rs,tests/policy_artifact_checker.rs
- 概念
- Cell deps and script lookup, Type ID and upgrades
- 证据
- 来自一次修复: 来自一个项目,已对照其提交核对
- 首次出现
- 2026-10-09
- 最近改动
- 2026-10-09
- 最近核对
- 2026-11-19
- 对照提交的核对结果
- 正确:这条经验出自该提交,并且在今天的代码中仍然成立
来源(1)
- 2026-10-09 · CellScript-Labs/CellScript · 这个项目的更多经验
更多关于Developer tooling
- Absence of on-chain references does not mean a code cell is safe to consume
- Derive devnet Spore and system script cell deps from a fresh OffCKB export
- Matching a Script code_hash to its code Cell by hash_type
引用这条经验
LusoCryptoLabs, "Script hash_type selects the VM version: data2 (4) or type (1) for a VM2 target", CKB lessons, https://pulse.lusocryptolabs.com/learned/tooling/script-hash-type-selects-the-vm-version-data2-4-or-type-1-fo, CC BY 4.0, last changed 2026-10-09.