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
docs: refresh codebase docs for post-phase-1 state
- Update all SmartTransaction/CapacityManager references to note
deletion in Phase 1 (ARCHITECTURE, CONCERNS, CONVENTIONS)
- Update fork-scripts paths from ccc-fork/*.sh to fork-scripts/*.sh
(PROJECT, CONCERNS, CONVENTIONS, STACK, STRUCTURE)
- Add fork-scripts/ directory tree and @generated markers (STRUCTURE)
- Mark resolved concerns as RESOLVED (CONCERNS)
- Update code examples to current APIs: findUdts, isUdt, collect
(CONVENTIONS)
- Update 64-output DAO limit references to CCC core (CONCERNS)
Copy file name to clipboardExpand all lines: .planning/PROJECT.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,7 +56,7 @@ Clean, CCC-aligned library packages published to npm that frontends can depend o
56
56
57
57
**Migration status:** Library packages are on CCC. Apps split: faucet/sampler already migrated; bot/interface/tester still on legacy Lumos (`@ckb-lumos/*`, `@ickb/lumos-utils@1.4.2`, `@ickb/v1-core@1.4.2`).
58
58
59
-
**Local CCC dev build:**`ccc-dev/` supports using local CCC builds for testing. `.pnpmfile.cjs` transparently rewires `@ckb-ccc/*` to local packages. `ccc-dev/patch.sh` rewrites exports to `.ts` source. This enables testing upstream changes before they're published.
59
+
**Local CCC dev build:**`ccc-fork/` supports using local CCC builds for testing. `.pnpmfile.cjs` transparently rewires `@ckb-ccc/*` to local packages. `fork-scripts/patch.sh` rewrites exports to `.ts` source. This enables testing upstream changes before they're published.
Copy file name to clipboardExpand all lines: .planning/codebase/ARCHITECTURE.md
+29-32Lines changed: 29 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@
11
11
- Manager-based pattern encapsulating script operations with uniform `ScriptDeps` interface
12
12
- Async-first cell discovery via generator functions with lazy evaluation
13
13
- TypeScript ESM modules with strict null checks and type safety
14
-
-SmartTransaction builder for automatic fee/change calculation
14
+
-CCC-native transaction building with TransactionLike pattern (SmartTransaction deleted in Phase 1)
15
15
- Cell wrapper abstractions extending raw blockchain data with domain logic
16
16
17
17
**Migration Status:**
@@ -21,7 +21,7 @@
21
21
- Apps split: `faucet` and `sampler` already use new packages; `bot`, `tester`, `interface` still on legacy Lumos
22
22
- CCC PRs for UDT and Epoch support have been MERGED upstream -- local Epoch class has been deleted (replaced by `ccc.Epoch`); some local UDT handling may still overlap with CCC's `@ckb-ccc/udt`
23
23
- Custom `mol.union` codec and deprecated `mol.*` APIs have been replaced with CCC's `mol.union`, `ccc.Entity.Base`, and `@ccc.codec` decorator
24
-
- SmartTransaction was ABANDONED as an ecosystem-wide concept (no adoption), but the class itself remains used locally; headers are now cached in CCC Client Cache
24
+
- SmartTransaction was DELETED in Phase 1; all managers now accept `ccc.TransactionLike` and return `ccc.Transaction` directly; headers cached by CCC Client Cache
25
25
26
26
## Protocol Design (from whitepaper)
27
27
@@ -70,21 +70,22 @@ Receipts convert to UDT; deposits stay as deposits or convert to UDT. No iCKB ca
70
70
71
71
**Foundation: CCC Framework**
72
72
- Purpose: Provide blockchain primitives and client interface
73
-
- Location: `@ckb-ccc/core` (npm or local `ccc-dev/ccc/`)
73
+
- Location: `@ckb-ccc/core` (npm or local `ccc-fork/ccc/`)
-`completeFeeChangeToLock()`: Calculate and add change cells for CKB
286
-
-`addUdtChange()`: Add change cells for each tracked UDT
287
-
-`addCellDeps()`: Deduplicate and append cell dependencies
288
-
- Used by: All managers to build transactions atomically
289
-
- Note: The "SmartTransaction" ecosystem concept was ABANDONED (no CKB ecosystem adoption). However, this class is still actively used throughout all new packages. The name is a vestige. Header caching has moved to CCC's Client Cache.
281
+
**Transaction Building (ccc.Transaction):**
282
+
- Purpose: All managers use plain `ccc.Transaction` (SmartTransaction was deleted in Phase 1)
283
+
- Pattern: Managers accept `ccc.TransactionLike` and return `ccc.Transaction` (TransactionLike pattern)
Copy file name to clipboardExpand all lines: .planning/codebase/CONCERNS.md
+20-28Lines changed: 20 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,27 +38,28 @@
38
38
39
39
### Local UDT Handling May Overlap CCC Upstream (Medium)
40
40
41
-
- Issue: CCC now has a dedicated `@ckb-ccc/udt` package (at `ccc-dev/ccc/packages/udt/`). The local `packages/utils/src/udt.ts` and `packages/core/src/udt.ts` implement custom UDT handling (`UdtHandler` interface, `IckbUdtManager` class). While the local UDT handling is iCKB-specific (custom balance calculation accounting for DAO deposits), the generic UDT operations like `ccc.udtBalanceFrom()` are still being used from CCC upstream in `packages/utils/src/udt.ts` (4 locations).
41
+
- Issue: CCC now has a dedicated `@ckb-ccc/udt` package (at `ccc-fork/ccc/packages/udt/`). The local `packages/utils/src/udt.ts` and `packages/core/src/udt.ts` implement custom UDT handling (`UdtHandler` interface, `IckbUdtManager` class). While the local UDT handling is iCKB-specific (custom balance calculation accounting for DAO deposits), the generic UDT operations like `ccc.udtBalanceFrom()` are still being used from CCC upstream in `packages/utils/src/udt.ts` (4 locations).
42
42
- Files:
43
43
-`packages/utils/src/udt.ts` - `UdtHandler` interface, `UdtManager` class (~370 lines)
44
44
-`packages/core/src/udt.ts` - `IckbUdtManager` extending UDT handling for iCKB-specific logic
- Usage of `ccc.udtBalanceFrom()`: `packages/utils/src/udt.ts` lines 169, 197, 323, 368
47
47
- Impact: There may be duplicated utility code for standard UDT operations (finding cells, calculating balances). The iCKB-specific extensions (e.g., `IckbUdtManager` which modifies balance calculations based on DAO deposit/withdrawal state) are domain-specific and unlikely to be in CCC.
48
48
- Fix approach: Audit the CCC `@ckb-ccc/udt` package to identify which local utilities can be replaced. Keep iCKB-specific extensions but delegate standard UDT operations (cell finding, basic balance) to CCC where possible.
49
49
50
50
### Fragile CCC Local Override Mechanism (Medium)
51
51
52
-
- Issue: The `.pnpmfile.cjs` hook and `ccc-dev/record.sh` script create a fragile mechanism for overriding published CCC packages with local builds. The `.pnpmfile.cjs``readPackage` hook intercepts pnpm's dependency resolution to redirect `@ckb-ccc/*` packages to local paths under `ccc-dev/ccc/packages/*/`.
52
+
- Issue: The `.pnpmfile.cjs` hook and `fork-scripts/record.sh` script create a fragile mechanism for overriding published CCC packages with local builds. The `.pnpmfile.cjs``readPackage` hook intercepts pnpm's dependency resolution to redirect `@ckb-ccc/*` packages to local paths under `ccc-fork/ccc/packages/*/`.
53
53
- Files:
54
54
-`.pnpmfile.cjs` - pnpm hook that overrides `@ckb-ccc/*` package resolutions
55
-
-`ccc-dev/record.sh` - clones CCC repo, merges refs, and builds it locally
56
-
-`pnpm-workspace.yaml` - includes `ccc-dev/ccc/packages/*` in workspace
57
-
-`ccc-dev/ccc/` - local CCC checkout (when present)
-`pnpm-workspace.yaml` - includes `ccc-fork/ccc/packages/*` in workspace (auto-generated section)
58
+
-`ccc-fork/ccc/` - local CCC checkout (when present)
58
59
- Impact: Multiple fragility points:
59
-
1. The local CCC repo at `ccc-dev/ccc/` must be manually cloned and kept in sync with a specific branch/commit.
60
+
1. The local CCC repo at `ccc-fork/ccc/` must be manually cloned and kept in sync with a specific branch/commit.
60
61
2. The `readPackage` hook modifies `dependencies` objects at install time, which can silently break if CCC reorganizes its packages.
61
-
3. CI/CD (`ccc-dev/replay.sh`) must run this setup before `pnpm install`, creating an ordering dependency.
62
+
3. CI/CD (`fork-scripts/replay.sh`) must run this setup before `pnpm install`, creating an ordering dependency.
62
63
4. The override mechanism is invisible to developers who don't read `.pnpmfile.cjs`, leading to confusion when packages resolve differently than expected from `package.json`.
63
64
- Fix approach: Now that UDT and Epoch PRs have been merged into CCC upstream, evaluate whether the local overrides are still needed. If CCC publishes releases containing the merged features, switch to published versions and remove the override mechanism.
64
65
@@ -107,7 +108,7 @@
107
108
-`packages/dao/src/dao.ts`, lines 326-334 (called in async generator loop)
- Cause: Each `daoCellFrom()` call makes 1-2 RPC calls that cannot be parallelized within a single cell construction.
110
-
- Improvement path: The `SmartTransaction.headers` cache in `packages/utils/src/transaction.ts` partially mitigates this by caching fetched headers. For batch operations, consider prefetching all needed headers in parallel before constructing DAO cells.
111
+
- Improvement path: CCC's Client Cache transparently caches fetched headers (SmartTransaction's header cache was deleted in Phase 1). For batch operations, consider prefetching all needed headers in parallel before constructing DAO cells.
111
112
112
113
### Duplicated RPC Batching Code in Legacy Apps
113
114
@@ -128,12 +129,9 @@
128
129
129
130
## Fragile Areas
130
131
131
-
### SmartTransaction Class Extending ccc.Transaction
132
+
### SmartTransaction Class Extending ccc.Transaction (RESOLVED)
- Why fragile: `SmartTransaction` extends `ccc.Transaction` and overrides 8 methods: `completeFee`, `getInputsUdtBalance`, `getOutputsUdtBalance`, `getInputsCapacity`, `clone`, `copy`, `from`, `default`, and `fromLumosSkeleton`. Changes to `ccc.Transaction`'s interface or behavior upstream can silently break `SmartTransaction`.
135
-
- Safe modification: When updating CCC dependency, review `ccc.Transaction` changelog for breaking changes to overridden methods. The `completeFee` override (lines 63-98) is particularly fragile as it calls `super.completeFee()` and also queries the client for the NervosDAO script to check the 64-output limit.
136
-
- Test coverage: No tests for `SmartTransaction`.
134
+
- Status: **Resolved in Phase 1** — SmartTransaction class and CapacityManager were fully deleted from `@ickb/utils`. All manager methods now accept `ccc.TransactionLike` and return `ccc.Transaction` directly. Header caching is handled by CCC Client Cache. The 64-output DAO limit check was contributed to CCC core.
137
135
138
136
### Bot Order Matching Algorithm
139
137
@@ -154,11 +152,11 @@
154
152
### 64 Output Cell Limit for NervosDAO Transactions
155
153
156
154
- Current capacity: Maximum 64 output cells per transaction containing NervosDAO operations.
157
-
- Limit: Enforced by the NervosDAO script itself. Checked in 6 locations throughout the codebase.
155
+
- Limit: Enforced by the NervosDAO script itself. Consolidated into CCC core in Phase 1.
-`apps/bot/src/index.ts`, line 414 (limits to 58 outputs to reserve 6 for change)
163
161
- Scaling path: Protocol-level constraint. The bot works around it by limiting deposit/withdrawal operations per transaction. Future NervosDAO script updates may relax this.
164
162
@@ -242,19 +240,13 @@
242
240
243
241
## Dead Code
244
242
245
-
### `fromLumosSkeleton` in SmartTransaction
243
+
### `fromLumosSkeleton` in SmartTransaction (RESOLVED)
246
244
247
-
- Issue: `SmartTransaction.fromLumosSkeleton()` at `packages/utils/src/transaction.ts` line 432 provides Lumos interoperability. Since the new packages do not use Lumos, this method is only needed if external code passes Lumos skeletons to the new packages.
- Impact: Low. The method is a thin wrapper delegating to the superclass.
250
-
- Fix approach: Remove after all apps are migrated away from Lumos.
245
+
- Status: **Resolved in Phase 1** — SmartTransaction class was fully deleted, including `fromLumosSkeleton()`.
251
246
252
-
### SmartTransaction Name is Misleading (Not Dead)
247
+
### SmartTransaction Name is Misleading (RESOLVED)
253
248
254
-
- Issue: Despite the original "SmartTransaction" concept being abandoned ecosystem-wide, the `SmartTransaction` class in `packages/utils/src/transaction.ts` is actively used throughout the new packages. It extends `ccc.Transaction` with UDT handler management and header caching (which is what replaced the abandoned SmartTransaction headers concept). The name is a vestige but the code is alive and critical.
- Impact: The name `SmartTransaction` may confuse developers familiar with the abandoned ecosystem concept.
257
-
- Fix approach: Consider renaming to `IckbTransaction` or `EnhancedTransaction`. Low priority since the class is internal to the monorepo.
249
+
- Status: **Resolved in Phase 1** — SmartTransaction class was fully deleted from `@ickb/utils`. All manager methods now accept `ccc.TransactionLike` directly.
0 commit comments