Todas as lições · CCC (TypeScript SDK) · Começa aqui · Glossário
Verifying an immutable data1 script code cell after deploymentPráticoDe uma correção
De uma correção · Verificação: em parte certa · Verificada em 2026-11-19
For a script referenced by hashType 'data1', put the binary in a cell whose lock is the always fail lock (codeHash 32 zero bytes, hashType data1, args 0x, which no code cell can match) and with no type, so the cell can never be spent and the cell dep stays live; the capacity is locked forever. After sending, read the cell with client.getCellLive(outPoint, true) and assert that ccc.hashCkb(outputData) equals the pinned code hash, that the lock equals the always fail lock and that there is no type, ideally on more than one endpoint. The data1 code hash is already pinned by the binary's content; the immutable lock is what keeps the cell available.
Porque importa: If the code cell had a spendable lock, the deployer could consume it, and every transaction using that out point as a cell dep would fail. Without the post-deployment check, a wrong binary, lock or type would be recorded in the manifest unnoticed.
Padrão
assert(code&&ccc.hashCkb(code.outputData)===LOCK_V2.codeHash ...); assert(code.cellOutput.lock.eq(IMMUTABLE_LOCK)&&!code.cellOutput.type,`Code cell is not immutable on ${url}`);Tirado do commit, encurtado.
Um teste mudou no mesmo commit
Está ao lado da correcção. Nós não o corremos.
- toastmanAu/openswap:
frontend/test/fixtures.ts,sdk/test/v2-sdk.test.ts
- Conceitos
- Cell deps and script lookup, Type ID and upgrades
- Evidência
- De uma correção: de um projeto, verificada contra o commit
- Vista pela primeira vez
- 2026-10-29
- Última mudança
- 2026-10-29
- Ú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-10-29 · toastmanAu/openswap · mais deste projeto
Mais sobre CCC (TypeScript SDK)
- CCC custom client scripts must include AnyoneCanPay for SignerCkbPrivateKey
- Registering NervosDao on devnet
- Convert Fiber RPC snake_case scripts to CCC camelCase ScriptLike
Manténs um projeto de onde esta lição veio? Confirma ou corrige
Citar esta lição
LusoCryptoLabs, "Verifying an immutable data1 script code cell after deployment", CKB lessons, https://pulse.lusocryptolabs.com/learned/ccc/verifying-an-immutable-data1-script-code-cell-after-deployme, CC BY 4.0, last changed 2026-10-29.