Repository navigation
refactor(dashpay)!: sync DashPay through platform-wallet and show it from shared snapshots - #1134
Claudius-Maginificent wants to merge 14 commits into
Conversation
…let state Add `WalletBackend::dashpay_snapshot(owner)`: one lock-free read per identity combining platform-wallet's DashPay state (profile, established contacts, pending requests, contact profiles, payments) with this device's overlays (withdrawn/declined requests, private memos, payment times). Snapshots are rebuilt after every DashPay write task and by a new `DashPayTask::RefreshSnapshots` the frame loop dispatches after each completed sync pass (polled; TODO(upstream) on_dashpay_sync_completed) and every 15 s. `DashPayTask::SyncNow` runs a pass on demand once the masternode list is ready. What platform-wallet does not hold is looked up after a pass: contacts' DPNS usernames (kept in a slimmed per-contact username store that reads the old contact-profile blobs) and the profiles of wallet-less identities. Drop DET's own incoming-payment detector: platform-wallet records incoming DashPay payments itself (live and by reconcile), so DET's `txid:vout` copies duplicated them. Older composite entries still shadow their bare-txid twin at read time (TODO(upstream) per-output keys). Build pending: host disk full, no build slot yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
…inators Start `DashPaySyncManager` in the quorum-readiness gate next to the platform-address, identity and shielded coordinators, and quiesce it on a same-network disconnect; manager shutdown already drains it. Contact requests, profiles, contact profiles, contactInfo and payments now refresh every 15 s without a screen asking. Build pending: host disk full, no build slot yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
platform-wallet does not read `contactInfo` back for a wallet loaded
without its seed, which is how wallets load after a restart. DET now
reads them with the seed (DIP-0015 and legacy-key documents, same
precedence as before) and stores the result through platform-wallet's
`set_contact_metadata`, so the contact snapshot shows them from
platform-wallet's state instead of a DET-side merge. A legacy document
is taken over once.
The read runs on wallet unlock, on `DashPayTask::SyncNow { identity }`
and before every contact details save, under the owner's contactInfo
write lock. TODO(upstream): dip15-contactinfo-reader.
Build pending: host disk full, no build slot yet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
Accept, Decline and Cancel now name the other identity instead of a
request document id: platform-wallet's request state has no document
id, and DashPay holds at most one request each way per pair. Each
action re-fetches the request by ($ownerId, toUserId) before acting and
still verifies its direction. In-flight claims, per-owner action locks,
results and `DashPayContactRequestActionFailed` carry a
`ContactRequestKey { owner, counterparty }`, so two identities acting
on the same person never block each other. Progress records older
versions kept per document are still cleared by the fetched document id.
The backend E2E steps now pick A's request by its sender, the identity
id they were already comparing against.
Build pending: host disk full, no build slot yet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
The Identities hub reads profiles, contacts, requests and recent payments from the snapshots platform-wallet's DashPay sync publishes, and asks for a sync (SyncNow) on arrival, refresh, identity switch and Contacts entry once the masternode list is ready. Removes ProfileCache, the per-tab load/retry/dispatch-id machinery, the confirmed-note bookkeeping and Home's payment-history loads. Profiles of identities platform-wallet does not sync (no wallet, or a wallet not loaded) are read once per session after a sync pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
The Contacts, Requests, Profile, Payments and Contact Details screens read the selected identity's DashPay snapshot every frame and rebuild only when it changes. Their Refresh buttons ask for a sync (SyncNow); the per-screen load flags, dispatch guards and offline/network load tasks are gone. Contact Details still reads the public profile of someone the snapshot does not hold as a contact, and now lists the payments exchanged with the contact. Payments carry the time this device first saw them. Adds a test seam publishing a profile into the snapshots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
The hub asks for a sync instead of per-tab loads, so its kittests check when SyncNow goes out and seed profiles and contacts as a sync would. Tests of the removed load, retry and late-answer routing are dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
Screens read DashPay state from the snapshots platform-wallet's sync keeps current, so the raw-SDK load tasks and what served them go: - DashPayTask::LoadProfile, LoadContacts, LoadContactsOffline, LoadContactRequests, LoadContactDetails and LoadPaymentHistory, with their result variants and loaders - the profile load revisions (saves keep theirs, so a stale save result is still recognised); a synced profile name now wins over one saved on this device earlier, so a change made elsewhere shows - the contact-list load context, its batch dispatch routing and AppAction::BackendTasksWithContexts, which only the loads produced - WalletBackend::dashpay_sync(owner), superseded by the sync manager Synced own profiles get the time this device first saw them after each pass, as fetched ones did. The contact details precedence tests move to the model, next to shown_contact_details. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
Brings in the Platform v5.1-dev bump, v1.0-dev, and the contact details fixes. The load tasks those fixes touched are gone here: - Contact Details waits for its own SyncNow (new DashPaySync context) instead of the removed LoadContactDetails read before it reopens the editor after a failure. - The deleted contact profile cache and load paths stay deleted; their accessor and base58 updates are applied to what replaced them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
First compile of the DashPay snapshot steps: - box the profile in ProfileState::Present (large_enum_variant) - restore the re-engage test double lost with the load tests - fix imports, a stale argument and kittest payment previews - move the offline contact-details test onto the snapshot, keeping end-to-end coverage that held details win over this device's copy Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n sync Any DashPaySynced result reopened the editor, including the frame loop's snapshot refreshes, which can land while the sync reading the published details is still running. Only the SyncNow for this identity does now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…placed platform-wallet's DashpayReceivingFunds account marks receiving addresses used and extends its pool (gap limit 10) from the account xpub, so the receive cursor DET's removed payment detector advanced has no writer. The address registration no longer reads it; the field stays in ContactAddressIndex because the stored bincode layout is positional. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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 |
|
🕓 Review not started yet because this PR is a draft.
Commit 6a76f90. Normal review starts when eligible; priority review starts as soon as a slot is available. |
The profiles of identities platform-wallet does not sync are read with the SDK's batched get_profiles instead of a hand-written query per identity; an owner it returns nothing for is recorded as having none. Each upstream gap's TODO now names its dashpay/platform issue (#5595-#5601). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Blocked by the stack: this PR is based on #1102, which waits on dashpay/platform#5546 (DashPay contact details signed with HASH160 keys, DET's default identity key type). It can land only after that upstream PR merges, DET bumps its Platform pin past it, and #1102 merges; then retarget this branch to v1.0-dev. 🤖 Co-authored by Claudius the Magnificent AI Agent |
|
To do here, handed over from #1117 by the maintainer: keep The 🤖 Co-authored by Claudius the Magnificent AI Agent |
|
Scope addition (maintainer decision, carried over from #1117 — thepastaclaw finding PRRT_kwDOM8GK3c6zmKjS): Make the DashPay profile writer use the same key-availability policy as the profile screen. Suggested fix (~20–25 lines): wrap the identity in a profile-only signer whose 🤖 Co-authored by Claudius the Magnificent AI Agent |
TL;DR: DashPay contacts, contact requests, profiles and payments now stay up to date on their own in the background, and every screen shows the same, current view of them instead of loading its own copy.
User story
As an everyday DashPay user, I want my contacts, requests, profile and payment history to stay current without pressing Refresh on every screen, to achieve a contact list I can trust, including changes I made on another device.
Scenario
Base flow
I open the Identities hub, look at Home and Contacts, then open the older DashPay screens (contacts, requests, profile, payment history, contact details). Meanwhile I accept a request or rename my profile on another device, and a contact pays me.
Actual behavior
Each screen loads its own copy of the DashPay data when it opens or when I press Refresh. The screens can disagree with each other, show a spinner on every visit, and a change made elsewhere shows up only after I refresh the right screen. A profile name saved earlier on this device keeps winning over a newer name from the network.
Expected behavior
DashPay data syncs in the background every 15 seconds once the network is ready. Every screen shows the same current data straight away, a change made on another device appears by itself, and Refresh asks for an immediate sync. My own actions (sending, accepting, declining or withdrawing a request, saving a profile or contact details, paying) appear as soon as they finish. Contact details also list the payments exchanged with that contact.
Detailed discussion
Stacked atop #1102 (
fix/dashpay-contact-info-keys); merge that first.What was done
DET moves onto platform-wallet's
DashPaySyncManagerand itsManagedIdentityDashPay state, and deletes the DET-side machinery that duplicated it.dashpay_syncstarts and stops alongside the platform-address, identity and shielded coordinators: started by the masternode-readyCoordinatorGate, quiesced on disconnect, restarted in place.wallet_backend/dashpay_snapshot.rs). One frame-safeArc<DashPaySnapshot>per owner identity, published through anArcSwap. Each snapshot combines upstream state with the DET-local overlays: withdrawn and declined requests, private memos, details-synced markers, contact DPNS usernames, and payment/profile first-seen times.Arcchanged.DashPayTask::RefreshSnapshotsafter each completed sync pass (at most once per second, at least every 15 s).DashPayTask::SyncNow { identity }. With an identity, it also reads the owner'scontactInfodocuments with the wallet seed throughwallet_backend/secret_seam.rs. The same read runs once on wallet unlock.ContactRequestKey { owner, counterparty }instead of a document id. Each action re-fetches the document before acting. The paid-action double-click guards and the per-owner write locks (ContactInfoWrites,lock_identity_profile) are kept.SyncNowends (newBackendTaskContext::DashPaySync), not on a snapshot refresh or a profile read.ProfileCache,ContactsStateload/retry/dispatch-id tracking,ConfirmedNote, and the legacy screens' loading flagsDashPayTask::{LoadProfile, LoadContacts, LoadContactsOffline, LoadContactRequests, LoadContactDetails, LoadPaymentHistory}, together with their result variants and raw-SDK loadersBackendTaskContext::DashPayContactsLoad, andAppAction::BackendTasksWithContextsdet:contact_profilecache andTaskError::ContactProfileCacheStorageDetectIncomingContactPaymentsand theEventBridgecandidates). Upstreamreconcile_incoming_paymentsis the single writer.WalletBackend::dashpay_sync(owner)ContactAddressIndex::highest_receive_indexis no longer read. Upstream'sDashpayReceivingFundsaccount marks receiving addresses used and extends its pool from the account xpub. The field stays because the stored bincode layout is positional.Upstream gaps (each marked
// TODO(upstream): ...)ContactRequestcarries no document id (platform-wallet: keep the document id on a synced ContactRequest platform#5597): actions are keyed by owner and counterparty and re-fetch the document.contactInfoonly (platform-wallet: let a seedless wallet read its contact details without draining the whole contact-crypto queue platform#5595): reading stored contact details needs the wallet seed.ContactProfileEntryhas no DPNS username (platform-wallet: keep a contact's DPNS username next to their cached DashPay profile platform#5598). Stopgap: a small DET k/v store (contact_usernames) holds the usernames looked up once per session. It reuses the olddet:contact_profile:keys, so stored usernames survive. Remove it once platform-wallet carries the username.contactInfowrite serialization upstream (platform-wallet: serialize contact-details saves per identity so two saves cannot pick the same document slot platform#5599): DET keepsContactInfoWritesandlock_identity_profile.Sdk::get_profiles.txid:voutshadow upstream's bare-txid twin at read time (unit-tested).Known limitations
contactInfowrites for the same identity would lose an edit in platform-wallet (platform-wallet: serialize contact-details saves per identity so two saves cannot pick the same document slot platform#5599). DET's per-owner lock (ContactInfoWrites) is what prevents this today, so every DETcontactInfowrite must go through it.contactInforead (logged at debug). Arriving at the hub may ask for the wallet password, as the previous contact load did.blockedmarker has no production writer (no UI sets it), so the snapshots do not read it. Nothing user-visible changes.tests/backend-e2e/dashpay_tasks.rsis rewritten ontoSyncNowand snapshots, but the module is still disabled intests/backend-e2e/main.rs.Testing
WalletBackend(held details win over this device's copy)SyncNowcargo test --all-features --lib --test kittest: 3810/3810 lib tests and 508/509 kittests passed in the full run. The remaining kittest (identity_selector) was fixed and passes in a targeted re-run (2/2), the Contact Details tests (5/5) were re-run after the last behaviour change, and all DashPay lib tests (240/240) pass on the head commit.cargo clippy --all-features --all-targets -- -D warningsandcargo fmt --all -- --checkare clean on the head commit.dashpay_tasksis disabled in that suite.Breaking changes
Internal API only. The
DashPayTaskload variants, theirBackendTaskSuccessResultvariants,AppAction::BackendTasksWithContexts,ContactProfileCacheView,TaskError::ContactProfileCacheStorageandWalletBackend::dashpay_syncare removed. Request actions takecounterparty_idinstead ofrequest_id. No stored data format changes, and no user action is needed.Checklist
cargo fmt,cargo clippy -D warningsAttribution
🤖 Co-authored by Claudius the Magnificent AI Agent
🤖 Generated with Claude Code
https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q