@@ -39,6 +39,31 @@ launch.bootstrap_token or launch.launch_token
3939` launch_token ` materialises the Pool and LP receipt topology directly. It does
4040not link or call the ` amm_pool.seed_pool ` entry at runtime.
4141
42+ ## Resource Identity Boundary
43+
44+ There are three separate script roles in this flow:
45+
46+ - scoped action artifacts are active verifiers for one selected CellScript
47+ action;
48+ - resource type scripts are passive or lifecycle-stable identity badges for
49+ ` MintAuthority ` , ` Token ` , ` Pool ` , and ` LPReceipt ` Cells;
50+ - fixture badges such as ` always_success_fixture_only ` are local test
51+ scaffolding only.
52+
53+ Do not use an action artifact such as ` token_mint_with_authority.elf ` as the
54+ passive type script for a newly-created resource Cell. CKB executes output type
55+ scripts during creation, so the generated ` _cellscript_entry ` wrapper will look
56+ for action witness bytes and can fail with ` entry-witness-abi-invalid ` .
57+
58+ Current compiler metadata exposes this boundary through
59+ ` constraints.ckb.resource_identities ` and ` cellc solve-tx ` under
60+ ` transaction_plan.resource_identities ` . Entries marked
61+ ` compiler-passive-identity-available ` should be materialized with
62+ ` cellc resource-identity ` , which emits the passive artifact plus the exact
63+ ` { code_hash, hash_type, args } ` scripts to place on resource outputs. A
64+ production builder must not replace that passive identity with the scoped
65+ action artifact.
66+
4267## Entry Action Selection
4368
4469Do not rely on "the first action runs on creation" as a protocol rule. Cell
@@ -131,6 +156,20 @@ cellc entry-witness examples/amm_pool.cell \
131156For ` launch_token ` , the ` distribution ` payload is exactly four
132157` (Address, u64) ` entries, so it is 160 bytes: ` 4 * (32 + 8) ` .
133158
159+ ## One-Line Builder Contract Bundle
160+
161+ After building the scoped artifact and producing a candidate transaction JSON,
162+ run the compiler-facing contract checks as one shell bundle. Replace ` META ` and
163+ ` TX ` with the generated ` .meta.json ` sidecar and transaction file:
164+
165+ ``` bash
166+ INPUT=examples/amm_pool.cell ACTION=swap_a_for_b META=build/amm_swap_a_for_b.elf.meta.json TX=build/swap.tx.json RID=build/resource-identities.json MIN_OUT=49000 TO=0x1111111111111111111111111111111111111111111111111111111111111111; cellc resource-identity " $INPUT " --target-profile ckb --identity Token=token-default --identity Token:token_out=token-b --identity Pool=pool-main --identity LPReceipt=pool-main --plan-output " $RID " --json && cellc abi " $INPUT " --target-profile ckb --action " $ACTION " && cellc constraints " $INPUT " --target-profile ckb --entry-action " $ACTION " && cellc solve-tx " $INPUT " --target-profile ckb --entry-action " $ACTION " --primitive-strict 0.16 --json && cellc entry-witness " $INPUT " --target-profile ckb --action " $ACTION " --arg " $MIN_OUT " --arg " $TO " --json && cellc explain-assumptions " $INPUT " --target-profile ckb --entry-action " $ACTION " --primitive-strict 0.16 --json && cellc validate-tx --against " $META " --resource-identities " $RID " " $TX " --production --primitive-strict 0.16 --json
167+ ```
168+
169+ ` cellc entry-witness ` emits the raw ` _cellscript_entry ` payload. Do not wrap it
170+ in ` WitnessArgs.input_type ` unless the CellScript source explicitly reads that
171+ separate CKB witness surface.
172+
134173## ProofPlan And Builder Assumptions
135174
136175Before signing, builders should inspect both the proof plan and the concrete
@@ -158,7 +197,8 @@ particular, verify:
158197
159198- each cell-bound parameter resolves to the expected input or output Cell;
160199- output data matches the generated Molecule schema;
161- - output type scripts use the intended artifact and script args;
200+ - resource output type scripts follow ` constraints.ckb.resource_identities ` ;
201+ - scoped action artifacts are not used as passive resource type identities;
162202- CellDeps or script refs resolve to the intended code cells;
163203- capacity floors and occupied capacity are both satisfied;
164204- the transaction size and cycle budget are measured from the final
@@ -187,13 +227,16 @@ The relevant flows are:
187227- AMM lifecycle: seed, add liquidity, swap, and remove liquidity operate on
188228 live ` Pool ` , ` Token ` , and ` LPReceipt ` Cells.
189229
190- External builder repos should mirror those flows instead of using
191- ` always_success ` token stand-ins for the token and pool state path. It is fine
192- to keep ` always_success ` locks for pure locking scaffolding, but token Cells,
193- Pool Cells, LP receipts, and the MintAuthority hand-off should be real
194- CellScript typed Cells when testing this bootstrap sequence.
230+ External builder repos should mirror those flows, but should treat
231+ ` always_success ` resource type scripts as ` always_success_fixture_only ` badges.
232+ They prove the transaction shape is plausible; they do not prove the production
233+ resource identity story. The compiler now exposes passive resource identity
234+ contracts in metadata and emits resource identity plans so builders can fail
235+ early instead of discovering identity mistakes through an opaque action-witness
236+ error. Use ` cellc validate-tx --production ` to reject known fixture identities
237+ before signing.
195238
196239The production gate now exercises these flows with original scoped strict
197240artifacts for ` token.cell ` , ` amm_pool.cell ` , and ` launch.cell ` ; generated
198- harnesses remain only as fallback coverage for examples that are not part of
199- this bootstrap path .
241+ harnesses and passive fixture badges remain coverage scaffolding, not the
242+ external-builder production identity contract .
0 commit comments