Repository navigation
chore: bump breez sdk to 0.28.2 - #1306
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[Medium impact] The PR appears safe to merge; no actionable issue was found in the dependency update. SummaryUpdates
Reviews (1) · Last reviewed commit: "chore: bump breez sdk to 0.28.2" · Reviewed by Greptile |
talosmachina
left a comment
There was a problem hiding this comment.
No findings. Bumps breez-sdk-spark-swift from 0.28.0 to 0.28.2 in the project pin and Package.resolved. Reviewed 82ec599, full tier (dependency manifest), static: no build, because iOS does not build on this reviewer's Linux host.
What I checked, and 3 candidates I ruled out
Checked: Package.resolved's revision 063f6ad is the commit the upstream 0.28.2 tag points to (git ls-remote), and the pbxproj pin is exactVersion 0.28.2.
Diffed the Swift package, 0.28.0 against 0.28.2: only Package.swift (the xcframework URL and checksum) and breez_sdk_spark.swift changed; the Swift changes are doc comments plus the UniFFI checksums of the two bridgeFromCashApp methods.
CI: SwiftFormat and Greptile green; Run Tests still running at review time
Ruled out
- An API break in a call Bitkit makes: no public signature changed; the only methods with new checksums are
bridgeFromCashApp, and no file underBitkit/references Cash App. - New
RecoveryVerdictor transaction status cases:.redoand.unverifiedalready exist in 0.28.0 andSparkExitDriveralready handles both, socheckRecoverFundsreturningRedowhere it returnedValidlands on an existing branch. - Stale FFI module cache: CI builds clean; a local build may need
just clean modules(AGENTS.md), and that is not a code defect.
Merge confidence: 4/5, no findings and the binding diff is docs-only for Bitkit's calls, but the unit-test job had not finished when I reviewed.
Reviewer model: claude-opus-5-5
Reasoning effort: Not exposed (the runtime does not report it)
|
Triage: milestone 3.2.0, as its Android twin synonymdev/bitkit-android#1881. This PR brings Breez SDK fixes the 3.2.0 Spark paths use and closes no issue, so it carries the milestone itself. |
coreyphillips
left a comment
There was a problem hiding this comment.
Two independent reviews, nothing blocking a merge.
worth doing, does not block
- A failed chain read during a check now triggers the unverified rebuild (Bitkit/Services/SparkExit/SparkExitDriver.swift:871-875). With 0.28.2, one failed chain read during
check_recover_fundscan make the exit driver rebuild over a step that is still in flight, which the guard inisUnverifiedRebuildDueexists to prevent. In 0.28.0 a check never producedUnverified.status_after_checkended with(None, _) => current, so aReadystep stayedReady. 0.28.2 (breez/spark-sdk b892ec21) adds this arm ahead of it:rust (None, _) if check.unverified.contains(txid) => ExitTransactionStatus::Unverified,check_exit_chainputs a step that still has to confirm intounverifiedwhenever an outspend query fails for one of its inputs or one of its CPFP child's inputs. Those inputs include the exit's funding.isUnverifiedRebuildDueskips the rebuild only while some unilateral step readsReady. The comment at :627 gives the reason: a build now would conflict with a step still to send, at the same fee. If a rate-limited chain service flips the only ready step toUnverified, the guard passes. The driver then rebuilds with the same funding inputs over a step it may already have broadcast. If that build hitsInsufficientCpfpFunds, it also raises anisUnverifiedAskfee ask. The user sees that as needs-funding, with its funding reminders, until a clean check withdraws it. 0.28.2 also clearsUnverifieditself on the next clean check, including one thatrecover_fundsgave. Its guide now says to callcheck_recover_fundsagain instead of building again. So this rebuild is no longer needed even for build-timeUnverified. I confirmed the SDK side by diffingcrates/breez-sdk/core/src/sdk/unilateral_exit.rsandcrates/spark-wallet/src/unilateral_exit.rsbetween the 0.28.0 and 0.28.2 tags, and the app side by reading the driver. I did not reproduce it on regtest. The fakes inSparkExitTestsreturn canned check results, so unit tests cannot show it. One fix: rebuild only over steps that were alreadyUnverifiedin the stored recovery before this check, and otherwise wait for the next check. The comments at :627 and :1319 that say a rebuild settles an unread step need the same update.
nits
- Description omits the Done-after-failed-request change in 0.28.2. The description leaves out one more
check_recover_fundschange in 0.28.2. After a failed chain request, it returnsValidinstead ofDoneuntil the latest confirmation is six blocks deep (breez/spark-sdk c5f0198f). The driver's.validbranch does nothing when every step is confirmed, so an exit just ends a few blocks later while the chain service is flaky. No code change is needed, but a line in the description would save the next reader from finding it again.
jvsena42
left a comment
There was a problem hiding this comment.
No new findings. I read the upstream 0.28.0..0.28.2 diff. The pins are consistent: project.pbxproj:1265 is exactVersion 0.28.2, and the Package.resolved revision 063f6ad1… is the 0.28.2 tag.
-
breez/spark-sdk#1299: iOS passes
completionTimeoutSecs: nil(SparkManager.swift:367), so listing timing is unchanged. A storage error after dispatch surfaces fromsendPayment, which iOS already treats as uncertain unless it's a known pre-dispatch failure.failedSendHashescounts a pending send as live, so there is no double-pay path. -
breez/spark-sdk#1283:
check()anddriveWhileFundingboth handle.redo. A diverged generation is never rebroadcast, andbroadcastReadystill never sends an unverified unilateral step. I agree with coreyphillips's note onUnverifiedreachingisUnverifiedRebuildDue. -
A lost CPFP race now comes in as
.redoinstead of.valid+deadCpfpChildren, so three things change:- strikes count (
:442); - Redo rebuilds skip the stall cap;
keepValidGenerationdoesn't apply.
I found no route to a second consecutive strike, because the rebuild follows the spent funding. A driver test feeding
.redowith a loggedisInputSpentrefund would pin it. Android synonymdev/bitkit-android#1881 has the same interaction with #1782's driver. - strikes count (
-
The description says CI's e2e runs against the new SDK, but e2e and build are skipped here; only
Run Tests(pending) and SwiftFormat run.
Device gate: no device check needed: no UI change. A regtest exit run on 0.28.2 is still worth doing once this branch's exit gate runs again. perf: the check reads the outspend of every input of each unconfirmed step and its child, so more chain requests per tick during an exit. CI: Run Tests pending at 82ec59938.
Reviewer model: Claude Fable 5.2 (claude-fable-5-2), Claude Opus 5.5 (claude-opus-5-5)
Reasoning effort: not exposed
Fixed in 8150b14, the way you suggested. The driver now rebuilds only over a unilateral step that was already
Added to the description.
I'm leaving it for the follow-up that decides whether the lost-race fallback stays. That's the change that moves the lost race onto
Corrected: the description now says only unit tests and lint run on this PR. The Android twin, synonymdev/bitkit-android#1881, already merged with the same guard. The same fix for Android follows in its own PR into Re-review is needed only because of this push: 82ec599...8150b14 |
|
The Android fix is up in synonymdev/bitkit-android#1886. |
coreyphillips
left a comment
There was a problem hiding this comment.
Rechecked after 1 new commit (8150b14). Nothing blocking remains.
addressed
- Description omits the Done-after-failed-request change in 0.28.2. Fixed: The PR body now has the c5f0198 bullet: Valid instead of Done after a failed chain request, until six blocks deep, with no code change. I checked it with
gh pr view 1306.
still open
- A failed chain read during a check now triggers the unverified rebuild (Bitkit/Services/SparkExit/SparkExitDriver.swift:871-875). With 0.28.2, one failed chain read during
check_recover_fundscan make the exit driver rebuild over a step that is still in flight, which the guard inisUnverifiedRebuildDueexists to prevent. In 0.28.0 a check never producedUnverified.status_after_checkended with(None, _) => current, so aReadystep stayedReady. 0.28.2 (breez/spark-sdk b892ec21) adds this arm ahead of it:rust (None, _) if check.unverified.contains(txid) => ExitTransactionStatus::Unverified,check_exit_chainputs a step that still has to confirm intounverifiedwhenever an outspend query fails for one of its inputs or one of its CPFP child's inputs. Those inputs include the exit's funding.isUnverifiedRebuildDueskips the rebuild only while some unilateral step readsReady. The comment at :627 gives the reason: a build now would conflict with a step still to send, at the same fee. If a rate-limited chain service flips the only ready step toUnverified, the guard passes. The driver then rebuilds with the same funding inputs over a step it may already have broadcast. If that build hitsInsufficientCpfpFunds, it also raises anisUnverifiedAskfee ask. The user sees that as needs-funding, with its funding reminders, until a clean check withdraws it. 0.28.2 also clearsUnverifieditself on the next clean check, including one thatrecover_fundsgave. Its guide now says to callcheck_recover_fundsagain instead of building again. So this rebuild is no longer needed even for build-timeUnverified. I confirmed the SDK side by diffingcrates/breez-sdk/core/src/sdk/unilateral_exit.rsandcrates/spark-wallet/src/unilateral_exit.rsbetween the 0.28.0 and 0.28.2 tags, and the app side by reading the driver. I did not reproduce it on regtest. The fakes inSparkExitTestsreturn canned check results, so unit tests cannot show it. One fix: rebuild only over steps that were alreadyUnverifiedin the stored recovery before this check, and otherwise wait for the next check. The comments at :627 and :1319 that say a rebuild settles an unread step need the same update. The single-step case is fixed at SparkExitDriver.swift:880-884, and your new test passes locally. The guard still passes when a different unilateral step was already unread, becauseunreadBeforeonly has to match some step. I ran a two-leaf test on a scratch copy (stored n2 unverified, m2 ready; the check returns both unverified). The tick rebuilt to generation 2 over m2, which may already be in the mempool. To close it, also hold the rebuild while any unilateral step is unverified for the first time ($0.status == .unverified && !unreadBefore.contains($0.txid)), alongside the.readycheck. The description's "rebuilds only over a step that was already unverified" needs the same correction. Android #1886 has the same shape.
Fixed in bfa6268. The rebuild now needs every unverified unilateral step to have been unverified before this check, so a step this check just turned unverified holds it, as a ready one does. Your two-leaf case is Re-review is needed only because of this push: 8150b14...bfa6268 |
jvsena42
left a comment
There was a problem hiding this comment.
Re-approving at bfa6268a2. 8150b1480 and bfa6268a2 wait one check before rebuilding over a step a single read left unverified, and hold while any step just turned unverified. That matches Android synonymdev/bitkit-android#1886 with the same predicate and tests.
In 0.28.2 a clean check clears Unverified, so a step that stays unread rebuilds one tick later and a flapping step is sent on its clean tick. A third-party spend still arrives as .redo, so nothing can stall for good. The hold returns before the rebuild height is recorded, so no block is lost.
Device gate: no device check needed: no UI change. perf: at most one extra tick before an unverified rebuild.
coreyphillips
left a comment
There was a problem hiding this comment.
Rechecked after 1 new commit (bfa6268). Nothing blocking remains.
addressed
- A failed chain read during a check now triggers the unverified rebuild (Bitkit/Services/SparkExit/SparkExitDriver.swift:871-875). Fixed:
isUnverifiedRebuildDueat SparkExitDriver.swift:883-884 now passes only if every unverified unilateral step was already unverified instored, so a step one failed read just flipped holds the rebuild. I traced both new tests against it: in SparkExitTests.swift:1611 and :1647 the oldcontainsrebuilds and the newallSatisfydoes not. The comments at :627-630 and :1331-1332 now describe the wait-a-check behaviour. I could not run the suite here because there is no simulator runtime.
new since the last review
worth doing, does not block
- Funded unverified ask still rebuilds over a step a clean check made ready (Bitkit/Services/SparkExit/SparkExitDriver.swift:147-159). With 0.28.2, the funding resume at
SparkExitDriver.swift:147-159can rebuild over a step that has already been sent again. The trigger is a clean check during an unverified rebuild's fee ask that turns the unread step back toReady. Here is the path: 1.driveWhileFundingwithdraws the ask only when no step is unverified and no savings payment is pending (:307). 2. If the user paid the ask from savings, the ask stays. 3.broadcastReadyat :315 sends the step that now readsReady. 4. When the payment confirms, the tick callsbuildstraight away. Nothing like theisUnverifiedRebuildDueguard runs first. The result is the same-fee conflict that the comment at :627 says the check path avoids. A single failed read on another step can keep the ask open the same way without a pending payment, because :308 counts cooperative steps too. That case also needs the funding to be adopted on that tick. Point 1 found that 0.28.0 never clearedUnverifiedon a check, so the step could not go out during the ask. The bump is what opens this path. I found this by reading the code only. I did not reproduce it, and I could not run the unit tests here. One possible fix: on resume, skip the build when no unilateral step still reads unverified, or when one readsReady. Leave the funding at the address, as :306 already does.
Fixed in 0869a9e, the first way you suggested. When funding for an unverified ask arrives, the resume now skips the build if a unilateral step reads Re-review is needed only because of this push: bfa6268...0869a9e |
coreyphillips
left a comment
There was a problem hiding this comment.
Rechecked after 2 new commits (0869a9e, cf14f5e). Nothing blocking remains.
still open
- Funded unverified ask still rebuilds over a step a clean check made ready (Bitkit/Services/SparkExit/SparkExitDriver.swift:147-159). With 0.28.2, the funding resume at
SparkExitDriver.swift:147-159can rebuild over a step that has already been sent again. The trigger is a clean check during an unverified rebuild's fee ask that turns the unread step back toReady. Here is the path: 1.driveWhileFundingwithdraws the ask only when no step is unverified and no savings payment is pending (:307). 2. If the user paid the ask from savings, the ask stays. 3.broadcastReadyat :315 sends the step that now readsReady. 4. When the payment confirms, the tick callsbuildstraight away. Nothing like theisUnverifiedRebuildDueguard runs first. The result is the same-fee conflict that the comment at :627 says the check path avoids. A single failed read on another step can keep the ask open the same way without a pending payment, because :308 counts cooperative steps too. That case also needs the funding to be adopted on that tick. Point 1 found that 0.28.0 never clearedUnverifiedon a check, so the step could not go out during the ask. The bump is what opens this path. I found this by reading the code only. I did not reproduce it, and I could not run the unit tests here. One possible fix: on resume, skip the build when no unilateral step still reads unverified, or when one readsReady. Leave the funding at the address, as :306 already does. Claude still sees it: The new guard atSparkExitDriver.swift:152-159covers a clean check on the same tick the payment confirms, andtestAFundedUnverifiedAskWhoseStepReadsAgainEndsWithoutARebuildshows that case. It misses a clean check on an earlier tick of the ask. Say the savings payment is still unconfirmed: a clean check readsn2asReadyandbroadcastReadysends it. The ask stays open, because :315 needsfundingPaymentTxid == nilandfundingTopUpadopts only confirmed coins. If one chain read fails on the tick the payment confirms, the in-mempooln2readsUnverifiedand no step readsReady, so :160-165 builds over it at the same fee. The resume needs the clause thatisUnverifiedRebuildDuehas at :891-893: keep the statuses from beforedriveWhileFunding's check, and hold while any unread unilateral step was not unread then. I traced this by reading the code. I did not run the tests.
jvsena42
left a comment
There was a problem hiding this comment.
Re-approving at cf14f5e77. 0869a9e34 ends a funded unverified ask once its unilateral steps read again, instead of rebuilding over a step about to be sent. The adopted funding stays for a later rebuild or the leftover sweep. This matches Android synonymdev/bitkit-android#1886 (f20441738).
|
Pushed d594038, the iOS side of a point @coreyphillips raised on synonymdev/bitkit-android#1886 (comment). The funded unverified ask's resume now holds over a step this tick's check just turned unverified, using the recovery from before the check, as the check path's rebuild does. So a step sent on an earlier clean check, while the savings payment was still unconfirmed, is no longer rebuilt over when the payment confirms on a tick whose read fails. New test Re-review is needed only because of this push: cf14f5e...d594038 |
|
@coreyphillips the still-open point in #1306 (review) is fixed in d594038. The funded resume now keeps the statuses from before |
coreyphillips
left a comment
There was a problem hiding this comment.
Rechecked after 1 new commit (d594038). Nothing blocking remains.
addressed
- Funded unverified ask still rebuilds over a step a clean check made ready (Bitkit/Services/SparkExit/SparkExitDriver.swift:147-159). Fixed:
SparkExitDriver.swift:153takes the unread set frombefore.recovery, the stored recovery beforedriveWhileFunding's check. The branch at :161-163 skips the build when any unread unilateral step was not unread then. This is the same clause asisUnverifiedRebuildDueat :888-900. I traced your sequence through both ticks. On the first tick, a clean check sends n2, and the unconfirmed payment returns early at :133. On the next tick n2 reads unverified again and the payment is adopted. n2 is not in the before-set, so the code reaches :161 instead ofbuild. The cooperative-unverified variant takes the same path: adoption on the same tick ends at the ready guard on :154, and adoption on a later tick holds at :161. One case remains: a sent step that stays unread for two checks in a row is still rebuilt over. The check path does the same, and the description states it. I could not runtestAFundedUnverifiedAskHoldsItsRebuildOverAStepSentOnAnEarlierCleanCheckbecause this machine has only the command-line tools, no Xcode. By reading, without the new branch the second tick reachesbuildat tip 1001, so therecoverRequestsassertion would fail.
new since the last review
nits
- New hold test never asserts the payment was adopted on the second tick (BitkitTests/SparkExitTests.swift:1871-1875)
|
Pushed 31f8848, test only: the hold test now asserts the payment was adopted, per @coreyphillips's nit in #1306 (comment). Re-review is needed only because of this push: d594038...31f8848 |
jvsena42
left a comment
There was a problem hiding this comment.
Re-approving at d5940383c. The funded unverified resume now holds while a step was turned unverified by this check rather than an earlier one (unreadBefore from before.recovery). That matches Android synonymdev/bitkit-android#1886 (45bd7340c) and the check's own rebuild rule. A step that stays unread resumes on the next tick, and nothing new is paid.
coreyphillips
left a comment
There was a problem hiding this comment.
Rechecked after 1 new commit (31f8848). Nothing blocking remains.
addressed
- New hold test never asserts the payment was adopted on the second tick (BitkitTests/SparkExitTests.swift:1871-1875). Fixed: BitkitTests/SparkExitTests.swift:1873 now asserts
record.funding.contains { $0.txid == paid }after the second tick. On the first tick the payment's UTXO is unconfirmed, andfundingTopUp(SparkExitFunding.swift:449) takes only confirmed coins. The only place a txid entersrecord.fundingisadoptFunding(SparkExitDriver.swift:358), so the assertion fails if adoption fails and the tick returns at the :133 guard. I ran-only-testing:BitkitTests/SparkExitDriverTestsat 31f8848 on an iPhone 17e simulator: 84 tests, 0 failures, this test included.
|
Merging into |
Twin: synonymdev/bitkit-android#1881
Description
breez-sdk-spark-swiftfrom 0.28.0 to 0.28.2, the current stable release. From 0.28.0 it brings:check_recover_fundsnow returnsRedowhen a CPFP child's funding was spent by another transaction, instead ofValid. It also asks the chain less per check, and marks a transaction it couldn't readUnverified. The emergency exit's driver already rebuilds a fee chain that lost a race on its own, when the SDK calls itValid. That fallback stays: with 0.28.2 the SDK reports the case asRedofirst, so the fallback should rarely run.Unverifiedduring a check when one chain read fails, and clears it on the next clean check. The exit driver used to rebuild over any unverified step while nothing was ready to send. A single failed read could then rebuild over a step that was already sent, and could show a funding ask until a clean check withdrew it. The driver now rebuilds only when every unilateral step it can't read was already unverified before the current check. A step one failed read turns unverified holds the rebuild until the next check, the same as a step that is ready to send. A step that stays unread rebuilds at the first check where no other step just turned unverified, once a block at most. When funding for an unverified rebuild's fee ask arrives after a clean check read the step again, the rebuild no longer runs: the ask ends and the funding stays at the address. When the payment confirms on a check that turns a step unverified again, the resume waits for the next check, as the check's own rebuild does, since a clean check before it may have sent that step.check_recover_fundsreturnsValidinstead ofDoneuntil the latest confirmation is six blocks deep (c5f0198). A finished exit can then take a few more blocks to end while the chain service is flaky. No code change: the driver'sValidbranch does nothing once every step is confirmed.listPaymentsshows it during the wait. Bitkit's Spark sync already treats a listed pending send as in flight, the same as an uncertain retry, so the node keeps holding off. The only visible difference is that the send can appear a little sooner. No code or test change.Design
N/A — no UI changes.
Preview
N/A
QA Notes
Automated Checks
SparkExitTests:testAStepAFailedReadTurnsUnverifiedWaitsForTheNextCheckInsteadOfRebuilding: a ready step that one check turns unverified is neither rebuilt over nor sent, and the exit rebuilds only once the next check still can't read it.testAStepAFailedReadTurnsUnverifiedHoldsTheRebuildOverAnotherUnreadLeaf: one leaf's step was already unread and the other's just turned unverified, and nothing rebuilds.testAFundedUnverifiedAskWhoseStepReadsAgainEndsWithoutARebuild: a paid ask whose step reads ready again sends it and doesn't rebuild.testAFundedUnverifiedAskHoldsItsRebuildOverAStepSentOnAnEarlierCleanCheck: a step sent on a clean check while the payment was unconfirmed is not rebuilt over when the payment is adopted on a tick whose check can't read it.