All lessons · Rust scripts and ckb-std · Start here · Glossary
Passing a pipe to a spawned child script via a zero-terminated inherited_fds listAdvancedFrom one fix
From one fix · Check: partly right · Checked 2026-11-19
When a lock spawns a verifier script from a cell dep with ckb-std 1.1.0 syscalls::spawn, it creates a pipe and passes the read fd in SpawnArgs.inherited_fds as an array ending in 0. After writing the full request, the parent closes write_fd so the child's read returns 0 or OtherEndClosed (end of input), then uses syscalls::wait(pid) == 0 as the verification result.
Why it matters: If the parent never closes the write end, the child's final end-of-input read cannot return 0 or OtherEndClosed, so the verifier rejects the request as malformed or blocks waiting for data.
A test changed in the same commit
It sits next to the fix. We did not run it.
- toastmanAu/ckb-crypto-agile-account-reference-v0.1:
crates/host/tests/abi_v1_conformance.rs,crates/host/tests/config.rs,crates/host/tests/encoding.rs,crates/host/tests/identity.rs,demo/test/browser/demo.spec.ts
- Concepts
- Cell deps and script lookup, Other
- Evidence
- From one fix: from one project, checked against its commit
- First seen
- 2026-10-22
- Last changed
- 2026-10-22
- Last checked
- 2026-11-19
- Check against the commit
- partly right: a true core, with a part that is loose or too wide
Sources (1)
More about Rust scripts and ckb-std
- Enable molecule bytes_vec so ckb-std scripts contain no atomic instructions
- Check that a derived successor type args match the spent cell's type args
- CKB VM2 READ and INHERITED_FDS syscalls take a length pointer and return status in a0
Do you maintain a project this lesson came from? Confirm or correct it
Cite this lesson
LusoCryptoLabs, "Passing a pipe to a spawned child script via a zero-terminated inherited_fds list", CKB lessons, https://pulse.lusocryptolabs.com/learned/scripts/passing-a-pipe-to-a-spawned-child-script-via-a-zero-terminat, CC BY 4.0, last changed 2026-10-22.