CKB Pulse

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

Prefer
.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.

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)

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, "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.

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.