All lessons · Rust scripts and ckb-std · Start here · Glossary
Raw cell_deps indexes match Source::CellDep only before the first dep groupAdvancedFrom one fix
From one fix · Check: partly right · Checked 2026-11-19
When a script reads the raw transaction's cell_deps (via load_transaction) and uses a position there as a Source::CellDep index for load_cell_type_hash or load_cell_data, the mapping holds only for the leading run of dep_type code entries, because dep groups expand into their member cells and shift later indexes. This vote script restricts its proposal and deposit lookups to that direct prefix and lets wallet dep groups follow it.
Why it matters: Once a dep group sits before the wanted dep, a raw cell_deps position reads a different resolved cell, so the script checks the wrong proposal or deposit data, or fails.
Pattern
.take_while(|dep| dep.dep_type().as_slice() == [0])Taken from the commit, shortened.
A test changed in the same commit
It sits next to the fix. We did not run it.
- CellScript-Labs/AgoraSeal:
crates/protocol/tests/reference_vote_vm.rs,crates/protocol/tests/replay.rs,crates/protocol/tests/treasury_vm.rs
- Concepts
- Cell deps and script lookup
- Evidence
- From one fix: from one project, checked against its commit
- First seen
- 2026-10-07
- Last changed
- 2026-10-07
- 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)
- 2026-10-07 · CellScript-Labs/AgoraSeal · more from this project
More about Rust scripts and ckb-std
- Check that a derived successor type args match the spent cell's type args
- Delegating script validation via exec to a hash bound cell dep
- Iterating group inputs and outputs with ckb-std until IndexOutOfBound
Do you maintain a project this lesson came from? Confirm or correct it
Cite this lesson
LusoCryptoLabs, "Raw cell_deps indexes match Source::CellDep only before the first dep group", CKB lessons, https://pulse.lusocryptolabs.com/learned/scripts/raw-cell-deps-indexes-match-source-celldep-only-before-the-f, CC BY 4.0, last changed 2026-10-07.