Todas as lições · Rust scripts and ckb-std · Começa aqui · Glossário
Delegating script validation via exec to a hash bound cell depPráticoDe uma correção
De uma correção · Verificação: certa · Verificada em 2026-11-19
This lifecycle type script stores a 32 byte data hash in its args, scans cell deps with load_cell_data_hash to find exactly one match (rejecting duplicates), then calls ckb_std syscalls::exec on that dep, which keeps the current Script context (GroupInput, GroupOutput, args) for the child. Because exec only returns when it fails, any code after the call must return an error instead of falling through to success.
Porque importa: If code after exec falls through to success, a failed exec (for example a missing or invalid dep at that index) lets the transaction pass with no child validation at all, and without the uniqueness check an ambiguous dep set picks an unintended executable.
Padrão
let _ = syscalls::exec(parent, Source::CellDep, 0, 0, &[]); Err(Error::Exec)Tirado do commit, encurtado.
Um teste mudou no mesmo commit
Está ao lado da correcção. Nós não o corremos.
- CellScript-Labs/CellScript:
contracts/zk-private-counter/tests/admission.rs,contracts/zk-private-counter/tests/application.rs,contracts/zk-private-counter/tests/node.rs,contracts/zk-private-counter/tests/support/mod.rs
- 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-04
- Última mudança
- 2026-10-04
- Ú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-10-04 · CellScript-Labs/CellScript · mais deste projeto
Mais sobre Rust scripts and ckb-std
- Separate builds for test-only contract constants
- Check that a derived successor type args match the spent cell's type args
- Iterating group inputs and outputs with ckb-std until IndexOutOfBound
Manténs um projeto de onde esta lição veio? Confirma ou corrige
Citar esta lição
LusoCryptoLabs, "Delegating script validation via exec to a hash bound cell dep", CKB lessons, https://pulse.lusocryptolabs.com/learned/scripts/delegating-script-validation-via-exec-to-a-hash-bound-cell-d, CC BY 4.0, last changed 2026-10-04.