6.3 KiB
6.3 KiB
Gaps and Additional Tasks (Payment and State Channels)
This document lists gaps in the current implementation, additional tasks, and code that is still needed. Use it with the Todos list to prioritize work.
1. Frontend and config
| # | Task | Gap / need | Priority |
|---|---|---|---|
| 1.1 | Add GenericStateChannelManager to frontend config | Deployment doc references CONTRACT_ADDRESSES.mainnet.GENERIC_STATE_CHANNEL_MANAGER and chain138; contracts.ts has no GENERIC_STATE_CHANNEL_MANAGER. Add optional addresses for mainnet and chain138. |
High |
| 1.2 | GenericStateChannelManager ABI and UI | No frontend-dapp/src/abis/GenericStateChannelManager.ts ABI; no UI to open/fund/close state channels (with stateHash). Add ABI and a "State channels" section or tab (open, fund, close with stateHash, list channels). | Medium |
| 1.3 | Channels UI: cooperative close and submit close | Current UI has open, fund, finalize close only. No form for cooperative close or submit close (require off-chain signatures → v,r,s). Add optional forms (nonce, balanceA, balanceB, sig inputs) or a short guide + link to sign state off-chain. | Medium |
| 1.4 | Admin panel and Chain 138 | AdminPanel restricts to mainnet (chainId === 1). Channels and Channel Admin are unreachable on Chain 138. Either allow Chain 138 in the admin panel or add a separate Channels page that works on both Mainnet and Chain 138. |
Medium |
2. Contract security (pre-deployment recommendations)
| # | Task | Gap / need | Priority |
|---|---|---|---|
| 2.1 | ReentrancyGuard | PRE_DEPLOYMENT_RECOMMENDATIONS.md suggests ReentrancyGuard on closeChannelCooperative, finalizeClose (and any path that does _transfer). Not implemented in PaymentChannelManager or GenericStateChannelManager. |
High |
| 2.2 | Signature malleability (ECDSA) | Recommendations suggest EIP-2 check (reject s > secp256k1n/2) or OpenZeppelin ECDSA to avoid malleability and zero-address edge cases. Current contracts use raw ecrecover without these checks. |
Medium |
3. Off-chain services
| # | Task | Gap / need | Priority |
|---|---|---|---|
| 3.1 | Watchtower service | WATCHTOWER_AND_INDEXER.md describes design only; no services/watchtower/ implementation. Implement a small service (e.g. Node/TS) that subscribes to ChallengeSubmitted, holds latest state per channel, and calls challengeClose before deadline when needed. |
Low |
| 3.2 | Indexer for channels | No indexer or subgraph for ChannelOpened / ChannelClosed. Frontend enumerates via getChannelCount + getChannelIdByIndex; no "my channels" or filter-by-participant. Add indexer (custom service or The Graph subgraph) and optional API for channels by participant. |
Low |
4. Testing
| # | Task | Gap / need | Priority |
|---|---|---|---|
| 4.1 | E2E tests for GenericStateChannelManager | Only unit tests exist for GenericStateChannelManager. Add full e2e (e.g. test/e2e/GenericStateChannelsE2E.t.sol): cooperative close with stateHash, unilateral close, challenge (newest state wins) with stateHash. |
Medium |
| 4.2 | Gas report in docs | PRE_DEPLOYMENT suggests gas snapshot. Run forge test --gas-report for channel and e2e tests and add results to deployment or PRE_DEPLOYMENT doc (or a GAS_REPORT.md). |
Low |
| 4.3 | Fork / testnet e2e | Document or automate running e2e on Mainnet fork and (if available) Chain-138 testnet to catch chain-specific issues. | Low |
5. Deployment and ops
| # | Task | Gap / need | Priority |
|---|---|---|---|
| 5.1 | Chain-138 verification | PAYMENT_CHANNELS_DEPLOYMENT.md mentions --verify; Chain-138 may need a different block explorer and env (e.g. Blockscout, BLOCKSCOUT_API_KEY). Document chain-specific verification steps or add to deployment script. |
Medium |
| 5.2 | Incident response runbook | PRE_DEPLOYMENT suggests documenting how to pause, unpause, replace admin (multisig). Add a short runbook (section in PRE_DEPLOYMENT or docs/operations/): when to pause, how to unpause, how to change admin. | Low |
6. Documentation and future work
| # | Task | Gap / need | Priority |
|---|---|---|---|
| 6.1 | Virtual channels as future work | Virtual channels (hub, ledger channels, guarantees) are documented as external (Statechannels.org/Nitro). Add a short "Future work" section in README.md or a FUTURE_WORK.md that lists virtual channels and links to State Channels blog. | Low |
| 6.2 | SUPPORTED_CHAINS for Chain 138 | contracts.ts exports SUPPORTED_CHAINS = { mainnet }. If the dApp should support Chain 138 for channels, add chain 138 to wagmi chains and to SUPPORTED_CHAINS. |
Medium (if targeting Chain 138 in UI) |
7. Optional / later
| # | Task | Gap / need | Priority |
|---|---|---|---|
| 7.1 | ERC20 payment channels | Current managers are ETH-only. PRE_DEPLOYMENT notes: if ERC20 is needed, add PaymentChannelManagerERC20 or extend with token parameter and safe transfers. | Optional |
| 7.2 | Connext / Raiden / Statechannels SDK integration | Frontend only links out to Connext, Raiden, Statechannels.org. No in-app "Pay via Connext" or "Open state channel (Statechannels.org)" flow. Optional: minimal SDK integration or embedded guide. | Optional |
| 7.3 | Upgradeability | Contracts are not proxy-based. Optional: deploy behind transparent proxy if upgradeability is required later. | Optional |
Summary (actionable order)
- High: 1.1 (config), 2.1 (ReentrancyGuard).
- Medium: 1.2 (GenericStateChannel ABI + UI), 1.3 (cooperative/submit close UI), 1.4 (Chain 138 in admin or separate page), 2.2 (ECDSA), 4.1 (GenericStateChannel e2e), 5.1 (Chain-138 verify), 6.2 (SUPPORTED_CHAINS).
- Low: 3.1 (watchtower), 3.2 (indexer), 4.2 (gas report), 4.3 (fork/testnet e2e), 5.2 (incident runbook), 6.1 (virtual channels future work).
- Optional: 7.1 (ERC20), 7.2 (SDK integration), 7.3 (upgradeability).