Repository navigation
feat(platform-wallet): support DashPay shielded tips with dedicated accounts - #5288
PastaPastaPasta wants to merge 42 commits into
Conversation
Walkthrough
Merge Risk:
|
|
Waiting for bot review — coderabbitai not yet · thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
Live V4 adds PersistentDashpayPaymentAddresses, which sorts ahead of PersistentIdentity and renumbers it from 13 to 14. Core Data embeds the ordinal in generated column names, so the token-balance table's Z13TOKENBALANCES foreign key becomes Z14TOKENBALANCES with its values intact. validatePreservation normalized Z_<n> join-table names but not the Z<n><NAME> column form, so the V1 -> V3 -> V4 and historical V2 -> V3 -> V4 migrations were reported as removing a column (DashModelMigrationTests, CI on #5288). validatePreservation now keys columns by entity name for the cross-store comparison; a dropped or type-converted column is still rejected. layout()/evidence() keep their existing keys so recovery journals written by earlier builds still verify. Test: a renumbered copy of the dash-v1 fixture (entity inserted at 8, join-table and generated columns renamed) passes; the same copy with the column dropped or converted to VARCHAR is rejected. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Waiting for bot review — coderabbitai not yet · thepastaclaw ✓. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
Verified the supplied findings against head 02460d6 and confirmed four issues involving identity-placement persistence, restart-safe submissions, identity-specific spending-account selection, and concurrent account binding. These are client-side defects, classified as suggestions under the supplied policy reserving blocking severity for consensus invariants. Validation was static: the supplied CI snapshot reports successful Rust workspace and Kotlin checks, skipped dedicated wallet tests, and Swift build/tests still in progress.
🟡 4 suggestion(s)
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 7: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 8: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — The large, cross-language diff directly changes key derivation and dedicated account handling in packages/rs-platform-wallet/src/wallet/shielded/tips.rs, funds submission in packages/rs-platform-wallet-ffi/src/shielded_send.rs, and persisted-data migrations in SQLite, SwiftData, and Room. - 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(antigravity below 15% reserve: weekly 15% left, 5h 100% left),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `packages/rs-platform-wallet/src/wallet/identity/state/manager/lifecycle.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/state/manager/lifecycle.rs:206-207: Preserve corrected identity indices through changeset merging
The new adoption path changes identity_index, but IdentityChangeSet::merge never copies that field into an existing entry. With SQLite FlushMode::Manual, a snapshot buffered at placeholder index 0 can therefore absorb the subsequent discovery snapshot at verified index 5 while retaining index 0. Both Buffer::normalize_identities and the final buffered merge use these semantics, so flush/reload restores the incorrect placement. The same stale slot also remains occupied during buffered admission checks, potentially rejecting another identity that discovery places into the freed slot.
Make identity_index follow the latest snapshot alongside wallet_id. Add a SQLite regression that buffers an old-slot snapshot, adopts the identity into its verified slot, persists the resulting snapshot, then flushes and reloads; also verify that another identity can occupy the freed slot.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/ShieldedTipSubmission.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/ShieldedTipSubmission.swift:28-32: Restore outstanding tip submissions before enabling another send
The submission guard and wallet map are memory-only, and each new process initializes the guard to ready. Kotlin's ShieldedTipSubmissions has the same lifecycle. Restarting after a broadcast with an unresolved outcome therefore removes the warning and permits the user to retry the same intended payment as a new transfer. A relay withholding confirmation is sufficient to create this ambiguity; process termination during broadcast also exposes it.
Rust records pending transfer activity and can redrive the original transition, but transfer reserves individual input notes rather than a payment intent. Additional spendable notes can fund the retry, allowing both transfers to execute. Persist an unresolved intent before entering the native send, restore its guard before enabling submission, and reconcile it with the original activity or transition. Add process-recreation coverage with an ambiguous original transfer and additional spendable notes; the existing reopening tests retain the same in-memory owner.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/DashPayProfileView.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/DashPayProfileView.swift:39-44: Verify the identity index before selecting its tip spending account
Rust's optional index getter returns recorded metadata, not a verified identity-to-account association. The mobile restore path constructs ManagedIdentity::new(identity, spec.identity_index), so a persisted placeholder zero becomes Some(0). The existing should_refuse_tip_account_for_a_placeholder_index_until_it_is_verified regression demonstrates an identity belonging at index 5 restored at index 0 while index 0's tip account is bound.
Preparation rejects this association by checking the seed, but this balance/spending selector and Kotlin's corresponding selectors bypass that check. They can display index 0's funds as belonging to the restored identity and pass that account to the send API, which validates account keys but receives no source identity to verify. Resolve identity-specific tip accounts through a verified wallet operation, or disable these selectors until the association is verified. Extend the placeholder regression to cover balance lookup and spending-account selection, not only address preparation.
In `packages/rs-platform-wallet/src/wallet/shielded/tips.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/shielded/tips.rs:142-147: Make tip preparation an atomic augmentation of the bound account set
The account snapshot and replacement bind are separate operations. Preparation can snapshot ordinary account 0, another task can finish binding accounts 0 and 1, and preparation can then bind its stale snapshot plus the tip account. bind_shielded automatically retains discovered and persisted tip accounts, but not omitted ordinary accounts. Consequently, register_locked removes account 1 from registration and purges its live subwallet state, contradicting preparation's ordinary-account preservation guarantee.
The shield guard and coordinator install transaction serialize individual installations, not the preceding read-modify-write sequence. Serialize configuration changes across the snapshot and bind, or provide an augmentation operation that merges with the current registration inside the installation transaction. Add a deterministic interleaving regression proving that an ordinary account added during preparation remains bound.
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- Seed verification runs while holding the wallet-manager read guard — The guard covers bounded synchronous derivation and verification with no network call or await inside the guarded block. Writers are briefly excluded, but the finding supplies no demonstrated hot-path or material contention problem; moving this work outside the lock is an optional optimization rather than a confirmed review defect.
- Follow-up: Consider creating a separate issue or author/maintainer-requested PR for this.
|
Waiting for bot review — coderabbitai not yet · thepastaclaw ✓. 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
Static verification confirms the original concurrent-bind race and buffered identity-index merge defect are fixed, and the reported occupied-placeholder spending case is now rejected before recipient resolution. Six client-side suggestions remain concerning restart recovery, stale source-account selection, identity replay, account preservation, and test isolation; no consensus-blocking defect was confirmed. No builds or tests were run, and the supplied exact-head CI snapshot still had most validation queued or pending.
🟡 6 suggestion(s)
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: Serialize shielded_add_account with the new shielded config lock
packages/rs-platform-wallet/src/wallet/platform_wallet.rs:1154-1160
Tip preparation now holds shielded_config_lock across its account snapshot and replacement bind, but shielded_add_account writes the same shielded_keys map without participating in that lock. Preparation can snapshot [0], an addition can persist and insert ordinary account 1, and preparation can then install its stale snapshot plus the tip account, overwriting the completed insertion while leaving its viewing-key row persisted. This breaks the new preparation helper's ordinary-account preservation guarantee even though the concurrent-bind case is fixed. Acquire the same configuration lock for the complete add operation, preserving the existing rule that host callbacks run outside the key-slot guard. The add API intentionally does not register accounts with the coordinator itself, so this finding concerns loss of its in-memory insertion, not a claim that it creates a coordinator registration. Extend the interleaving coverage to race preparation with this writer.
source: muse-spark-1.3-contributor (phase1-reviewer: rust-quality)
1 carried-forward finding(s) already raised on this PR; not re-posting as new inline comments.
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 7: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 8: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 9: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 10: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 11: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 12: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 13: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 14: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — This large, intricate diff directly changes funds movement and dedicated ZIP-32 key/account handling in packages/rs-platform-wallet/src/wallet/shielded/tips.rs and packages/rs-platform-wallet-ffi/src/shielded_send.rs, as well as persisted-data migrations. - 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(antigravity below 15% reserve: weekly 15% left, 5h 100% left),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/DashPayTabScreen.kt`:
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/DashPayTabScreen.kt:336-345: Invalidate and reverify the source account when an identity is re-slotted
The lookup keys include the wallet wrapper, manager, and identity ID, but not the identity's placement. This PR allows discovery to move that same identity from placeholder index 0 to verified index 5 without replacing those objects. If discovery completes while this composition is alive, the cached result remains `0x40000000` and is still offered as that identity's dedicated source account. A blocking discovery can continue natively after its search screen is dismissed, so returning to DashPay before it finishes can expose this interleaving. The new Rust check does not reject the stale source: `verify_tip_account_owner` succeeds when slot 0 has become empty, and also succeeds if the rightful identity 0 later occupies it. A confirmed send can thus spend the retained account-0 funds rather than the selected identity's account-5 funds. Invalidate the lookup when verified placement changes and recheck the selected source identity/account association at submission; checking only the account's current occupant is insufficient. Add a regression resolving at placeholder 0, adopting into 5, and attempting a send with the old selection. The profile-screen lookup also needs placement-change invalidation.
In `packages/rs-platform-wallet/src/wallet/identity/state/manager/lifecycle.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/state/manager/lifecycle.rs:195-207: Carry identity relocation through changeset replay
Adoption now changes bucket placement and identity coordinates, but `IdentityManager::apply_identity_entry` still updates an existing identity in place and returns without applying `wallet_id`, `identity_index`, or `location_index`. Replaying valid snapshots A@0, then adopted A@5, then newly admitted B@0 through the public `PlatformWallet::apply` or `PlatformWalletInfo::apply_changeset` API leaves A at slot 0 until B's fresh insertion overwrites it. A's state is lost and its reverse-index entry still points to slot 0, so `identity(A)` returns B. Promotion from the observed bucket likewise fails to reproduce the adoption. Normal startup reconstruction uses a different path, which limits the current impact, but the public replay API no longer reproduces the mutations introduced here. Apply relocation while preserving managed state and reverse-index consistency, reject unrelated occupied targets, and handle merged batches independently of identity-ID ordering when one entry frees another's slot. Add round-trip coverage for observed-identity promotion and A@0 → A@5 followed by B@0.
In `packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/SearchWalletsForIdentitiesScreen.kt`:
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/SearchWalletsForIdentitiesScreen.kt:147-151: Preserve ordinary accounts during discovery-triggered rebinding
This new refresh calls the replacement bind API with its default account list `[0]`. For a wallet already bound to ordinary accounts `[0, 1]`, Rust adds discovered and persisted tip accounts but does not retain omitted ordinary account 1. `NetworkShieldedCoordinator::register_locked` consequently removes account 1's registration and purges its live notes and watermark, so discovering identities unexpectedly stops an existing ordinary account from scanning. Swift preserves a snapshot of ordinary accounts, but its snapshot and replacement call are also outside the native configuration lock. Provide a refresh operation that reads the current configuration and adds discovered tip accounts atomically under `shielded_config_lock`, and use it from discovery rather than treating `[0]` as a complete replacement configuration. Keep full bind available for intentional replacement. Cover discovery refresh starting from `[0, 1]` and verify that both ordinary registrations survive.
In `packages/rs-platform-wallet/src/wallet/platform_wallet.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/platform_wallet.rs:1154-1160: Serialize shielded_add_account with the new shielded config lock
Tip preparation now holds `shielded_config_lock` across its account snapshot and replacement bind, but `shielded_add_account` writes the same `shielded_keys` map without participating in that lock. Preparation can snapshot `[0]`, an addition can persist and insert ordinary account 1, and preparation can then install its stale snapshot plus the tip account, overwriting the completed insertion while leaving its viewing-key row persisted. This breaks the new preparation helper's ordinary-account preservation guarantee even though the concurrent-bind case is fixed. Acquire the same configuration lock for the complete add operation, preserving the existing rule that host callbacks run outside the key-slot guard. The add API intentionally does not register accounts with the coordinator itself, so this finding concerns loss of its in-memory insertion, not a claim that it creates a coordinator registration. Extend the interleaving coverage to race preparation with this writer.
In `packages/rs-platform-wallet/src/wallet/shielded/tips.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/shielded/tips.rs:258-263: Isolate the preparation pause hook by wallet instance
The global pause hook is consumed using only the deterministic wallet ID. The concurrency regression, placeholder-index regression, and discovery/restoration regression all create independent testnet wallet instances from `MESSAGE_SIGNING_TEST_MNEMONIC`, so they share that ID. Under parallel execution, another test's preparation can remove the concurrency test's hook and signal `reached` while holding its own configuration lock. The intended preparation then runs without pausing, allowing the competing bind to complete inside the timeout and failing the regression despite correct production locking. Attach the hook to shared state belonging to the actual wallet instance, use an instance-specific token, or give the concurrency fixture a distinct deterministic mnemonic. The current wallet-ID key does not provide the parallel-test isolation claimed by the comment.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/ShieldedTipSubmission.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/ShieldedTipSubmission.swift:28-32: Restore outstanding tip submissions before enabling another send
(existing thread: https://github.com/dashpay/platform/pull/5288#discussion_r4185823786)
The shared owner preserves the submission guard across sheet dismissal, but a new process reconstructs an empty wallet map and a `.ready` submission. Kotlin has the same lifecycle. After termination during an accepted-but-unconfirmed send, reopening therefore removes the uncertainty warning and permits the user to confirm the same payment again. Native pending activity and redrive records do not prevent this: note reservations exclude particular inputs, while `reserve_unspent_notes` can select other funded notes for a fresh transfer. The redrive transaction itself is armed only after an ambiguous broadcast result returns, so process loss during the call also cannot be treated as a recovered safe retry. Persist a network/wallet-scoped unresolved intent before entering native spending, restore its warning before enabling confirmation, and reconcile native activity or require explicit acknowledgment that another submission is a separate payment. Add process-recreation tests using newly constructed owners and sufficient independent notes to fund both attempts. The PR's pending maintainer decision is not an implemented recovery boundary.
|
Re: the review's non-inline finding "Serialize shielded_add_account with the new shielded config lock" ( Confirmed and fixed in 93d4d3b. The new regression 🤖 Posted autonomously by Claude on behalf of pasta. |
|
Waiting for bot review — coderabbitai not yet · thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
Waiting for bot review — coderabbitai not yet · thepastaclaw ✓. 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
At head 6c88c31, the configuration-locking, pause-hook isolation, and identity-index merge fixes are present, but three client-side suggestions remain around merged replay, queued source-account selection, and restart-safe submission state; no consensus blocker was confirmed. All nine prior findings were independently reconciled, with the acknowledged balance-provenance follow-up kept deferred. Validation was static only: the supplied CI snapshot shows Rust workspace and Kotlin checks passing, the dedicated wallet job skipped, and PR Hygiene pending; the Swift failure log confirms “database is locked” in testCaptureHistoricalV2Fixture.
🟡 3 suggestion(s)
1 carried-forward finding(s) already raised on this PR; not re-posting as new inline comments.
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 7: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 8: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 9: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 10: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 11: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 12: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 13: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 14: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — This large, intricate diff changes funds movement and key handling in packages/rs-platform-wallet-ffi/src/shielded_send.rs and packages/rs-platform-wallet/src/wallet/shielded/tips.rs, as well as persisted-state migrations across SQLite, SwiftData, and Room. - 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(antigravity below 15% reserve: weekly 15% left, 5h 100% left),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `packages/rs-platform-wallet/src/wallet/apply.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/apply.rs:162-170: Carry identity relocation through changeset replay
The new ordering handles sequential relocation, but it still evaluates occupancy against transient state rather than the merged batch's final survivors. Starting with A@0, merge the changesets from moving A to 5, removing A, and inserting B@5. IdentityChangeSet::merge retains both A's snapshot and tombstone, so this partition postpones A's removal. Replay moves A to 5, skips fresh B because A occupies 5, then removes A and returns success with B missing. B's subsequent key/contact entries cannot route, and applying the batch again can produce a different result.
The relocation loop in identity/state/manager/apply.rs has another instance of the same final-state problem: A@0/B@1 ending at A@1/B@0 remains blocked and falls back to in-place updates. The public adoption API can produce those final snapshots through free slot 2, and SQLite's check_index_conflicts explicitly accepts a two-way swap, so replay can disagree with persistence even for a conflict-free final batch.
Remove all tombstoned identities before placement and exclude their snapshots. Stage surviving relocations so valid cycles can be installed while preserving managed state and reverse-index consistency. Add regressions using actual merged mutation changesets, checking replay against the final persisted placement and checking repeated application.
In `packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/ShieldedTipSheet.kt`:
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/ShieldedTipSheet.kt:95-99: Invalidate and reverify the source account when an identity is re-slotted
The placement keys now refresh the account offered by the open sheet, but confirmation copies it into sendAccount before history.confirm suspends on Dispatchers.IO. Discovery can move the selected identity A from placeholder 0 to verified 5 during that suspension. Subsequent recomposition cannot change the account captured by the application-owned submission, so the native call still receives 0x40000000.
Rust's verify_tip_account_owner accepts that account if slot 0 is empty, or verifies its rightful replacement B if B now occupies slot 0. Neither case establishes that the submitted account belongs to selected identity A. These are still wallet-owned funds, and explicitly spending a retired account is legitimate; the defect is silently using that pool from an identity-specific dedicated-account choice.
Carry the expected source identity through the identity-scoped submission and verify its seed-derived association with the requested account before selecting notes. Preserve intentional retired-account spending through an explicitly account-based path. Add a regression that pauses recipient-history persistence, re-slots A, and verifies that the captured old source is rejected.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/ShieldedTipSubmission.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/ShieldedTipSubmission.swift:28-32: Restore outstanding tip submissions before enabling another send
(existing thread: https://github.com/dashpay/platform/pull/5288#discussion_r4185823786)
The application-owned guard survives navigation, but its status and registry are memory-only. After process termination, forWallet creates a submission in ready without consulting persisted outgoing activity or recovery state. Kotlin's registry has the same lifetime boundary, and recipient confirmation history records the destination rather than the payment outcome.
If the process exits after broadcast but before the result reaches the host, relaunch permits a fresh attempt while the first payment may already have executed or remain eligible for redrive. Native reservations protect the first payment's nullifiers, not the logical payment: operations::transfer selects other available notes without an unresolved-intent check. With another sufficient note set, both transfers can execute and pay the recipient twice. This is duplicate payment, not a consensus double-spend.
Persist an unresolved intent before entering the native send, restore a conservative reconciliation state before enabling another attempt, and clear it only after a definitive outcome. Add process-recreation coverage with an unresolved first payment and enough other notes to fund another transfer; the current tests reuse the same submission owner.
|
Waiting for bot review — coderabbitai not yet · thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
Waiting for bot review — coderabbitai not yet · thepastaclaw ✓. 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
The client-only diff preserves proof-verified recipient resolution and addresses the reported identity-replay, account-configuration locking, and changeset-merging defects. Three non-blocking concerns remain: two source-account relocation windows and loss of unresolved-payment guards after process restart; unverified balance attribution remains an explicitly separated follow-up. Validation was static only: git diff --check passed, and the supplied exact-head CI snapshot still had Kotlin build/tests and PR Hygiene pending.
🟡 3 suggestion(s)
3 carried-forward finding(s) already raised on this PR; not re-posting as new inline comments.
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 7: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 8: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 9: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 10: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 11: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 12: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 13: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 14: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — This large, intricate diff changes key derivation and viewing-key binding in packages/rs-platform-wallet/src/wallet/shielded/tips.rs, funds submission in packages/rs-platform-wallet-ffi/src/shielded_send.rs, and persisted profile encoding and migrations across SQLite, SwiftData, and Room. - 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(antigravity below 15% reserve: weekly 15% left, 5h 100% left),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/ShieldedTipSheet.kt`:
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/ShieldedTipSheet.kt:95-99: Invalidate and reverify the source account when an identity is re-slotted
(existing thread: https://github.com/dashpay/platform/pull/5288#discussion_r4190547321)
The source account is copied into sendAccount before history.confirm suspends on Dispatchers.IO. Discovery can move the selected identity from placeholder slot 0 to verified slot 5 during that suspension. A subsequent Room update cannot change the captured argument, and the JNI/C send signatures carry the recipient identity but no expected source identity. Rust's verify_tip_account_owner accepts the emptied slot-0 account, so with sufficient retained notes the payment can spend account 0x40000000 instead of the selected identity's account-5 pool. This is a source-selection error, not an unauthorized-spending bypass: both pools remain wallet-owned. Carry the selected source identity and confirmed account through the identity-specific submission path, reject a changed association before spending, and require renewed review. Preserve explicitly selected retired-account spending separately. Add an interleaving regression that relocates the source while confirmation-history persistence is suspended.
In `packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/DashPayTabScreen.kt`:
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/DashPayTabScreen.kt:337-345: Invalidate and reverify the source account when an identity is re-slotted
(existing thread: https://github.com/dashpay/platform/pull/5288#discussion_r4187974162)
The placement key fixes eventual cache invalidation, but there is also a window before Room delivers the changed placement. Native discovery updates the identity manager first; until the corresponding row reaches composition, tipAccountKey still matches the old result and the sheet can confirm that account as the selected identity's dedicated source. Reading the current prop at confirmation does not close this window. The native ownership check validates the account's current occupant, not the selected source identity, and deliberately permits an empty retired slot. Retaining that policy is reasonable, but this identity-selected flow should not silently substitute the retired pool. Keep the Room-key fix and validate the expected source identity/account association natively at submission. Cover relocation before the corresponding Room emission, separately from relocation after the sheet captures its argument.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/ShieldedTipSubmission.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/ShieldedTipSubmission.swift:28-32: Restore outstanding tip submissions before enabling another send
(existing thread: https://github.com/dashpay/platform/pull/5288#discussion_r4185823786)
Every reconstructed submission starts ready, and both apps retain their per-wallet guards only in memory. Restarting after a broadcast with an unresolved outcome therefore enables another confirmation without restoring the previous sending/uncertain state. Native recovery does not make this payment-intent-safe: PendingRedrive is armed after an ambiguous result returns, and even a surviving record reserves only the original transaction's notes. reserve_unspent_notes can select other available notes for a fresh transfer, allowing both payments to execute if the user repeats the apparently unfinished tip. Persist an unresolved submission marker by network and wallet before invoking native send, restore it before enabling payment, and reconcile it with shielded activity/recovery state. Add reconstruction tests with a new submissions owner over the same durable state; the current reopening tests exercise only the existing owner. The description identifies a pending maintainer decision, but the current implementation still has this limitation.
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- Track verified identity placement for tip-balance attribution — The restore path constructs ManagedIdentity::new(identity, spec.identity_index), so a historical placeholder zero becomes Some(0). Swift and Kotlin balance selectors consequently can attribute retained account-0 notes to an identity actually derived at index 5. Native seed checks reject preparation and spending while that incorrect identity occupies the slot, but do not verify the displayed balance. This is the concrete balance-display remainder explicitly separated into a follow-up in the author's response, not a new finding to reopen here.
- Follow-up: Track derivation-verification provenance and expose an identity-aware tip-account resolver through the native bindings, with an unverified presentation state and placeholder-restore coverage.
|
Bots are done — your move: post |
74a473f to
4451545
Compare
|
Waiting for bot review — coderabbitai not yet · 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
The configuration-locking, identity-replay, and changeset-merging fixes are present; three client-side suggestions remain concerning source-account association, restart recovery, and profile clearing. Static validation only: git diff --check passed, and no builds or tests were run. The supplied CI snapshot shows Kotlin and Swift schema/explorer checks passing, Rust workspace tests pending, and the dedicated Rust wallet job skipped.
🟡 3 suggestion(s)
2 carried-forward finding(s) already raised on this PR; not re-posting as new inline comments.
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 7: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 8: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 9: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 10: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 11: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 12: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 13: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 14: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — This large, intricate diff directly changes shielded funds submission in packages/rs-platform-wallet-ffi/src/shielded_send.rs, viewing-key and dedicated-account handling in packages/rs-platform-wallet/src/wallet/shielded/tips.rs, and persisted profile migrations across SQLite, SwiftData, and Room. - 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(antigravity below 15% reserve: weekly 14% left, 5h 100% left),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletPersistenceHandler.swift`:
- [SUGGESTION] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletPersistenceHandler.swift:3593-3595: Preserve the shared wallet's profile-clear semantics during persistence
ManagedIdentity::set_dashpay_profile(None) explicitly clears the profile, sync_profiles emits that snapshot after confirming absence, and IdentityChangeSet::merge preserves None with last-write-wins semantics. This adapter instead leaves the previous profile row untouched; Kotlin's onPersistIdentityUpsert does the same. Although that interpretation predates this change, this PR adds owned-profile restoration that loads the retained row back into canonical ManagedIdentity state. A successfully cleared profile can consequently reappear after restart, including its cached shielded address. Apply an absent profile snapshot by deleting the cached owner profile and, on Swift, its owner-profile payment-address sidecar. If callers need a distinct unknown/no-update state, represent it explicitly rather than interpreting the authoritative snapshot differently in each adapter. Add a persist-profile, clear-snapshot, cold-restore regression for both hosts.
In `packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/ShieldedTipSheet.kt`:
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/ShieldedTipSheet.kt:95-99: Invalidate and reverify the source account when an identity is re-slotted
(existing thread: https://github.com/dashpay/platform/pull/5288#discussion_r4190547321)
Confirmation copies tipAccount into sendAccount before history.confirm suspends on Dispatchers.IO to commit preferences. Discovery can relocate the selected identity from placeholder slot 0 to verified slot 5 during that suspension. The placement-keyed lookup can subsequently refresh, but it cannot replace the value already captured by this submission. Native send_shielded_tip receives only the numeric source account, and verify_tip_account_owner accepts the old account when slot 0 is empty or contains its correctly derived owner. With available notes, the payment can therefore spend account-0 funds while the UI presents the source as the selected identity's dedicated account. Wallet ownership makes deliberate retired-account spending valid, but does not establish that this stale identity-specific selection was deliberate. Carry the expected source identity into an identity-aware native submission operation and validate its verified account association before selecting notes. Add a regression that pauses confirmation-history persistence, relocates the identity, and verifies that resuming cannot spend the obsolete source.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/ShieldedTipSubmission.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/ShieldedTipSubmission.swift:28-32: Restore outstanding tip submissions before enabling another send
(existing thread: https://github.com/dashpay/platform/pull/5288#discussion_r4185823786)
Application ownership preserves the guard across navigation, but the wallet dictionary and submission status are entirely process-local. After termination during broadcasting or following an uncertain result, relaunch constructs a new submission in ready state without restoring the outstanding payment. Kotlin's application-owned submissions have the same boundary. Native recovery can reconcile or redrive the original transition, but reserve_unspent_notes selects available notes without deduplicating the recipient/amount intent; a fresh submission can use other notes and pay the recipient again. Persist an outstanding intent before invoking native send, restore it into an unresolved state before enabling another submission, and reconcile it against native activity before clearing the guard. The existing reopen tests retain the same submission owner; add a reconstruction regression using a new owner after an accepted-but-unconfirmed attempt.
|
Waiting for bot review — coderabbitai not yet · 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
The client-only account policy, persistence migrations, replay fixes, and owned-profile clearing are consistent with the intended design; no consensus or dependency-layering blockers were found. Three non-blocking issues remain: source-account association can change during asynchronous confirmation, unresolved submissions are forgotten after process restart, and Kotlin's new profile deletion crosses network boundaries. This was static verification only; the supplied exact-head CI snapshot still has Kotlin validation running and other checks pending or queued.
🟡 3 suggestion(s)
2 carried-forward finding(s) already raised on this PR; not re-posting as new inline comments.
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 7: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 8: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 9: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 10: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 11: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 12: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 13: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 14: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — This large, intricate diff directly changes shielded key derivation and funds isolation in packages/rs-platform-wallet/src/wallet/shielded/tips.rs, payment submission in packages/rs-platform-wallet-ffi/src/shielded_send.rs, and persisted storage migrations across SQLite, SwiftData, and Room. - 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(antigravity below 15% reserve: weekly 14% left, 5h 100% left),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/persistence/PlatformWalletPersistenceHandler.kt`:
- [SUGGESTION] packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/persistence/PlatformWalletPersistenceHandler.kt:1746-1747: Scope owned-profile deletion to the snapshot network
This new absent-profile branch calls `deleteProfilesByIdentity`, whose SQL filters only by identityId. However, DashpayProfileEntity is keyed by `(networkRaw, identityId)`, the present-profile branch writes using the resolved networkRaw, and restoration reads profiles using that network-qualified key. The example app shares one DashDatabase across network managers. If the same identity ID has cached profile rows on two networks, an authoritative absence on one network deletes both rows, including the other network's profile and payment addresses. Add a network-scoped DAO deletion and use the networkRaw already resolved for this snapshot. Extend the clearing regression with a second-network profile row and assert that it survives.
In `packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/ShieldedTipSheet.kt`:
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/ShieldedTipSheet.kt:95-99: Invalidate and reverify the source account when an identity is re-slotted
(existing thread: https://github.com/dashpay/platform/pull/5288#discussion_r4190547321)
The placement-keyed lookup refreshes subsequent compositions, but this submission captures only a numeric source account before `history.confirm` suspends on Dispatchers.IO. Discovery can move identity A from restored placeholder index 0 to verified index 5 during that suspension, and the resumed submission still passes account 0x40000000. Native `verify_tip_account_owner` accepts that account when slot 0 is empty, or when its correctly derived identity subsequently occupies it; the send boundary receives no selected source identity to detect that the account no longer matches A. Allowing explicitly selected retired accounts is valid, but it does not preserve this UI's promise to spend from the selected identity's dedicated account. Carry the selected source identity and expected account association into the native identity-specific send operation and reject a changed association before selecting funds, while preserving explicit retired-account spending separately. Add a regression that pauses confirmation persistence, re-slots A, and resumes the captured submission.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/ShieldedTipSubmission.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/ShieldedTipSubmission.swift:28-32: Restore outstanding tip submissions before enabling another send
(existing thread: https://github.com/dashpay/platform/pull/5288#discussion_r4185823786)
Both example apps keep submission guards exclusively in memory, so a new process creates an empty registry and initializes each wallet to ready. Termination after broadcast but before observing its outcome, or after an unconfirmed result, therefore removes the warning and permits an apparent retry as a new payment. Native activity/redrive records protect the original transaction, and note reservations exclude its selected inputs, but `operations::transfer` independently selects other available notes for a new call; neither mechanism deduplicates the user's payment intent. With sufficient additional notes, both transfers can execute. Persist an unresolved submission marker before entering native spending, restore it before enabling another send, and reconcile it against durable activity/recovery information or require explicit acknowledgement of the unresolved payment. Add a cold-recreation regression: the existing reopen tests retain the same application-owned guard and do not exercise process restart. The PR description's open maintainer decision does not establish an implemented recovery path or an agreed exclusion.
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
The current head closes the previously reported wallet lifecycle, generation, placement, profile-authority, persistence, and account-scoping defects, and the available code checks are successful. Two new blocking issues remain: default-feature profile publication does not fail closed when shielded ownership checks are unavailable, and FFI restore still owns payment-address normalization policy instead of delegating it to platform-wallet.
Step back: this PR keeps drawing new blockers
This is review round 28, and the PR has drawn 25 blocking findings so far. The review of bddc6b4e named this cause and the decision that would settle it; this round found 2 more finding(s) from the same place. Fixing them one at a time is not converging, so this review asks for that decision before another round.
1. Split payment-address policy (2 new in this round, 2 earlier finding(s))
Payment-address policy is split between platform-wallet and the FFI restore and publication adapters, and the split changes with the shielded feature. write_dashpay_profile checks only encoding and contract support when shielded spending is unavailable, while profile_from_restore_row independently filters each field, so no single wallet-owned operation defines the invariant for published and restored addresses. Fixes to one binding or feature path therefore expose the same gap in the next path.
In this round: Fail closed when shielded support is unavailable before publishing a shielded profile address; Keep persisted payment-address restore policy in platform-wallet
Requested decision (redesign the component): Redesign the payment-address boundary in rs-platform-wallet to provide one feature-independent, wallet-owned operation for profile-update validation and persisted-profile normalization, including an explicit fail-closed result when shielded spending is unavailable. Make rs-platform-wallet-ffi only marshal rows and call that operation; native, C, JNI, Swift, and Kotlin restore paths must consume the same result. Do not continue adding per-feature or per-binding address filters until that boundary exists.
Automatic re-review is paused until then: later pushes keep this review's verdict and are not reviewed on their own. Comment @thepastaclaw review once the decision is made: that resumes automatic re-review, and reviews the current commit if it has not been reviewed.
🔴 2 blocking
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.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — This is a large, intricate change that directly modifies shielded wallet funds movement and coin/account selection, key-derived account handling, cryptographic address publication, and storage migrations in files such as packages/rs-platform-wallet/src/wallet/shielded/tips.rs and packages/rs-platform-wallet-storage/migrations/V021__profile_address_encoding.rs. - 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(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
Before fixing anything, read the review's "Step back" section. This PR keeps drawing new blocking findings from the same underlying causes, and patching the findings below one at a time is not converging. The review asks for this decision first (redesign the component): Redesign the payment-address boundary in `rs-platform-wallet` to provide one feature-independent, wallet-owned operation for profile-update validation and persisted-profile normalization, including an explicit fail-closed result when shielded spending is unavailable. Make `rs-platform-wallet-ffi` only marshal rows and call that operation; native, C, JNI, Swift, and Kotlin restore paths must consume the same result. Do not continue adding per-feature or per-binding address filters until that boundary exists. Raise that decision with the PR's author or maintainer instead of only patching; if it is theirs to make, stop and ask them.
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/platform_wallet.rs`:
- [BLOCKING] packages/rs-platform-wallet/src/wallet/platform_wallet.rs:3055-3066: Fail closed when shielded support is unavailable before publishing a shielded profile address
`write_dashpay_profile` recognizes a shielded-address set at line 3055, but the only ownership and dedicated-account check is compiled under `#[cfg(feature = "shielded")]`. `platform-wallet-ffi` has `default = []` while still exposing the profile-write ABI, so a default-feature caller can submit any syntactically valid 43-byte Orchard address: `validate_payment_address_update` checks its encoding and contract field, but no code proves wallet ownership, prepared identity-slot membership, or the dedicated-account policy. This can publish an ordinary wallet address in a DashPay profile and link private activity to the identity. Add an unconditional rejection for shielded-address sets when shielded support is unavailable, while retaining `check_tip_address_publication` for shielded builds.
In `packages/rs-platform-wallet-ffi/src/persistence.rs`:
- [BLOCKING] packages/rs-platform-wallet-ffi/src/persistence.rs:7422-7436: Keep persisted payment-address restore policy in platform-wallet
The FFI restore adapter decides which persisted payment-address fields are accepted and silently drops fields that fail validation. Calling the canonical validators does not remove that ownership decision: this function still chooses per-field filtering and constructs the canonical profile differently from native Rust restore callers. A malformed or unsupported persisted row therefore follows binding-specific normalization semantics, and future changes to address/profile restore policy can drift between C, JNI, Swift, Kotlin, and native paths. Expose a platform-wallet-owned restore/normalization constructor or result and have the FFI only marshal the host row into that API.
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
@thepastaclaw review The previous run stopped on an invalid severity emitted by the security-auditor lane, without a code verdict. Please rerun the final review on the current head. 🤖 Posted autonomously by Codex on behalf of pasta. |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Two in-scope issues remain at 0ca5170. Profile publication is generation-fenced but is not admitted to the coordinator operation gate used by Clear, allowing a publication to complete after shielded state has been wiped; public shielded APIs also accept coordinators for a different network. Rust workspace, Swift, Kotlin, WASM, and JS checks reported success where run; the review and PR-hygiene checks remain in progress.
A pattern across this PR's review rounds
This is review round 29, and the PR has drawn 26 blocking findings so far. 1 of them share one underlying cause. They are listed with the other findings as usual; fixing the cause is likely to be cheaper than fixing each case.
1. Unowned shielded coordinator boundary (2 new in this round finding(s))
Shielded operations treat the NetworkShieldedCoordinator as an external argument, or omit it entirely, instead of using one wallet-owned, network-checked coordinator boundary. Coordinator network validation and Clear admission are consequently repeated at selected call sites: a bind refactor dropped the network check, while profile publication never joined the coordinator's operation admission. Each new lifecycle or coordinator fix can therefore expose another path that bypasses the invariant.
In this round: Serialize shielded profile publication with Clear; Reject mismatched shielded coordinator networks
Suggested decision (redesign the component): Redesign the shielded coordinator boundary in rs-platform-wallet so a PlatformWallet uses its manager-owned, network-matched coordinator rather than accepting an arbitrary coordinator for individual operations. Put the shared operation admission and network check at that boundary, and route profile publication, binding, preparation, and spending through it. Do not continue repairing these guarantees independently at each call site.
If a later review again finds new blockers from this cause, it will ask for that decision and pause automatic re-review until it is made.
🔴 1 blocking | 🟡 1 suggestion(s)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — This large, intricate change modifies shielded funds movement, account derivation and key handling, concurrency gates, FFI bindings, and persistence migrations, including critical surfaces inpackages/rs-platform-wallet/src/wallet/shielded/tips.rsandpackages/rs-platform-wallet/src/wallet/platform_wallet.rs. - 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(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
Several findings on this PR share an underlying cause (the review's "pattern" section): Unowned shielded coordinator boundary. When you fix the findings below, fix the cause, not only the reported case. The review suggests (redesign the component): Redesign the shielded coordinator boundary in rs-platform-wallet so a PlatformWallet uses its manager-owned, network-matched coordinator rather than accepting an arbitrary coordinator for individual operations. Put the shared operation admission and network check at that boundary, and route profile publication, binding, preparation, and spending through it. Do not continue repairing these guarantees independently at each call site. If that decision is not yours to make, say so to the PR's author or maintainer.
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/platform_wallet.rs`:
- [BLOCKING] packages/rs-platform-wallet/src/wallet/platform_wallet.rs:3050-3084: Serialize shielded profile publication with Clear
`write_dashpay_profile` holds the wallet-generation guard and the identity-placement read lock, but it does not acquire the coordinator's shared operation admission. `clear_shielded` takes that admission exclusively before resetting the coordinator store and registrations. A publication can therefore pass `check_tip_address_publication`, have Clear reset the shielded state and let the host delete its persisted rows, and then continue through signing, broadcast, and persistence. The prepared-address check only compares `clear_generation` before this asynchronous work; it is not revalidated at the point where the profile write completes. This can republish an address the wallet no longer scans and resurrect profile state after an explicit Clear. Carry the relevant coordinator operation guard through the complete profile publication, or otherwise make publication and Clear linearize against one another through the final persistence completion.
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/platform_wallet.rs:915-925: Reject mismatched shielded coordinator networks
`bind_shielded` accepts an arbitrary `NetworkShieldedCoordinator` and immediately persists derived viewing keys and installs the registration without checking `coordinator.network() == self.network()`. `prepare_shielded_identity_address` and `send_shielded_tip` likewise accept arbitrary coordinators. A caller of these public Rust APIs can therefore derive keys for the wallet's network while registering, scanning, persisting, and broadcasting through a coordinator configured for another network. The private-payment restore path already fails closed on this mismatch at the wallet boundary. Add one shared network check to the public shielded bind, preparation, and send paths before any coordinator registration, persistence, or spend work.
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
|
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
Two in-scope issues remain on head 86aa2ab: public preparation and sending still accept a coordinator for a different network, and preparation can resurrect pre-Clear host state after Clear has already completed natively but before the host deletes its rows. The second issue permits private viewing keys and shielded notes to be persisted after an explicit Clear, so changes are required. Rust workspace, Kotlin, JavaScript, WASM, and schema checks passed; the Swift build and review checks are still in progress.
Step back: this PR keeps drawing new blockers
This is review round 30, and the PR has drawn 27 blocking findings so far. The review of 0ca5170b named this cause and the decision that would settle it; this round found 1 more finding(s) from the same place. Fixing them one at a time is not converging, so this review asks for that decision before another round.
1. Unowned shielded lifecycle boundary (1 new in this round, 4 earlier finding(s))
Shielded operations still receive a coordinator as an external argument, while Clear's native coordinator reset and the host persistence wipe occur in separate transactions. Each call site therefore assembles its own network check, operation admission, and clear-generation check; preparation takes admission before sampling the generation, so a pre-Clear host snapshot can be accepted under the post-Clear generation. Fixes to publication, binding, and teardown close individual paths while leaving another path with the same missing cross-layer invariant.
In this round: Reject tip preparation admitted after Clear before host persistence is wiped
Requested decision (redesign the component): Redesign the shielded lifecycle boundary in rs-platform-wallet so the wallet manager owns and supplies one network-matched NetworkShieldedCoordinator, and Clear, host persistence deletion, binding, preparation, publication, and spending use one explicit admission protocol. That boundary must carry a pre-Clear snapshot generation through host-state loading and reject stale state before any bind or flush; callers must not be able to pass a different coordinator or recreate these checks independently. Do not continue adding per-call gates to the current API.
Automatic re-review is paused until then: later pushes keep this review's verdict and are not reviewed on their own. Comment @thepastaclaw review once the decision is made: that resumes automatic re-review, and reviews the current commit if it has not been reviewed.
🔴 1 blocking | 🟡 1 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.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — This large, intricate diff changes shielded funds movement, account derivation and key handling, concurrency/race protections, cross-language FFI bindings, and persistent storage migrations in files such aspackages/rs-platform-wallet/src/wallet/shielded/tips.rs,packages/rs-platform-wallet-ffi/src/shielded_send.rs, and the storage migration/schema files. - 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(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
Before fixing anything, read the review's "Step back" section. This PR keeps drawing new blocking findings from the same underlying causes, and patching the findings below one at a time is not converging. The review asks for this decision first (redesign the component): Redesign the shielded lifecycle boundary in rs-platform-wallet so the wallet manager owns and supplies one network-matched NetworkShieldedCoordinator, and Clear, host persistence deletion, binding, preparation, publication, and spending use one explicit admission protocol. That boundary must carry a pre-Clear snapshot generation through host-state loading and reject stale state before any bind or flush; callers must not be able to pass a different coordinator or recreate these checks independently. Do not continue adding per-call gates to the current API. Raise that decision with the PR's author or maintainer instead of only patching; if it is theirs to make, stop and ask them.
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/tips.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/shielded/tips.rs:118-147: Reject mismatched shielded coordinator networks
The bind entry points reject coordinators whose network differs from the wallet, but `prepare_shielded_identity_address` and `send_shielded_tip` still accept arbitrary coordinators. Preparation derives keys using `self.sdk.network` and then calls `bind_shielded_locked_unfenced` with the supplied coordinator; sending passes the same unchecked coordinator to `shielded_transfer_to`. A direct Rust caller can therefore combine wallet-network-derived keys and persisted state with another network's coordinator, commitment tree, and spend state. Add one shared owner-level network check and invoke it at the start of every public coordinator-taking path, before binding, persistence, recipient resolution, or spending.
- [BLOCKING] packages/rs-platform-wallet/src/wallet/shielded/tips.rs:147-179: Reject tip preparation admitted after Clear before host persistence is wiped
Preparation acquires the coordinator operation read guard before sampling `clear_generation`. If `clear_shielded` obtains the exclusive operation guard first, it can reset the coordinator, increment the generation, and return; the host deletes its viewing-key and note rows only after that native call returns. Preparation then acquires the read guard, samples the already-incremented generation, loads the still-present pre-Clear host snapshot, binds it, and flushes it. Its later equality check passes because it sampled the post-Clear generation, so private viewing keys and notes can be resurrected after the user requested Clear. Sample the generation before waiting for operation admission, verify it is unchanged immediately after acquiring the read guard, and only then load or bind the host snapshot.
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
|
Your move: thepastaclaw left review threads unresolved; resolve them. |
|
@thepastaclaw review The lifecycle boundary fixes are complete on 🤖 Posted autonomously by Codex on behalf of pasta. |
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
@thepastaclaw review CI found and I fixed one clippy-only issue from the previous head. The corrected head is 🤖 Posted autonomously by Codex on behalf of pasta. |
|
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
Two blocking issues remain on the reviewed head. The Rust workspace test job fails because manager-created expiry fixtures inject a coordinator without configuring the manager-owned coordinator slot, and shielded bind/account-add persistence is still not admitted against Clear, allowing viewing-key rows to be written after Clear has purged host state. The existing coordinator ownership and tip lifecycle fixes otherwise address the carried findings.
Step back: this PR keeps drawing new blockers
This is review round 31, and the PR has drawn 29 blocking findings so far. The review of 86aa2ab0 named these causes and the decision that would settle it; this round found 2 more finding(s) from the same place. Fixing them one at a time is not converging, so this review asks for that decision before another round.
1. Manager-owned coordinator is only validated, not supplied (1 new in this round, 2 earlier finding(s))
The manager now stores a coordinator and resolve_shielded_coordinator rejects a foreign Arc, but bind and tip APIs still require callers to provide one. Ownership is therefore a hidden precondition rather than an invariant of the operation API: manual callers and fixtures construct a coordinator and fail only at the boundary, while each new entry point needs another check instead of obtaining the manager's single object.
In this round: Update manager-based expiry fixtures for coordinator ownership
2. Clear admission does not cover durable bind state (1 new in this round, 5 earlier finding(s))
Clear's coordinator write admission protects its reset, but shielded bind and account-add can write FVK rows through the persister before taking that admission, while the host wipe happens after native Clear returns. A bind that overlaps Clear can therefore recreate host viewing-key state after the wipe; generation checks can reject stale in-memory restoration but cannot undo that host write. The successive gates around preparation, spending, publication, and teardown patch individual paths instead of establishing one invariant for every coordinator and persistence mutation.
In this round: Fence shielded bind persistence against Clear
Requested decision (redesign the component): Redesign the shielded lifecycle boundary in rs-platform-wallet so PlatformWalletManager is the sole source of NetworkShieldedCoordinator and one explicit admission/epoch protocol covers binding, account addition, preparation, publication, spending, Clear, and the host persistence wipe. Remove coordinator injection from wallet operations, or reduce it to an internally resolved handle, and make the protocol guarantee that no pre-Clear snapshot or viewing-key write can complete after the wipe. Do not continue adding per-entry guards; land this boundary redesign before continuing the shielded tip lifecycle in this PR.
Automatic re-review is paused until then: later pushes keep this review's verdict and are not reviewed on their own. Comment @thepastaclaw review once the decision is made: that resumes automatic re-review, and reviews the current commit if it has not been reviewed.
🔴 2 blocking
2 finding(s) not shown inline (the lines are not part of this PR's diff)
🔴 Blocking: Update manager-based expiry fixtures for coordinator ownership
packages/rs-platform-wallet/src/wallet/identity/network/private_contact_requests.rs:9977-9980
The Rust workspace test job fails in the expiry fixtures at expect("bound"). ExpiryFixture::new creates its wallet through PlatformWalletManager, manually constructs a coordinator, and calls bind_shielded, but manager-created wallets now require the configured manager-owned coordinator. resolve_shielded_coordinator therefore returns ShieldedStoreError("shielded support is not configured on this wallet manager") before binding. Configure this manager with the fixture's database path and obtain the coordinator from manager.shielded_coordinator(), or construct a standalone wallet when injecting a coordinator. The ownership invariant should remain enforced.
Raised on code unchanged since the last review, and confirmed by an independent pass: Every shielded test using ExpiryFixture::new panics at expect("bound"): wallet_on creates the wallet through PlatformWalletManager without calling configure_shielded, then bind_shielded rejects the manually constructed coordinator with ShieldedStoreError("shielded support is not configured on this wallet manager").
manager
.configure_shielded(&db_path)
.await
.expect("configured");
let coordinator = manager
.shielded_coordinator()
.await
.expect("configured");
source: muse-spark-1.3-contributor (phase1-reviewer: general, rust-quality); gpt-6.1-sol (phase2-reviewer: general, architecture-layering, ffi-engineer, rust-quality, security-auditor)
🔴 Blocking: Fence shielded bind persistence against Clear
packages/rs-platform-wallet/src/wallet/platform_wallet.rs:1084-1104
bind_shielded_locked_unfenced writes viewing keys through persister.store without holding the coordinator's shared operation_admission read guard. clear_shielded takes the corresponding exclusive guard, resets the coordinator, increments clear_generation, returns, and the host then deletes its viewing-key rows. A seed-backed bind or shielded_add_account can consequently perform its host persistence after that deletion and recreate the viewing-key state. The later generation check in installation can reject restoration of stale notes, but it cannot undo the already-resurrected host rows. Protect the complete bind/account-add persistence and installation transaction with coordinator operation admission, while retaining the existing preparation guard without reacquiring the non-reentrant read lock. Add a deterministic delayed-persistence race covering Clear and host deletion.
source: gpt-6.1-sol (phase2-reviewer: general, architecture-layering, ffi-engineer, rust-quality, security-auditor)
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 6: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 7: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — This is a large, intricate change that modifies shielded funds movement, account derivation and key handling, concurrent wallet operation gates, and multiple persistent storage migrations, notably in packages/rs-platform-wallet/src/wallet/shielded/tips.rs, packages/rs-platform-wallet/src/wallet/platform_wallet.rs, packages/rs-platform-wallet-ffi/src/shielded_send.rs, and the storage migration file - 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(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Code unchanged since the last final review (
86aa2ab0): 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.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
Before fixing anything, read the review's "Step back" section. This PR keeps drawing new blocking findings from the same underlying causes, and patching the findings below one at a time is not converging. The review asks for this decision first (redesign the component): Redesign the shielded lifecycle boundary in `rs-platform-wallet` so `PlatformWalletManager` is the sole source of `NetworkShieldedCoordinator` and one explicit admission/epoch protocol covers binding, account addition, preparation, publication, spending, Clear, and the host persistence wipe. Remove coordinator injection from wallet operations, or reduce it to an internally resolved handle, and make the protocol guarantee that no pre-Clear snapshot or viewing-key write can complete after the wipe. Do not continue adding per-entry guards; land this boundary redesign before continuing the shielded tip lifecycle in this PR. Raise that decision with the PR's author or maintainer instead of only patching; if it is theirs to make, stop and ask them.
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/identity/network/private_contact_requests.rs`:
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/private_contact_requests.rs:9977-9980: Update manager-based expiry fixtures for coordinator ownership
The Rust workspace test job fails in the expiry fixtures at `expect("bound")`. `ExpiryFixture::new` creates its wallet through `PlatformWalletManager`, manually constructs a coordinator, and calls `bind_shielded`, but manager-created wallets now require the configured manager-owned coordinator. `resolve_shielded_coordinator` therefore returns `ShieldedStoreError("shielded support is not configured on this wallet manager")` before binding. Configure this manager with the fixture's database path and obtain the coordinator from `manager.shielded_coordinator()`, or construct a standalone wallet when injecting a coordinator. The ownership invariant should remain enforced.
_Raised on code unchanged since the last review, and confirmed by an independent pass: Every shielded test using `ExpiryFixture::new` panics at `expect("bound")`: `wallet_on` creates the wallet through `PlatformWalletManager` without calling `configure_shielded`, then `bind_shielded` rejects the manually constructed coordinator with `ShieldedStoreError("shielded support is not configured on this wallet manager")`._
In `packages/rs-platform-wallet/src/wallet/platform_wallet.rs`:
- [BLOCKING] packages/rs-platform-wallet/src/wallet/platform_wallet.rs:1084-1104: Fence shielded bind persistence against Clear
`bind_shielded_locked_unfenced` writes viewing keys through `persister.store` without holding the coordinator's shared `operation_admission` read guard. `clear_shielded` takes the corresponding exclusive guard, resets the coordinator, increments `clear_generation`, returns, and the host then deletes its viewing-key rows. A seed-backed bind or `shielded_add_account` can consequently perform its host persistence after that deletion and recreate the viewing-key state. The later generation check in installation can reject restoration of stale notes, but it cannot undo the already-resurrected host rows. Protect the complete bind/account-add persistence and installation transaction with coordinator operation admission, while retaining the existing preparation guard without reacquiring the non-reentrant read lock. Add a deterministic delayed-persistence race covering Clear and host deletion.
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix. |
…ator Manager-created wallets now accept only their manager's configured shielded coordinator, and a coordinator must match the wallet's network. The expiry fixture and the restart test configured no manager coordinator, and the viewing-key bind fixture built Mainnet wallets for a Testnet coordinator, so 20 tests failed at bind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
Bots are done — your move: post |
Issue being fixed or feature implemented
DashPay users have no way to receive private payments by username. This PR lets an identity publish a reusable shielded (Orchard) tip address on its DashPay profile and lets a wallet pay a username's tip address. Each wallet identity's tips land in a dedicated ZIP-32 account, so tip viewing keys stay separate from ordinary wallet activity. An externally generated Orchard address can be published instead.
The contract field shipped in #4768 and the DPNS resolver fix in #4769. This follows #4380 and dashpay/dips#188.
This is the first PR in a three-part stack:
Rebase plan
This PR rebases onto #5934, which puts the shielded lifecycle boundary in one place, and onto #5905, which carries this PR's per-identity account. Review continues after that rebase.
coordinatorarguments. Tests configure it withmanager.configure_shielded(..).coordinator.admit()for as long as it persists and installs, taken after anyshield_guard.wipe_shielded_statecallback does it before Clear returns.What was done?
iuses account0x40000000 + i.prepare_shielded_identity_addressproves with the seed that the identity holds that slot, binds the account and flushes persistence before returning the address. Wallet-generation and coordinator operation gates keep bind, flush, and prepared-account bookkeeping ahead of removal or Clear; a retained handle is refused after same-ID recreation. Identity discovery rebuilds tip accounts without the profile, and retired accounts keep scanning.PlatformWallet::write_dashpay_profilecarries the core, platform and shielded payment addresses as explicit keep/set/remove updates, so unrelated profile edits keep them, and checks that the connected chain's contract has the field. It refuses this wallet's ordinary-account addresses, including diversified addresses. An external receiving address of this wallet's identity shielded account must have been prepared in this session for the identity at the slot it holds now. Internal-scope identity addresses are refused because the wallet scans external receiving addresses; external-wallet addresses remain allowed. Clear invalidates preparation, including a Clear racing the final preparation step. Publication takes the current wallet generation’s payment gate before the placement lock and holds it through signing, broadcast, and cache/persistence completion; removal waits, and removed or replaced handles are refused before validation.identity_placementlock orders identity moves against the tip operations that depend on the moving identity's slot. Discovery, loading, changeset apply and public state write guards take it to move an identity. Public manager handles expose read access only. Mutable state guards, changeset apply, identity loading, discovery, and own/contact profile synchronization check the handle's generation under the wallet-manager write lock, so a retained handle cannot mutate a same-ID replacement under an old placement lock. Preparation and publication hold it through their operation. Tip sends release it during recipient resolution, then revalidate the source and hold it through spending.resolve_shielded_tipreturns the verified identity and address for the user to confirm.send_shielded_tipre-resolves, refuses if either changed, and takes aShieldedTipSource.Identity(id)pays from that identity's tip account after the seed proves the slot it holds.Account(n)pays from an ordinary account, or from the tip account of an empty (retired) slot. The generation payment gate fences proving, bookkeeping, and broadcast against removal, and a stale generation is refused after same-ID recreation. The shared coordinator operation gate also excludes Clear through proving, persistence, broadcast, and result settlement. The source has the same shape in C (ShieldedTipSourceFFI), JNI, Swift (ShieldedTipSource) and Kotlin.dashpay_profilesoverlay: a missing key is unknown, a profile is present, and an explicitNoneis confirmed absent. The first confirmed absence emits an update even on a cold cache. A size-negotiated callback carries these updates to Swift and Kotlin in the scalar transaction; scalar snapshots without a profile preserve cached profiles and payment addresses through observed-to-owned adoption. SQLite folds explicit updates and deletions into its canonical identity blob so they survive reload. Identity placement never determines profile authority; this adds no database migration orIdentityEntryencoding change.17.json), preserving the published migrations. SwiftData addsPersistentDashpayPaymentAddressesto live V5 while frozen V4 remains unchanged. Restored and synchronized Orchard metadata is validated and retained even without shielded spending support.How Has This Been Tested?
-D warnings), workspace formatting, andcargo check --workspace --all-targets --lockedpassed. Native Swift build and SwiftData tests require the Apple CI runners.Breaking Changes
These are client-side only; there is no consensus or protocol change, so the title has no
!.on_persist_dashpay_profiles_fnextension.IdentityEntryFFIandContactProfileRowFFIgained the payment addresses, andplatform_wallet_manager_send_shielded_tiptakes a*const ShieldedTipSourceFFIin place ofaccount. Rebuild the xcframework and the JNI library together with host code.IdentityEntry.dashpay_profile == Noneis unknown/no update; explicit profile deletion usesPlatformWalletChangeSet.dashpay_profiles. The profile models andrs-sdk'sProfileFieldsgained the payment address fields.PaymentAddressUpdatemoved todash_sdk::platform::dashpay, andplatform-walletre-exports it.send_shielded_tiptakes aShieldedTipSource.DashPayView::{create,update}_profile_with_external_signerare now crate-private; usePlatformWallet::write_dashpay_profile, which checks tip addresses.PlatformWallet::wallet_managerandPlatformWalletManager::wallet_manager_arcnow expose read-only handles. RawIdentityWalletwrite getters are removed; live state writes usestate_mut,state_mut_blocking, ortry_state_mut, which hold the identity-placement lock through mutation and whole-manager replacement.state_mutandstate_mut_blockingnow returnResult, rejecting removed/replaced handles withWalletNotFound;try_state_mutreturnsNonefor them. Account APIs useSHIELDED_IDENTITY_ACCOUNT_BASE,shielded_identity_account_index,is_shielded_identity_account, andprepare_shielded_identity_address; the corresponding C, Swift, Kotlin, and JNI entry points use the same identity-account naming. Tip send/resolve APIs keep their names.PersistentIdentity.remove(in:identityId:)nowthrows, andsendShieldedTiptakessource:in place ofaccount:.sendShieldedTiptakessource:in place ofaccount:.Checklist:
For repository code-owners and collaborators only
Review history before 2026-09 is on #4616.
🤖 Generated with Claude Code
Summary by CodeRabbit
PR Hygiene ·
5975962/self-reviewedCargo.lock,packages/rs-unified-sdk-jni/src/dashpay.rs,packages/rs-unified-sdk-jni/src/funding.rsand 3 more) — QuantumExplorer or shumkovkotlin-sdk(packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/wallet/SendTransactionScreen.kt,packages/kotlin-sdk/sdk/schemas/org.dashfoundation.dashsdk.persistence.DashDatabase/17.json,packages/kotlin-sdk/sdk/src/androidTest/kotlin/org/dashfoundation/dashsdk/persistence/DashDatabaseMigrationTest.ktand 18 more) — HashEngineeringrs-platform-wallet-ffi(packages/rs-platform-wallet-ffi/src/contact_request.rs,packages/rs-platform-wallet-ffi/src/dashpay.rs,packages/rs-platform-wallet-ffi/src/dashpay_profile.rsand 11 more) — HashEngineering or ZocoLini or llbartekll or romchornyiwallet-storage(packages/rs-platform-wallet-storage/SCHEMA.md,packages/rs-platform-wallet-storage/migrations/V021__profile_address_encoding.rs,packages/rs-platform-wallet-storage/src/sqlite/mod.rsand 11 more) — lklimekrs-platform-wallet(packages/rs-platform-wallet/Cargo.toml,packages/rs-platform-wallet/docs/SHIELDED_TIPS.md,packages/rs-platform-wallet/src/changeset/changeset.rsand 31 more) — HashEngineering or ZocoLini or llbartekll or romchornyirust-sdk(packages/rs-sdk/src/platform/dashpay/mod.rs,packages/rs-sdk/src/platform/dashpay/profile.rs) — lklimek or shumkovswift-sdk(packages/swift-sdk/SCHEMA_RELEASES.md,packages/swift-sdk/Sources/SwiftDashSDK/Persistence/DashLegacyStoreSQLite.swift,packages/swift-sdk/Sources/SwiftDashSDK/Persistence/DashModelContainer.swiftand 23 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.