CellScript Wiki

Tutorial 06: Metadata Verification and Production Gates

Tutorial 06: Metadata Verification and Production Gates

Use cellc interface-diff --checked --old old/main.elf --new new/main.elf --json when comparing qualified nominal contracts across import-alias changes. Build both bundles with --source-contracts and retain their canonical metadata, lowering and source-map sidecars. Every bundle is independently verified before comparison; missing evidence and different nominal owners reject. Declaration JSON hashes retain their existing source-spelling contract. This offline result does not authorize signing, deployment or peer execution.

Check fail_closed_runtime_features before using time or capacity helpers. Maturity/time/epoch constraints and the occupied_capacity floor are deferred: production policy rejects them, while development artifacts abort with errors 86 and 87 respectively. A successful metadata build does not establish their on-chain semantics. Bare named spawn is rejected with source error E1021, including metadata-only analysis; use the separately checked CellDep transport APIs. Ordinary resolved user functions named spawn remain valid. IPC reads abort on syscall failure or incomplete u64 delivery; inherited-fd indices must fit both the reported count and the 64-entry copied prefix. See the runtime error catalog.

For bounded Edition 2027 named collections, run cellc explain collections path/to/package or add --json before tuning shared budgets. It shows each member's maximum payload, alignment/record overhead, cumulative growth cost, and whether all maxima fit when reserved once or grown incrementally. A shared shortfall is a reported scenario, not a source error. The command includes unused declarations and does not emit artifacts or modify source. Hovering the collection declaration or constructor's owner name displays the same capacity scenarios in the editor, including resolved package record widths; invalid layouts do not receive a guessed estimate. These scenarios do not prove all execution paths or stable source admission; see the budget boundary.

The same command's v2 report also explains actual storage for resolved values and schema fields, and editor hover shares that projection. A local Vec<u64> constructed with Vec::with_capacity(4) still has the fixed 256-byte stack backing and capacity 32. A schema vector is an encoded view; an arena member has its owner's shared byte/event policy. Cell selections, output plans and nested codecs show their own bounds. These layout facts do not establish allocation fit or execution-path coverage. The optional browser language service supports the shared hover, while default browser metadata continues to omit these native report fields.

Bounded exact-role selections use v2 ProtocolBundle/report schemas when their mandatory source-derived contracts are present. Native checking and the adapter reconstruct protected Cells, canonical nested data and correspondence; the adapter repeats the check over packed outputs. Non-selection bundles retain v1. This is candidate transaction evidence, with source admission, live input resolution and VM execution still separate. Complete fixed settlement and nested migration fixtures now compare generated SDK data, adapter bytes and all-group VM outcomes. Record-list migration also compares named/explicit bounds and checks revision identities and aggregate exhaustion. Unbound conditional sites fail closed; final candidate gates remain pending. See the selection contract.

The bounded multi-asset transfer fixture also compares native encode_fixed_cell_data with generated encodeFixedCellData, then executes the SDK's actual Note bytes through the canonical adapter and all required groups. These encoders accept exact named bytes for supported flat fixed Cell fields; encoding establishes neither asset conservation nor authorization. The generated plan no longer carries blanket allocation/Cell-data proof flags, but still cannot submit and requires live/deployment resolution. The admission review defines the checked candidate scope and pending gates. See the collection business evidence.

The bounded ZK counter-set profile composes 1–4 unchanged exact leaf proofs over one final transaction. Its separate set codec/checker reconstructs complete transaction-wide membership; leaf metadata alone does not establish set completeness. Local-node conflict/recovery and per-VM resource evidence remain separate from host parsing and SDK byte parity.

Native package builds can explicitly request bounded source declaration evidence with cellc build --target riscv64-elf --source-contracts; the corresponding inspection command is cellc build-plan --source-contracts. Default builds retain ordinary metadata size budgets and include only catalogs required for nominal alias or interface-handle admission. Open module projection rejects missing evidence. The option does not establish compatibility, source equivalence, deployment identity or runtime admission. See the interface receipt boundary.

The experimental exact ZK interface adds runtime.zk_verifiers to metadata. It records the profile, exact handle/VK commitments, transaction statement origins, witness placement and resource bounds. The independent checker reconstructs the contract and checks the generated parent transport. Browser metadata alone does not establish machine or cryptographic verification. See the exact composition boundary for its non-authorizing test circuit and remaining production requirements.

Every CellScript CKB ELF build should be treated as one four-file bundle:

artifact
artifact.meta.json
artifact.lowering.json
artifact.sourcemap.json

The artifact is executable RISC-V ELF. The metadata sidecar is the explanation: source identity, target profile, artifact hash, schema layout, runtime requirements, scheduler information, and verifier obligations. The canonical lowering record exposes a bounded typed-semantics, CFG, ABI, stack, ProofPlan, syscall, runtime exit, and final machine-range contract. The canonical source map binds source spans and lowering blocks to final ELF instruction ranges. On 0.26b, source-map v2 also maps semantic node IDs to diagnostic spans, while a separate SourceDigest identifies source bytes. Assembly output does not claim this verified-artifact boundary.

The distinction matters during review: compiler SemVer can advance for compatible implementation work, and a wire ABI or metadata schema can advance for an urgent fix, without forcing a new calendar-year source edition. A new Edition is reserved for a change to the meaning of existing source.

This chapter is about trust boundaries. It teaches you what compiler evidence can prove, and where you still need CKB transaction evidence.

Cost evidence is also explicit: CI/backend and both release gates require the Rust toolchain's RISC-V target and llvm-strip, execute the matched and bounded growth corpus, and retain a fresh JSON report under target/cellscript-cost/. A missing tool or unexecuted corpus fails the gate. The cost regression contract distinguishes ELF, individual stack-frame, witness and cycle budgets from universal cost claims.

The Main Rule

Compiler verification is necessary, but it is not the same thing as a deployed transaction or chain acceptance report.

If verify-artifact passes for an ELF, you know all four files agree and that the standalone checker independently accepted the bounded typed and structural contracts. You do not yet know that a transaction builder can provide the right inputs, serialize the right witness, satisfy capacity, pass dry-run, and commit. The checker does not claim complete source-to-machine semantic equivalence.

That distinction prevents overclaiming.

Emit Metadata

Compile normally:

cellc build --json

For a persistent Type policy explicitly declared in the package's [[artifacts]], select that declaration for both checks and builds:

cellc check --artifact token-policy --all-targets
cellc build --artifact token-policy --target riscv64-elf --json

The build flag is mutually exclusive with --entry-action and --entry-lock. It selects the versioned policy envelope, not the old single-entry witness ABI. Inspect runtime.policy_artifact and the compatibility profile in the emitted metadata. A valid declaration is not authentication or deployment evidence; see the policy witness contract before constructing and signing a transaction. entry-witness --artifact requires an exported action and a full Script hash and emits only the policy payload; gen-builder --artifact exports the declared variants and records the runtime's aggregation, placement, and signing responsibilities. Its raw-inner-argument helper does not replace typed argument encoding.

Ordinary single-entry action and Lock SDKs expose metadata-driven entry payload encoders, including Lock-only packages with no action plans. The result still needs the existing pre-signing WitnessArgs placement and signer. See the generated entry witness contract for argument ownership, byte-parity checks and the distinction between a generated SDK test and actual transaction execution.

Or request metadata directly:

cellc metadata src/main.cell --target riscv64-elf --target-profile ckb -o /tmp/main.meta.json

Add --artifact token-policy to inspect the explicitly selected policy through the metadata-only compiler path. This does not produce an ELF, assembly, sidecars, or a machine artifact hash; --output writes only the inspection JSON. Without the flag, the existing default-entry path remains unchanged.

Open the metadata when something is unclear. It is often easier to understand a compiler decision by reading the emitted facts than by guessing from the source alone.

Inspect the canonical semantic foundation separately:

cellc expand src/main.cell
cellc --json expand src/main.cell
cellc expand --artifact token-policy
cellc expand --artifact token-policy --json

The foundation exposes value provenance, artifact entry selection, transaction roles, Cell dispositions, enforcement-classified claims, and layered semantic IDs. The human rendering is deterministic but is not hashed. Source paths and spans are intentionally excluded from CoreSemanticId.

The text view and native entry/Cell-role hover also classify each relation's data, identity/accounting, Lock, Type Script, capacity and cardinality policy. explicit describes source/declaration/operation authority; derived-and-enforced describes an enforced contextual rule; unconstrained-by-this-relation states that the relation supplies no such check; not-applicable covers components without a successor. Each row retains its separate evidence boundary. A builder-required relation remains builder-required even when its policy is explicit. The context includes actual selectors and coverage: output[0] does not acquire group-output[0] authority from a schema name. Capacity floors and local relation arity remain separate from successor capacity equality and exact group coverage. Browser summaries omit the native policy records; use native expansion for this evidence.

The selected-policy view includes exported numeric tags, entry IDs, payload schema hashes, exact group input/output counts, selector bounds, and common checks in declaration order. It does not treat retained helper actions as dispatch variants. Like selected metadata, selected expand does not invoke machine-code generation.

For an executable source require or Edition 2027 enforce, inspect its entry-condition claim. evidence_reference selects the typed branch-condition; execution records the condition-provenance node, ordered success and failure blocks, and exact fail-closed runtime-error code. Supporting ProofPlan obligations use proof-plan:<name> references and no execution binding. The independent checker validates these structural links, while still making no complete source-to-machine equivalence claim.

Verify an Artifact

Native builds include nominal declaration/owner catalogs when aliases or interface handles need independent admission, including default builds. --source-contracts requests complete source-contract export; omitting it cannot suppress required declaration evidence. See the interface contract.

Start with the basic check:

cellc verify-artifact build/main.elf

The command automatically loads build/main.elf.meta.json, build/main.elf.lowering.json, and build/main.elf.sourcemap.json. Use --metadata, --lowering-record, and --source-map only for custom paths.

Pin the target profile:

cellc verify-artifact build/main.elf --expect-target-profile ckb

Verify source units on disk:

cellc verify-artifact build/main.elf --verify-sources

Use production checks when preparing release evidence:

cellc verify-artifact build/main.elf --production
cellc verify-artifact build/main.elf --deny-fail-closed
cellc verify-artifact build/main.elf --deny-runtime-obligations

Read this gate narrowly: it verifies binding, structural ELF/lowering/source-map invariants, source hash expectations, and selected policy flags. Its JSON report keeps binding_verification, structural_verification, lowering_record_verification, ckb_vm_evidence, and chain_evidence separate, and keeps semantic_equivalence_claimed = false. It does not prove that a concrete CKB transaction has been built, deployed, dry-run, indexed, or measured.

Check Before Build

Use check mode for CI and local feedback:

cellc check --all-targets --production
cellc check --target-profile ckb --json

Important policy flags:

Flag Purpose
--production Reject unsafe or incomplete lowering paths.
--deny-fail-closed Reject metadata that contains fail-closed runtime features or obligations.
--deny-ckb-runtime Reject CKB runtime features when they are not allowed for the workflow.
--deny-runtime-obligations Reject runtime-required verifier obligations.

These flags are useful because they turn "remember to inspect this later" into a compiler-visible failure.

What To Inspect First

You do not need to memorize the whole sidecar. Start with these fields:

  • target_profile
  • artifact_format
  • artifact_hash
  • artifact_size_bytes
  • source_hash
  • source_content_hash
  • source_units
  • metadata_schema_version
  • source_metadata_schema_version
  • artifact_metadata_schema_version
  • constraints_metadata_schema_version
  • actions
  • locks
  • schema
  • runtime
  • verifier_obligations
  • runtime.proof_plan
  • runtime.proof_plan_soundness
  • runtime.transaction_view_handles
  • capability_registry
  • types[].capability_set_version
  • runtime.capability_proofs
  • runtime.builder_assumptions
  • template_layouts
  • constraints
  • runtime_error_registry
  • constraints.artifact
  • constraints.entry_abi
  • constraints.ckb.capacity_evidence_contract
  • constraints.ckb.declared_capacity_floors
  • constraints.ckb.hash_type_policy
  • constraints.ckb.dep_group_manifest
  • scheduler

When reviewing a contract, ask simple questions first:

  • which action or lock is the entry;
  • what witness does it expect;
  • which Cells are consumed or created;
  • which runtime obligations remain;
  • which CKB profile assumptions are recorded.

The top-level metadata_schema_version is the envelope version. The component schema fields split review risk by surface: source/package identity, artifact-binding facts, and CKB constraint summaries can now move independently in future schema revisions. verify-artifact still rejects a mismatch in any of these versions.

Schema 53 includes runtime.transaction_view_handles. Each record identifies the callable scope, source (Input, GroupOutput, CellDep, and so on), public handle type, and evidence tiers. A conforming record is a read-only view with lifecycle_authority = false; it is evidence of a transaction read surface, not evidence that a Cell was consumed or an output was created.

Schema 53 also makes capability authority auditable. The top-level capability_registry fixes both the closed vocabulary and entailment version; each persistent type repeats capability_set_version. For every accepted destroy or replace_unique, inspect runtime.capability_proofs: required, provided, entailed, and missing must agree, missing must be empty, and the proof's versions must match the registry. replace_unique additionally records the exact identity(...) condition declared by the same resource. No proof may source authority from a container or another Cell type.

Top-level enum_layouts for concrete payload ADTs first appeared in schema 53 and remain in current metadata schema 79 in the current development contract. Audit the packed-tagged-union-v1 layout, one-byte tag, sequential variant tags, packed field offsets, encoded size, ownership, storage, and ABI together. A linear-cell-handle field is exactly eight bytes and forces local-linear-handle-v1 storage; it is never a persistent serialization claim. Non-linear fixed payloads use serializable-fixed-width. Functions may return layouts of at most 16 bytes through fixed-bytes-pointer-v1+register-pair-return-v1; larger layouts remain local or parameter values. Generic and variable-width payload enums are compile errors.

Bounded forall and count invariant clauses appear as bounded-source-quantifier ProofPlan records. Review reads, coverage, group_cardinality, and evidence_tier: coverage names the source scan, complexity, declared field reads, runtime cardinality, vacuous-zero behavior, and count overflow policy. A runtime-helper-required record is a known helper contract, not proof that the selected artifact emitted or executed that helper.

runtime.collection_instantiations also distinguishes local stack collections from source-aware bounded Cell collections. For a checked BoundedCellSet<T, N>, verify source = input, ownership = linear-cell-set, status = checked-runtime, finite max_elements, and helper bounded-type-group-inputs-v1. The matching ProofPlan must say actual_scanned_cardinality:runtime-observed, group_input_count<=N, and on_chain_checked = true.

For a checked BoundedList<P, N> driving create_each, verify source = witness, ownership = bounded-output-plan, helper bounded-output-plan-v1, output_cardinality_max = N, and capacity_builder_evidence_required = false. Its ProofPlan must bind exact plan/output count, fixed-width codec, canonical GroupOutput order, output data, lock, and capacity floor. A builder-evidence-required record instead means the selected create shape did not qualify for the 0.26 runtime contract.

Treat every selected consensus ProofPlan whose codegen_coverage_status begins with gap: as a production blocker. Unsupported bounded shapes still emit runtime error 24 in permissive artifacts and stop at E2105 under the production policy; a static N alone is never evidence that a scan ran.

The validity record first appeared in schema 55 during the 0.22 line and is retained by current metadata schema 79 in the current development contract as types[].validity_predicates. Review each predicate's expression, dependencies, evidence_tier, runtime_checked_on_create, create_paths_selected, create_paths_checked, update_paths_selected, create_path_status, update_path_status, and source_span together. checked-runtime means every selected constructor/create path emitted a fail-closed predicate before its output instruction. Partial path coverage is partial-runtime-helper-required, never checked-runtime. A named output or update path without concrete predicate lowering stays runtime-helper-required; it is not silently promoted by metadata.

env::block_number() is the only approved validity environment read in this line. CKB-VM does not expose an ambient current-tip block-number syscall, so CellScript records builder-evidence-required with explicit header-dep builder evidence instead of emitting a fictional runtime call. Unknown env::* reads are compile errors. Imported helpers are retained transitively and receive module-qualified dependency names. Validity predicates require transitively empty external-operation facts; lifecycle, process and transaction-context operations are rejected there.

Explicit borrow blocks first appeared in schema 55 and current metadata schema 79 records them in runtime.borrow_regions. Review root, binding, view_type, storage, abi, evidence_tier, and source_span. A canonical record has View<T>, storage = none, abi = none, and checked-static evidence. Its matching borrow-region ProofPlan entry proves compiler rejection of escape, root lifecycle crossing, and incompatible callee facts must have empty lifecycle and process sets; the region does not describe a runtime allocation or persistent CKB Cell reference.

Assurance Layer

CellScript 0.16 added a checked assurance layer over ProofPlan metadata, and 0.21 extends the same evidence stream with ProtocolGraph, TemplateLayout, and compile receipt binding:

cellc explain proof src/main.cell --json
cellc explain assumptions src/main.cell --json
cellc tx validate --against build/main.elf.meta.json --tx tx.json --json

runtime.proof_plan_soundness tells you whether verifier obligations and ProofPlan records agree. --primitive-strict=0.16 rejects metadata-only or runtime-required ProofPlan gaps. The soundness key includes origin/scope, category, feature, status, and detail; local and runtime ProofPlan records are compared by full semantic content, including trigger, reads, coverage, and source spans.

runtime.builder_assumptions is the machine-readable contract for transaction builders. tx validate checks a transaction JSON shape against that contract, rejects bare evidence tokens, and requires indexed evidence objects for non-structural assumptions before signing. Evidence indexes are range-checked against the transaction, and concrete fields such as outpoints, hashes, capacity, dep metadata, witness bytes, and TYPE_ID args must match when present. For exact_script_handle, the validator additionally checks the complete 202-byte handle against its compile-time hash, class and role; recomputes the selected Lock/Type Script or verifier CellDep data identity; decodes WitnessArgs.input_type; and binds the handle to its compiled CSARGv1 parameter position. Exact-handle source items therefore need resolved Script, Script-hash, data, or data-hash fields in addition to their transaction index. For checked create_each, metadata schema 79 retains an explicit bounded output plan contract. tx validate re-decodes the exact CSBPLv1 parameter at its compiled CSARGv1 position and requires cellscript-bounded-output-plan-evidence-v1: a witness index, current Script hash, exact Plan payload, and strictly ordered output indexes. It then compares the Plan count and every selected output's complete data, Lock hash, Type hash, and capacity floor. Generated TypeScript builders materialize the same ordered contract, and the CKB adapter repeats the validation before building a packed transaction. See the bounded output plan contract. This is still pre-chain evidence: dry-run, capacity, cycles, and commit checks remain required for production claims.

Additional audit reports are available for audit and deployment workflows:

cellc tx solve src/main.cell --json   # emits can_submit=false template output
cellc explain graph src/main.cell --format mermaid
cellc deploy plan src/main.cell --json
cellc proof-diff old.meta.json new.meta.json --json
cellc audit-bundle src/main.cell --output target/audit

ProtocolGraph role labels are explanatory metadata. For each action, inspect actions[].protocol_role_candidates; for each graph edge, inspect role, role_source, role_source_used, role_candidates, role_status, and role_warnings. The deterministic precedence is:

  1. a direct verification equality between an Address-valued Cell field and an Address supplied by witness, default entry witness, or lock_args;
  2. a participant-like witness or lock_args Address binding;
  3. a participant-like Address field name.

The third form is deliberately weak. Renaming participant to a neutral field name yields PG-ROLE-MISSING; it never silently creates authority. Conflicting roles yield PG-ROLE-CONFLICT while preserving all sources. Every role record is metadata-only with authorization_proven = false, and no role appears as authorization evidence in ProofPlan. Authorization still has to be enforced by the lock/type Script and its generated runtime checks.

0.21 Compile Receipts

Compile receipts bind the same evidence stream to deterministic hashes:

cellc receipt src/main.cell --output target/main.receipt.json
cellc sign-receipt target/main.receipt.json --role publisher --key publisher.ed25519.pkcs8
cellc verify-receipt target/main.receipt.json \
  --metadata target/main.elf.meta.json \
  --artifact target/main.elf
cellc verify-artifact target/main.elf --receipt target/main.receipt.json

Receipt signatures authenticate metadata/artifact evidence and derived report hashes. They do not prove transaction validity, live-cell freshness, dry-run success, capacity sufficiency, or successful submission.

0.21 TemplateLayout Metadata

template_layouts is metadata-only in the current compiler: records are derived from resource/shared/receipt type metadata, use a Flat layout by default, and set consensus_checked = false until a backend verifier explicitly enforces a template commitment. Cyclic flow state machines are marked with cycle_policy = RootRequired; acyclic layouts use PathOnlyAllowed.

The compiler rejects unsupported consensus_checked = true claims in this RC. That keeps TemplateLayout from looking consensus-enforced before generated verifier code actually checks the template commitment.

ProofPlan coverage states are intentionally explicit:

State Meaning
gap:metadata-only The claim is preserved for audit but has no executable verifier coverage.
gap:runtime-helper-required The claim maps to a runtime helper, but the selected entry did not emit matching helper coverage.
checked-runtime Generated runtime access backs the claim for the selected entry.

Introduced on the 0.22 line and retained by the current compiler, invariant read ranges and aggregate operands are parsed once into a closed typed target: a source view (inputs, outputs, group_inputs, group_outputs, cell_deps, header_deps, witness, or lock_args) plus optional cell type and field. The formatter emits canonical plural source-view names, while ProofPlan keeps the same readable target text. Unknown generic source views fail in the parser; later compiler phases do not recover their meaning by splitting strings.

The evidence tiers introduced on the 0.22 line still record who must discharge every obligation:

Evidence tier Discharged by
checked-static Compiler or static analysis.
checked-runtime Generated verifier code.
runtime-helper-required A known helper contract that is not emitted for the selected entry.
builder-evidence-required Transaction-builder or indexer evidence.
metadata-only Audit metadata with no executable enforcement.
chain-evidence-required Dry-run, tx-pool, commit, capacity, or cycle evidence.

The tier is serialized as evidence_tier in each ProofPlan record and is also shown by cellc explain proof. --production rejects metadata-only records whose invariant, terminal, or assert/check/enforce/require/validate/verify naming promises executable enforcement. This does not turn builder or chain evidence into compiler proof; those tiers remain external obligations.

For the review-finding closure matrix, see docs/archive/0.17/CELLSCRIPT_0_17_REVIEW_FINDINGS_CLOSURE.md.

Effect And Terminal Evidence

Callable effects are inferred from bindings, operations, and transitive calls. Source code does not declare them:

fn read_capacity() -> u64 {
    return ckb::cell_capacity(source::input(0));
}

This helper infers an input capacity observation in effects.context_reads. Its lifecycle_ops and process_ops are empty. Reading and then creating retains facts in both dimensions. Temporary collection mutation is local computation. Metadata stores the required structured facts, together with evidence status; there is no category field or default category. The compiler resolves imported and aliased calls from their definitions before inference. Manual effect attributes and the retired native wrapper are rejected.

The compiler first completes structural typing and binding, lowers unoptimized IR, infers facts and validates observation/invariant constraints. Optional optimization must preserve those facts. The independent checker reconstructs facts from its own bound typed operations and call evidence, then compares them exactly. Rebinding hashes cannot legitimize an omitted or broadened fact set. Concrete source-only declarations do not establish executable availability; uninstantiated templates carry explicit effects: null. Concrete instances have inferred facts, while absent executable projections lack verified evidence. An empty required fact contract rejects a candidate that starts reading context. Interface comparison uses a subset check in each of the three dimensions; all lifecycle, ownership and ABI obligations remain independently checked. See the effect contract for the complete rules.

Suggested Compiler CI Gate

For CKB packages, a useful compiler CI gate is:

cellc fmt --check
cellc check --target-profile ckb --all-targets --production
cellc build --target riscv64-elf --target-profile ckb --production
cellc verify-artifact build/main.elf --expect-target-profile ckb --verify-sources --production

For CKB, make the profile explicit in every step:

cellc check --target-profile ckb --production
cellc build --target riscv64-elf --target-profile ckb --production
cellc verify-artifact build/main.elf --expect-target-profile ckb --verify-sources --production

These gates are suitable for a compiler/package CI loop. They are not enough for a release claim that says a contract is production-ready on a chain.

Syntax-Combination Preflight

Syntax and lowering bugs can pass ordinary example compilation when the risky shape is hidden in an uncommon combination. The reusable syntax-combination audit exists to catch those bugs before chain evidence is generated:

./scripts/cellscript_syntax_combo_audit.sh quick
./scripts/cellscript_syntax_combo_audit.sh ci

The syntax-combination audit is a release acceptance preflight. It exercises parser, formatter, type checking, lowering, metadata, codegen, and negative obsolete-syntax oracles with compact reports under target/syntax-combo-audit/.

On success, the generated cases and their metadata/assembly are reproducible from the recorded mode, seed, matrix, and checked-in seeds, so the runner keeps only report.json and report.jsonl. Failed and explicit repro runs keep the complete intermediate tree. Each mode has a small latest-<mode>.json index, and local managed history defaults to the most recent three runs. Use CELLSCRIPT_KEEP_GATE_WORKDIRS=1 for a successful debugging run that needs all intermediates, or CELLSCRIPT_EVIDENCE_KEEP_RUNS=all when another process will archive every run.

For CellScript releases, quick is part of the pre-push gate and ci runs before builder-backed CKB acceptance. A direct CKB acceptance run does not replace this preflight because it only proves selected concrete transactions.

The current source contract requires comma-separated type fields and lifecycle field lists. Newlines are whitespace. Statement and policy clauses use explicit semicolons. The formatter preserves the lossless source tree, comments and discard/tail distinctions; comma-free compatibility input is retired.

Unified Gate Entry Points

For repository work, use the unified gate wrapper instead of hand-picking component scripts:

./scripts/cellscript_gate.sh commit
./scripts/cellscript_gate.sh dev
./scripts/cellscript_gate.sh ci
./scripts/cellscript_gate.sh backend
./scripts/cellscript_gate.sh release
./scripts/cellscript_gate.sh release-quick

commit is the default lightweight gate for ordinary commits and pushes; add focused tests for changed behavior. It checks source/docs hygiene, changed shell syntax, and formatting/host compilation for affected Rust packages, without VM execution or reproducible ELF builds. dev is a local integration checkpoint, not a per-commit requirement. ci establishes pull-request/merge readiness. backend validates integrated IR/codegen/RISC-V changes. release is the production CKB evidence gate. release-quick is a compile-only release preflight, not external live/devnet evidence. See docs/CELLSCRIPT_GATE_POLICY.md for the exact command contract. Both release modes first require a clean checkout and an accepted bounded business corpus through check-business-corpus --release. A development corpus check cannot authorize publication; publication constraints remain separate.

The gate also rebuilds the pinned 52-byte context child twice. Its source/lock/ELF fixture is checked alongside byte-oracle and real parent/child CKB-VM tests. Replay must agree with the ordinary verifier, and parent and child stack observations remain separate. The fixture resource ceilings do not replace general cost budgets or a full application assurance review. See the fixed encoding example.

In dev and ci, the wrapper also checks that examples/language/core/canonical_style.cell is already formatter-clean and that the checked atomic-swap, NFT, timelock, and multi-phase-DAO example pairs use named U64_MAX boundary expressions. CI's CKB-VM integration tests encode CellScript entry payloads in canonical WitnessArgs.input_type; a raw CSARGv1 witness is a negative ABI case, not a valid test shortcut.

Fiber's no-profile compatibility harness is deliberately separate from these unified gates:

./scripts/cellscript_fiber_acceptance.sh --static

This runs the dedicated invariant-entry CKB-VM matrix plus adapter tests. A passing result means the exact compiled entry accepts and rejects the covered CKB transaction shapes; it does not mean a Fiber node has loaded or announced the generated UDT configuration. Full mode validates a complete externally produced lifecycle report against an exact Fiber revision. Completed rows and certified topology reports reference files under an explicit evidence root by normalized relative path plus CKB Blake2b-256 digest; missing, empty, symlinked, path-escaping, or modified evidence fails closed. This proves bundle integrity, not the identity of its operator. Full mode never manages node processes or signing keys. Treat StaticallyCompatible, LocalNodeConfiguredRestartRequired, LocalNodeAdvertised, ChannelReady, and TopologyCertified as distinct monotonic evidence states.

The entry accepts either legacy 32-byte Type Script args containing an input Lock Script hash, or tagged 33-byte args containing 0x01 followed by an input Type Script hash. Issuance or destruction requires a matching absolute input. The tagged form lets a stateful policy Type Script enforce caps, reserves, or bridge accounting while that policy Cell's Lock independently carries single-owner, multisig, or governance authorisation. Every ordinary Fiber channel transaction instead takes the unauthorised path and must have non-empty, checked-u128, conserved Type Script groups. A 2026-07-20 bounded devnet run observed the exact config through node_info and passed Fiber's official routed-payment and pending-TLC watchtower suites, but it did not produce a signed-announcement report or the complete pinned matrix and is not full or release evidence.

CKB Release Evidence Gate

When you are ready to make a CKB production claim, move from compiler evidence to chain evidence. Run the CKB acceptance gate from the CellScript repository root:

./scripts/cellscript_gate.sh release

For ordinary commits and pushes, run lightweight checks and focused regressions for the changed behavior. Use dev for a broader integration checkpoint:

./scripts/cellscript_gate.sh commit

If you specifically need the old compile-only production acceptance pass, ./scripts/cellscript_ckb_release_gate.sh quick remains supported and delegates to ./scripts/cellscript_gate.sh release-quick. The legacy ./scripts/cellscript_ckb_release_gate.sh full command is also supported as a compatibility wrapper for ./scripts/cellscript_gate.sh release. The production mode is the release-facing gate because it first runs compiler and backend-contract evidence, then runs pinned local CKB acceptance transactions, public builder-contract generation, and mandatory stateful scenario/action coverage.

The CKB validator records primitive-strict original bundled-example coverage, including strict v0.16 PP0150 fail-closed records, then requires scoped action and lock compile coverage, public action build/gen-builder contracts, source-bound acceptance provenance, acceptance-harness action and lock valid-spend/invalid-spend matrices, valid transaction dry-runs, committed valid transactions, malformed rejection, measured cycles, consensus-serialized transaction size, occupied-capacity evidence, exact-artifact build reports, live code-cell data-hash linkage, no under-capacity outputs, bundled example deployment, and a passed final production hardening gate. Fail-closed PP0150 records are evidence of a strict boundary, not deployable production acceptance.

The report must explicitly record a passed final production hardening gate and source provenance for the repository commit, tracked source file list, tracked source hash, acceptance runner hash, and evidence validator hash. It must also record cellscript_build_reports: each row binds the compiled RISC-V ELF, verify-artifact result, the exact 20-byte ELF entry trampoline, CKB data hash, and any live devnet code-cell deployment whose data hash equals that compiled artifact hash. Compile-only reports keep the live deployment list empty and are not external release evidence.

Release evidence is accepted only from a completely clean CellScript checkout. The full run also binds the local CKB checkout to scripts/ckb_acceptance_pin.json: exact revision, clean worktree, version string, executable hash, source and effective template hashes, and genesis hash. Production does not accept a supplied or cached CKB binary: it builds the pinned source in a fresh dedicated Cargo target directory and archives that executable with the report. Each stateful step must also carry a committed transaction, dead consumed inputs, live declared outputs, measured cycles, serialized size, and occupied-capacity evidence. Tagged GitHub releases cannot build or publish until this full gate has passed, and the tag/version must match the workspace version.

The report's builder-backed action runs, lock cases, and stateful transactions come from the native Rust recipe replayer and are labelled that way. The separate public-builder contract gate proves that every production action is exposed by cellc action build and cellc gen-builder; it does not claim those generated packages constructed the acceptance transactions. Likewise, always_success resource Type Scripts are fixture-only. They prove scoped verifier behaviour and transaction shape, not the production resource-identity deployment story.

Registry artifact evidence remains another independent boundary. A verified_build record may carry compiler-backed CellScript verification, the declared hash-bound generic profile level, or structurally_verified evidence from the least-privilege artifact checker. Generic CKB bundles remain hash_bound; structural admission requires the complete metadata, lowering record, and source map set, and partial verified sidecars fail closed. None of those levels is deployment or chain evidence. A reproducible profile is not verified until reproduced_build evidence binds at least two independent builders to the signed source, recipe, environment, executable, and logs. Likewise, a wallet-ready Registry commitment file is not chain evidence. Only a sufficiently confirmed live mainnet Cell matching the configured Registry Type Script, commitment custody Lock, exact commitment data, and both live Script code CellDeps can produce current on_chain_committed state. Scheduled reconciliation demotes that current state when the commitment or deployment Cell is spent or no longer sufficiently confirmed.

LS-IDL introduces another narrow Registry evidence layer. The interface verifier checks a bounded IDL schema, SHA-256 of the exact ABI object bytes, and the executable's final 32-byte commitment. A chain-verified lookup also binds those bytes to a deployed Script identity. This is still not proof that the Lock Script implements the decoder correctly and is not a security audit. Do not promote schema-and-suffix-bound into semantic, VM, or chain-execution evidence.

Package resolution is an earlier, separate gate. Cell.lock v5 binds the exact Cell.toml digest, root and dependency compiler requirements, the resolving compiler release, dependency graph edges, dependency manifests, whole-tree hashes, exact Git/Registry source pins, feature/test modes, and CKB environment genesis identity. Build/check/test never perform mutable version selection. A changed manifest or source requires explicit cellc lock, or a cellc update-plan receipt followed by cellc update --apply-plan; --frozen additionally forbids network access and lockfile writes. The transactional receipt recompiles reverse dependents and keeps source API, serialized layout, runtime ABI, effects/capabilities, builder, deployment, and upgrade authorization as separate evidence. Applying it changes only the listed locks and never supplies deployment or TYPE_ID authorization. The Registry's versioned profile catalog allows only cellscript_source to enter this graph. Executable, reproducible, TCB, and copy artifacts retain their separate evidence and consumption paths.

For the current NovaSeal profile set, production-ready source-package evidence means the live local devnet runners pass for core, Agreement, and the six planned profiles: BTC transaction commitment, BTC UTXO seal, dual seal, Fiber candidate, Fungible xUDT, and RWA receipt. Public/mainnet deployment evidence is separate: profile docs must still name any required CellDep attestation, external BIP340 TCB review, public BTC SPV/indexer report, or RWA legal/registry review.

The production gate compiles the seven production checked-in top-level example contracts directly: token, NFT, timelock, multisig, vesting, AMM pool, and launch. Those files are the single canonical production business source and the cleaner reading surface; there are no checked-in examples/business or examples/acceptance mirrors. Acceptance-only profile/effect/scheduler metadata belongs in runner configuration or generated files under target/.

Lock behavior coverage is machine-readable through lock_acceptance_scope.onchain_lock_spend_matrix_scope; each listed lock must have both valid-spend and invalid-spend evidence.

examples/registry.cell, examples/atomic_swap.cell, examples/multi_phase_dao.cell, and every checked-in examples/language/*.cell file are non-production examples covered by compiler/tooling tests, not by the bundled CKB production matrix.

--compile-only and bounded diagnostic runs can help development, but they are not external production release evidence.

Bounded open-participant admission

cellc protocol bundle check bundle.json --open-admission open.json --output report.json --json reconstructs private source-policy proofs from frozen package inputs, then binds the selected Type-policy, single Type/Lock or parameterless spawned-verifier participants to the complete transaction bytes. Generated builders can extract the admitted 656-byte selection and encode its 664-byte entry witness. The adapter requires those same bytes before signing; every Script group must still succeed during the subsequent signed dry-run.

The offline command does not establish signatures, live Cells, network inclusion or successful participant execution. A verifier must have an independently checked membership-to-SPAWN/WAIT path; the child inherits its consumer's Script group, and a nonzero child exit rejects the parent. See the input and evidence contract. The maintainer waived external human review for #28 and #29; independent artifact checking and their remaining technical acceptance requirements still apply.

The bounded constrained-instance extension keeps that old path intact. Use request schema cellscript-protocol-instance-admission-input-v2 with the same CLI option, and add the canonical instance_policy to each instance binding. InstanceScriptHandle<I> selections are 1768 bytes and their CSARG payloads are 1776 bytes. Generated builders expose separate encodeInstanceHandleWitness / instanceHandleWitnessFromCheckedBundle functions; the SDK rechecks the concrete instance and configuration before signing. Its bounded technical acceptance passed on 2026-10-18; release, public deployment and independent human audit remain separate. See its own acceptance and review record: constrained Script instances.

Next

Once the verification boundary is clear, continue with LSP and Tooling.

Exact ZK transition profile

The first ZK profile connects a CellScript parent to a pinned Groth16/BN254 verifier through Spawn/IPC/Wait. Proof generation stays off chain. The parent constructs public inputs from the actual single-Cell transition, current Script, action, domain, consumed outpoint and full raw transaction hash; it rejects failed verification before the action can return successfully.

ZkTransitionProof, VerificationKeyCommitment and ExactScriptHandle expose this contract to source code. Packages additionally bind a named policy to an exact deployment receipt in deploy.ckb.zk_verifiers. Compiler metadata and the independent artifact checker retain identities, source origins, fixed codecs and runtime bounds. Generated TypeScript and native Rust builders share public input/request vectors. Use the native compiler and its matching artifact checker to build and verify the parent ELF. The Playground compiles metadata only.

The private counter application proves knowledge of an owner secret and permits one increment while preserving its public owner commitment. Its admission is limited to explicit local single-party setup trust and local execution evidence. It does not establish an MPC ceremony, independent review or public deployment. See the profile specification.

Match the source grammar before compiling

Run cellc language-contract --json to inspect the selected compiler without a package or a build. The source-semantics identity distinguishes evolving alpha grammars even when compiler release numbers match. Editor/LSP and website WASM consumers must select the same identity. This query provides grammar pairing, not artifact verification or execution evidence.

On this page