All lessons · Rust scripts and ckb-std · Start here · Glossary
Enable molecule bytes_vec so ckb-std scripts contain no atomic instructionsWorkingChecked by the owner
Checked by the owner · Check: right · Checked 2026-11-19
With ckb-std 0.16, molecule's default Bytes uses the external bytes crate, which emits lr.d/sc.d atomic instructions that the CKB VM rejects, so the built lock script was not executable on chain. Adding molecule 0.8 with default-features = false and features = ["bytes_vec"] to the script crate makes feature unification swap in molecule's Vec-backed Bytes, and the commit reports the artifact then had zero atomic instructions.
Why it matters: Without the bytes_vec feature, the external bytes crate's atomic refcounting compiles into the RISC-V script, so the CKB VM cannot execute the deployed script and cells locked by it cannot be unlocked on chain.
Pattern
molecule = { version = "0.8", default-features = false, features = ["bytes_vec"] }Taken from the commit, shortened.
A test changed in the same commit
It sits next to the fix. We did not run it.
- wraith-protocol/contracts:
ckb/integration-tests/tests/lock_integration.rs - LusoCryptoLabs/vortx-swap:
scripts/e2e/aggregator-otx.mjs,scripts/e2e/concurrency.mjs,scripts/e2e/otx-joyid-real.mjs,scripts/e2e/otx-testnet.mjs,scripts/e2e/run.mjs
- Concepts
- Other
- Evidence
- Checked by the owner: checked by the owner of the project it came from, who is also the publisher of these lessons
- First seen
- 2026-09-30
- Last changed
- 2026-10-22
- Last checked
- 2026-11-19
- Check against the commit
- right: the lesson follows from its commit and still holds in the code today
Sources (2)
- 2026-09-30 · wraith-protocol/contracts · more from this project
- 2026-10-22 · LusoCryptoLabs/vortx-swap · more from this project
More about Rust scripts and ckb-std
- CKB VM2 READ and INHERITED_FDS syscalls take a length pointer and return status in a0
- Close spawn pipe descriptors when an IPC channel is freed
- Disable overflow checks for ckb-std when using its dummy-atomic polyfills
Checked by @LusoCryptoLabs (owner of the project), 2026-11-19.
Do you maintain a project this lesson came from? Confirm or correct it
Cite this lesson
LusoCryptoLabs, "Enable molecule bytes_vec so ckb-std scripts contain no atomic instructions", CKB lessons, https://pulse.lusocryptolabs.com/learned/scripts/enable-molecule-bytes-vec-so-ckb-std-scripts-contain-no-atom, CC BY 4.0, last changed 2026-10-22.