Repository navigation
feat: move LN channel balances to spark - #1212
Conversation
|
Pushed |
|
Pushed
Screenshots on an iPhone SE are in Preview. The build, SwiftFormat lint and the translation check pass. |
ffba7c7 to
0eed9c2
Compare
0dc18be to
fa535a9
Compare
|
Rebased onto the rebuilt Spark base
The build, SwiftFormat lint, the translation check and the unit test selection pass. The device runs and screens in the description were taken before the rebase on the same Move to Spark code. |
… feat/move-to-spark
|
Merged the new base head |
|
Dropped "at the lowest fee" from this PR's changelog line, to match the new title: the line now says what the change does, not how cheaply. |
|
Pushed |
… feat/move-to-spark
|
Merged the new base head |
|
Pushed
The remaining low-severity items are in #1236. The unit test selection from |
|
0ce947b gives every Move illustration the zap's size and makes the amount on Too large bold white. The changed screens and recordings in the description are re-shot. |
jvsena42
left a comment
There was a problem hiding this comment.
Delta review of 5261e49 and 0ce947b: no findings. resetForWipe (called from AppReset) bumps the generation and clears the move latch and the stored move hashes. A wiped wallet's late outcome now fails the generation == moveGeneration check and leaves the next wallet's screen alone. 0ce947b only changes illustrations and copy styling.
Reviewer model: Claude Opus 5.5 (claude-opus-5-5)
Reasoning effort: not exposed
pwltr
left a comment
There was a problem hiding this comment.
Reviewed 0ce947b: the too-large screen now shows the amount in bold, and the check, cross and exclamation-mark illustrations are scaled up to match the zap. The other move screens' texts have no highlighted parts, so they look the same as before, and the scaling changes only how the images are drawn, not the layout or any tap target. No findings.
Review details
General review
Model: Claude Opus 5.5
Reasoning effort: high
… feat/move-to-spark # Conflicts: # Bitkit/Views/Wallets/SpendingWalletScreen.swift
|
@ovitrif this conflicts with |
Merged the base at b4f3e04 in 26a0bfc (merged rather than rebased, so the history you reviewed stays). The one conflict was in Also in this push, at 1483196:
|
jvsena42
left a comment
There was a problem hiding this comment.
Re-review after the rebase: own commits e84249fa4 and 1483196b9. No findings.
Routing fee kept (e84249fa4): CoreService.swift:1022-1026 lets an LDK update through the staleness check when it changes the stored fee, the same as Android 5315c3634. Downgrades are still blocked by keepsLightningStatus. settleMove is idempotent once the send succeeded. After the LDK update writes the fee, the next equal-fee listing is skipped, so the two writers don't overwrite each other back and forth. MoveToSparkActivityTests.testSparkReceiveSettlingTheSendTakesTheRoutingFeeFromTheLaterLdkUpdate covers the pending-send, Spark-receive, LDK-send order.
Translations (1483196b9): deferring them is the author's call.
Reviewer model: claude-fable-5-1 (delta review), claude-opus-5-5 (coordination)
Reasoning effort: not exposed (Fable subagent), default (Opus)
pwltr
left a comment
There was a problem hiding this comment.
Reviewed 1483196.
- Low — Unresolved watcher survives wipe.
Bitkit/ViewModels/WalletViewModel.swift:1228keeps its event task after timeout, but wipe never finishes that stream. If no terminal payment event arrives, the task remains retained. Add lifecycle teardown while preserving late outcomes for the active wallet. Wipe already clears the move screen's state. - Low candidate — Bind submission to the quoted wallet/node.
Bitkit/ViewModels/WalletViewModel.swift:1195supplies no identity check before queued submission. Wipe ordering and generation guards reduce the risk; a successful wrong-wallet dispatch has not been demonstrated. - Low candidate — Confirm the synchronous send-error guarantee.
Bitkit/Managers/MoveToSparkManager.swift:371permits a smaller retry afterPaymentSendingFailed. The earlier discussion establishes the intended no-payment-created behavior for rc.78; this revision pins rc.79. Duplicate movement is only a conditional concern if that guarantee differs.
Review details
Quick review
Model: Claude Opus 5.5
Reasoning effort: high
General review
Model: GPT-6.1 Sol
Reasoning effort: high
Security review
Model: Kimi K3
Reasoning effort: high
Combined review
Model: GPT-6.1 Sol
Reasoning effort: high
Fixed in fb26d22.
No change. The send goes to the node that is running at that moment, and
No change. Between rc.78 and rc.79 ldk-node only bumped rustls (synonymdev/ldk-node@a44cf8f6), so the no-payment-created behaviour for |
jvsena42
left a comment
There was a problem hiding this comment.
Re-review of fb26d2273: no findings. Approving. A move's late-outcome event stream is now kept in moveEventSinks, so wipe can finish it: a wiped node reports no late outcome, and the watch would otherwise wait forever. The new MoveToSparkLateOutcomeTests case covers it. Device gate: no device check needed for this delta.
Reviewer model: Claude Opus 5.5 (claude-opus-5-5)
Reasoning effort: not exposed
pwltr
left a comment
There was a problem hiding this comment.
Reviewed fb26d22 against b4f3e04. No actionable code findings. The move retains its identity through timeout and re-entry, and wallet wipe now finishes retained event streams so their listeners can unregister. Activity reconciliation preserves the outgoing move and routing fee across the two rail events.
Review details
Quick review
Model: Claude Opus 5.5
Reasoning effort: high
General review
Model: GPT-6.1 Sol
Reasoning effort: high
Combined review
Model: GPT-6.1 Sol
Reasoning effort: high
Move takes no Spark wallet that is exiting.
|
878e102 merges
The build and the Move unit tests pass locally, and swiftformat 0.64.6 is clean. |
|
Merging into Since those approvals, 878e102 merged the Spark base with the emergency exit from #1217, and |
Closes #1206
Twin: synonymdev/bitkit-android#1774
Dependency: #1128
Companion: synonymdev/bitkit-e2e-tests#297
This PR adds Move to Spark: a one-time sheet and an action that pays the balance of a Lightning channel to the user's own Spark wallet over the channel, then offers to close the emptied channel. Blocktank is closing its channels, and moving the balance over Lightning costs only the routing fee, where a close followed by a deposit costs on-chain and claim fees and 3 confirmations. It stacks on #1128: review it against that base; it merges after #1128.
Description
MoveToSparkManager, which quotes the move against a new amountless Spark invoice: it starts from what the channels can send and leaves room for the routing fee. The fee shown is LDK's estimate plus a 2 sat margin, and the payment's routing fee is capped at exactly that.channelsOnlyoption onLightningService.sendandestimateRoutingFees, used throughWalletViewModel.sendOverChannels, so the move always goes over the channels and never falls back to Spark; the defaultshouldPayWithRailrouting is unchanged.Out of Scope
makeQuoteunit tests — chore: move to spark review follow-ups #1236.isExitingcomes with the exit PR (feat: spark emergency exit #1217), not this PR's base. Every Move to Spark check goes throughMoveToSparkMath.isSparkUsableinMoveToSparkManager.swift, so whichever of the two PRs lands second changes that one line tospark.isReady && !spark.isExiting.Design
N/A — no design available. UI pending design: this is an AI-made first version from existing components; a Figma design and designer review follow.
Preview
iPhone 17 Pro simulator at 2x (iOS 27.0), at 2x speed.
rec-sheet2x.mp4
rec-too-large2x.mp4
rec-move-rest2x.mp4
rec-close2x.mp4
Screens
iPhone 17 Pro simulator at 2x (iOS 27.0), in flow order. Bitkit draws dark only, its system bars included.
QA Notes
Setup
sparkprofile from feat: local spark regtest network bitkit-docker#37 (./spark up), which runs three Spark operators, the SSP with its Lightning node, the LNURL and data-sync servers and a chain API on bitkit-docker's chain, compatible with Spark SDK 0.28. It does not publish the SSP node's P2P port (9735); publish it in a compose override to open a channel from the app.SIMCTL_CHILD_SPARK_LOCAL_CONFIG_B64set to./spark config --base64and the Spark chain service pointed athttp://127.0.0.1:23090/api; the simulator reaches the stack on the Mac's loopback. This PR has no switch for it; the app-side settings land in separate PRs../spark send <address> 500000), then open Lightning Connections, Manual Setup, and open a channel to the SSP node; confirm it with./spark mine 6.QA_MOVE_HOOKlaunch value (limit=<sats>,fail,slow).Journeys
move-to-spark.xml— sheet once, entry button, move with routing fee, close afterwards, nothing for a wallet without a channelManual Tests
Automated Checks
MoveToSparkMathTests.swift— first quote leaves room for a guessed fee, the amount fits under the limit with the fee, the fee cap covers the quoted fee, a move is offered only when 1,000 sats fit beside the fee reserve, halving stops at the minimum, no move without a usable SparkMoveToSparkLateOutcomeTests.swift— a success after the wait shows the done result with the fee paid, only for the move that still owns the screenMoveToSparkActivityTests.swift— a move keeps one outgoing Activity row with the routing fee, whichever leg arrives firstEvidence
Tested at
68028ff73on the stack and build from Setup, iPhone 17 Pro simulator at 2x (iOS 27.0), one 400,000 sat channel to the SSP; the Preview and Screens above are this run. Later commits (c2305be and 26d4ad1) change only the in-flight screen and Activity rows, which this run does not show.failhook, the screen showed "Could not move" with Try Again.Tested again at
1483196b9on the same stack and simulator, with a fresh wallet and one channel to the SSP. To bring up the in-flight screen, the build also carried a local hook that ends the settle wait at once.1-no-channel2x.mp4
2-sheet-relaunch2x.mp4
2b-relaunch-again2x.mp4
3-in-flight2x.mp4
4-activity2x.mp4
Gaps
Mainnet tests (run by the author)
These run on real devices with mainnet funds, by the author. Reviewers and review bots don't need to run them, and they don't block review.
Round 1
None yet.
Round 2 (pending)
Models used
claude-opus-5-5(reasoning:medium)claude-opus-5-5(reasoning:medium)claude-opus-5-5(reasoning:Not exposed)Metadata note: the review subagents' run records give the model but not a reasoning setting.