Todas as lições · Other · Começa aqui · Glossário
Hand-encoding WitnessArgs in moleculePráticoDe uma correção
De uma correção · Verificação: em parte certa · Verificada em 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.
Porque importa: 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.
Um teste mudou no mesmo commit
Está ao lado da correcção. Nós não o corremos.
- toastmanAu/daowow:
apps/web/test/claim-codec.test.js
- Conceitos
- Data encoding (molecule, hex, bigints), Witnesses and signatures
- Evidência
- De uma correção: de um projeto, verificada contra o commit
- Vista pela primeira vez
- 2026-11-14
- Última mudança
- 2026-11-14
- Última verificação
- 2026-11-19
- Verificação contra o commit
- em parte certa: um núcleo verdadeiro, com uma parte solta ou demasiado larga
Fontes (1)
- 2026-11-14 · toastmanAu/daowow · mais deste projeto
Mais sobre 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
Manténs um projeto de onde esta lição veio? Confirma ou corrige
Citar esta lição
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.