全部经验 · Developer tooling · 从这里开始 · 术语表
Matching a Script code_hash to its code Cell by hash_type实践再次出现
再次出现 · 核对结果:正确 · 核对于 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.
为什么重要: 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.
代码模式
0 | 2 | 4 => artifact, 1 => type_hash.ok_or_else(|| invalid("Type-hash selection has no actual code Cell Type Script"))?,摘自提交,已缩短。
同一提交中改动了测试
它与修复在一起,我们没有运行它。
- CellScript-Labs/CellScript:
tests/policy_artifact_checker.rs
- 概念
- Cell deps and script lookup, Data encoding (molecule, hex, bigints)
- 证据
- 再次出现: 在两个或以上项目中出现
- 首次出现
- 2026-10-09
- 最近改动
- 2026-10-09
- 最近核对
- 2026-11-19
- 对照提交的核对结果
- 正确:这条经验出自该提交,并且在今天的代码中仍然成立
来源(2)
- 2026-10-09 · CellScript-Labs/CellScript · 这个项目的更多经验
- 2026-10-06 · salmansarwarr/Kirea-finance · 这个项目的更多经验
更多关于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
引用这条经验
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.