Skip to content

Commit 3694442

Browse files
committed
docs: refine research and earlier phase docs with phase-03 findings
Update infoFrom override strategy (single override point, not getInputsInfo/getOutputsInfo), correct fork-scripts paths in phase-01 summaries, and incorporate CCC Udt investigation results into research documents.
1 parent 5f56518 commit 3694442

12 files changed

Lines changed: 179 additions & 232 deletions

File tree

.planning/phases/01-ickb-utils-smarttransaction-removal/01-01-PLAN.md

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ type: execute
55
wave: 1
66
depends_on: []
77
files_modified:
8-
- ccc-dev/ccc/packages/core/src/ckb/transactionErrors.ts
9-
- ccc-dev/ccc/packages/core/src/ckb/transaction.ts
10-
- ccc-dev/ccc/packages/core/src/ckb/index.ts
11-
- ccc-dev/pins/REFS
12-
- ccc-dev/pins/HEAD
8+
- ccc-fork/ccc/packages/core/src/ckb/transactionErrors.ts
9+
- ccc-fork/ccc/packages/core/src/ckb/transaction.ts
10+
- ccc-fork/ccc/packages/core/src/ckb/index.ts
11+
- ccc-fork/pins/
1312
- packages/dao/src/dao.ts
1413
- packages/core/src/logic.ts
1514
- packages/core/src/owned_owner.ts
@@ -25,23 +24,23 @@ must_haves:
2524
- "The `ErrorNervosDaoOutputLimit` error class exists in CCC `transactionErrors.ts` with count and limit fields"
2625
- "`pnpm check:full` passes after DAO check consolidation"
2726
artifacts:
28-
- path: "ccc-dev/ccc/packages/core/src/ckb/transactionErrors.ts"
27+
- path: "ccc-fork/ccc/packages/core/src/ckb/transactionErrors.ts"
2928
provides: "ErrorNervosDaoOutputLimit error class"
3029
contains: "ErrorNervosDaoOutputLimit"
31-
- path: "ccc-dev/ccc/packages/core/src/ckb/transaction.ts"
30+
- path: "ccc-fork/ccc/packages/core/src/ckb/transaction.ts"
3231
provides: "assertDaoOutputLimit utility function and completeFee safety net"
3332
contains: "assertDaoOutputLimit"
3433
key_links:
3534
- from: "packages/dao/src/dao.ts"
36-
to: "ccc-dev/ccc/packages/core/src/ckb/transaction.ts"
35+
to: "ccc-fork/ccc/packages/core/src/ckb/transaction.ts"
3736
via: "import and call assertDaoOutputLimit"
3837
pattern: "assertDaoOutputLimit"
3938
- from: "packages/core/src/logic.ts"
40-
to: "ccc-dev/ccc/packages/core/src/ckb/transaction.ts"
39+
to: "ccc-fork/ccc/packages/core/src/ckb/transaction.ts"
4140
via: "import and call assertDaoOutputLimit"
4241
pattern: "assertDaoOutputLimit"
4342
- from: "packages/core/src/owned_owner.ts"
44-
to: "ccc-dev/ccc/packages/core/src/ckb/transaction.ts"
43+
to: "ccc-fork/ccc/packages/core/src/ckb/transaction.ts"
4544
via: "import and call assertDaoOutputLimit"
4645
pattern: "assertDaoOutputLimit"
4746
---
@@ -51,7 +50,7 @@ Build the 64-output NervosDAO limit check as a CCC core utility and replace all
5150

5251
Purpose: Consolidate duplicated DAO output limit logic into a single source of truth in CCC core, preparing for SmartTransaction deletion by removing one of its responsibilities. This is the first feature-slice step (purely additive, nothing breaks).
5352

54-
Output: `ErrorNervosDaoOutputLimit` error class + `assertDaoOutputLimit` utility in CCC core; all iCKB packages calling the utility instead of inline checks; ccc-dev pins recorded.
53+
Output: `ErrorNervosDaoOutputLimit` error class + `assertDaoOutputLimit` utility in CCC core; all iCKB packages calling the utility instead of inline checks; ccc-fork pins recorded.
5554
</objective>
5655

5756
<execution_context>
@@ -68,9 +67,9 @@ Output: `ErrorNervosDaoOutputLimit` error class + `assertDaoOutputLimit` utility
6867
@.planning/codebase/ARCHITECTURE.md
6968

7069
Key source files to read:
71-
@ccc-dev/ccc/packages/core/src/ckb/transactionErrors.ts (error class patterns)
72-
@ccc-dev/ccc/packages/core/src/ckb/transaction.ts (completeFee method, where safety net goes)
73-
@ccc-dev/ccc/packages/core/src/ckb/index.ts (barrel exports)
70+
@ccc-fork/ccc/packages/core/src/ckb/transactionErrors.ts (error class patterns)
71+
@ccc-fork/ccc/packages/core/src/ckb/transaction.ts (completeFee method, where safety net goes)
72+
@ccc-fork/ccc/packages/core/src/ckb/index.ts (barrel exports)
7473
@packages/utils/src/transaction.ts (SmartTransaction.completeFee with DAO check at lines 85-95)
7574
@packages/dao/src/dao.ts (DaoManager with 3 DAO checks at lines 100, 174, 245)
7675
@packages/core/src/logic.ts (LogicManager.deposit with DAO check at line 106)
@@ -82,14 +81,14 @@ Key source files to read:
8281
<task type="auto">
8382
<name>Task 1: Build ErrorNervosDaoOutputLimit and assertDaoOutputLimit in CCC core</name>
8483
<files>
85-
ccc-dev/ccc/packages/core/src/ckb/transactionErrors.ts
86-
ccc-dev/ccc/packages/core/src/ckb/transaction.ts
87-
ccc-dev/ccc/packages/core/src/ckb/index.ts
84+
ccc-fork/ccc/packages/core/src/ckb/transactionErrors.ts
85+
ccc-fork/ccc/packages/core/src/ckb/transaction.ts
86+
ccc-fork/ccc/packages/core/src/ckb/index.ts
8887
</files>
8988
<action>
9089
**Step 1: Add error class to transactionErrors.ts**
9190

92-
Read `ccc-dev/ccc/packages/core/src/ckb/transactionErrors.ts`. Add `ErrorNervosDaoOutputLimit` following the existing `ErrorTransactionInsufficientCapacity` pattern:
91+
Read `ccc-fork/ccc/packages/core/src/ckb/transactionErrors.ts`. Add `ErrorNervosDaoOutputLimit` following the existing `ErrorTransactionInsufficientCapacity` pattern:
9392

9493
```typescript
9594
export class ErrorNervosDaoOutputLimit extends Error {
@@ -108,7 +107,7 @@ export class ErrorNervosDaoOutputLimit extends Error {
108107

109108
**Step 2: Add assertDaoOutputLimit to transaction.ts**
110109

111-
Read `ccc-dev/ccc/packages/core/src/ckb/transaction.ts`. Add the standalone utility function as a module-level export (NOT a method on Transaction). Place it after the Transaction class definition. Import `ErrorNervosDaoOutputLimit` from `./transactionErrors.js`, `KnownScript` from the appropriate module, and `Script` if not already imported:
110+
Read `ccc-fork/ccc/packages/core/src/ckb/transaction.ts`. Add the standalone utility function as a module-level export (NOT a method on Transaction). Place it after the Transaction class definition. Import `ErrorNervosDaoOutputLimit` from `./transactionErrors.js`, `KnownScript` from the appropriate module, and `Script` if not already imported:
112111

113112
```typescript
114113
/**
@@ -154,20 +153,20 @@ In the `completeFee` method of the Transaction class (around line 2183), add a c
154153

155154
**Step 4: Export from barrel**
156155

157-
Read `ccc-dev/ccc/packages/core/src/ckb/index.ts`. Add exports for `ErrorNervosDaoOutputLimit` (from `./transactionErrors.js`) and `assertDaoOutputLimit` (from `./transaction.js`). Follow existing export patterns in the file.
156+
Read `ccc-fork/ccc/packages/core/src/ckb/index.ts`. Add exports for `ErrorNervosDaoOutputLimit` (from `./transactionErrors.js`) and `assertDaoOutputLimit` (from `./transaction.js`). Follow existing export patterns in the file.
158157

159-
**Step 5: Record ccc-dev pins**
158+
**Step 5: Record ccc-fork pins**
160159

161-
Run: `pnpm ccc:record`
160+
Run: `pnpm fork:record`
162161

163-
This updates `ccc-dev/pins/REFS` and `ccc-dev/pins/HEAD` to reflect the new CCC state.
162+
This updates `ccc-fork/pins/` to reflect the new CCC state.
164163

165-
Verify: `pnpm ccc:status` should exit 0 (no pending work).
164+
Verify: `pnpm fork:status` should exit 0 (no pending work).
166165
</action>
167166
<verify>
168-
1. `pnpm ccc:status` exits 0
169-
2. `grep -r "ErrorNervosDaoOutputLimit" ccc-dev/ccc/packages/core/src/ckb/transactionErrors.ts` finds the class
170-
3. `grep -r "assertDaoOutputLimit" ccc-dev/ccc/packages/core/src/ckb/transaction.ts` finds the function
167+
1. `pnpm fork:status` exits 0
168+
2. `grep -r "ErrorNervosDaoOutputLimit" ccc-fork/ccc/packages/core/src/ckb/transactionErrors.ts` finds the class
169+
3. `grep -r "assertDaoOutputLimit" ccc-fork/ccc/packages/core/src/ckb/transaction.ts` finds the function
171170
4. `pnpm check:full` passes (purely additive change, nothing should break)
172171
</verify>
173172
<done>
@@ -244,9 +243,9 @@ All 7 inline DAO output checks are removed. Every location now calls `await asse
244243

245244
<verification>
246245
1. `grep -rn "outputs.length > 64" packages/` -- should return 0 results
247-
2. `grep -rn "assertDaoOutputLimit" packages/ ccc-dev/ccc/packages/core/src/ckb/` -- should show usage in 4 iCKB files + definition in CCC
248-
3. `grep -rn "ErrorNervosDaoOutputLimit" ccc-dev/ccc/packages/core/src/ckb/` -- should show class definition + export
249-
4. `pnpm ccc:status` -- should exit 0
246+
2. `grep -rn "assertDaoOutputLimit" packages/ ccc-fork/ccc/packages/core/src/ckb/` -- should show usage in 4 iCKB files + definition in CCC
247+
3. `grep -rn "ErrorNervosDaoOutputLimit" ccc-fork/ccc/packages/core/src/ckb/` -- should show class definition + export
248+
4. `pnpm fork:status` -- should exit 0
250249
5. `pnpm check:full` -- should pass clean
251250
</verification>
252251

@@ -256,7 +255,7 @@ All 7 inline DAO output checks are removed. Every location now calls `await asse
256255
- completeFee has DAO safety net
257256
- All 7 scattered inline checks replaced with centralized utility calls
258257
- No intermediate broken build state
259-
- ccc-dev pins recorded
258+
- ccc-fork pins recorded
260259
</success_criteria>
261260

262261
<output>

.planning/phases/01-ickb-utils-smarttransaction-removal/01-01-SUMMARY.md

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,34 @@ provides:
1010
- ErrorNervosDaoOutputLimit error class in CCC core
1111
- assertDaoOutputLimit centralized utility function in CCC core
1212
- completeFee safety net for DAO output limit in CCC core
13-
- ccc-dev local patch mechanism for deterministic builds
13+
- ccc-fork local patch mechanism for deterministic builds
1414
affects: [01-02, 01-03, 01-04]
1515

1616
# Tech tracking
1717
tech-stack:
1818
added: []
19-
patterns: [centralized-dao-limit-check, ccc-dev-local-patches]
19+
patterns: [centralized-dao-limit-check, ccc-fork-local-patches]
2020

2121
key-files:
2222
created:
23-
- ccc-dev/pins/local/001-dao-output-limit.patch
23+
- ccc-fork/pins/local-001-dao-output-limit.patch (now part of pins/ multi-file format)
2424
modified:
25-
- ccc-dev/ccc/packages/core/src/ckb/transactionErrors.ts
26-
- ccc-dev/ccc/packages/core/src/ckb/transaction.ts
27-
- ccc-dev/record.sh
28-
- ccc-dev/replay.sh
25+
- ccc-fork/ccc/packages/core/src/ckb/transactionErrors.ts
26+
- ccc-fork/ccc/packages/core/src/ckb/transaction.ts
27+
- ccc-fork/record.sh
28+
- ccc-fork/replay.sh
2929
- packages/dao/src/dao.ts
3030
- packages/core/src/logic.ts
3131
- packages/core/src/owned_owner.ts
3232
- packages/utils/src/transaction.ts
3333

3434
key-decisions:
35-
- "Added ccc-dev local patch mechanism (pins/local/*.patch) to support deterministic replay of CCC source modifications"
35+
- "Added ccc-fork local patch mechanism (pins/local-*.patch) to support deterministic replay of CCC source modifications"
3636
- "Moved client parameter before optional options in DaoManager.requestWithdrawal and DaoManager.withdraw signatures"
3737
- "assertDaoOutputLimit uses early return when outputs <= 64 for zero-cost in common case"
3838

3939
patterns-established:
40-
- "Local CCC patches: place .patch files in ccc-dev/pins/local/ for changes applied after standard merge+patch cycle"
40+
- "Local CCC patches: pins/local-*.patch files applied after standard merge+patch cycle"
4141
- "DAO output limit: always use ccc.assertDaoOutputLimit(tx, client) instead of inline checks"
4242

4343
requirements-completed: [SMTX-06]
@@ -64,7 +64,7 @@ completed: 2026-02-22
6464
- Built assertDaoOutputLimit utility function that checks both inputs and outputs for DAO type script using full Script.eq() comparison
6565
- Added completeFee safety net in CCC Transaction class (both return paths)
6666
- Replaced all 7 inline DAO output checks across 4 files with centralized utility calls
67-
- Added local patch mechanism to ccc-dev record/replay for deterministic builds of CCC modifications
67+
- Added local patch mechanism to ccc-fork record/replay for deterministic builds of CCC modifications
6868

6969
## Task Commits
7070

@@ -74,31 +74,30 @@ Each task was committed atomically:
7474
2. **Task 2: Replace all 7 scattered DAO checks with assertDaoOutputLimit calls** - `2decd06` (refactor)
7575

7676
## Files Created/Modified
77-
- `ccc-dev/ccc/packages/core/src/ckb/transactionErrors.ts` - ErrorNervosDaoOutputLimit error class
78-
- `ccc-dev/ccc/packages/core/src/ckb/transaction.ts` - assertDaoOutputLimit utility + completeFee safety net
79-
- `ccc-dev/pins/local/001-dao-output-limit.patch` - Local patch for deterministic replay
80-
- `ccc-dev/pins/HEAD` - Updated pinned HEAD SHA
81-
- `ccc-dev/record.sh` - Added local patch preservation and application
82-
- `ccc-dev/replay.sh` - Added local patch application after standard merge+patch
77+
- `ccc-fork/ccc/packages/core/src/ckb/transactionErrors.ts` - ErrorNervosDaoOutputLimit error class
78+
- `ccc-fork/ccc/packages/core/src/ckb/transaction.ts` - assertDaoOutputLimit utility + completeFee safety net
79+
- `ccc-fork/pins/` - Updated pins for deterministic replay
80+
- `ccc-fork/record.sh` - Added local patch preservation and application
81+
- `ccc-fork/replay.sh` - Added local patch application after standard merge+patch
8382
- `packages/dao/src/dao.ts` - DaoManager.deposit/requestWithdrawal/withdraw now async with client param
8483
- `packages/core/src/logic.ts` - LogicManager.deposit now async with client param
8584
- `packages/core/src/owned_owner.ts` - OwnedOwnerManager.requestWithdrawal/withdraw now async with client param
8685
- `packages/utils/src/transaction.ts` - SmartTransaction.completeFee DAO check replaced
8786

8887
## Decisions Made
89-
- Added ccc-dev local patch mechanism (pins/local/*.patch) because the existing record/replay infrastructure had no way to persist source-level CCC modifications through the clean/replay cycle. This was a necessary blocking-issue fix (Rule 3).
88+
- Added ccc-fork local patch mechanism (pins/local-*.patch) because the existing record/replay infrastructure had no way to persist source-level CCC modifications through the clean/replay cycle. This was a necessary blocking-issue fix (Rule 3).
9089
- Placed `client: ccc.Client` parameter before optional `options` parameters in DaoManager signatures for cleaner API design (required params before optional).
9190
- assertDaoOutputLimit uses early return when `outputs.length <= 64` so the common-case path has zero async overhead.
9291

9392
## Deviations from Plan
9493

9594
### Auto-fixed Issues
9695

97-
**1. [Rule 3 - Blocking] Added ccc-dev local patch mechanism**
96+
**1. [Rule 3 - Blocking] Added ccc-fork local patch mechanism**
9897
- **Found during:** Task 1 (CCC core changes)
99-
- **Issue:** ccc-dev record/replay infrastructure had no way to persist local CCC source modifications. Running `pnpm ccc:record` or `pnpm check:full` would wipe changes because replay clones fresh from upstream.
100-
- **Fix:** Added `pins/local/` directory for `.patch` files. Modified `record.sh` to preserve local patches during re-recording and apply them after standard merge+patch. Modified `replay.sh` to apply local patches after standard replay. Both use deterministic git identity/timestamps for reproducible HEAD SHAs.
101-
- **Files modified:** `ccc-dev/record.sh`, `ccc-dev/replay.sh`, `ccc-dev/pins/local/001-dao-output-limit.patch`
98+
- **Issue:** ccc-fork record/replay infrastructure had no way to persist local CCC source modifications. Running `pnpm fork:record` or `pnpm check:full` would wipe changes because replay clones fresh from upstream.
99+
- **Fix:** Added `pins/local-*.patch` mechanism. Modified `record.sh` to preserve local patches during re-recording and apply them after standard merge+patch. Modified `replay.sh` to apply local patches after standard replay. Both use deterministic git identity/timestamps for reproducible HEAD SHAs.
100+
- **Files modified:** `ccc-fork/record.sh`, `ccc-fork/replay.sh`, `ccc-fork/pins/local-001-dao-output-limit.patch`
102101
- **Verification:** `pnpm check:full` passes (clean wipe + replay + build cycle)
103102
- **Committed in:** 7081869 (Task 1 commit)
104103

@@ -120,7 +119,7 @@ None - no external service configuration required.
120119

121120
## Self-Check: PASSED
122121

123-
- FOUND: ccc-dev/pins/local/001-dao-output-limit.patch
122+
- FOUND: ccc-fork/pins/ (local patch integrated into multi-file format)
124123
- FOUND: 01-01-SUMMARY.md
125124
- FOUND: commit 7081869 (Task 1)
126125
- FOUND: commit 2decd06 (Task 2)

.planning/phases/01-ickb-utils-smarttransaction-removal/01-02-SUMMARY.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ key-files:
3333
- packages/sdk/src/sdk.ts
3434

3535
key-decisions:
36-
- "Moved getHeader/HeaderKey to transaction.ts as non-exported internals rather than deleting entirely, since SmartTransaction class still uses them internally until Plan 03 deletion"
36+
- "Moved getHeader/HeaderKey to transaction.ts as non-exported internals (deleted alongside SmartTransaction in 01-03)"
3737
- "TransactionHeader moved to utils.ts as canonical location, imported by transaction.ts"
3838
- "Inlined CCC client calls use explicit null checks with descriptive error messages matching original getHeader throw semantics"
3939

@@ -84,7 +84,7 @@ Each task was committed atomically:
8484
- `packages/sdk/src/sdk.ts` - Inlined 1 getHeader call with client.getTransactionWithHeader
8585

8686
## Decisions Made
87-
- Moved getHeader/HeaderKey into transaction.ts as non-exported internals rather than deleting entirely. SmartTransaction's own instance methods (getHeader, encodeHeaderKey, addHeaders) still reference these internally. Deleting them would break SmartTransaction, which is not removed until Plan 03. This keeps the public API clean while maintaining internal consistency.
87+
- Moved getHeader/HeaderKey into transaction.ts as non-exported internals rather than deleting entirely. SmartTransaction's own instance methods (getHeader, encodeHeaderKey, addHeaders) still reference these internally. Deleting them would break SmartTransaction, which was removed in Plan 01-03. This kept the public API clean while maintaining internal consistency.
8888
- TransactionHeader placed in utils.ts as the canonical location since it outlives SmartTransaction (used by DaoCell.headers and ReceiptCell.header).
8989
- Inlined CCC client calls preserve the original error semantics: getHeader always threw on null results, and the inlined code also throws with descriptive messages.
9090

@@ -95,15 +95,15 @@ Each task was committed atomically:
9595
**1. [Rule 3 - Blocking] Retained getHeader/HeaderKey as non-exported internals in transaction.ts**
9696
- **Found during:** Task 1 (Step 5 - removing getHeader from utils.ts)
9797
- **Issue:** SmartTransaction class in transaction.ts imports and uses the standalone getHeader function and HeaderKey type internally. Removing them from utils.ts without providing them in transaction.ts would break the class.
98-
- **Fix:** Moved getHeader function and HeaderKey type into transaction.ts as non-exported (internal) declarations. They are no longer part of the @ickb/utils public API but remain available for SmartTransaction's internal use until Plan 03 deletes the class.
98+
- **Fix:** Moved getHeader function and HeaderKey type into transaction.ts as non-exported (internal) declarations. They are no longer part of the @ickb/utils public API but remained available for SmartTransaction's internal use until 01-03 deleted the class.
9999
- **Files modified:** packages/utils/src/transaction.ts
100100
- **Verification:** pnpm check:full passes; HeaderKey/getHeader not found in any consumer packages
101101
- **Committed in:** 85ead3a (Task 1 commit)
102102

103103
---
104104

105105
**Total deviations:** 1 auto-fixed (1 blocking)
106-
**Impact on plan:** Necessary to keep SmartTransaction functional until Plan 03 removes it. No scope creep.
106+
**Impact on plan:** Necessary to keep SmartTransaction functional until 01-03 removed it. No scope creep.
107107

108108
## Issues Encountered
109109
None - plan executed smoothly once the internal SmartTransaction dependency was handled.

.planning/phases/01-ickb-utils-smarttransaction-removal/01-CONTEXT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ Delete SmartTransaction class and its infrastructure across all packages; contri
1313
<decisions>
1414
## Implementation Decisions
1515

16-
### CCC DAO Contribution (via ccc-dev/)
16+
### CCC DAO Contribution (via ccc-fork/)
1717
- Build the 64-output NervosDAO limit check **in CCC core**, not in @ickb/utils
18-
- Develop in `ccc-dev/ccc/`, record pins, use immediately via workspace override while waiting for upstream merge
18+
- Develop in `ccc-fork/ccc/`, record pins, use immediately via workspace override while waiting for upstream merge
1919
- **Submit the upstream CCC PR during Phase 1 execution**
2020
- CCC PR includes three components:
2121
1. **`completeFee()` safety net** — async check using `client.getKnownScript(KnownScript.NervosDao)` with full `Script.eq()` comparison

0 commit comments

Comments
 (0)