Skip to content

Commit 89a4206

Browse files
committed
Add runnable 0.24 workflow examples
1 parent 6543a15 commit 89a4206

29 files changed

Lines changed: 596 additions & 13 deletions

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
scattered Registry artifact-profile conditionals with the versioned,
1717
fail-closed `cellscript-registry-profile-catalog-v1`; only CellScript source
1818
profiles are dependency-resolving, while executable, reproducible, and copy
19-
profiles remain explicit non-resolving artifacts.
19+
profiles remain explicit non-resolving artifacts. Add a portable
20+
`examples/package_graph` fixture that executes alias, SemVer, feature,
21+
test-only, environment, and override selection from the frozen graph.
2022
- Implement the 0.24 trust-closure core. CKB ELF builds now emit canonical
2123
`cellscript-verified-lowering-record-v1` and
2224
`cellscript-source-artifact-map-v1` sidecars, bound by metadata schema 58 and
@@ -37,6 +39,8 @@
3739
whose production graph excludes the compiler. Freeze the CellScript side of
3840
the Myelin handoff without a new profile or raw-witness alias; keep external
3941
Myelin adoption and the incomplete Fiber/RGB++ matrices explicitly pending.
42+
Add `examples/scenario_basics` as the runnable positive/exact-negative
43+
scenario and four-file verified-artifact walkthrough.
4044
- Freeze the 0.23 implementation scope around Edition 2026 and its resolved
4145
profile/entry identities, the deployed Registry and publisher-session path,
4246
native gate tooling, the recoverable website workbench, and the bounded Fiber

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,9 +805,14 @@ Non-CellScript artifact profiles still fail closed.
805805
- `[resolvers.<name>]` — optional absolute-path/SHA-256-bound, time/output
806806
bounded update-time resolver; its versioned response must normalize to an
807807
exact Registry version or Git commit and is never executed by locked builds
808+
- `examples/package_graph` — runnable frozen/offline alias, SemVer, feature,
809+
test-only dependency, and explicit CKB-environment graph
810+
- `examples/scenario_basics` — runnable positive and exact-negative scenarios
811+
under both simulator and CKB-VM, plus a four-file artifact walkthrough
808812
- `cellc info --json` — exposes package metadata for CI and tooling
809813
- `cellc package verify --json` — fails closed when `Cell.toml`, source hash,
810-
dependency resolution, or build identity disagree with `Cell.lock`
814+
dependency resolution, or build identity disagree with `Cell.lock`; run an
815+
ordinary locked build first when a tracked example lock is graph-only
811816
- `cellc registry verify --json` — checks off-chain deployment facts against
812817
`Cell.lock` and `Deployed.toml`
813818
- `cellc registry verify --live --rpc-url ... --json` — adds CKB RPC

docs/releases/CELLSCRIPT_0_24_RELEASE_NOTES.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ authoritative runtime evidence, not chain evidence. The v1 CKB-VM runner
7272
supports no-argument entries; transaction-syscall cases remain with the
7373
stateful CKB oracle.
7474

75+
`examples/scenario_basics` is the checked-in runnable form of this contract. It
76+
executes positive and exact-negative fixtures under both backends and provides
77+
a concrete four-file bundle/checker walkthrough.
78+
7579
Native `cellc run` now includes the VM runner by default. It executes only a
7680
no-argument standalone ELF and fails closed for parameter or transaction/
7781
syscall context. Development interpretation requires explicit `--simulate`;
@@ -163,6 +167,13 @@ must pass `--environment <name>` when overrides exist. This adapts Move's named
163167
environment idea to CKB's genesis-bound Cell Model rather than copying Sui
164168
addresses or published package IDs.
165169

170+
`examples/package_graph` is the portable runnable form of these package
171+
features. Its checked-in graph covers a declared-package alias, standard SemVer
172+
requirements, optional and transitive feature activation, a test-only
173+
dependency, two genesis-bound environments, and an exact testnet override.
174+
Frozen/offline commands prove that those selections are consumed from the lock
175+
without invoking mutable resolution.
176+
166177
### Bounded resolver extension, normalized before trust
167178

168179
`[resolvers.<name>]` is a versioned extension point for package ecosystems that

docs/wiki/Tutorial-04-Packages-and-CLI-Workflow.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,12 @@ cellc auth capability create --principal-id <principal_id> \
310310
cellc gen-builder . --target typescript --target-profile ckb --json
311311
```
312312

313+
`package verify` checks build identity as well as the dependency graph. A
314+
freshly cloned example intentionally carries a graph-only `Cell.lock`; run
315+
`cellc build --locked` first to populate `[package.build]`. A frozen build
316+
cannot add that local evidence because `--frozen` suppresses every lockfile
317+
write.
318+
313319
Legacy flat aliases such as `solve-tx`, `deploy-plan`, and
314320
`explain-assumptions` remain executable for compatibility, but they are hidden
315321
from public discovery. Prefer `--json` where a command offers it, and reserve
@@ -418,6 +424,19 @@ namespace = "cellscript"
418424
When overrides exist, `--environment mainnet` is mandatory. The environment
419425
root in `Cell.lock` binds both `chain_id` and genesis hash.
420426

427+
The portable checked-in example exercises these inputs together:
428+
429+
```bash
430+
cd examples/package_graph
431+
cellc check --frozen --offline --environment mainnet
432+
cellc check --frozen --offline --environment testnet --features full
433+
cellc test --no-run --frozen --offline --environment testnet --all-features
434+
```
435+
436+
Its local dependency alias is distinct from the declared package name, and its
437+
testnet override resolves a different exact version of the same declared
438+
package. Omitting `--environment` is an intentional fail-closed example.
439+
421440
Advanced ecosystems may declare a hash-pinned bounded resolver. It runs only
422441
during explicit lock/update, without a shell or inherited environment, and
423442
must normalize its versioned JSON response to an exact Registry version or Git

docs/wiki/Tutorial-08-Bundled-Example-Contracts.md

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,34 @@ There are no checked-in `examples/business` or `examples/acceptance` mirrors;
4545
acceptance-only profile/effect/scheduler metadata belongs in runner
4646
configuration or generated files under `target/`.
4747

48+
Two 0.24 workflow packages sit beside, but are not part of, the business
49+
matrix:
50+
51+
- `examples/scenario_basics` runs one positive and one exact-negative scenario
52+
through both the simulator and CKB-VM, and builds a four-file verified
53+
artifact bundle;
54+
- `examples/package_graph` demonstrates standard SemVer, a package alias,
55+
optional and transitive features, a test-only dependency, explicit CKB
56+
environments, a testnet dependency override, and frozen/offline consumption
57+
of the tracked graph.
58+
59+
These packages are deliberately small and synthetic. They teach tooling
60+
boundaries without implying that simulator bookkeeping or illustrative chain
61+
identities are production evidence.
62+
4863
Despite its legacy filename, `multisig.cell` is not a signature verifier or a
4964
standalone custody Lock Script. Its `Approval` values and `reported_time`
5065
arguments are witness data. A surrounding Lock Script must authenticate the
5166
approver, and any production time policy must bind a HeaderDep-derived value.
52-
CellScript 0.22 has no implicit signer identity, sighash selection, or witness
53-
layout. Packages that need cryptographic custody may call the explicit BIP340
54-
CellDep verifier ABI, but the bundled threshold-approval example deliberately
55-
does not do so.
67+
Since CellScript 0.22 there has been no implicit signer identity, sighash
68+
selection, or witness layout. Packages that need cryptographic custody may call
69+
the explicit BIP340 CellDep verifier ABI, but the bundled threshold-approval
70+
example deliberately does not do so.
5671

5772
## Fiber Interoperability Examples
5873

59-
CellScript 0.22 also includes seven bounded interoperability examples under
60-
`examples/fiber/`. They are not additional members of the bundled CKB
74+
The CellScript 0.22 line introduced seven bounded interoperability examples
75+
under `examples/fiber/`. They are not additional members of the bundled CKB
6176
production matrix:
6277

6378
| Example | Interoperability boundary |
@@ -137,6 +152,17 @@ cellc build --package amm_pool --target riscv64-elf --target-profile ckb --json
137152
cellc build --package launch --target riscv64-elf --target-profile ckb --json
138153
```
139154

155+
For the 0.24 workflow examples, follow their tracked locks without repinning:
156+
157+
```bash
158+
cd examples/scenario_basics
159+
cellc test --frozen --offline --backend all --json
160+
161+
cd ../package_graph
162+
cellc check --frozen --offline --environment mainnet
163+
cellc check --frozen --offline --environment testnet --features full
164+
```
165+
140166
Do not treat `cellc build --workspace` as the canonical compile-all command for
141167
this checked-in examples tree. Some folders under `examples/` are compiler and
142168
tooling fixtures rather than packages with a `src/main.cell` entry.

docs/wiki/Tutorial-14-Verified-Artifacts-and-Executable-Tests.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ without calling local execution chain evidence.
77

88
## Build the Four-File Bundle
99

10-
From an Edition 2026 package, build the CKB ELF:
10+
The checked-in `scenario_basics` package is the smallest complete example. From
11+
the repository root:
1112

1213
```bash
13-
cellc build --target riscv64-elf --target-profile ckb --json
14+
cd examples/scenario_basics
15+
cellc build --frozen --offline --json
1416
```
1517

1618
The build emits:
@@ -71,6 +73,12 @@ schema names the confined source file, CKB target profile, entry, initial live
7173
Cells, ordered replacement steps, dependencies, headers, `since`, witnesses,
7274
limits, and an exact expectation.
7375

76+
See `examples/scenario_basics/tests/pass.scenario.json` and
77+
`assertion-failure.scenario.json` for runnable positive and exact-negative
78+
fixtures. Scenario sources intentionally stay in the same `tests/` directory:
79+
v1 rejects absolute paths and parent traversal instead of letting a fixture
80+
escape its evidence root.
81+
7482
A minimal positive shape is:
7583

7684
```json
@@ -109,9 +117,9 @@ and unsupported evidence requests fail before execution.
109117
## Run Both Evidence Tiers
110118

111119
```bash
112-
cellc test --backend simulator
113-
cellc test --backend ckb-vm
114-
cellc test --backend all --json
120+
cellc test --backend simulator --frozen --offline
121+
cellc test --backend ckb-vm --frozen --offline
122+
cellc test --backend all --frozen --offline --json
115123
```
116124

117125
The simulator is deterministic development feedback and is labelled

examples/Cell.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ members = [
1111
"token",
1212
"vesting",
1313
"language",
14+
"package_graph",
15+
"scenario_basics",
1416
]

examples/package_graph/Cell.lock

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
version = 3
2+
schema = "cellscript-lock-v0.24-graph-v1"
3+
4+
[package]
5+
edition = "2026"
6+
name = "package_graph_demo"
7+
version = "0.1.0"
8+
source_hash = "5f146552641c097ec165eeb72cc368f3c2b4f762221417da3960960967ef26cd"
9+
10+
[root]
11+
manifest_digest = "sha256:57f0f363771fc6ca67b678e3b9a676b1e1ee4021acfa25e0cf6eeb5a7f7edad2"
12+
13+
[dependencies."audit_helpers@0.4.2|path:deps/audit-helpers|env=mainnet|features=default"]
14+
name = "audit_helpers"
15+
version = "0.4.2"
16+
source_hash = "44b8be2a00aaba5c51b296623598792a95caa48c8d0cbd5036936a92a68038b4"
17+
manifest_digest = "sha256:e24ef32ca50f1e257c7757d6c16d483a07c7e574236267947b16d2aa36cdc8fc"
18+
19+
[dependencies."audit_helpers@0.4.2|path:deps/audit-helpers|env=mainnet|features=default".source.Path]
20+
path = "deps/audit-helpers"
21+
22+
[dependencies."audit_helpers@0.4.2|path:deps/audit-helpers|env=testnet|features=default"]
23+
name = "audit_helpers"
24+
version = "0.4.2"
25+
source_hash = "44b8be2a00aaba5c51b296623598792a95caa48c8d0cbd5036936a92a68038b4"
26+
manifest_digest = "sha256:e24ef32ca50f1e257c7757d6c16d483a07c7e574236267947b16d2aa36cdc8fc"
27+
28+
[dependencies."audit_helpers@0.4.2|path:deps/audit-helpers|env=testnet|features=default".source.Path]
29+
path = "deps/audit-helpers"
30+
31+
[dependencies."canonical_math@1.2.3|path:deps/canonical-math|env=mainnet|features=default"]
32+
name = "canonical_math"
33+
version = "1.2.3"
34+
source_hash = "fd053efe46302c263148061ecd62e798100d31c38b2308285097462f70331864"
35+
manifest_digest = "sha256:bcb871cd37a39cf52b5b30b3b23c43ada0b90f0c68476b1218a08a0dd223b5ea"
36+
37+
[dependencies."canonical_math@1.2.3|path:deps/canonical-math|env=mainnet|features=default".source.Path]
38+
path = "deps/canonical-math"
39+
40+
[dependencies."canonical_math@1.2.3|path:deps/canonical-math|env=testnet|features=default"]
41+
name = "canonical_math"
42+
version = "1.2.3"
43+
source_hash = "fd053efe46302c263148061ecd62e798100d31c38b2308285097462f70331864"
44+
manifest_digest = "sha256:bcb871cd37a39cf52b5b30b3b23c43ada0b90f0c68476b1218a08a0dd223b5ea"
45+
46+
[dependencies."canonical_math@1.2.3|path:deps/canonical-math|env=testnet|features=default".source.Path]
47+
path = "deps/canonical-math"
48+
49+
[dependencies."network_contracts@1.0.0|path:deps/contracts-mainnet|env=mainnet|features=default"]
50+
name = "network_contracts"
51+
version = "1.0.0"
52+
source_hash = "509ab43e27f7e1cba59a079b92ed7d0e04128aab27de513817bb5225c71d7274"
53+
manifest_digest = "sha256:2e2fc06b5cf1f269e91356b8c39efc68f182e43592b6384df0629271dcfee6fe"
54+
55+
[dependencies."network_contracts@1.0.0|path:deps/contracts-mainnet|env=mainnet|features=default".source.Path]
56+
path = "deps/contracts-mainnet"
57+
58+
[dependencies."network_contracts@2.0.0|path:deps/contracts-testnet|env=testnet|features=default"]
59+
name = "network_contracts"
60+
version = "2.0.0"
61+
source_hash = "148e0ead158a5dfa4f84b6ec4b7c3d7783debe732d894dbf0157c0b8309e9539"
62+
manifest_digest = "sha256:b7269f73fc0802b76cd2dcc357d3927aca7d62c2194449082c02e5b083c5828c"
63+
64+
[dependencies."network_contracts@2.0.0|path:deps/contracts-testnet|env=testnet|features=default".source.Path]
65+
path = "deps/contracts-testnet"
66+
67+
[dependencies."scenario_test_support@0.1.0|path:deps/test-support|env=mainnet|features=default"]
68+
name = "scenario_test_support"
69+
version = "0.1.0"
70+
source_hash = "34956e5ec9750c7ba52b41b76396456f4f006952903579b1680863fa23f33d63"
71+
manifest_digest = "sha256:3d736afd4e06f265e1d00489321475a5b89b0c60bf040ed05814f21e7ec86c54"
72+
73+
[dependencies."scenario_test_support@0.1.0|path:deps/test-support|env=mainnet|features=default".source.Path]
74+
path = "deps/test-support"
75+
76+
[dependencies."scenario_test_support@0.1.0|path:deps/test-support|env=testnet|features=default"]
77+
name = "scenario_test_support"
78+
version = "0.1.0"
79+
source_hash = "34956e5ec9750c7ba52b41b76396456f4f006952903579b1680863fa23f33d63"
80+
manifest_digest = "sha256:3d736afd4e06f265e1d00489321475a5b89b0c60bf040ed05814f21e7ec86c54"
81+
82+
[dependencies."scenario_test_support@0.1.0|path:deps/test-support|env=testnet|features=default".source.Path]
83+
path = "deps/test-support"
84+
85+
[environments.mainnet]
86+
chain_id = "ckb-mainnet"
87+
genesis_hash = "0x1111111111111111111111111111111111111111111111111111111111111111"
88+
89+
[environments.mainnet.dependencies]
90+
audit = "audit_helpers@0.4.2|path:deps/audit-helpers|env=mainnet|features=default"
91+
contracts = "network_contracts@1.0.0|path:deps/contracts-mainnet|env=mainnet|features=default"
92+
core = "canonical_math@1.2.3|path:deps/canonical-math|env=mainnet|features=default"
93+
94+
[environments.mainnet.dev_dependencies]
95+
test_support = "scenario_test_support@0.1.0|path:deps/test-support|env=mainnet|features=default"
96+
97+
[environments.testnet]
98+
chain_id = "ckb-testnet"
99+
genesis_hash = "0x2222222222222222222222222222222222222222222222222222222222222222"
100+
101+
[environments.testnet.dependencies]
102+
audit = "audit_helpers@0.4.2|path:deps/audit-helpers|env=testnet|features=default"
103+
contracts = "network_contracts@2.0.0|path:deps/contracts-testnet|env=testnet|features=default"
104+
core = "canonical_math@1.2.3|path:deps/canonical-math|env=testnet|features=default"
105+
106+
[environments.testnet.dev_dependencies]
107+
test_support = "scenario_test_support@0.1.0|path:deps/test-support|env=testnet|features=default"

examples/package_graph/Cell.toml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[package]
2+
edition = "2026"
3+
name = "package_graph_demo"
4+
version = "0.1.0"
5+
6+
[dependencies.core]
7+
package = "canonical_math"
8+
version = "^1.2.0"
9+
path = "deps/canonical-math"
10+
11+
[dependencies.audit]
12+
package = "audit_helpers"
13+
version = "~0.4.0"
14+
path = "deps/audit-helpers"
15+
optional = true
16+
17+
[dependencies.contracts]
18+
package = "network_contracts"
19+
version = ">=1.0.0, <3.0.0"
20+
path = "deps/contracts-mainnet"
21+
22+
[dev_dependencies.test_support]
23+
package = "scenario_test_support"
24+
version = "=0.1.0"
25+
path = "deps/test-support"
26+
27+
[features]
28+
default = []
29+
auditing = ["dep:audit"]
30+
full = ["auditing"]
31+
32+
[environments.mainnet]
33+
chain_id = "ckb-mainnet"
34+
genesis_hash = "0x1111111111111111111111111111111111111111111111111111111111111111"
35+
36+
[environments.testnet]
37+
chain_id = "ckb-testnet"
38+
genesis_hash = "0x2222222222222222222222222222222222222222222222222222222222222222"
39+
40+
[dependency_overrides.testnet.contracts]
41+
package = "network_contracts"
42+
version = "=2.0.0"
43+
path = "deps/contracts-testnet"
44+
45+
[build]
46+
target = "riscv64-elf"
47+
target_profile = "ckb"

examples/package_graph/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Lock-Authoritative Package Graph
2+
3+
This portable 0.24 example concentrates the package features that do not
4+
belong in the business-contract examples:
5+
6+
- the local alias `core` resolves declared package `canonical_math` through a
7+
standard `^1.2.0` SemVer requirement;
8+
- optional `audit_helpers` is activated through `dep:audit` and the transitive
9+
`full` feature;
10+
- `scenario_test_support` enters only the test graph;
11+
- mainnet and testnet roots bind explicit CKB chain identities; and
12+
- the testnet environment replaces `network_contracts` with an exact `2.0.0`
13+
path source.
14+
15+
The tracked `Cell.lock` contains every feature, test, and environment root, so
16+
the following commands perform no mutable dependency selection:
17+
18+
```bash
19+
cd examples/package_graph
20+
cellc check --frozen --offline --environment mainnet
21+
cellc check --frozen --offline --environment testnet --features auditing
22+
cellc test --no-run --frozen --offline --environment testnet --all-features
23+
```
24+
25+
Omitting `--environment` fails closed because this manifest has an explicit
26+
environment override. Run `cellc lock` only when intentionally repinning the
27+
graph.
28+
29+
Git and Registry requirements normalize to immutable commits or snapshots at
30+
repin time. They are not included here because a portable checked-in example
31+
must not depend on mutable network discovery. Hash-pinned external resolvers
32+
remain test/documentation fixtures because their commands must use
33+
machine-specific absolute paths.

0 commit comments

Comments
 (0)