CKB Pulse

All lessons · Rust scripts and ckb-std · Start here · Glossary

Delegating script validation via exec to a hash bound cell depWorkingFrom one fix

From one fix · Check: right · Checked 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.

Why it matters: 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.

Pattern

Prefer
let _ = syscalls::exec(parent, Source::CellDep, 0, 0, &[]); Err(Error::Exec)

Taken from the commit, shortened.

A test changed in the same commit

It sits next to the fix. We did not run it.

Concepts
Cell deps and script lookup, Type ID and upgrades
Evidence
From one fix: from one project, checked against its commit
First seen
2026-10-04
Last changed
2026-10-04
Last checked
2026-11-19
Check against the commit
right: the lesson follows from its commit and still holds in the code today

Sources (1)

More about Rust scripts and ckb-std

All 35 in this topic

Do you maintain a project this lesson came from? Confirm or correct it

Cite this lesson
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.

Drawn from public commits and checked against the commit each one came from and the project's code today. Read the source before you rely on one. Text under CC BY 4.0: credit LusoCryptoLabs, CKB lessons, with a link to the lesson. Want a lesson changed or removed? Open an issue.