Repository navigation
fix(platform-wallet)!: name private entry and contact request payments in shielded activity - #6226
Conversation
… in shielded activity A private document entry paid from the shielded pool (type 29), which is also how DashPay private contact requests and private replies are paid, was recorded live as the residual kind ShieldedSpend with amount 0. Both example apps therefore showed the device's own payment as "Shielded Spend, -0 DASH", and SwiftExampleApp added the restored-wallet footnote it shows for every row of that kind. The wallet now records two kinds, appended to the stored tags: 13 PrivateDocumentCreate (counterparty: the data contract id) and 14 PrivateContactRequest (counterparty: the recipient identity id). Nothing but the fee leaves the pool, so the row's amount is the fee. The FFI restores both tags at boot instead of folding them into the residual kind. The apps label the two kinds and say the amount is the fee. No FFI struct, JNI signature or stored schema changes. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
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 56 minutes. View limit details
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. |
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
✅ Final review complete — no blockers (commit 026d32d) · triage: normal |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
Changes requested: 1 blocker
- A private payment can show a confirmed fee after another spend consumed its notes —
packages/rs-platform-wallet/src/wallet/shielded/operations.rs:3096-3101(new)
Impact: A user spending from the same wallet on two devices can see a lasting debit for a private entry or contact request that never executed if the losing device accepts a spent-input snapshot before scanning the winning spend.
The wallet now gives private document entries and DashPay requests and replies their own shielded activity kinds, records the intended fee as the amount, and carries the new tags through FFI and both example apps without a schema change. Rust workspace tests, the Kotlin emulator build and tests, and the Swift frozen-schema check passed; the Swift build and tests are pending.
🔴 1 blocking | 🟡 7 suggestion(s)
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: Failed private payments still display an amount that looks like a debit
Impact: Someone viewing a failed private payment sees a negative amount in both example apps, and an ordinary Fee field in Swift, even when the attempt cost nothing.
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/ShieldedActivityView.swift:470-475
A payment refused before delivery still looks like a charge at a glance. Rust records the intended fee before broadcast and preserves it on the Failed row. Swift renders it under the usual Amount and Fee labels, and Kotlin retains the signed debit next to the failure message. Keep the intended fee in history, but label it as attempted or omit the debit for failed rows.
source: gpt-6.2-sol (phase2-reviewer: general, architecture-layering, ffi-engineer, platform-versioning, rust-quality)
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: general); reviewer 9: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 10: gpt-6.2-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 11: gpt-6.2-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 12: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — The change spans Rust wallet bookkeeping, persisted activity tags, FFI restoration, and two app displays, but it does not change how funds move or require a storage migration. - 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) - Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
- 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— 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
🤖 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-platform-wallet/src/wallet/shielded/operations.rs`:
- [BLOCKING] packages/rs-platform-wallet/src/wallet/shielded/operations.rs:3096-3101: A private payment can show a confirmed fee after another spend consumed its notes
Impact: A user spending from the same wallet on two devices can see a lasting debit for a private entry or contact request that never executed if the losing device accepts a spent-input snapshot before scanning the winning spend.
The new row can attribute a specific fee to a contract or recipient even though that operation never executed. When a type 29 payment uses two or more real notes, its bundle has no dummy spend nullifier to distinguish it from a competing spend of the same notes. The honest DAPI wait checks the requested transaction's result, but the SDK cannot authenticate that check from the returned proof: it accepts a snapshot proving only that the requested nullifiers are spent. If an endpoint returns that snapshot before the scan sees the competing spend, `settle_affected_state_spend` confirms the row and marks the notes spent. `mark_spent` then drops the saved transition the scan needs to distinguish the two spends, and the scan's conflict handler only fails pending rows. #6180 tracks the existing status problem; this PR turns that status into a nonzero debit for a named payment and tells users the fee left the pool. Mark the notes spent without confirming the debit from an ambiguous snapshot, and retain enough evidence for sync to resolve the payment without keeping it eligible for rebroadcast. Cover the snapshot-before-scan ordering in a wallet regression test.
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/shielded/operations.rs:2942-2943: The payment API lets activity and recovery name different recipients
Impact: If a future call site supplies inconsistent recipient metadata, Shielded Activity can name the wrong identity or show a generic document entry while recovery tracks the actual contact.
`contact_recipient` controls the activity row, while the optional `private_contact` record independently carries the recipient used for recovery. The current DashPay caller derives both from the same identity, but the signature accepts conflicting values. The new coordinator test supplies the expected recipient directly and would still pass if the production reply path forwarded the wrong identity or none at all. Pass one typed payment purpose that carries the recipient once and makes only the journal-specific metadata optional. Add an offline test through the wallet's private accept path asserting that the row names the original requester.
In `packages/rs-platform-wallet-ffi/src/shielded_persistence.rs`:
- [SUGGESTION] packages/rs-platform-wallet-ffi/src/shielded_persistence.rs:133-136: A failed private request can leave a saved recipient ID even when nothing was sent
Impact: SDK hosts auditing what their wallet store retains can overlook recipient IDs for attempts that never produced an outgoing contact request.
Shielded Activity now retains the intended recipient independently of the outgoing request. The recorder queues tag 14 and its recipient before broadcast. When submission is refused before delivery and the saved transition is retired, `settle_private_document_payment` discharges the journal but keeps the activity row as Failed; the request flow returns before readback can save an outgoing request. Document that tag 14 covers attempts, including failed ones, and correct the PR description's claim that the recipient is already stored in every case.
In `packages/rs-platform-wallet/src/wallet/shielded/activity.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/shielded/activity.rs:145-157: Older Rust Serde readers reject activity records with the new kinds
Impact: A Rust host using the optional Serde API cannot read an activity record containing either new kind after downgrading to a build that predates the variants.
A record with either new variant fails to deserialize on older Rust builds, and it can make an entire batch unreadable if the host decodes the batch at once. `ShieldedActivityEntry.kind` uses the enum's derived Serde codec, including in `ShieldedChangeSet`; it does not use the FFI numeric tag decoder that falls back to `ShieldedSpend`. Document this distinction and the exhaustive-match source break in the 5.1 upgrade and release notes so Rust hosts can update their readers before writing the new variants.
In `packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/persistence/entities/ShieldedActivityEntity.kt`:
- [SUGGESTION] packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/persistence/entities/ShieldedActivityEntity.kt:34-35: An older build can overwrite the payment label when it updates a restored row
Impact: A user who reopens the same store with a pre-tag SDK and lets it confirm a pending private payment can still see only Shielded Spend after upgrading again.
The original classification can be lost on rollback, not just hidden while the older build is running. The older FFI decoder loads tags 13 and 14 as `ShieldedSpend`; when a scan confirms the row, the wallet re-emits the same entry ID as tag 7 and both hosts upsert it over the original tag. The scan cannot recover the classification. This does not change the amount or stop the older build from opening the store, but the Room comment saying the unknown tag is kept needs to be qualified. Carry the caveat already in the PR description into the public persistence and release notes.
In `packages/rs-platform-wallet-ffi/src/persistence.rs`:
- [SUGGESTION] packages/rs-platform-wallet-ffi/src/persistence.rs:8204-8206: A new activity kind can silently become Shielded Spend if the restore table misses it
Impact: If a future wallet kind gets an emitted tag but no matching FFI restore arm, a mobile host can overwrite its saved classification on the next status update.
Tags 13 and 14 round-trip on this head, but adding a future variant to `ShieldedActivityKind::tag()` does not force a corresponding FFI decoder update. The decoder's wildcard returns a valid but different kind, which a later status upsert saves as tag 7. Keep the stable tag mapping and its inverse together in the wallet crate, test round trips for all assigned tags there, and let FFI pass the raw fields to that decoder.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/ShieldedActivityView.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/ShieldedActivityView.swift:470-475: Failed private payments still display an amount that looks like a debit
Impact: Someone viewing a failed private payment sees a negative amount in both example apps, and an ordinary Fee field in Swift, even when the attempt cost nothing.
A payment refused before delivery still looks like a charge at a glance. Rust records the intended fee before broadcast and preserves it on the Failed row. Swift renders it under the usual Amount and Fee labels, and Kotlin retains the signed debit next to the failure message. Keep the intended fee in history, but label it as attempted or omit the debit for failed rows.
In `packages/kotlin-sdk/KotlinExampleApp/app/src/test/java/org/dashfoundation/example/ui/shielded/ShieldedActivityKindsTest.kt`:
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/app/src/test/java/org/dashfoundation/example/ui/shielded/ShieldedActivityKindsTest.kt:25-32: The Kotlin amount test fails under a decimal-comma locale
Impact: Contributors running the test with a French or German default formatting locale get a failure even though the amount is formatted correctly for that locale.
The assertion expects `−0.0015 DASH`, but `signedAmount` calls `String.format` without a locale, so those JVMs produce `−0,0015 DASH`. Make the test's formatting locale explicit and restore it afterward, or derive the expected display from the active locale without changing production formatting.
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
…and journal record Review follow-ups for the private entry and contact request activity kinds: - The payment takes one PrivateDocumentPurpose instead of a recipient for the activity row and a separate journaled payment, so the two cannot name different recipients. - ShieldedActivityKind::from_tag is the inverse of tag() and lives beside it; the FFI restore path calls it instead of keeping its own table. A test lists every kind through a match with no wildcard arm and reads each back from its tag. - Docs say that a kind 14 row stands for an attempt (a refused payment keeps its row and recipient id), and what a build that predates a tag does with it, by numeric tag and by serde. - The Kotlin amount test pins its formatting locale. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
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 |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Changes requested: 1 blocker
- A private payment can show a confirmed fee after another spend consumed its notes —
packages/rs-platform-wallet/src/wallet/shielded/operations.rs:3148-3153(thread, carried)
Impact: A DashPay user spending from a wallet shared by two devices can see a lasting confirmed debit for a specific recipient even though the request never landed and the send API reports it as pending.
New on this head: This revision moves stored activity-tag decoding into the Rust wallet and derives each private payment’s activity row and recovery journal from the same payment purpose. It also documents downgrade and failed-attempt behavior and pins the Kotlin amount test’s locale. The Kotlin emulator and Swift frozen-schema checks passed; Rust workspace tests were pending, with no failed code checks reported.
🔴 1 blocking | 🟡 3 suggestion(s)
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: Failed private payments still display an amount that looks like a debit
Impact: Example-app users inspecting a failed private entry or contact request see a negative DASH amount even though the failure message says nothing left the shielded pool.
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/ShieldedActivityView.swift:470-475
A failed attempt looks like a debit. Swift shows the signed amount in both the list and detail, and the detail also labels the retained fee as Fee; none of those fields checks status. Kotlin likewise renders signedAmount(row) alongside its failure message. Keep the stored attempt values, but omit the signed debit for failed fee-only rows or label the value as an attempted fee that was not charged.
source: muse-spark-1.3-contributor (phase1-reviewer: general, rust-quality); gpt-6.2-sol (phase2-reviewer: general, architecture-layering, ffi-engineer, platform-versioning, rust-quality)
Still open from earlier rounds (1)
- 🔴 Blocking: A private payment can show a confirmed fee after another spend consumed its notes —
packages/rs-platform-wallet/src/wallet/shielded/operations.rs:3148-3153(thread)
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); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — The diff changes wallet activity classification, fee display, and persisted tag handling across Rust and both mobile apps, but it does not change funds movement, coin selection, consensus, or storage migration logic. - 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) - 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
🤖 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/Core/Views/ShieldedActivityView.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/ShieldedActivityView.swift:470-475: Failed private payments still display an amount that looks like a debit
Impact: Example-app users inspecting a failed private entry or contact request see a negative DASH amount even though the failure message says nothing left the shielded pool.
A failed attempt looks like a debit. Swift shows the signed amount in both the list and detail, and the detail also labels the retained fee as `Fee`; none of those fields checks status. Kotlin likewise renders `signedAmount(row)` alongside its failure message. Keep the stored attempt values, but omit the signed debit for failed fee-only rows or label the value as an attempted fee that was not charged.
In `packages/rs-platform-wallet/src/wallet/shielded/activity.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/shielded/activity.rs:1344-1367: The codec tests can miss a missing or renumbered activity tag
Impact: A future wallet build can pass these tests while restoring a user’s saved activity as the wrong operation.
The replacement tests can miss a compatibility regression. The round-trip test decodes the byte produced by `tag()`, and the distinctness test only counts unique values, so swapping tags 10 and 11 in both mappings would pass while older token purchases and transfers would restore as each other. The decoder move also removes the FFI assertion that pinned tag 11, and the separate wallet test pins only tags 12–14. For new kinds, adding an arm to the no-op exhaustive match is enough to compile even if the fixture list and decoder both omit the new kind. Use literal `(stored_tag, kind)` fixtures to test both directions, and either generate the fixture list and exhaustive check together or describe the match as a reminder rather than a guarantee.
In `packages/kotlin-sdk/KotlinExampleApp/app/src/test/java/org/dashfoundation/example/ui/shielded/ShieldedActivityKindsTest.kt`:
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/app/src/test/java/org/dashfoundation/example/ui/shielded/ShieldedActivityKindsTest.kt:24-33: The Kotlin amount test overwrites JVM locale overrides after it finishes
Impact: Contributors running JVM tests with separate formatting or display locales can get order-dependent results from later locale-sensitive tests.
Later tests can inherit a different locale from the one the JVM started with. `Locale.getDefault()` captures only the general default, while `Locale.setDefault(Locale)` overwrites the `FORMAT` and `DISPLAY` defaults as well. For example, a worker with a French formatting locale and an English general locale ends this test with English formatting. Save and set only `Locale.Category.FORMAT`, which is what the amount formatter reads.
In `packages/rs-platform-wallet/src/wallet/shielded/operations.rs`:
- [BLOCKING] packages/rs-platform-wallet/src/wallet/shielded/operations.rs:3148-3153: A private payment can show a confirmed fee after another spend consumed its notes
(carried; thread: https://github.com/dashpay/platform/pull/6226#discussion_r4681421586)
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix. |
…tures Second round of review follow-ups: - The activity kind tests now check a literal (stored tag, kind) table in both directions, and every one of the 256 possible tags: two kinds that swapped tags, or a decoder arm with no row in the table, fail. - The Kotlin amount test saves and restores only the FORMAT locale. - A failed private entry or contact request row says the fee shown was not charged, in both apps. - PrivateContactRequest docs: Confirmed says the payment's notes read spent, not that the request was read back. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
On the review finding that has no inline thread, "Failed private payments still display an amount that looks like a debit": Partly taken in 026d32d. The failed note for these two kinds now reads "It did not go through; the fee shown was not charged." in both apps, which is the second option the finding offers. Not taken: hiding the signed amount for failed rows of these two kinds. Every kind's failed row shows its attempted amount with its sign beside the Failed badge (a failed send shows its amount the same way), so special-casing two kinds would make the list inconsistent and put a per-kind decision in the apps. Changing how every failed row shows its amount is outside this PR. |
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Nothing blocks: no blocking finding stands on this head.
Not counted: 1 disputed blocking finding(s) left to maintainers.
New on this head: This revision pins every assigned shielded activity tag in both codec directions, scopes the Kotlin test’s locale override to formatting, and clarifies in both apps that a failed payment’s displayed fee was not charged. The Kotlin SDK emulator check passed on this head; no failed code checks or final-head Rust or Swift build and test results were listed.
🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)
Disputed — left to maintainers (1)
- 🔴 Blocking: A private payment can show a confirmed fee after another spend consumed its notes —
packages/rs-platform-wallet/src/wallet/shielded/operations.rs:3096-3101(thread)
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); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — The change spans Rust wallet bookkeeping, persistence bindings, and two mobile UIs, but changes how existing payments are recorded and displayed rather than changing funds movement, coin selection, consensus, or storage schemas. - 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) - 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
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.
No unresolved findings remain from the prior review on this head.
Not approved: 1 blocking finding(s) are disputed and left to the maintainers.
|
Bots are done — your move: post |
Basic explanation
When a wallet pays for a private document entry from its shielded balance, the only thing that leaves the balance is the fee. A DashPay private contact request, and the private reply that accepts one, are paid the same way.
Until now the device that made the payment listed it in Shielded Activity as an unnamed "Shielded Spend" of 0 DASH. On iOS the detail also said the entry was "reconstructed from on-chain note data", which is the text meant for wallets restored from a seed.
With this change the wallet records what the payment was for, and both apps show it by name with the fee as its amount.
SwiftExampleApp, row and detail
-0 DASH-0.001530744 DASH-0 DASH-0.001530744 DASH0.001530744 DASH0.001530744 DASHA private document entry reads Private Document Entry, with a Data Contract section in place of Recipient Identity.
KotlinExampleApp, row
−0.0000 DASH−0.0015 DASHA row that failed keeps its attempted fee as the amount, as every failed row keeps its amount, and says "It did not go through; the fee shown was not charged."
Issue being fixed or feature implemented
Found on 2026-11-24 by the QA passes of SwiftExampleApp and KotlinExampleApp at
v5.1.0-dev.4on a protocol version 15 devnet: the private entry and the private contact requests the app had just sent appeared as "Shielded Spend, −0 DASH".The cause is not the one the report gave. The report said the wallet records no live activity entry for this spend, so the app falls back to reconstruction. The wallet did record one (
private_document_create_from_pool_with_metadatacalledrecord_pending_activity, and the log line readslive activity entry recorded (pending) kind=ShieldedSpend). It recorded it under the residual kindShieldedSpendwithamount: 0, because no kind existed for this transition. The "reconstructed" text is a footnote SwiftExampleApp shows for every row of that kind, live or restored. The right fee in the Swift detail came from that live row.What was done?
Rust wallet (
rs-platform-wallet), where the decision livesShieldedActivityKindgains two kinds:PrivateDocumentCreate(stored tag 13): an entry appended to a private document type's store. Counterparty: the 32-byte data contract id.PrivateContactRequest(stored tag 14): a DashPay private contact request, or the private request sent back to accept one. Counterparty: the 32-byte id of the identity the request is to.record_pending_private_document_createrecords the row for a built type 29 transition: direction Out,feeset, andamountequal to the fee. Nothing but the fee leaves the pool, so the fee is what a host that prints a row's amount should print. This one decision serves both apps.PrivateDocumentPurpose(Entry, orContactRequest { sender, recipient, account_reference }). The activity row's counterparty and the journaled payment's recipient are both read from it, so they cannot name different identities.pay_private_contact_requestbuilds the contact request purpose;create_private_document_entrypassesEntry.ShieldedActivityKind::from_tagis the inverse oftag()and lives beside it. The tests hold both to a literal table of every stored tag and its kind, and check all 256 possible tag values, so two kinds that swapped tags, or a decoder arm with no row in the table, fail.FFI (
rs-platform-wallet-ffi)from_taginstead of keeping its own tag table, so tags 13 and 14 come back as their kinds when the host hands its rows back at boot. Without this a restart would load them as the residual kind, and the next status change would store that over the named row.ShieldedActivityFFIupdated. No field added, removed or retyped.Apps (display only)
SH-02now says what these rows read;DOC-19and the private contact request rows point to it.Left as it was
v5.2-dev(feat(platform-wallet): plan a shielded spend with its exact fee and spend against the plan #5865, fix(platform-wallet): own the shielded coordinator and wipe host rows inside Clear #5934, feat(platform-wallet)!: detect inconsistent shielded commitment trees and add explicit rebuild #5565, feat(platform-wallet): report whether a failed payment may have left the wallet #5928, feat: report a shielded identity create proven to have its inputs spent without its identity #5853, feat(platform-wallet): multi-output shielded transfers + output-aware fee predictor #4312): none of them adds an activity kind. feat(platform-wallet): plan a shielded spend with its exact fee and spend against the plan #5865 touches the same function's surroundings (ShieldedFeeKind::PrivateDocumentCreate) and will need an ordinary rebase.Public interface changes
Stored activity kind tag (
ShieldedActivityKind::tag, FFIkind_tag, SwiftPersistentShieldedActivity.kindTag, KotlinShieldedActivityEntity.kindTag)13and14. Tags 0 to 12 keep their meaning, and a unit test pins every tag.u8over the FFI,Intin SwiftData and Room), so there is no SwiftData schema version and no Room schema bump. Room stays at version 21, the version of the base (set by feat: set, change and remove DashPay profile payment addresses in KotlinExampleApp #6146).Meaning of
amountfor the two new kindsamountis the fee, the same number asfee. It is not a second charge, and nothing adds the two fields together (checked in the wallet, both SDKs and both apps).amount = 0under tag 7.amountis unchanged.Meaning of
counterpartyfor the two new kindsRust API
platform_wallet::wallet::shielded::ShieldedActivityKindhas two new variants. The enum is notnon_exhaustive, so Rust code outside this repository that matches it exhaustively needs two more arms. Inside the repository every match already has a fallback arm.serdefeature the enum uses its derived codec, not the numeric tag: a Rust host built before this change does not deserialize an activity entry of either new kind, and a batch decoded as a whole fails with it. Such a host has to be updated before it reads data written by this build.ShieldedActivityKind::from_tag(tag, identity_id, has_identity).pub(in crate::wallet).Not changed: FFI struct layouts, exported C symbols, JNI signatures, Swift and Kotlin SDK method signatures.
How Has This Been Tested?
Run locally on macOS, targeted checks only:
cargo fmt --all -- --checkcargo test -p platform-wallet --all-features --lib -- wallet::shielded wallet::platform_wallet private_contact(run on the second commit): 690 tests. 689 passed in the full filtered run;balance_emitter_tests::should_emit_once_a_failed_scan_releases_the_store, a deadline-based test this change does not touch, missed its deadline once while another build was running on the machine and passed when rerun. The third commit changes only the activity kind tests in Rust;-- wallet::shielded::activitywas rerun on it: 24 passed. New tests:wallet::shielded::coordinator::tests::should_record_a_private_document_create_under_its_own_kind_with_its_fee: builds a real type 29 transition with the DPP builder and a proof, records it for both purposes, and checks kind, direction, amount equal to the fee, fee, counterparty, the row's key (the change note) and its spent nullifier. Then it runs the scan derivation and checks the same row is confirmed with its kind kept and no reconstructed "Shielded Spend" row is added beside it.wallet::shielded::operations::tests::should_name_one_recipient_for_a_contact_request_s_row_and_its_journal_record.wallet::shielded::activity::tests:should_write_the_stored_tag_of_every_kind,should_read_every_stored_tag_as_the_kind_it_was_written_for,should_read_a_token_unshield_without_an_identity_as_recipient_unknown.cargo test -p platform-wallet-ffi --all-features --lib -- activity shielded(second commit; the FFI crate is unchanged since): 129 passed.cargo clippy -p platform-wallet -p platform-wallet-ffi --all-targets --all-features --locked -- --no-deps -D warnings: clean (platform-walletrerun on the third commit)../gradlew :app:testDebugUnitTest --tests '*ShieldedActivityKindsTest': 3 tests, 0 failures, with the formatting locale pinned.python3 scripts/check_sdk_parity_manifest.py: OK.MasternodeVotingKeySigningTestwith "User not authenticated", which this change does not touch, and passed when rerun.Not yet verified
ShieldedActivityKindDisplayTests. The third commit changes one Swift string and its test, parsed locally only.Breaking Changes
For Rust consumers of
platform-walletoutside this repository only:ShieldedActivityKindhas two new variants; an exhaustivematchneeds two more arms.serdefeature, a build that predates the variants does not read an activity entry of either new kind.Nothing breaks for the apps or over the FFI: no struct layout, symbol, JNI signature or stored schema changes.
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 ·
026d32d/self-reviewedkotlin-sdk(packages/kotlin-sdk/KotlinExampleApp/TEST_PLAN.md,packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/shielded/ShieldedActivityScreen.kt,packages/kotlin-sdk/KotlinExampleApp/app/src/test/java/org/dashfoundation/example/ui/shielded/ShieldedActivityKindsTest.ktand 1 more) — HashEngineeringrs-platform-wallet-ffi(packages/rs-platform-wallet-ffi/src/persistence.rs,packages/rs-platform-wallet-ffi/src/shielded_persistence.rs) — HashEngineering or ZocoLini or llbartekll or romchornyirs-platform-wallet(packages/rs-platform-wallet/src/wallet/platform_wallet.rs,packages/rs-platform-wallet/src/wallet/shielded/activity.rs,packages/rs-platform-wallet/src/wallet/shielded/coordinator.rsand 1 more) — HashEngineering or ZocoLini or llbartekll or romchornyiswift-sdk(packages/swift-sdk/Sources/SwiftDashSDK/Persistence/Models/PersistentShieldedActivity.swift,packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/ShieldedActivityView.swift,packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/StorageRecordDetailViews.swiftand 2 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.