CKB Pulse

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

Preferir
"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.

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)

Mais sobre Developer tooling

Ver as 35 deste tema

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.

Tiradas de commits públicos e verificadas contra o commit de onde cada uma veio e o código de hoje do projeto. Lê a fonte antes de confiar numa. Texto sob CC BY 4.0: dá crédito à LusoCryptoLabs, CKB lessons, com uma ligação para a lição. Queres que uma lição seja mudada ou retirada? Abre um issue.