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
Implement the positive runtime semantics for BoundedCellSet<T, N>::consume_each on the CKB target.
The frontend already preserves the bounded operation and its predicate, but production builds correctly reject it because the emitted verifier does not yet select, authenticate, decode, count, and discharge the lifecycle of every matching input Cell. This issue is complete only when the selected shape executes in CKB-VM and the standalone checker can prove that the corresponding machine blocks are present.
This is a consensus-facing feature. An accepted specification must precede positive lowering.
Portfolio status
This is a candidate consensus-runtime workstream, not an authorized 0.26 or P0 implementation commitment. Until the post-0.25 evidence review accepts concrete use cases, an accountable owner, an independent reviewer, capacity, and stop conditions, only Phase 0 specification and use-case discovery are authorized. The issue priority describes semantic risk, not a promised release slot.
Why this is a real gap
Today, N is only a static complexity declaration. It is not evidence that runtime execution observed at most N Cells. The current boundary is documented in the collections support matrix.
Explicit fixed-arity parameters work, but they do not express protocols whose input cardinality is bounded yet chosen by each transaction—for example batched account updates, bounded receipt settlement, or a capped set of claims.
Argent's open range PR #44 is a useful design signal, not production evidence: its runtime builder and several interaction classes remain follow-up work. CellScript must define the CKB Script Group, Molecule, identity, and linear-lifecycle contract directly.
Required semantic contract
The first accepted version should be deliberately narrow:
support Type Script group inputs first;
require an explicit group source; never scan the whole transaction implicitly;
bind T to an exact Type Script identity and canonical schema;
compute the actual group cardinality in CKB-VM and require actual_count <= N;
decode every selected Cell exactly once;
execute the predicate exactly once for every decoded element;
fail the whole Script on any predicate, identity, source, count, or decoding failure;
discharge every selected Cell through the linear consume lifecycle;
preserve canonical group-relative order in metadata, traces, and builder evidence.
Lock Script support must be a separate explicitly justified shape if its observable group and authority rules differ.
flowchart LR
TX["Candidate CKB transaction"] --> SG["Exact Type Script group inputs"]
SG --> COUNT["Load actual group count"]
COUNT --> BOUND{"count <= N?"}
BOUND -- "no" --> REJECT["Stable runtime error"]
BOUND -- "yes" --> LOOP["For each group-relative input"]
LOOP --> ID["Verify Script identity"]
ID --> DECODE["Decode canonical Molecule T"]
DECODE --> PRED["Run predicate exactly once"]
PRED --> LIFE["Record/discharge consume"]
LIFE --> ACCEPT["All selected Cells covered"]
Loading
Required failure taxonomy
Each failure must have a stable registered runtime error and a source-linked ProofPlan obligation:
Failure
Required behavior
wrong source kind
Reject before trusting data
wrong Type Script identity
Reject the selected Cell
missing or ambiguous identity
Reject; never fall back to schema-only matching
malformed Molecule data
Reject with a decoding-specific error
actual count greater than N
Reject before iteration
duplicate logical identity
Reject when the resource policy requires uniqueness
predicate returns false
Reject the complete transaction
predicate or decode path omitted by codegen
Standalone checker mutation must reject the artifact
lifecycle not discharged
Compile-time ownership error or production rejection
Implementation phases
Phase 0 — specification
Add an accepted bounded-lifecycle RFC covering:
observable source and group ordering;
Type Script identity policy;
canonical Molecule codec;
zero-input semantics;
uniqueness policy;
predicate evaluation and side-effect rules;
error-code allocation;
ProofPlan and typed-semantics records;
Lock versus Type Script differences;
cycle, stack, and serialized-size budgets.
No positive runtime lowering should land before this phase is accepted.
Phase 1 — typed and metadata boundary
keep the predicate and source selection in typed semantics;
make actual-cardinality observation explicit;
add independent ProofPlan records for selection, identity, decode, count, predicate, and lifecycle discharge;
update entry ABI and builder assumptions;
ensure the executable-surface classifier distinguishes the newly supported shape from all unsupported variants.
Phase 2 — CKB runtime lowering
use canonical Script Group input syscalls;
enforce actual count before iteration;
lower a bounded loop with deterministic memory use;
decode each element once and retain a typed addressable view;
propagate exact runtime errors;
keep unsupported shapes fail-closed with E2105.
Phase 3 — verification and tooling
extend the standalone artifact checker and mutation corpus;
add simulator, CKB-VM, and stateful CKB acceptance fixtures;
update builder validation, LSP, VS Code, Playground summaries, docs, and release notes;
Summary
Implement the positive runtime semantics for
BoundedCellSet<T, N>::consume_eachon the CKB target.The frontend already preserves the bounded operation and its predicate, but production builds correctly reject it because the emitted verifier does not yet select, authenticate, decode, count, and discharge the lifecycle of every matching input Cell. This issue is complete only when the selected shape executes in CKB-VM and the standalone checker can prove that the corresponding machine blocks are present.
This is a consensus-facing feature. An accepted specification must precede positive lowering.
Portfolio status
This is a candidate consensus-runtime workstream, not an authorized 0.26 or P0 implementation commitment. Until the post-0.25 evidence review accepts concrete use cases, an accountable owner, an independent reviewer, capacity, and stop conditions, only Phase 0 specification and use-case discovery are authorized. The issue priority describes semantic risk, not a promised release slot.
Why this is a real gap
Today,
Nis only a static complexity declaration. It is not evidence that runtime execution observed at mostNCells. The current boundary is documented in the collections support matrix.Explicit fixed-arity parameters work, but they do not express protocols whose input cardinality is bounded yet chosen by each transaction—for example batched account updates, bounded receipt settlement, or a capped set of claims.
Argent's open range PR #44 is a useful design signal, not production evidence: its runtime builder and several interaction classes remain follow-up work. CellScript must define the CKB Script Group, Molecule, identity, and linear-lifecycle contract directly.
Required semantic contract
The first accepted version should be deliberately narrow:
Tto an exact Type Script identity and canonical schema;actual_count <= N;consumelifecycle;Lock Script support must be a separate explicitly justified shape if its observable group and authority rules differ.
flowchart LR TX["Candidate CKB transaction"] --> SG["Exact Type Script group inputs"] SG --> COUNT["Load actual group count"] COUNT --> BOUND{"count <= N?"} BOUND -- "no" --> REJECT["Stable runtime error"] BOUND -- "yes" --> LOOP["For each group-relative input"] LOOP --> ID["Verify Script identity"] ID --> DECODE["Decode canonical Molecule T"] DECODE --> PRED["Run predicate exactly once"] PRED --> LIFE["Record/discharge consume"] LIFE --> ACCEPT["All selected Cells covered"]Required failure taxonomy
Each failure must have a stable registered runtime error and a source-linked ProofPlan obligation:
NImplementation phases
Phase 0 — specification
Add an accepted bounded-lifecycle RFC covering:
No positive runtime lowering should land before this phase is accepted.
Phase 1 — typed and metadata boundary
Phase 2 — CKB runtime lowering
Phase 3 — verification and tooling
Acceptance matrix
The same fixture identity must be exercised in simulator, CKB-VM, and the stateful harness.
Nmatching inputsN + 1matching inputsCompletion criteria
dev,ci, andbackendgates pass.Non-goals
create_eachin this issue.References