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
Copy file name to clipboardExpand all lines: IMPLEMENTATION_LEARNINGS.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,3 +48,14 @@
48
48
- Process improvement: lease/version ownership is part of every nested async function contract. Recheck it immediately after each await and in the same atomic mutation as every result write, including errors. Tests must force takeover inside nested send and receipt awaits and return both stale success and stale error. Recovery must reconstruct all signing inputs from the persisted draft or reject configuration drift.
49
49
- Final cycle-4 review: accepted and fixed guard propagation through persisted transaction resume, send, and receipt awaits; guarded CAS evidence/error/finalization writes; stale-owner-safe cleanup; and complete draft authority including the optional ECDSA key name. Factory 110/110, artifact/Candid parity, shared 25/25, indexer 96/96, web 95/95, and all lints passed. No P0/P1 or implementation-caused/plan-required P2 findings remain.
50
50
- Follow-up risk for Plan 004: use the factory's persisted transaction draft and generation-CAS discipline for confirmation depth; an observed receipt must never finalize after a lease/version loss or configuration drift.
51
+
52
+
## Plan 004 — Factory EVM confirmation depth (2026-07-16)
53
+
54
+
- Repository convention: release, refund, and reproduction flows share typed receipt evidence and must use the same canonical block and confirmation-count helper; persisted transaction hashes are authoritative and must never fall through to a second broadcast.
55
+
- Constraint: every caller of a confirmation helper must branch on its returned `confirmed` flag. Persisting receipt evidence is not equivalent to finality, and `debug_assert!` cannot enforce a financial invariant in release builds.
56
+
- ICP/Candid/stable storage: the implementation uses additive serde-defaulted receipt and per-block payment-evidence fields plus an optional stable confirmation-depth field, preserving old snapshot decoding while regenerating the factory Candid interface.
57
+
- Effective gates: 19 confirmation tests, 6 escrow tests, 146 full factory tests, fmt, clippy with warnings denied, warning-free release Wasm, generated Candid, and artifact parity all passed. Parent diff inspection still caught no-rebroadcast and bytes32 fixture regressions; final review caught host refund finalization below depth, demonstrating that green gates did not cover every caller contract.
58
+
- Review findings accepted and fixed before the final review: canonicality-before-depth, per-block deposit evidence, guard propagation across async RPC stages, pending receipt representation, overflow-safe arithmetic, local-chain defaults, spawn no-rebroadcast behavior, pending-state preservation, and exact bytes32 fixtures.
59
+
- Authorized final-cycle finding accepted and fixed: `claim_escrow_refund_inner` in the non-Wasm path had finalized both resumed and newly broadcast refunds without rejecting `receipt.confirmed == false`; one branch relied only on `debug_assert!`. Both branches now persist evidence, return a pending error below depth, and finalize only after runtime-confirmed depth. Three host tests cover fresh pending, resumed pending, and exact-depth idempotent finalization.
60
+
- Process improvement: map every boolean/enum result from a shared financial helper to every call site and add a caller-contract test matrix, including host-only adapters. Keep Spark executor/reviewer prompts bounded, use high reasoning, require runtime model provenance, and stop broad diagnostic loops that can overflow context or generate unbounded logs.
61
+
- Final review: the same Spark/high reviewer approved the extra authorized cycle with no unresolved P0/P1 or implementation-caused P2 findings. Final independent gates passed with 3 focused refund tests, 20 confirmation tests, 9 escrow tests, 149 full factory tests, clean fmt/clippy, warning-free release Wasm, regenerated Candid, and artifact parity.
0 commit comments