|
| 1 | +# iCKB CellScript Completeness Benchmark Final Report |
| 2 | + |
| 3 | +## Executive Summary |
| 4 | + |
| 5 | +CellScript is **partially complete but not ready** for iCKB-grade CKB protocols. |
| 6 | + |
| 7 | +It can express useful iCKB-style resource, receipt, linear-consumption, |
| 8 | +owner-pairing, transfer, and limit-order arithmetic patterns. It cannot yet |
| 9 | +express several production-critical iCKB invariants natively: HeaderDep |
| 10 | +accumulated-rate binding, script lock/type role introspection, exact |
| 11 | +transaction-wide computed accounting, xUDT args construction, DAO maturity, CKB |
| 12 | +OutPoint/index relations, C256 arithmetic, and signed relative distances. |
| 13 | + |
| 14 | +The benchmark is an iCKB-inspired semantic model. It is not a faithful port and |
| 15 | +does not prove behavioural equivalence with the audited iCKB Rust scripts. |
| 16 | + |
| 17 | +## Implemented Artifacts |
| 18 | + |
| 19 | +- `examples/ickb_benchmark/README.md` |
| 20 | +- `examples/ickb_benchmark/ickb_logic.cell` |
| 21 | +- `examples/ickb_benchmark/limit_order.cell` |
| 22 | +- `examples/ickb_benchmark/owned_owner.cell` |
| 23 | +- `tests/ickb_benchmark.rs` |
| 24 | +- `tests/benchmarks/ickb_positive/*.json` |
| 25 | +- `tests/benchmarks/ickb_negative/*.json` |
| 26 | +- `tests/benchmarks/ickb_diff/matrix.json` |
| 27 | +- `docs/0.17/ickb_discovery.md` |
| 28 | +- `docs/0.17/ickb_semantics.md` |
| 29 | +- `docs/0.17/ickb_cellscript_gap_matrix.md` |
| 30 | +- `docs/0.17/ickb_diff_results.md` |
| 31 | +- `docs/0.17/ickb_final_report.md` |
| 32 | + |
| 33 | +CI integration is through the existing Cargo test workflow: `tests/ickb_benchmark.rs` |
| 34 | +is a normal integration test, so the existing `cargo test --locked ...` CI step |
| 35 | +will run it. |
| 36 | + |
| 37 | +## Coverage Table |
| 38 | + |
| 39 | +| Semantic item | CellScript support | Test coverage | Remaining gap | Severity | |
| 40 | +|---|---|---|---|---| |
| 41 | +| Deposit phase 1 receipt creation | EXPRESSIBLE_WITH_PATTERN | positive + forged receipt/capacity negatives | executable output-group aggregate lowering | HIGH | |
| 42 | +| Deposit phase 2 mint | EXPRESSIBLE_WITH_ESCAPE_HATCH | positive + inflation/deflation/header/xUDT negatives | HeaderDep and xUDT binding | BLOCKER | |
| 43 | +| Receipt consumption/no double use | NATIVE plus model duplicate check | duplicate receipt negative | true prior-cell lineage API | MEDIUM | |
| 44 | +| iCKB transfer | NATIVE for token resource model | positive transfer | xUDT ABI binding | HIGH | |
| 45 | +| Withdrawal/redeem | EXPRESSIBLE_WITH_ESCAPE_HATCH | positive withdrawal, immature redeem negative | DAO maturity and since/header primitives | HIGH | |
| 46 | +| Exact accounting | EXPRESSIBLE_WITH_ESCAPE_HATCH | inflation/deflation negatives | executable computed aggregate invariants | BLOCKER | |
| 47 | +| Owned-Owner pairing | EXPRESSIBLE_WITH_PATTERN | positive + wrong owner negative | signed distance and source index APIs | HIGH | |
| 48 | +| Limit Order fulfilment | EXPRESSIBLE_WITH_PATTERN | positive + underpayment/wrong asset negatives | C256 and MetaPoint support | HIGH | |
| 49 | +| Script role confusion | NOT_EXPRESSIBLE | negative model fixture | current script role/source scans | BLOCKER | |
| 50 | +| Witness malformation | EXPRESSIBLE_WITH_PATTERN | negative model fixture | full witness/Molecule parser and auth primitives | HIGH | |
| 51 | +| CellDep substitution | EXPRESSIBLE_WITH_PATTERN | negative model fixture | deploy/runtime dep verification integration | HIGH | |
| 52 | + |
| 53 | +## Test Results |
| 54 | + |
| 55 | +Commands run before benchmark changes: |
| 56 | + |
| 57 | +```bash |
| 58 | +cargo test --locked -p cellscript |
| 59 | +``` |
| 60 | + |
| 61 | +Result: passed, 529 Rust tests plus doc-tests. |
| 62 | + |
| 63 | +iCKB test attempt: |
| 64 | + |
| 65 | +```bash |
| 66 | +cd /tmp/cellscript-ickb-audit/v1-core/scripts |
| 67 | +cargo test --locked |
| 68 | +``` |
| 69 | + |
| 70 | +Result: crates compiled, but the iCKB `tests` crate failed 2 tests because |
| 71 | +Capsule-built binaries were missing under `scripts/build/debug`. |
| 72 | + |
| 73 | +Benchmark command: |
| 74 | + |
| 75 | +```bash |
| 76 | +cargo test --locked -p cellscript --test ickb_benchmark |
| 77 | +``` |
| 78 | + |
| 79 | +Result: passed, 4 tests. |
| 80 | + |
| 81 | +The positive fixture set contains 6 model-level cases. The negative set contains |
| 82 | +15 adversarial model-level cases. The differential matrix contains 9 |
| 83 | +model-level rows. |
| 84 | + |
| 85 | +## Compiler Changes Made |
| 86 | + |
| 87 | +No compiler implementation changes were made. The benchmark intentionally records |
| 88 | +the current compiler gaps instead of weakening invariants to make a production |
| 89 | +claim. |
| 90 | + |
| 91 | +## Unresolved Blockers |
| 92 | + |
| 93 | +1. HeaderDep accumulated-rate binding. |
| 94 | +2. Lock/type script-role introspection and script args scanning. |
| 95 | +3. Executable transaction-wide aggregate invariants with computed values. |
| 96 | +4. Native xUDT owner-mode args and token amount layout support. |
| 97 | +5. DAO deposit/withdrawal/maturity primitives. |
| 98 | +6. CKB OutPoint, output index, occupied capacity, and CellDep surfaces. |
| 99 | +7. Signed integer types and checked 256-bit arithmetic. |
| 100 | +8. Stable per-invariant diagnostics and runtime error codes. |
| 101 | + |
| 102 | +## Recommended Next Steps |
| 103 | + |
| 104 | +1. Add typed CKB source primitives for headers, outpoints, script role, script |
| 105 | + args, occupied capacity, and cell deps. |
| 106 | +2. Lower aggregate invariants into executable CKB runtime checks for exact |
| 107 | + equality and bounded inequality over typed cell groups. |
| 108 | +3. Add `std::dao` and `std::xudt` modules with deployed ABI-compatible helpers. |
| 109 | +4. Add signed integer and checked `u256`/`C256` arithmetic support. |
| 110 | +5. Build an actual CKB testtool differential harness once iCKB Capsule binaries |
| 111 | + and CellScript generated binaries can be run against the same fixtures. |
| 112 | +6. Use a Rosen-style bridge settlement invariant benchmark after iCKB to test |
| 113 | + multi-party cross-chain accounting and replay prevention. |
| 114 | + |
| 115 | +## Honesty Statement |
| 116 | + |
| 117 | +This benchmark is a semantic model and partial port. It proves that selected |
| 118 | +iCKB-style positive and adversarial scenarios can be represented and checked at |
| 119 | +the model level while the CellScript specs compile. It does not prove CKB VM |
| 120 | +behavioural equivalence, production readiness, cycle bounds, transaction size, |
| 121 | +occupied capacity, or under-capacity safety. |
0 commit comments