CKB Pulse

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

Preferir
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.

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)

Mais sobre CCC (TypeScript SDK)

Ver as 33 deste tema

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.

Tiradas de commits públicos e verificadas contra o commit de onde cada uma veio e o código de hoje do projeto. Lê a fonte antes de confiar numa. Texto sob CC BY 4.0: dá crédito à LusoCryptoLabs, CKB lessons, com uma ligação para a lição. Queres que uma lição seja mudada ou retirada? Abre um issue.