Hand-encoding WitnessArgs in molecule实践来自一次修复
来自一次修复 · 核对结果:部分正确 · 核对于 2026-11-19
WitnessArgs is a molecule table of three BytesOpt fields (lock, input_type, output_type). An absent field takes zero bytes, but a present empty field still takes a 4-byte length header, so the two encode differently. The table starts with a u32le total size, then three u32le offsets, the first being 16 (4 + 4*3), each counted from the start of the table. Check any hand-written encoder byte for byte against ccc.WitnessArgs.from(...).toBytes(), including the cases lock only, all absent, and a present empty field.
为什么重要: A hand-written encoder that treats an empty field like an absent one, or gets the offsets wrong, produces witness bytes that do not match what CCC and the scripts expect.
同一提交中改动了测试
它与修复在一起,我们没有运行它。
- toastmanAu/daowow:
apps/web/test/claim-codec.test.js
- 概念
- Data encoding (molecule, hex, bigints), Witnesses and signatures
- 证据
- 来自一次修复: 来自一个项目,已对照其提交核对
- 首次出现
- 2026-11-14
- 最近改动
- 2026-11-14
- 最近核对
- 2026-11-19
- 对照提交的核对结果
- 部分正确:核心属实,但有一部分表述松散或范围过宽
来源(1)
- 2026-11-14 · toastmanAu/daowow · 这个项目的更多经验
更多关于Other
- Recognizing a Nervos DAO deposit cell (not a withdrawing one)
- Nervos DAO phase-two withdrawal since and amount
- Restrict script hashType to data, type, data1, data2 when loading config
引用这条经验
LusoCryptoLabs, "Hand-encoding WitnessArgs in molecule", CKB lessons, https://pulse.lusocryptolabs.com/learned/other/hand-encoding-witnessargs-in-molecule, CC BY 4.0, last changed 2026-11-14.