Repository navigation
feat(dashpay): rebuild contacts on SwiftDashSDK, delete the DashSync subsystem - #787
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
1a67533 to
36fc391
Compare
llbartekll
left a comment
There was a problem hiding this comment.
Two verified money-path issues (details inline).
setFunding/addInputs/buildSigned take ManagedPlatformWallet on every published platform ref (v4.1-dev's #3970 API); the ManagedCoreWallet overloads the call sites were written against never shipped. The platform wallet is already in scope; ManagedCoreWallet stays for broadcastTransaction only. Co-Authored-By: Claude Fable 5 <[email protected]>
… DashSync subsystem Migration Row #18 — the contacts feature (dead at runtime since the post-M6 DashSync freeze) is rebuilt end-to-end on SwiftDashSDK and the entire DashSync implementation is removed in the same change. E2E-verified on testnet against SwiftExampleApp driving the far side: request sent → reciprocated → established → paid both directions. New SDK boundary (Sources/Infrastructure/SwiftDashSDK/Contacts/): - SwiftDashSDKContactsService: SwiftData read model (established = both direction rows, single row = pending; debounced NSManagedObjectContextDidSave refresh), PIN-gated send/accept via DWIdentityAuthorizer + KeychainSigner, ignoreSender (replaces the legacy decline, which was a TODO stub that faked failure), DPNS prefix search + reverse lookup (dpnsGetUsername, base58), contact meta (alias/note/hide via EstablishedContact + flushPersist), notifications read-state on the legacy DWGlobalOptions slot, and the payments projection (see below). - DWIdentityKeyUpgrader: dashwallet registration derives AUTHENTICATION keys only, so identities registered here could not send contact requests. Before the first contact action, one IdentityUpdate adds the missing ENCRYPTION + DECRYPTION keys (ECDSA, MEDIUM, bounds SingleContractDocumentType(DashPay, "contactRequest") — Drive rejects unbound or contract-level bounds). - DashPay background sync (15s six-step pass) start/stop wired into PlatformAddressSyncCoordinator alongside BLAST + shielded. - SDK.enableLogging installed at host init — the app previously ran the whole SDK with Rust diagnostics muted. Payments correctness (found live-testing): - PersistentDashpayPayment rows exist only via the app-pulled projection (PlatformWalletManager.refreshDashPayPayments); the Rust persister never pushes them, and Sent entries are unrecoverable if the app dies before a projection. The service now projects on every sync pass, at most once a minute on snapshot refresh, on profile open, and immediately after every successful send. - WalletSendService.sendToContact: pay-to-contact through the send boundary — spend-auth gate, then the single-shot SDK sendDashPayPayment (derives the DIP-15 address Rust-side), invoked only after the user's explicit Pay tap. Returns the exact network fee of the broadcast transaction (requires the platform fee- threading commit; see the DASHSYNC_MIGRATION.md platform pin). SwiftUI screens (UI/DashPay/Contacts/SwiftUI/), styled to the Android dash-wallet DashPay design (dashpay_contact_row.xml et al.): contacts home (card rows, Accept pill + round ignore, golden pending state, Android empty state), add-contact (debounced DPNS search, collision detection, DashPay-key eligibility marking via identityGetKeys mirroring the send path's key predicate), contact profile (Pay CTA, tap-the-header collapsible contact settings, payments history, green accept / ignore pane), notifications (New/Earlier, inline accept), and the Android HSV avatar algorithm (hue = charIndex/36, S 0.3, V 0.6). DPNS names render without the implied ".dash" suffix. Deleted (163 files): the DWDP* item/factory hierarchy, contacts VCs/models/FRC data sources, GlobalSearch, DWDashPayContactsUpdater/ Actions, DWNotificationsProvider/Data/VC/cells, the other-user profile stack, DWDPAmount*View, dead DWFilterHeaderView, and the pay-to-user payment plumbing (paymentInputWithUserItem — a frozen DSIncomingFundsDerivationPath read — plus the performPayToUser chain; the payment-confirm accept-contact checkbox is now honestly hidden). Kept: Items/Protocols headers (type the always-nil payment userItem; fall with the C8 processor rewrite), DWDPAvatarView (current-user surfaces), the invitation flow (out of scope per Row #16). The Contacts/Explore tabs now gate on DWCurrentUserIdentityInfo.hasIdentity — the old DashSync defaultBlockchainIdentity gate hid them from SDK-registered identities. Requires ../platform on local/tx-decode-plus-v4.1-dev (see the platform pin note in DASHSYNC_MIGRATION.md) and an xcframework rebuild. Co-Authored-By: Claude Fable 5 <[email protected]>
From a deleted-vs-new gap audit of the Row #18 contacts rebuild, restore the four legacy behaviors worth keeping: 1. Un-cap DPNS search (limit 10 → 0 = SDK default 100, the legacy page size); move eligibility checks to lazy per-row onAppear so a large result set doesn't fan out a key query per hit. 2. Enrich the contact-profile payment rows: current-rate fiat, tap through to the standard tx-detail screen (reusing TXDetailVCWrapper via navigationDestination), and the 'direct-to-address payments aren't retained' caption. Non-resolving txs stay non-tappable. 3. Add outgoing 'You sent a contact request to X' notification entries. 4. Add a search-result preview/confirm sheet (avatar, name, framing, collision-appropriate CTA) as the single send/accept surface. Honest limitation: the SDK has no on-chain profile fetch for an arbitrary identity (cache-only reads), so a true stranger shows username + placeholder, not a fetched bio. Deliberately not restored: the pay-confirm accept-contact checkbox and post-payment profile modal (superseded), and the invitation promos (blocked on the not-yet-migrated DashSync invitation flow). Co-Authored-By: Claude Fable 5 <[email protected]>
New 'Request 1 tDash' shortcut (testnet only): copies the wallet's receive address and opens the testnet faucet in-app, mirroring the Explore screen's get-test-dash flow. On testnet it replaces Spend as the default fourth shortcut and joins the customization list; a saved faucet shortcut degrades to Spend while on mainnet (config untouched). The request itself stays in the web page — the faucet API requires its anti-bot challenge token, which only the page can produce (verified: bare POST to /api/core-faucet returns 400 'Captcha token required'). Also fixes the Explore faucet link: the faucet no longer answers on port 80, so the http:// URL opened nothing. The new enum case is appended last — raw values persist in DWGlobalOptions.shortcuts. Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
…llback The '1 tDash' shortcut now calls the SDK's TestnetFaucet client (promoted from SwiftExampleApp — platform 5f53767be7): solve the faucet's soft cap.js proof-of-work on-device, POST the receive address to /api/core-faucet, show the result in a HUD. No web page on the happy path. Rate limit or any failure falls back to the previous behavior: copy the address, open the web faucet in-app, log why. Mechanism live-verified against faucet.thepasta.org: challenge -> solve -> redeem -> 200, 1 tDash delivered (txid 395eeb08...). Co-Authored-By: Claude Fable 5 <[email protected]>
…ts on pay-to-contact Review fixes (llbartekll): - sendToContact now passes spendAmount to authorizeSend, engaging the C7.4 biometric spending limit; without it the gate was non-monetary and Face ID alone authorized a contact payment of any size. - PayContactSheet validates the entered amount in Decimal space before the UInt64 conversion; NSDecimalNumber.uint64Value wraps modulo 2^64, so 2^64+1 duffs aliased to 1 duff, passed the range check, and broadcast the wrong amount while the success screen echoed the typed text. Co-Authored-By: Claude Fable 5 <[email protected]>
3af915a to
1287c49
Compare
…xid-typed delegate With #787 merged (pay-to-user excised, contacts on the SDK), the processor's DashSync branch lost its last producer, provable from the call graph: `DWPaymentInputSource_BlockchainUser` has zero producers, and the `.request` courier is minted only by `attachParsedURI:`, which always also sets `paymentIntent` — so processPaymentInput branches 3/4, confirmRequest's nil-parsed arm, protocolRequestFromPaymentRequest, confirmProtocolRequest(+ViaSwiftDashSDK), the confirmPaymentOutput DashSync fallthrough, every txManager* callback, the challenge/signed/ error blocks, reqeustAmountForProtocolRequest and cancelOrChangeAmount were reachable only from each other. Deleted (~380 lines), along with the never-called initWithDelegate: and the write-only canChangeAmount/ shouldClearPasteboard state. Delegate retype: didSendRequest:txidWire:contactItem: → didSendWithTxidWire:contactItem: — every live call site passed a nil request. requestUserActionTitle: leaves the protocol (its only producers were the deleted challenge/cancel paths); PaymentController drops that handler and the DSErrorDomain error special-case (live errors carry WalletSendService/SDK/BIP70 domains), keeping the pre-existing nil-error silence. confirmRequest: becomes confirmParsedPaymentInput (reads the parsed URI box directly; the nil-parsed arm fails visibly). The callback scheme rides the intent, and the display-order txid hex comes from a local DWReversedHexString helper instead of the pod's NSString+Dash/NSData+Dash categories. Zero DashSync imports/symbols remain in DWPaymentProcessor and PaymentController; 8 of 8 DWEnvironment reads in the processor are gone. Co-Authored-By: Claude Fable 5 <[email protected]>
The payment chain's id<DWDPBasicUserItem> plumbing has carried nil since the #787 contacts teardown deleted every DWDP item implementation: DWPaymentInput.userItem had zero setters, DWBasePayViewController's contactItem hook returned nil with no overrides, and pay-to-contact flows through the SwiftUI contacts screen → WalletSendService.sendToContact, never through this chain. Dropped end to end: the contactItem: delegate params (DWPaymentProcessorDelegate, PayViewControllerDelegate, PaymentsViewControllerDelegate, MainTabbarController), DWPaymentInput.userItem + the now write-only canChangeAmount (+ its DWQRScanModel writer), DWPaymentOutput.userItem (both initializers), the BIP70PaymentOutputFactory param, PaymentController.contactItem, ProvideAmountViewController's contact/avatar arm, SuccessTxDetailViewController.contactItem (a documented passthrough, never read), DWBasePayViewController's contactItem/ payViewControllerDidHidePaymentResultToContact hooks and its vestigial DashSync import, the confirm sheet's userItem row branch, the always-hidden accept-contact-request checkbox stubs, and DWPayModelStub's dead paymentInputWithUser:. Co-Authored-By: Claude Fable 5 <[email protected]>
…etailCellView With the userItem plumbing gone, the DWDP item protocol layer lost its last consumers. Deleted: the 12 protocol/associated-data headers under UI/DashPay/Items/Protocols (7 were orphaned since the #787 contacts teardown; DWDPBasicUserItem/DWDPBasicItem/DWDPBlockchainIdentityBackedItem fell with the plumbing — DWDPBasicUserItem itself was DS-tainted via DSFriendRequestEntity/DSBlockchainIdentity returns), the ObjC DWTitleDetailCellView.{h,m} (zero code/xib consumers — the confirm sheet renders through the Swift TitleValueCell), and its sole dependent DWDPSmallContactView.{h,m}. DWTitleDetailItem drops the userItem member and the _User style; DWTitleDetailCellModel drops the user initializer. Bridging header and pbxproj (38 lines; DWTitleDetailCellView.m had build-file entries in both targets) scrubbed; plutil -lint OK. Kept deliberately: DWDPAvatarView (live on Home/invites/username/profile surfaces; its blockchainIdentity property is Row #18 scope). Co-Authored-By: Claude Fable 5 <[email protected]>
Migration ledger row #29 + teardown-plan C8/C1 progress notes record the C8-fin strip: the C10 seam is deleted (not deferred) since #787 removed its last producer; the UI/Payments + Payment Controller trees import zero DashSync; 11 more DWEnvironment reads gone. Riders: stale comments stop describing the deleted DSPaymentRequest courier as present behavior (DWParsedPaymentURI header, SendViewModel.ingestScannedInput), and DWRequestAmountViewController drops its vestigial DashSync umbrella import (zero DS symbols used). Co-Authored-By: Claude Fable 5 <[email protected]>
… merge-dropped l10n (#808) * fix(l10n): restore en source strings dropped by the release-8.7.0 merge The merge commit 1ca07eb resolved DashWallet/en.lproj/Localizable.strings mostly to master's side, silently dropping 203 integration-branch entries. English UI kept rendering via the NSLocalizedString key fallback, but the Transifex source lost the strings. This restores the 34 dropped entries that are still referenced by an exact NSLocalizedString key in the current tree (shielded-DashPay Usernames strings from #801, Log export strings from #802, and DashPay registration strings), inserted in the file's case-insensitive key order with their original comment blocks. The file stays UTF-8. Deliberately not restored: - 160 dropped keys with no remaining NSLocalizedString reference (their call sites no longer exist on this branch) - the SPV-diagnostics entries from #804: fix/birth-height-chain-resync restores/rewords that screen's strings, and re-adding the old wordings here would only orphan them when that PR lands Co-Authored-By: Claude Fable 5 <[email protected]> * fix(l10n): restore DashPay contacts/invitations source strings Restores the 37 contacts- and invitations-flow entries that the release-8.7.0 merge (1ca07eb) dropped from the en source file. Their call sites were deleted when the contacts subsystem was rebuilt on SwiftDashSDK (#787), but the flows are about to be redone now that invitations live in the Dash SDK — keeping the entries preserves the Transifex source (and existing translations) for that rework. Selection rule: dropped keys whose last call site lived under DashWallet/Sources/UI/DashPay/{Contacts,Notifications,Items,Profile} or in a DWDP* contact view, as of the tree before the #787 rebuild. Inserted in the file's case-insensitive key order with their original comment blocks; file stays UTF-8. Co-Authored-By: Claude Fable 5 <[email protected]> * feat(invitations): rebuild the DashPay invitation claim on SwiftDashSDK Resolves teardown item T1's accept arm as PORT (INVITATIONS_REBUILD_PLAN.md is the full plan; the create/history/reclaim side follows). Invitations are DIP-13 vouchers, cross-platform-compatible with Android's shipping implementation (dashpay://invite?du/assetlocktx/pk/islock). Distribution is paste/scan-first with no third-party services: the invitee installs the app, then redeems by QR scan or paste ("Have an invitation?" in the Join DashPay dialog), or via a dashpay:// / applink deep link when the app is already installed. No AppsFlyer, no hosted link infrastructure. New: - DWInvitationLinkNormalizer — canonicalizes dashpay://invite, legacy invitations.dashpay.io/applink, and Android OneLink long-URLs (af_dp unwrap; keys tried in Android's order) down to the URI the SDK parser accepts. Obj-C-visible for the AppDelegate routing gate. - DWInvitationService — protocol-seamed facade: normalize, parse/preview, local-identity gate, post-claim contact request to the du inviter (DPNS resolve + SwiftDashSDKContactsService, which owns the PIN gate and the lazy DashPay-key upgrade). - ClaimInvitationScreen (+ ClaimInvitationFlow push glue) — paste field, QR scan sheet (GenericQRScannerView), inviter preview, inline invalid / already-registered states. - DWIdentityRegistrationCoordinator.startClaimInvitation — fourth funding path (.invitation): same PIN gate, key pre-persist, DPNS register, phase reporting and identity-resume semantics; the claim consumes the INVITER's asset lock via wallet.claimInvitation (no local PersistentAssetLock). - CreateUsernameView(Model) invitation mode: voucher funds the registration, so the balance cost rule and funding-source picker don't apply; success offers the inviter contact request; failures surface the SDK's typed claim errors. Rewired / deleted: - AppDelegate: dead FIRDynamicLinks handling removed (service shut down in 2025 — it silently swallowed universal links); invitation URLs route directly. dashpay:// added to CFBundleURLSchemes. - DashSync accept arm deleted: DWDashPayModel verifyDeeplink / createUsername:invitation: invitation branch / inviter friend-request via DSIdentitiesManager / invitationSteps; DWHomeModel deeplink passthrough; protocol surface narrowed to createUsername:. - DashUIKit package retargeted import/final → master @ 046f0875 (matches release-8.7.0; the stale pin's tip no longer resolves). Verified: clean dashpay arm64-sim builds under Xcode 26.3/Swift 6.2.4 and Xcode 26.6/Swift 6.3.3; fresh-wallet simulator smoke of the full invitee flow — menu entry → paste → parse/preview ("Invitation from …") → username form (zero balance, live DPNS availability) → PIN gate → SDK claim against testnet DAPI → typed funding-tx-not-found failure surfaced. Companion platform change (invitation cap 0.05 → 0.25 DASH for Android's contested tier) rides separately in dashpay/platform. Co-Authored-By: Claude Fable 5 <[email protected]> * docs(dashpay): record the translation-reuse audit in the invitations plan All 42 lproj files carry translations for the legacy claim-flow strings (already-claimed / invalid-invitation / invited-by-share copy) — the claim error mapping and the create-side share sheet must reuse those keys instead of minting new copy. The 37 restored contacts/invitations keys turn out to be English source only (no repo translations survive). Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: Claude Fable 5 <[email protected]>
Summary
Migration Row #18 — the DashPay contacts feature, dead at runtime since the post-M6 DashSync freeze, rebuilt end-to-end on SwiftDashSDK, with the entire legacy DashSync subsystem (163 files) deleted in the same change. E2E-verified on testnet against SwiftExampleApp driving the far side: contact request sent → reciprocated → established → paid in both directions, with the payment history attributing correctly.
What's new
SwiftDashSDKContactsService— the app-side boundary: SwiftData read model (established = both direction rows), PIN-gated send/accept reusingDWIdentityAuthorizer+KeychainSigner, ignore (replacing the legacy decline, which was aTODOstub that faked failure), DPNS prefix + reverse search, alias/note/hide via the SDKEstablishedContactsetters, notification read-state, and the payments projection.DWIdentityKeyUpgrader— dashwallet registration derives AUTHENTICATION keys only, so identities registered here couldn't send contact requests. One lazy IdentityUpdate adds the missing ENCRYPTION + DECRYPTION keys (boundsSingleContractDocumentType(DashPay, "contactRequest")— Drive rejects anything else) before the first contact action..dashsuffix implied). Contacts home, add-contact search (with per-identity DashPay-key eligibility marking), contact profile (Pay, collapsible contact settings, payment history), notifications.WalletSendService.sendToContact→ SDKsendDashPayPayment, invoked only after the explicit Pay tap; the success screen shows the exact network fee of the broadcast transaction.PlatformAddressSyncCoordinator;SDK.enableLogginginstalled at host init (Rust diagnostics were previously muted app-wide).DWCurrentUserIdentityInfo.hasIdentity(the DashSync gate hid them from SDK-registered identities).Payments correctness (found live-testing)
PersistentDashpayPaymentrows exist only via the app-pulled projection (refreshDashPayPayments) — the Rust persister never pushes them, and Sent entries are unrecoverable if the app dies first. The service now projects on every sync pass, throttled on snapshot refresh, on profile open, and immediately after each successful send.Deleted
The
DWDP*item/factory hierarchy, contacts VCs/models/FRC data sources, GlobalSearch,DWDashPayContactsUpdater/Actions,DWNotificationsProviderstack, the other-user profile stack, and the pay-to-user payment plumbing (including a frozenDSIncomingFundsDerivationPathread). Kept:Items/Protocolsheaders (typed by the always-nil paymentuserItem; fall with the C8 processor rewrite),DWDPAvatarView(current-user surfaces), and the invitation flow (out of scope per Row #16).Builds against
../platformon the local branchlocal/tx-decode-plus-v4.1-dev:origin/v4.1-dev+ the tx-decode cherry-pick from platform PR #3981 + a new fee-threading commit (send_paymentreturns the exact fee;platform_wallet_send_dashpay_paymentgainsout_fee_duffs) that still needs a platform PR. Details in the DASHSYNC_MIGRATION.md pin note. Rebuild the sim xcframework after switching.Follow-up: four legacy affordances restored (commit
feat(dashpay): restore four legacy contact affordances)From a deleted-vs-new gap audit of this rebuild: (1) DPNS search un-capped (
limit 10 → 0= SDK default 100, the legacy page size) with eligibility checks moved to lazy per-rowonAppear; (2) contact-profile payment rows enriched — current-rate fiat, tap-through to the standard tx-detail screen (reusingTXDetailVCWrapper), and the "direct-to-address payments aren't retained" caption; (3) outgoing "You sent a contact request to X" notification entries; (4) a search-result preview/confirm sheet (avatar, name, framing, collision-appropriate CTA) as the single send/accept surface. Honest limit recorded in-code: the SDK has no on-chain profile fetch for an arbitrary identity (cache-only reads), so a true stranger shows username + placeholder.Remaining UI work (not in this PR)
Tracked so it isn't lost — none of these block the migration; they're parity polish and follow-on arcs.
Deferred parity gaps (from the same audit):
Polish nits in the new contacts UI:
ContactProfileSheet/PayContactSheetuse rawDecimalinterpolation ("\(dash)") instead of the app's standard dash formatter — noᴆglyph, locale separator, or grouping. Cheapest real fix.ContactAvatarViewuses a bareAsyncImage(no caching/retry) for remote avatar URLs.Larger remaining DashPay UI (separate arc):
DWSendInviteFlowController,DWInvitationHistoryViewController, reachable from the More menu). Its own migration; unblocks the invitation promos above.Verification
dashpayarm64-sim build; app runs on the sim (testnet).fetchContactRequests/acceptFriendRequest…/searchIdentitiesByNamePrefix= 0 code references;DSFriendRequestEntity/DSDashpayUserEntityremain only in the kept protocol headers.dashpayarm64-sim build; interactive testnet smoke of the four restored affordances still pending (each is behind the wallet PIN).🤖 Generated with Claude Code