Repository navigation
feat!: set, change and remove DashPay profile payment addresses in SwiftExampleApp - #6094
Conversation
The wallet prepares an identity's shielded account by proving the identity's slot with the seed (#5905), and a contact request carries the sender's per-contact shielded address only once that preparation stands (#5901, #5902). No host could ask for the preparation, so a request sent from iOS or Android never carried an address. platform_wallet_manager_prepare_shielded_identity_address resolves the seed through the mnemonic resolver, as the shielded bind does, and calls PlatformWallet::prepare_shielded_identity_address. It returns the account's default address, zeroes its output on entry and writes it only on success. A panic inside the call comes back as a retryable error (catch_query_panic): the call moves no funds. Swift and Kotlin wrap it on PlatformWalletManager, and JNI bridges it as FundingNative.prepareShieldedIdentityAddress. Taken from #5288, without its account index helpers and bound-account snapshot, which no host calls. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…s the bind does Every failure but an unknown identity reached the host as ErrorUnknown, including the ordinary one of a wallet whose shielded side is not bound yet. An unknown identity keeps its code and the rest goes through map_shielded_error, as the shielded bind's failures do: the two recovery codes stay typed and anything else is ErrorWalletOperation with the wallet's reason. The docs said a panic comes back as a retryable error. That holds only in builds that unwind. The iOS profiles abort on panic, and the docs now say so. catch_query_panic moves beside the export, its only user, so runtime.rs is as on v5.1-dev. Tests: a second preparation returns the same address and leaves the bound accounts as they were, and a wallet that is not bound is refused with ErrorWalletOperation and a zeroed address. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…dentity-account-hosts # Conflicts: # packages/rs-platform-wallet-ffi/src/shielded_sync.rs
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 43 minutes. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
🔍 Review in progress (commit bcd0586) · live progress |
…es through the wallet, FFI and Swift The rs-sdk profile update can already set or remove the three profile payment addresses (#5970), but the wallet's profile update named none of them and the wallet's profile type dropped them on read. This carries corePaymentAddress, platformPaymentAddress and shieldedAddress through platform-wallet, its SQLite storage, the FFI, the Swift SDK and SwiftData. - platform-wallet: DashPayProfile and ProfileUpdate carry the addresses. PlatformWallet::write_dashpay_profile is the one way a profile is written. It refuses bytes that are not an address of the field's kind, a field the connected network's DashPay contract does not have yet, and a shielded address of this wallet that is not the identity's own account prepared in this session. - platform-wallet-storage: migration V021 stamps the encoding of the two blobs that embed the profile record, so rows written before it stay readable. - platform-wallet-ffi: the profile and persistence structs carry the addresses, and a new profile write takes keep / set / remove per address. - swift-sdk: DashPayProfile, DashPayProfileUpdate and a new SwiftData model carry the addresses. Taken out of #5288 so that it can be closed without merging. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
…dress strings, and report which ones the network accepts The wallet turns a Core (Base58Check), Platform or shielded (bech32m) address string into the bytes a DashPay profile stores and back, refusing an address of another network or kind. DashPayView::payment_address_support reports which of the three fields the connected network's DashPay contract has, and the profile write's own check now uses the same lookup. The FFI exposes the three calls for the Swift app. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nt addresses, and show a contact's The profile editor gets a Keep / Set / Remove choice for the Core, Platform and shielded payment addresses, with a field checked by the wallet and a button that fills in this wallet's own address. Set is disabled for a field the network does not accept yet. The profile and contact detail screens list the published addresses read-only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-hosts' into feat/swift-example-dashpay-profile-payment-addresses
9413338 to
358cdcd
Compare
… storage explorer The explorer must show every SwiftData model, and the new PersistentDashpayPaymentAddresses had no row. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…at/swift-example-dashpay-profile-payment-addresses
…nnot check, and name a failed read - A wallet whose shielded accounts are not bound yet holds no viewing keys, so it could not tell one of its own shielded addresses from another wallet's and let it through. It now refuses with ShieldedNotBound. The check also refuses bytes that are not an address itself instead of leaving that to its caller. - An encoding stamp no decoder knows is reported with the stamp and its column (UnknownBlobFormat) instead of a fixed message. - The Swift profile address accessors log a failed read before they report nil. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…at/swift-example-dashpay-profile-payment-addresses
… owns The address rows are keyed by owner identity id, so no SwiftData cascade reaches them. deleteChildrenFirst, PersistentIdentity.remove and DataManager.clearAllData left them behind, and a later re-add of the same identity id could read them back. removeOwned now marks the rows one by one instead of a batch delete: a batch delete writes to the store at once and survives a rollback, so a failed save kept the identity but lost its addresses. PersistentIdentity.remove now throws. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…at/swift-example-dashpay-profile-payment-addresses
…hat publishes a prepared shielded address The publication check reads the identity's preparation, which stands only until its coordinator is cleared. The write held the wallet's lifecycle gate but not the coordinator's operation admission, so a Clear could land between the check and the submission. The admission is now taken before the check and held until the profile is written. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…at/swift-example-dashpay-profile-payment-addresses
…paration of its shielded address The write chooses the coordinator admission to hold from the preparation recorded as it starts. A first preparation recorded after that choice passed the publication check on a coordinator the write did not hold, so a Clear of it would not wait. The write now refuses when the recorded preparation is not on the coordinator it holds; written again, it holds the right one. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…at/swift-example-dashpay-profile-payment-addresses
…let-profile-payment-addresses # Conflicts: # packages/rs-platform-wallet/src/lib.rs
…at/swift-example-dashpay-profile-payment-addresses # Conflicts: # docs/sdk/sdk-parity-manifest.json # packages/kotlin-sdk/PARITY_SUMMARY.md # packages/swift-sdk/SwiftExampleApp/TEST_PLAN.md
…n one place - Reading a profile copies the raw address bytes and leaves the decision to normalize_persisted_profile, which it already calls, instead of checking each address twice. - The shielded publication check parses the address with the same function the read path validates it with. - The three FFI converters share one fixed-size address copy. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…at/swift-example-dashpay-profile-payment-addresses
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Changes requested: 2 blockers
- Profile updates reject an empty replacement without checking the active schema —
packages/rs-sdk/src/platform/dashpay/profile.rs:351-360(new)
Impact: A caller removing the last field throughupdate_profileis refused before signing even if the supplied DashPay schema permits an empty replacement. - Saved addresses show as unpublished when the own-profile view falls back to storage —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/DashPayTabView.swift:822-824(carried)
Impact: An owner who opens their profile during a live-cache miss and a failed local address read can be told that a still-public address is unpublished and lose the option to remove it.
New on this head: This revision tightens Bech32m checksum and shielded-address publication rules, rejects empty profile replacements before signing, releases the FFI registry lock before the support fetch, and updates the Swift editor and address displays. Kotlin SDK emulator CI passed; policy reconciliation and PR Hygiene are still pending. A linked iOS app run and the DP-31 and DP-32 flows remain unverified.
🔴 2 blocking | 🟡 3 suggestion(s)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 6: gpt-6.2-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 7: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 8: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — The change spans UI, SDKs, and FFI, but its substantive behavior is address parsing, profile validation, and publication rather than changes to consensus, funds movement, or cryptographic primitives. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(lane failed),glm-5.3-flash(not used above high effort; tier asks max) - New since the last final review (
ab53a293): 1 new blocker(s) went to an independent confirmation pass (the final verifier's model in a fresh session, without its reasoning): 1 confirmed - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— platform-versioning (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/DashPayTabView.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/DashPayTabView.swift:822-824: Saved addresses show as unpublished when the own-profile view falls back to storage
Impact: An owner who opens their profile during a live-cache miss and a failed local address read can be told that a still-public address is unpublished and lose the option to remove it.
The fallback now shows saved addresses when the read succeeds, but a failed read still looks like confirmed absence. On a cold restore or identity switch, `loadOwnProfileFromCache()` can fall back to the persisted profile before the live wallet cache has an entry. Each address accessor then calls `fetchForDisplay`, which logs a SwiftData fetch error and returns the same `nil` as a missing row. The resulting profile drives both the “Not published” label and the editor's decision to omit Remove. Read the address row once through a fallible persistence accessor, preserve an unavailable state in the view and editor, and offer a retry or refresh. Cover both the successful cold-cache fallback and an address-row read failure.
In `packages/rs-sdk/src/platform/dashpay/profile.rs`:
- [BLOCKING] packages/rs-sdk/src/platform/dashpay/profile.rs:351-360: Profile updates reject an empty replacement without checking the active schema
Impact: A caller removing the last field through `update_profile` is refused before signing even if the supplied DashPay schema permits an empty replacement.
The preflight makes the SDK a second authority on whether the merged profile is valid. `replacement_document` already receives the DashPay contract, but the new `properties.is_empty()` branch hard-codes `minProperties: 1`. That agrees with DashPay v1–v3 today; the node gets the rule from the contract through DPP's versioned `DataContract::validate_document_properties`. The book's “Validation lives once” rule explicitly forbids duplicating a DPP count check in the SDK, even for a friendlier error. Keep the early guidance, but get the verdict from the shared DPP validator using the supplied contract and applicable `PlatformVersion`, then translate the minimum-property error into the existing message.
_Confirmed by an independent pass: The new `properties.is_empty()` branch in `replacement_document` violates the book's “Validation lives once” rule, which explicitly forbids SDKs from duplicating DPP count checks even to provide a friendlier error. It rejects a last-field removal before signing based on a hard-coded minimum instead of the supplied contract's schema._
In `packages/rs-dpp/src/address_funds/platform_address.rs`:
- [SUGGESTION] packages/rs-dpp/src/address_funds/platform_address.rs:293-296: Addresses with invalid padding still pass the Bech32m decoder
Impact: A user can paste a checksummed Platform address that a DIP-0018-compliant decoder rejects, see it accepted, and later see it displayed with different text.
The new shared decoder enforces the checksum but still accepts noncanonical payload spellings. In the locked `bech32` 0.11.1 release, `byte_iter()` discards trailing bits without validating them. A 21-byte Platform payload leaves two padding bits in its last five-bit group; a valid checksum over nonzero padding still yields the same 21 bytes, so the later length and type checks pass. Orchard uses the same helper and has the same gap. DIP-0018 specifies `convertbits(data, 5, 8, pad=false)` for decode. Validate padding on the checksum-stripped payload before collecting bytes and add a regression test with a valid Bech32m checksum and nonzero padding.
- [SUGGESTION] packages/rs-dpp/src/address_funds/platform_address.rs:365-366: Previously accepted legacy-checksum addresses stop parsing in Rust and WASM
Impact: An app that retained a `dash` or `tdash` string with a legacy Bech32 checksum can get a parse error after a client upgrade, even on the same network.
The checksum change affects existing client entry points, not just the new profile editor. In v5.0.2, both Rust `PlatformAddress::from_str` and WASM `PlatformAddress.fromBech32m` reached the DPP parser that accepted either checksum; both now reach the Bech32m-only helper. The PR already describes the DPP change. Make the effect on those client APIs explicit in the release notes and tell integrators to re-encode affected strings as Bech32m from the original address bytes. This does not change the stored bytes or require a protocol-version gate.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/ContactDetailView.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/ContactDetailView.swift:147-149: A contact's payment address can show a check time from a different profile snapshot
Impact: A user deciding whether to copy a cached destination can see a check time that does not describe the address on screen.
The footer attributes the check time to the displayed address, but the values come from different sources. `dashPayCachedProfile` reads the live Rust contact cache or falls back to the wallet's own-profile cache; the contact FFI getter returns the profile without its `checked_at_ms`. The new footer instead reads the date from SwiftData. `sync_contact_profiles` updates the live entry before persisting it and leaves that update in place if persistence fails, so a new address can appear with the previous snapshot's date. The date query also omits `networkRaw`, which is part of the persisted key. Keep the “Last known” label and omit the date until the address and check time can come from the same wallet snapshot. This is separate from verifying the current address before Copy in #6166.
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
…ofile update takes its empty-profile verdict from dpp - dpp: a Platform or Orchard address string whose padding bits after the last byte are not zero is refused. They were dropped, so strings that differed only there decoded to one address. - sdk: whether a profile update leaves too few properties is decided by dpp's check against the contract given, not by a count in the SDK. Only the message is the SDK's. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…n addresses The addresses come from the wallet's live contact cache and the time came from a stored row, so the two could describe different snapshots. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…e-dashpay-profile-payment-addresses
|
Your move: thepastaclaw left review threads unresolved; resolve them. |
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
There was a problem hiding this comment.
Re-review — Final validation — Phase 2 only (queue backlog)
Updated after discussion: 1 finding(s) of this review were settled in the inline threads; 1 blocking finding(s) still stand.
- ✅ Withdrawn: 🟡 Previously accepted legacy-checksum addresses stop parsing in Rust and WASM
Changes requested: 1 blocker
- Saved addresses show as unpublished when the own-profile view falls back to storage —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/DashPayTabView.swift:822-824(thread, carried)
Impact: An owner who opens Edit to unpublish an address during a live-cache miss and a failed local address read sees “Not published” and cannot select Remove in that editor session.
New on this head: This head rejects nonzero Bech32m padding, delegates the last-field removal check to DPP’s versioned validator, and removes the timestamp from cached contact addresses. Kotlin emulator CI passed; Rust workspace, WASM, JavaScript, and Swift schema checks were still queued or running when checked. The linked iOS app and DP-31/DP-32 flows remain unverified.
🔴 1 blocking | 🟡 2 1 suggestion(s)
Still open from earlier rounds (2)
- 🔴 Blocking: Saved addresses show as unpublished when the own-profile view falls back to storage —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/DashPayTabView.swift:822-824(thread) - 🟡 Suggestion: Previously accepted legacy-checksum addresses stop parsing in Rust and WASM —
packages/rs-dpp/src/address_funds/platform_address.rs:373-374(thread) — settled: ✅ Withdrawn
Review provenance
Source: reviewer 1: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — The cross-layer diff is substantial, but it changes profile publication, address-string validation, and SDK bindings rather than consensus, funds movement, coin selection, or cryptographic primitives. - Phase 1 reviewers: not run (skipped for throughput: 15 PRs queued, above the 10 limit)
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— platform-versioning (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/rs-sdk/src/platform/dashpay/profile.rs`:
- [SUGGESTION] packages/rs-sdk/src/platform/dashpay/profile.rs:673-680: The last-field test misses permissive schemas and the protocol 14 validator
Impact: The test can stay green if the SDK starts rejecting empty profiles unconditionally again or stops giving actionable removal guidance on protocol version 14.
The test does not distinguish the new schema-driven behavior from the old `properties.is_empty()` guard: the bundled latest schema requires one property, and the success case supplies one. It also only exercises protocol version 15, which uses the native validator; protocol version 14 is the first with profile payment addresses and gets its `minProperties` error from the JSON Schema validator. Keep the refusal and remove-plus-set assertions for both real contract versions, and add a fixture whose profile schema permits zero properties to verify that removing the last field returns an empty replacement.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/DashPayTabView.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/DashPayTabView.swift:822-824: Saved addresses show as unpublished when the own-profile view falls back to storage
(carried; thread: https://github.com/dashpay/platform/pull/6094#discussion_r4672781671)
In `packages/rs-dpp/src/address_funds/platform_address.rs`:
- [SUGGESTION → WITHDRAWN in discussion; do not fix] packages/rs-dpp/src/address_funds/platform_address.rs:373-374: Previously accepted legacy-checksum addresses stop parsing in Rust and WASM
(carried; thread: https://github.com/dashpay/platform/pull/6094#discussion_r4672781742)
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix. |
…4 and the latest Covers both protocol versions whose DashPay profile has payment addresses, and a profile schema without the minProperties bound, under which removing the last field gives an empty replacement. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
…linExampleApp Port of the SwiftExampleApp payment address editor (#6094) to Android. - JNI: payment address support, string to bytes and bytes to string exports over the platform-wallet-ffi helpers; the profile write takes keep/set/remove per address; profile JSON carries the addresses as hex. - Persistence: the own and contact profile rows keep their addresses (Room schema 20, migration 19 to 20), and the restore hands a contact's addresses back to Rust. - Kotlin SDK: DashPayPaymentAddressKind/Support/Update, DashPayPaymentAddresses.bytes/string, Dashpay.paymentAddressSupport. - App: payment address section in the profile editor and screen (Core and shielded fills; the Platform field is typed, #6164), and the last known addresses on the contact detail screen; TEST_PLAN DP-20/DP-21 mirror Swift DP-31/32. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…linExampleApp Port of the SwiftExampleApp payment address editor (#6094) to Android. - JNI: payment address support, string to bytes and bytes to string exports over the platform-wallet-ffi helpers; the profile write takes keep/set/remove per address; profile JSON carries the addresses as hex. - Persistence: the own and contact profile rows keep their addresses (Room schema 20, migration 19 to 20), and the restore hands a contact's addresses back to Rust. - Kotlin SDK: DashPayPaymentAddressKind/Support/Update, DashPayPaymentAddresses.bytes/string, Dashpay.paymentAddressSupport. - App: payment address section in the profile editor and screen (Core and shielded fills; the Platform field is typed, #6164), and the last known addresses on the contact detail screen; TEST_PLAN DP-20/DP-21 mirror Swift DP-31/32. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…linExampleApp Port of the SwiftExampleApp payment address editor (#6094) to Android. - JNI: payment address support, string to bytes and bytes to string exports over the platform-wallet-ffi helpers; the profile write takes keep/set/remove per address; profile JSON carries the addresses as hex. - Persistence: the own and contact profile rows keep their addresses (Room schema 20, migration 19 to 20), and the restore hands a contact's addresses back to Rust. - Kotlin SDK: DashPayPaymentAddressKind/Support/Update, DashPayPaymentAddresses.bytes/string, Dashpay.paymentAddressSupport. - App: payment address section in the profile editor and screen (Core and shielded fills; the Platform field is typed, #6164), and the last known addresses on the contact detail screen; TEST_PLAN DP-20/DP-21 mirror Swift DP-31/32. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…linExampleApp Port of the SwiftExampleApp payment address editor (#6094) to Android. - JNI: payment address support, string to bytes and bytes to string exports over the platform-wallet-ffi helpers; the profile write takes keep/set/remove per address (createOrUpdateProfileWithAddresses); profile JSON carries the addresses as hex. - Persistence: the own and contact profile rows keep their addresses, and the restore hands a contact's addresses back to Rust. The migration clears contact profile freshness so the next sync fetches their addresses. - Kotlin SDK: DashPayPaymentAddressKind/Support/Update, DashPayPaymentAddresses.bytes/string, Dashpay.paymentAddressSupport. - App: payment address section in the profile editor and screen (Core and shielded fills; the Platform field is typed, #6164), and the last known addresses on the contact detail screen, on the identity's own network. Your Profile decides create or update from the wallet after a sync pass that started after it opened (#6187 tracks the Rust side), sends only changed text, and needs a change to save an update. - TEST_PLAN DP-20/DP-21 mirror Swift DP-31/32. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…linExampleApp Port of the SwiftExampleApp payment address editor (#6094) to Android. - JNI: payment address support, string to bytes and bytes to string exports over the platform-wallet-ffi helpers; the profile write takes keep/set/remove per address (createOrUpdateProfileWithAddresses); profile JSON carries the addresses as hex. - Persistence: the own and contact profile rows keep their addresses, and the restore hands a contact's addresses back to Rust. The migration clears contact profile freshness so the next sync fetches their addresses. - Kotlin SDK: DashPayPaymentAddressKind/Support/Update, DashPayPaymentAddresses.bytes/string, Dashpay.paymentAddressSupport. - App: payment address section in the profile editor and screen (Core and shielded fills; the Platform field is typed, #6164), and the last known addresses on the contact detail screen, on the identity's own network. Your Profile decides create or update from the wallet after a sync pass that started after it opened (#6187 tracks the Rust side), sends only changed text, and needs a change to save an update. - TEST_PLAN DP-20/DP-21 mirror Swift DP-31/32. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Basic explanation
What this does: In the iOS example app, a user can now set, change or remove the public payment addresses on their DashPay profile: a Core address, a Platform address and a shielded address. A contact's published addresses show on the contact's screen.
Value: The SDK can write these addresses since #5970, and #6124 carries them through the wallet, FFI, Swift SDK and storage. Until now no screen offered them.
Risks: Low to moderate. Mostly app UI and read-only wallet helpers, and a profile edit that doesn't touch the addresses keeps them as published. Three rules got stricter after review (see Breaking Changes): Platform and shielded address strings must use the Bech32m checksum, a profile update cannot remove the profile's last field, and only the default address of an identity's own shielded account can be published. No consensus change.
Based on
v5.1-dev, where #6124 (the wallet, storage, FFI and Swift SDK layers) is now merged. It still needs #5967 (prepareShieldedIdentityAddressfor Swift), a draft whose branch is merged into this one, so #5967's six files show in this diff until it lands. Merge #5967 first; review only the other files here.Issue being fixed or feature implemented
The SwiftExampleApp profile editor only had display name, public message and avatar URL. The SDK layers for payment addresses are in #6124, but two things were missing for a screen:
Both are decisions, so they go in Rust, not Swift.
What was done?
Rust (
platform-wallet)profile_payment_address_from_string(kind, text, network)andprofile_payment_address_to_string(kind, bytes, network), withProfilePaymentAddressKind { Core, Platform, Shielded }.shieldedfeature.DashPayView::payment_address_support()returnsProfilePaymentAddressSupport { core, platform, shielded }. It reads the fields the network's DashPayprofiletype has. The shielded flag is also false in a build without shielded support. The profile write's own check (validate_payment_address_update) now uses the same lookup.FFI (
platform-wallet-ffi), new filedashpay_profile_payment_address.rsplatform_wallet_dashpay_profile_payment_address_supportdashpay_profile_payment_address_from_stringdashpay_profile_payment_address_to_stringDASHPAY_PROFILE_PAYMENT_ADDRESS_*value. These functions only marshal.Swift SDK
DashPayPaymentAddressKind,DashPayPaymentAddressSupport,ManagedPlatformWallet.dashPayPaymentAddressSupport().DashPayProfile.paymentAddressBytes(kind:from:network:)andpaymentAddressString(kind:bytes:network:).SwiftExampleApp
nextReceiveAddress(accountIndex: 0), fetched once per editor session, with a note that the same address can be offered again for another identity's profile until it receives a payment.prepareShieldedIdentityAddress, the identity's dedicated tip address. By the wallet's rule (feat(platform-wallet)!: a DashPay profile carries its payment addresses through the wallet, FFI and Swift #6124), this is the only shielded address of this wallet a profile may publish.Example, editing a testnet profile:
Changes made after review, outside the app
dpp:PlatformAddress::from_bech32m_string,PlatformAddress::is_mainnet_bech32mandOrchardAddress::from_bech32m_stringaccept only the Bech32m checksum and require zero padding bits. They usedbech32::decode, which also accepts a legacy Bech32 checksum and ignores the padding, so one address had several spellings.dash-sdk: a profile update that would leave the profile without any field is refused before signing, with a message to set another field in the same update. The contract requires at least one.platform-wallet: of an identity's own shielded account, only its default address can be published; the account's other addresses are the ones it gives to contacts.platform-wallet-ffi: the support query no longer holds the wallet registry lock across its network fetch.Docs
dashpay.profile_payment_addresses. Swift is partial, Kotlin unsupported. The Kotlin app has no payment address UI.How Has This Been Tested?
cargo test -p platform-wallet --lib -- payment_address address_patch_tests, with and without--features shielded: 19 and 21 passed. New tests cover:cargo test -p platform-wallet-ffi --features shielded --lib dashpay_profile: 16 passed, including 7 new FFI tests.cargo clippy -p platform-wallet -p platform-wallet-ffi --all-features --all-targets --locked -- --no-deps -D warnings: clean.cargo fmt --all: clean.python3 scripts/check_sdk_parity_manifest.py: OK.cargo test -p dpp --all-features --lib -- address_funds(207 passed),cargo test -p dash-sdk --lib --features mocks -- dashpay::(128 passed), the wallet's payment address, publication and profile write tests with and withoutshielded(29 and 20 passed), and clippy with-D warningson dpp, dash-sdk, platform-wallet, platform-wallet-ffi and rs-unified-sdk-jni.DashSDKFFI.xcframework.xcodebuild buildof theSwiftDashSDKscheme succeeds.Not yet verified:
build_ios.shbuild or linked app run.Breaking Changes
dpp: the bech32m address decoders now refuse a string with a legacy Bech32 checksum, and one whose padding bits after the last byte are not zero. Both used to decode to the same bytes as the canonical string.PlatformAddress::from_str,PlatformAddress::from_bech32m_string,PlatformAddress::is_mainnet_bech32mandOrchardAddress::from_bech32m_string, and WASMPlatformAddress.fromBech32m.dash1...ortdash1...string gets a parse error after upgrading: re-encode it as Bech32m from the address bytes.dash-sdk:update_profilereturns an error for an update that removes the profile's last field. Platform already rejected that document; the refusal now comes before signing. The verdict comes from dpp's check of the merged properties against the contract; the SDK only words the message.platform-wallet:write_dashpay_profilerefuses a non-default address of the identity's own shielded account. feat(platform-wallet)!: a DashPay profile carries its payment addresses through the wallet, FFI and Swift #6124 accepted any external address of that account.Everything else is additions: new public Rust functions and types in
platform-wallet, three newextern "C"functions, and new Swift types and methods.Left for later
DashPayProfileView.swift. The new UI is in its own file to keep that conflict small.Checklist:
structure.rs, regeneratedgrovedb-structure.json, and checked the structure viewer link posted on this pull requestFor repository code-owners and collaborators only
🤖 Generated with Claude Code
PR Hygiene ·
bcd0586/skip-botsproceeds without the ones not yet reported/self-reviewedsdk-parity— you own itkotlin-sdk(packages/kotlin-sdk/PARITY_SUMMARY.md,packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/ffi/FundingNative.kt,packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/PlatformWalletManager.ktand 1 more) — HashEngineeringdpp— you own itrs-platform-wallet-ffi(packages/rs-platform-wallet-ffi/src/dashpay_profile_payment_address.rs,packages/rs-platform-wallet-ffi/src/lib.rs,packages/rs-platform-wallet-ffi/src/shielded_sync.rs) — HashEngineering or ZocoLini or llbartekll or romchornyirs-platform-wallet(packages/rs-platform-wallet/Cargo.toml,packages/rs-platform-wallet/src/lib.rs,packages/rs-platform-wallet/src/wallet/identity/network/profile.rsand 5 more) — HashEngineering or ZocoLini or llbartekll or romchornyirust-sdk(packages/rs-sdk/src/platform/dashpay/profile.rs) — lklimek or shumkovswift-sdk(packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/DashPayPaymentAddress.swift,packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedSync.swift,packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/README.mdand 6 more) — llbartekll or romchornyiWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.Summary by CodeRabbit