You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Connect CellScript's runtime Script/ScriptRef values with its canonical package-interface and deployment identities.
The desired abstraction is a typed handle such as ScriptHandle<I> or VerifierHandle<I>: a runtime-selected Lock or Type Script whose implementation is proven to satisfy a declared interface contract, while remaining an ordinary non-Cell value that grants no lifecycle authority by itself.
This issue supplies the identity foundation required by the open foreign roles in #10.
Current gap
CellScript already has two strong but disconnected layers:
Runtime Script identity
The language can construct and inspect CKB Scripts:
Script and ScriptRef;
code_hash, hash_type, and args;
exact Lock/Type Script matching;
code/data CellDep identities;
deployment records.
Compile-time package identity
The compiler emits:
cellscript-package-interface-v2;
canonical interface_hash;
six-dimensional compatibility reports;
typed-semantics and lowering identities;
generated-builder and deployment contracts;
Registry admission checks.
A raw runtime Script does not currently carry or prove a package interface. Conversely, an interface_hash in Registry metadata does not prove which Script bytes are executing in a transaction.
Binds an upgradeable deployment identity, such as a Type ID code Cell, plus an explicit compatibility/upgrade policy.
The verifier or builder must resolve the actual code bytes used by the transaction and prove that the selected deployment belongs to the allowed line. A Type-hash Script reference alone must not be treated as proof that every future code Cell remains interface-compatible.
Compatible open handle
Accepts one of several implementations satisfying a minimum interface or schema/effect contract.
This requires a versioned compatibility policy and a consensus-verifiable binding from the selected Script to a checked interface receipt. It must not be implemented as “look up the code hash in the Registry and trust the response.”
Candidate receipt model
The exact encoding requires an RFC. A receipt could bind:
For data-hash code deployment, exact Script code identity can anchor the artifact strongly. For Type-hash/upgradeable deployment, the RFC must define how the concrete code Cell and its upgrade policy are bound and revalidated.
Type-system requirements
A handle type must:
be an ordinary fixed-width value, not a Cell-backed resource;
carry no implicit create, consume, replace, or authorization capability;
encode Lock versus Type Script role explicitly;
distinguish exact from compatible/upgradeable policies;
preserve target, VM, source-encoding, witness ABI, and Script hash-type identities;
prevent implicit conversion from raw Script or Hash;
require explicit checked construction;
be serializable only through a versioned canonical representation;
expose safe equality and exact-preservation operations;
remain separate from a peer Cell's decoded state.
The open-role system may state that an output uses the same implementation as an input, but that relation must compare the complete accepted handle identity, not only a code hash or interface name.
Trust boundaries
Evidence
What it proves
What it does not prove
raw Script fields
transaction carries this Script structure
the code satisfies interface I
Registry interface record
a published package claims this interface
the transaction executes that artifact
independent checker
artifact records and ELF agree structurally
deployment/live-chain identity
deployment record
expected artifact was recorded at an outpoint
the current transaction resolved the same bytes unless checked
code/data hash check
exact code bytes are selected
source-level intent unless bound to checked artifact
Type ID
unique/upgradable code-cell identity
upgrade compatibility
CKB-VM dry-run
selected Scripts accept this exact transaction
general source equivalence or future upgrades
Implementation phases
Phase 0 — threat model and exact handle
enumerate substitution, downgrade, stale-deployment, Registry-spoofing, and type-hash upgrade attacks;
define an exact artifact receipt and canonical hash;
define how the builder and on-chain Script check the selected implementation;
keep compatible/open handles out of scope until exact handles are proven.
Phase 1 — exact closed handles
add the fixed-width handle/receipt representation;
integrate it with public interfaces, deployment manifests, ProtocolBundle, metadata, and tx validate;
generate exact Script/data/code identity checks;
preserve the handle across declared input/output roles;
add independent checker and mutation coverage.
Phase 2 — upgradeable deployment lines
define upgrade authorization separately from compatibility;
require every selected code version to have a checked receipt;
reject stale, yanked, incompatible, or unbound versions according to policy;
preserve historical receipt identity in audit evidence.
Phase 3 — compatible open handles
define minimum interface and schema/effect requirements;
admit only implementations with a consensus-verifiable receipt binding;
Summary
Connect CellScript's runtime
Script/ScriptRefvalues with its canonical package-interface and deployment identities.The desired abstraction is a typed handle such as
ScriptHandle<I>orVerifierHandle<I>: a runtime-selected Lock or Type Script whose implementation is proven to satisfy a declared interface contract, while remaining an ordinary non-Cell value that grants no lifecycle authority by itself.This issue supplies the identity foundation required by the open foreign roles in #10.
Current gap
CellScript already has two strong but disconnected layers:
Runtime Script identity
The language can construct and inspect CKB Scripts:
ScriptandScriptRef;code_hash,hash_type, and args;Compile-time package identity
The compiler emits:
cellscript-package-interface-v2;interface_hash;A raw runtime
Scriptdoes not currently carry or prove a package interface. Conversely, aninterface_hashin Registry metadata does not prove which Script bytes are executing in a transaction.flowchart LR RS["Runtime Script<br/>code_hash + hash_type + args"] -. "missing verified link" .- PI["Package interface<br/>interface_hash + schema + effects"] ART["Checked artifact"] --> PI DEP["Deployment identity"] --> RSRequired security property
A consumer accepting
ScriptHandle<I>must be able to answer all three questions independently:I?The answer must not depend on a mutable Registry lookup during consensus execution.
Handle classes
The design should distinguish at least:
Exact artifact handle
Binds one exact checked artifact:
This is the simplest and safest first version.
Deployment-line handle
Binds an upgradeable deployment identity, such as a Type ID code Cell, plus an explicit compatibility/upgrade policy.
The verifier or builder must resolve the actual code bytes used by the transaction and prove that the selected deployment belongs to the allowed line. A Type-hash Script reference alone must not be treated as proof that every future code Cell remains interface-compatible.
Compatible open handle
Accepts one of several implementations satisfying a minimum interface or schema/effect contract.
This requires a versioned compatibility policy and a consensus-verifiable binding from the selected Script to a checked interface receipt. It must not be implemented as “look up the code hash in the Registry and trust the response.”
Candidate receipt model
The exact encoding requires an RFC. A receipt could bind:
flowchart TB SRC["Package source"] --> COMP["CellScript compiler"] COMP --> IFACE["Canonical interface hash"] COMP --> ART["ELF + typed/lowering records"] ART --> CHECK["Independent checker"] CHECK --> RECEIPT["Verified interface receipt"] RECEIPT --> DEPLOY["Deployment record / code Cell"] DEPLOY --> HANDLE["Runtime ScriptHandle<I>"] HANDLE --> ROLE["Open or closed transaction role"]For data-hash code deployment, exact Script code identity can anchor the artifact strongly. For Type-hash/upgradeable deployment, the RFC must define how the concrete code Cell and its upgrade policy are bound and revalidated.
Type-system requirements
A handle type must:
create,consume,replace, or authorization capability;ScriptorHash;The open-role system may state that an output uses the same implementation as an input, but that relation must compare the complete accepted handle identity, not only a code hash or interface name.
Trust boundaries
ScriptfieldsIImplementation phases
Phase 0 — threat model and exact handle
Phase 1 — exact closed handles
tx validate;Phase 2 — upgradeable deployment lines
Phase 3 — compatible open handles
Acceptance matrix
Completion criteria
tx validateresolve and verify handles.Non-goals
Dependencies
References