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
Design a CKB-native source and metadata model for typed transaction roles across independently compiled Scripts.
The goal is to let one CellScript entry declare the foreign inputs, outputs, dependencies, and peer Script identities that it relies on in the same atomic CKB transaction—without adding an ELF linker, runtime calls, or a shared hidden state model.
This work should begin only after the artifact-only composition boundary in #9 is specified well enough to expose real role and conflict requirements.
Problem
CellScript can already:
inspect transaction and Script Group views through typed SourceView;
construct and compare Script/ScriptRef values;
import schemas and pure helpers at compile time;
bind package interfaces and deployment identities;
express explicit local input/output transitions.
What it cannot express as one typed protocol contract is:
“This action is valid only when a foreign Script consumes these typed inputs, creates these typed outputs, and independently accepts the same transaction under this exact or compatible identity.”
Applications can hand-code individual syscall checks, but the relationship is not a first-class role graph. It is therefore missing from interface compatibility, builder generation, ProofPlan, audit output, and protocol-level transaction composition.
Argent's closed/open ICC and consumes/emits/observes model demonstrate the product value of making the application graph source-level. CellScript must adapt the idea to CKB's Cell Model and Script Groups rather than copying Kaspa covenant semantics.
CKB-native model
CKB already executes independent Lock and Type Script Groups against the same transaction. The language feature should describe and verify relationships between those groups; it should not call one Script from another.
flowchart TB
SRC["CellScript protocol/role declarations"] --> A["Compile artifact A obligations"]
SRC --> B["Compile artifact B obligations"]
SRC --> PB["Emit ProtocolBundle role graph"]
TX["One atomic CKB transaction"] --> GA["Script Group A"]
TX --> GB["Script Group B"]
GA --> VA["Artifact A validates its observable facts"]
GB --> VB["Artifact B validates its observable facts"]
VA --> OK{"Both independently accept?"}
VB --> OK
OK -- "yes" --> ACCEPT["Transaction valid"]
OK -- "no" --> REJECT["Transaction rejected"]
Loading
Required role classes
The design should separate these concepts rather than overloading ordinary action parameters:
Local lifecycle roles
inputs controlled by the current Script Group;
outputs created or updated under the current Script identity;
existing consume, create, transition, and bounded lifecycle rules.
Closed foreign roles
A peer role bound to:
exact package/interface hash;
exact serialized state schema;
exact deployment and Script identity policy;
fixed Lock/Type role;
explicit transaction or group source;
fixed or bounded cardinality.
This is the CKB analogue of a statically linked peer application, but it remains an independently executed Script.
Open foreign roles
A peer role whose implementation is chosen at transaction construction time, subject to an explicit interface/schema/effect contract and an on-chain-verifiable Script identity binding.
Open roles must not rely on a Registry lookup as consensus proof. See the separate interface-bound Script-handle issue that will build on this role model.
Dependency roles
code or data CellDeps;
HeaderDeps;
spawned VM/IPC verifier contracts;
read-only configuration Cells.
Dependency roles remain distinct from consumed inputs and created outputs.
Possible source shape
This issue must not preselect final syntax. A strawman only illustrates the semantic information:
The accepted design may use a manifest rather than new language syntax. The non-negotiable part is the typed role graph and its evidence, not the spelling.
Summary
Design a CKB-native source and metadata model for typed transaction roles across independently compiled Scripts.
The goal is to let one CellScript entry declare the foreign inputs, outputs, dependencies, and peer Script identities that it relies on in the same atomic CKB transaction—without adding an ELF linker, runtime calls, or a shared hidden state model.
This work should begin only after the artifact-only composition boundary in #9 is specified well enough to expose real role and conflict requirements.
Problem
CellScript can already:
SourceView;Script/ScriptRefvalues;What it cannot express as one typed protocol contract is:
Applications can hand-code individual syscall checks, but the relationship is not a first-class role graph. It is therefore missing from interface compatibility, builder generation, ProofPlan, audit output, and protocol-level transaction composition.
Argent's closed/open ICC and
consumes/emits/observesmodel demonstrate the product value of making the application graph source-level. CellScript must adapt the idea to CKB's Cell Model and Script Groups rather than copying Kaspa covenant semantics.CKB-native model
CKB already executes independent Lock and Type Script Groups against the same transaction. The language feature should describe and verify relationships between those groups; it should not call one Script from another.
flowchart TB SRC["CellScript protocol/role declarations"] --> A["Compile artifact A obligations"] SRC --> B["Compile artifact B obligations"] SRC --> PB["Emit ProtocolBundle role graph"] TX["One atomic CKB transaction"] --> GA["Script Group A"] TX --> GB["Script Group B"] GA --> VA["Artifact A validates its observable facts"] GB --> VB["Artifact B validates its observable facts"] VA --> OK{"Both independently accept?"} VB --> OK OK -- "yes" --> ACCEPT["Transaction valid"] OK -- "no" --> REJECT["Transaction rejected"]Required role classes
The design should separate these concepts rather than overloading ordinary action parameters:
Local lifecycle roles
consume,create,transition, and bounded lifecycle rules.Closed foreign roles
A peer role bound to:
This is the CKB analogue of a statically linked peer application, but it remains an independently executed Script.
Open foreign roles
A peer role whose implementation is chosen at transaction construction time, subject to an explicit interface/schema/effect contract and an on-chain-verifiable Script identity binding.
Open roles must not rely on a Registry lookup as consensus proof. See the separate interface-bound Script-handle issue that will build on this role model.
Dependency roles
Dependency roles remain distinct from consumed inputs and created outputs.
Possible source shape
This issue must not preselect final syntax. A strawman only illustrates the semantic information:
The accepted design may use a manifest rather than new language syntax. The non-negotiable part is the typed role graph and its evidence, not the spelling.
Role graph and obligations
graph LR ENTRY["Current entry"] --> LI["Local input role"] ENTRY --> LO["Local output role"] ENTRY --> FI["Foreign input role"] ENTRY --> FO["Foreign output role"] ENTRY --> DEP["CellDep/HeaderDep role"] FI --> ID["Script/interface identity"] FI --> SCHEMA["Typed schema decode"] FO --> CORR["Output correspondence"] FO --> PEER["Peer independently executes"] DEP --> POLICY["Read-only identity policy"]For each role, metadata must record:
Soundness rules
Implementation phases
Phase 0 — use cases and threat model
Select at least three concrete multi-Script protocols, for example:
For each, document current manual checks and the intended role graph.
Phase 1 — metadata-only role graph
This phase must not advertise on-chain coverage.
Phase 2 — closed roles
Phase 3 — open roles
Acceptance criteria
Non-goals
Dependencies
References