Todas as lições · Apps and UI · Começa aqui · Glossário
Occupied capacity depends on the actual lock's args lengthPráticoDe uma correção
De uma correção · Verificação: certa · Verificada em 2026-11-19
When quoting the capacity for cells locked to a user's wallet, compute the occupied size from the connected lock script (8 capacity bytes + 32 code_hash + 1 hash_type + args length + type + data), not a hardcoded value. In this commit a JoyID lock with 22 byte args gives a 222 CKB claim cell and a secp256k1 lock with 20 byte args gives 220 CKB. The script's molecule serialization header does not count toward occupied capacity.
Porque importa: A hardcoded lock size misquotes the capacity for any wallet whose lock args differ in length. In this commit that is 2 CKB per claim cell between JoyID (22 bytes) and secp256k1 (20 bytes), so the quoted total the user agrees to would not match what the transaction needs.
Distinct from the pre-sign checker lesson: this is about sizing by the connected lock's real args length.
Padrão
const lockScriptSize = (lockScript) => 32n + 1n + argsLength(lockScript);Tirado do commit, encurtado.
Um teste mudou no mesmo commit
Está ao lado da correcção. Nós não o corremos.
- toastmanAu/daowow:
apps/web/test/quote.test.js,crates/daowow-core/tests/gen_vectors.rs
- Conceitos
- Capacity and cell size
- Evidência
- De uma correção: de um projeto, verificada contra o commit
- Vista pela primeira vez
- 2026-09-23
- Última mudança
- 2026-09-23
- Última verificação
- 2026-11-19
- Verificação contra o commit
- certa: a lição sai do commit e continua a valer no código de hoje
Fontes (1)
- 2026-09-23 · toastmanAu/daowow · mais deste projeto
Mais sobre Apps and UI
- Exact CKB-to-shannon conversion with BigInt
- Pre-sign checkers must mirror every on-chain comparison
- Witness data in input_type and folding sub-minimum change
Manténs um projeto de onde esta lição veio? Confirma ou corrige
Citar esta lição
LusoCryptoLabs, "Occupied capacity depends on the actual lock's args length", CKB lessons, https://pulse.lusocryptolabs.com/learned/apps/occupied-capacity-depends-on-the-actual-lock-s-args-length, CC BY 4.0, last changed 2026-09-23.