Start here · Glossary · Test yourself · Feed
CECILIA-MULANDI/zk-Lock ✕
Lessons from CECILIA-MULANDI/zk-Lock
github.com/CECILIA-MULANDI/zk-Lock
Do you maintain this project? Confirm its lessons in one issue
2 lessons found. All lessons
In ckb-testtool tests, checking only that `context.verify_tx(&tx, MAX_CYCLES)` returns an error lets a test keep passing even if the targeted check is deleted from the script, because a badly built transaction usually fails for several reasons. This commit matches the script's exit code in the error string instead (`err.contains("error code {code} ")`), one constant per error discriminant of the script.
#Testing and devnet · Sources (1) · 2026-11-05
When a lock script commits to output 0's exact bytes (capacity included), the capacity must be decided before proving and must equal what the transaction ships. In CCC, tx.completeFeeBy(signer) pays the fee by pulling in the signer's cells and adding a change output, so output 0 keeps its capacity and the fee is then paid from extra inputs, which breaks the binding if the proof assumed inputCapacity minus fee. Instead compute the fee from tx.toBytes().length with the witness already at its final length, build output 0 at inputCapacity minus that fee, and check before sending that the fee recomputed on the real transaction equals the planned one.
#Transaction building and fees #Witnesses and signatures #Capacity and cell size · Sources (1) · 2026-11-04
Text under CC BY 4.0: credit LusoCryptoLabs, CKB lessons, with a link to the lesson. JSON · Want a lesson changed or removed? Open an issue.