Todas as lições · Developer tooling · Começa aqui · Glossário
Matching a Script code_hash to its code Cell by hash_typePráticoVista outra vez
Vista outra vez · Verificação: certa · Verificada em 2026-11-19
To check that a Script points at a given deployed code Cell, compare its code_hash with ckb blake2b256 of the Cell's output data when hash_type is data, data1 or data2 (0, 2, 4), and with the hash of that Cell's Type Script when hash_type is type (1). A type selection needs the code Cell to actually carry a Type Script, and other hash_type values are rejected.
Porque importa: Comparing a code_hash against the wrong preimage, such as the ELF hash for a type-mode Script or a type hash for a data-mode Script, wrongly rejects a correct binding or accepts the wrong code Cell. A type selection also fails when the Cell has no Type Script.
Padrão
0 | 2 | 4 => artifact, 1 => type_hash.ok_or_else(|| invalid("Type-hash selection has no actual code Cell Type Script"))?,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/policy_artifact_checker.rs
- Conceitos
- Cell deps and script lookup, Data encoding (molecule, hex, bigints)
- Evidência
- Vista outra vez: vista em dois ou mais projetos
- 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 (2)
- 2026-10-09 · CellScript-Labs/CellScript · mais deste projeto
- 2026-10-06 · salmansarwarr/Kirea-finance · mais deste projeto
Mais sobre Developer tooling
- Decoding InvalidDepGroup OutPoints
- Mock transactions must expand dep_group members
- ckb-vm-js 0.2.0 (npm) checks header hash instead of rejecting the field
Manténs um projeto de onde esta lição veio? Confirma ou corrige
Citar esta lição
LusoCryptoLabs, "Matching a Script code_hash to its code Cell by hash_type", CKB lessons, https://pulse.lusocryptolabs.com/learned/tooling/matching-a-script-code-hash-to-its-code-cell-by-hash-type, CC BY 4.0, last changed 2026-10-09.