Todas as lições · Rust scripts and ckb-std · Começa aqui · Glossário
Type Script group membership and group witness index derived from the full script hashPráticoDe uma correção
De uma correção · Verificação: certa · Verificada em 2026-11-19
When locating a Type Script group off chain, match input and output cells by the blake2b hash of the complete Script (code_hash, hash_type, args), never by code hash alone. By convention (RFC 22 for lock groups), a group's witness sits at the transaction index of its first input, or of its first output if the group has no inputs. CKB does not enforce this: the script picks which witness it reads, and which WitnessArgs field (input_type or output_type) holds the data is the protocol's own choice.
Porque importa: If cells are matched by code hash alone, cells whose Type Scripts differ only in args or hash_type land in the group, so the off chain tool computes the wrong group members, cardinality and witness index compared with what the CKB VM executes.
Padrão
output.type_script.as_ref().is_some_and(|script| hash(script.bytes) == selected_hash)Tirado do commit, encurtado.
Um teste mudou no mesmo commit
Está ao lado da correcção. Nós não o corremos.
- CellScript-Labs/CellScript:
tests/frozen_interface.rs,tests/policy_artifact_checker.rs
- Conceitos
- Witnesses and signatures, Transaction building and fees
- Evidência
- De uma correção: de um projeto, verificada contra o commit
- Vista pela primeira vez
- 2026-10-09
- Última mudança
- 2026-10-09
- Última verificação
- 2026-11-19
- Verificação contra o commit
- certa: a lição sai do commit e continua a valer no código de hoje
Fontes (1)
- 2026-10-09 · CellScript-Labs/CellScript · mais deste projeto
Mais sobre Rust scripts and ckb-std
- Place a script's raw witness at the index of the input it validates
- Use raw_data(), not as_slice(), when parsing a packed::Bytes witness
- Check that a derived successor type args match the spent cell's type args
Manténs um projeto de onde esta lição veio? Confirma ou corrige
Citar esta lição
LusoCryptoLabs, "Type Script group membership and group witness index derived from the full script hash", CKB lessons, https://pulse.lusocryptolabs.com/learned/scripts/type-script-group-membership-and-group-witness-index-derived, CC BY 4.0, last changed 2026-10-09.