Todas as lições · Developer tooling · Começa aqui · Glossário
Script hash_type selects the VM version: data2 (4) or type (1) for a VM2 targetPráticoDe uma correção
De uma correção · Verificação: certa · Verificada em 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.
Porque importa: 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.
Padrão
"ckb" => Some("data2"), "ckb-type-hash" => Some("type"),Tirado do commit, encurtado.
Um teste mudou no mesmo commit
Está ao lado da correcção. Nós não o corremos.
- CellScript-Labs/CellScript:
tests/frozen_interface.rs,tests/policy_artifact_checker.rs
- Conceitos
- Cell deps and script lookup, Type ID and upgrades
- Evidência
- De uma correção: de um projeto, verificada contra o commit
- Vista pela primeira vez
- 2026-10-09
- Última mudança
- 2026-10-09
- Última verificação
- 2026-11-19
- Verificação contra o commit
- certa: a lição sai do commit e continua a valer no código de hoje
Fontes (1)
- 2026-10-09 · CellScript-Labs/CellScript · mais deste projeto
Mais sobre 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
Manténs um projeto de onde esta lição veio? Confirma ou corrige
Citar esta lição
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.