All lessons · Developer tooling · Start here · Glossary
Emit shannon u64 values as strings in cross-language test vectorsWorkingFrom one fix
From one fix · Check: true, but the check found it more general than CKB · Checked 2026-11-19
When generating JSON test vectors in Rust for JavaScript decoders of CKB cell data, emit u64 fields (such as shannon amounts) as strings, because JSON numbers are IEEE-754 doubles and values above 2^53 would be silently rounded. Use distinct, non-zero field values so a decoder reading the wrong offset gives a visibly wrong result.
Why it matters: Without string encoding, u64 amounts above 2^53 are silently rounded in the JSON oracle, so the JavaScript decoder gets pinned to a wrong value and its tests still pass.
Pattern
"principal_total": oracle_shard.principal_total.to_string(),Taken from the commit, shortened.
A test changed in the same commit
It sits next to the fix. We did not run it.
- toastmanAu/daowow:
crates/daowow-core/tests/gen_vectors.rs
- Concepts
- Testing and devnet, Data encoding (molecule, hex, bigints)
- Evidence
- From one fix: from one project, checked against its commit
- First seen
- 2026-09-18
- Last changed
- 2026-09-18
- Last checked
- 2026-11-19
- Check against the commit
- true, but the check found it more general than CKB
Sources (1)
- 2026-09-18 · toastmanAu/daowow · more from this project
More about Developer tooling
- ckb-vm-js 0.2.0 (npm) checks header hash instead of rejecting the field
- Mirror on-chain rules off-chain with mutation tests
- Mock transactions must expand dep_group members
Do you maintain a project this lesson came from? Confirm or correct it
Cite this lesson
LusoCryptoLabs, "Emit shannon u64 values as strings in cross-language test vectors", CKB lessons, https://pulse.lusocryptolabs.com/learned/tooling/emit-shannon-u64-values-as-strings-in-cross-language-test-ve, CC BY 4.0, last changed 2026-09-18.