Repository navigation
fix(wallet): log the two wallet-startup outcomes added by the SDK - #1108
romchornyi wants to merge 1 commit into
Conversation
`WalletStartupStatus` gained `seedBindingUnverified` and `identityScanIncomplete`, so the DashPay readiness log stopped compiling. Both are logged as warnings rather than errors: unlike `discoveryFailed`, which is a local fault nothing will clear on its own, each of these is recoverable on a later start — a rerun with the matching signer completes the queued contact-account work, and an incomplete identity scan stays on record so the next launch re-scans instead of taking the warm shortcut.
|
Warning Review limit reachedNext included review available in 8 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
🕓 Ready for review — 37 ahead in queue (commit 63cb2d6) |
|
Superseded — The two switch arms landed in #1095 ( Two details from here are still worth having, if you want to open a small follow-up:
|
…ified token id Six findings from the automated review of #1109, plus one merge repair. **A failed purchase is no longer offered for a blind retry.** Every approval builds, signs and submits a NEW direct purchase against the identity's next nonce, and the SDK reports one opaque error for both "the transition was rejected" and "it was submitted and waiting on the outcome failed". The old catch called all of it an incomplete request and left the sheet ready to approve again, so a purchase Platform had already accepted could be bought a second time. `approveTokenPurchase` now throws `DashConnectTokenPurchaseFailure`, which says which side of submission the failure came from: everything up to and including authentication is `beforeSubmission` and keeps today's retry-in-place, while anything out of `tokenPurchase(...)` is `outcomeUnknown` — the sheet closes and the user is told to check this identity's tokens and credit balance before buying again. **The token id on the sheet is now the token that gets bought.** The id was copied from the untrusted payload while the purchase is rebuilt from the contract id and position alone, so a crafted payload could display one token and buy another. The request is now refused unless the payload's id matches `calculateTokenId(contractId:position:)` — the protocol formula the SDK itself derives from. Also: - `expectedTotalCost` is a ceiling, not an exact price: Platform rejects a higher current price and charges a lower one. Both comments claiming the shown and charged amounts "cannot diverge" said more than that. - The sheet renders the price at full credit precision. Credits are 1e11 per DASH, and the eight-decimal rendering rounded away a sub-duff remainder that is nevertheless charged — on a money-authorization surface. - The credits-per-DASH divisor comes from `PlatformCreditsFormatter` instead of a second literal definition. - Tests cover the token-purchase parse branch and the credits→DASH conversion, including zero, a whole DASH, a whole-duff value and a single credit (the sub-duff case the display used to drop). The merge repair: this branch carried its own copy of the `WalletStartupStatus` cases while the same fix landed on develop as #1108, so the merge left the switch with two of each. Kept develop's. Built against platform `v4.2-dev` (which now carries dashpay/platform#4584); succeeds. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01RstH83XqqRc6oudvpu7UxZ
Issue being fixed or feature implemented
developdoes not compile against the currentv4.2-dev.WalletStartupStatusgained two cases —seedBindingUnverifiedandidentityScanIncomplete— and the DashPay readiness log switches over it exhaustively:Reproduced by building
develop's copy of the file againstv4.2-devhead; restoring this change is what makes the build pass again.What was done?
Logs the two new outcomes, in the shape the neighbouring cases already use.
Both are warnings rather than errors.
discoveryFailednext to them is logged at error precisely because it is a local fault that nothing in this session or the next will clear on its own; these two are not that:seedBindingUnverified— the signer handed to the call belongs to a different wallet, so the contact-account drain derived nothing rather than write receiving addresses from the wrong seed. The work stays queued and a rerun with the matching signer completes it.identityScanIncomplete— the contact sync and drain both ran for the identity that is known, but the gap-limit scan left indices unanswered, so the identity set is not established. The verdict stays on record and the next launch re-scans instead of taking the warm shortcut.How Has This Been Tested?
xcodebuild -workspace DashWallet.xcworkspace -scheme dashpay -sdk iphonesimulator ARCHS=arm64againstv4.2-devhead: fails with the error above usingdevelop's file, succeeds with this change. No behaviour outside the log statements is touched.Breaking Changes
None.
Checklist:
For repository code-owners and collaborators only