Repository navigation
fix(platform-wallet): keep a shielded spend failed when its snapshot result arrives after proof it did not execute - #6183
Conversation
…result arrives after proof it did not execute An identity top-up (type 22) and a private document create (type 29) from the shielded pool get their result as an affected-state snapshot: the spend's nullifiers read spent, which does not say which transition spent them. While such a spend waits, the note scan can read another transition's action for one of its inputs and fail its row on that proof, or its anchor can be proven pruned. A snapshot arriving afterwards wrote Confirmed over that Failed row and reported success to the caller. Both success handlers now settle through settle_affected_state_spend, which reads and writes the row under one store guard: a row that reads Failed stays Failed and the spend is reported as ShieldedSpendNotExecuted. The notes are still marked spent, as the snapshot proves each nullifier spent on chain whichever transition spent it. The ordinary case is unchanged: the row is confirmed at once, without waiting for a sync. Closes #6160 Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 29 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
✅ Final review complete — no blockers (commit 6e24337) · triage: normal |
|
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.
Final validation — Phase 2 only (queue backlog)
Changes requested: 2 blockers
- An expired shielded spend can report success after the wallet releases its reservation —
packages/rs-platform-wallet/src/wallet/shielded/operations.rs:5001-5003(new)
Impact: A user whose top-up or private document payment expires can receive success for a spend that never executed if a later snapshot settles before the expiry pass marks the activity Failed. - Clearing shielded state can make a proved failure return as success —
packages/rs-platform-wallet/src/wallet/shielded/operations.rs:493-503(new; not shown inline, see below)
Impact: A user who clears shielded state after the scan fails an in-flight top-up or private document payment can still be told it succeeded, and the late result can recreate the cleared activity row.
This patch shares settlement logic for shielded identity top-ups and private document payments so a late snapshot preserves an activity row already marked Failed while still marking the snapshot-proven inputs spent. At review time, the Rust wallet tests, Kotlin emulator build and tests, and Swift frozen-schema check were pending; no code checks had failed.
🔴 2 blocking | 🟡 3 suggestion(s)
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🔴 Blocking: Clearing shielded state can make a proved failure return as success
Impact: A user who clears shielded state after the scan fails an in-flight top-up or private document payment can still be told it succeeded, and the late result can recreate the cleared activity row.
packages/rs-platform-wallet/src/wallet/shielded/operations.rs:493-503
A late snapshot can undo the effect of a failure the scan already recorded. NetworkShieldedCoordinator::clear takes exclusive operation admission and purges the subwallet store, but shielded_identity_top_up_from_pool, create_private_document_entry, and the private-contact payment path do not take shared admission. The public Clear path drains the sync pass, not these result waits. If Clear runs after the scan writes Failed but before the snapshot settles, unwrap_or(entry) treats the captured Pending row as current, upserts it as Confirmed, and lets the call return Ok. Hold the existing shared operation guard through settlement in these Rust wallet entry points, as shielded token transfer does, and test Clear racing with a snapshot after the scan records failure.
source: gpt-6.2-sol (phase2-reviewer: general, architecture-layering, rust-quality, security-auditor)
Review provenance
Source: reviewer 1: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
lowbygpt-6.2-sol(effort low) — The fix is confined to two wallet result handlers and preserves an existing Failed status under one write guard without changing how spends are constructed or executed. - Phase 1 reviewers: not run (skipped for throughput: 11 PRs queued, above the 10 limit)
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort medium); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort medium); agentphase2-reviewer,gpt-6.2-sol— rust-quality (completed, effort medium); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort medium); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/rs-platform-wallet/src/wallet/shielded/operations.rs`:
- [BLOCKING] packages/rs-platform-wallet/src/wallet/shielded/operations.rs:5001-5003: An expired shielded spend can report success after the wallet releases its reservation
Impact: A user whose top-up or private document payment expires can receive success for a spend that never executed if a later snapshot settles before the expiry pass marks the activity Failed.
The call can return `Ok` even though the activity ends up Failed. The expiry pass can scan through the height that proves a retained anchor was pruned while one of the inputs is still unspent; a later verified snapshot can then show all inputs consumed by a second device. `release_stranded_spends` acts on the expiry proof by clearing a reservation under the store write guard, but drops that guard at `coordinator.rs:2377` before writing Failed at lines 2409–2417. Settlement can acquire the store in between, see Pending, and write a heightless Confirmed row. The expiry writer can still flip that row to Failed, but settlement has already captured `proved_failed = false`. Record the non-token spend's failure under the same guard that releases its reservation, queue the changeset after unlocking, and test the handoff through the actual expiry path rather than prewriting Failed.
- [BLOCKING] packages/rs-platform-wallet/src/wallet/shielded/operations.rs:493-503: Clearing shielded state can make a proved failure return as success
Impact: A user who clears shielded state after the scan fails an in-flight top-up or private document payment can still be told it succeeded, and the late result can recreate the cleared activity row.
A late snapshot can undo the effect of a failure the scan already recorded. `NetworkShieldedCoordinator::clear` takes exclusive operation admission and purges the subwallet store, but `shielded_identity_top_up_from_pool`, `create_private_document_entry`, and the private-contact payment path do not take shared admission. The public Clear path drains the sync pass, not these result waits. If Clear runs after the scan writes Failed but before the snapshot settles, `unwrap_or(entry)` treats the captured Pending row as current, upserts it as Confirmed, and lets the call return `Ok`. Hold the existing shared operation guard through settlement in these Rust wallet entry points, as shielded token transfer does, and test Clear racing with a snapshot after the scan records failure.
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/shielded/operations.rs:481-491: A failed activity lookup can turn an ambiguous spend result into success
Impact: A caller of the generic top-up API using a fallible store can receive success for a spend already marked Failed if settlement cannot read the activity row.
The caller gets a successful execution result even though the wallet could not check the evidence that would rule out execution. The lookup error returns the same `false` as a successful check that finds no Failed row, and settlement treats both as `Ok(())`. The built-in lookups are infallible, but the public `ShieldedStore` trait permits lookup errors. Preserve that error as a distinct outcome for affected-state settlement: still mark the snapshot-proven inputs spent, but report execution as unconfirmed rather than successful or safe to retry.
In `packages/rs-platform-wallet/src/error.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/error.rs:1218-1225: A failed private contact payment says it can be sent again while retry is still blocked
Impact: A user who immediately retries a private contact request after seeing this error can instead receive `PrivateContactRequestPending` for the same contact.
The error tells the user they can resend an operation the wallet can still refuse. Private contact settlement deliberately keeps the payment journal and its sender-recipient hold, which the next attempt checks before paying (`platform_wallet.rs:2607–2634`). Keep the guarantee that this particular spend cannot execute, but remove the unconditional retry advice from the display text and clarify the distinction in the Rust docs. Releasing the pair itself is tracked in #6161.
In `packages/rs-platform-wallet/src/wallet/shielded/operations/affected_state_result_tests.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/shielded/operations/affected_state_result_tests.rs:303-304: The top-up tests pass their spent-note checks even if the notes stay reserved
Impact: A regression that skips note finalization can leave the selected top-up notes reserved and still pass both new top-up tests.
Neither assertion distinguishes spent notes from reserved notes. Both tests hand over their reservations before settlement, and `get_unspent_notes` excludes reserved notes even when `is_spent` is false. In both tests, assert that each selected nullifier is still present in `get_all_notes` and marked spent. The expiry fixture should also release the reservations before settlement, as the actual expiry path does.
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.
- A snapshot that settles before the scan can leave a false confirmation — Snapshot settlement drops the saved transition the scan needs to identify a competing action, and the scan only fails Pending rows. Later reconciliation needs to retain that evidence without keeping the spend eligible for rebroadcast.
- Follow-up: Address the snapshot-first ordering in #6180.
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
…guard that releases its notes The anchor expiry release cleared a spend's reservation under the store guard, dropped the guard, and wrote the row as Failed afterwards. A snapshot result settling in between found the row Pending, confirmed it and returned success, and the release then failed the row. The row is now failed under the guard that clears the reservation (fail_released_spend_row), and the host is told once the guard is released. Also from review: ShieldedSpendNotExecuted no longer says the operation can be sent again (a private contact request keeps its pair held), and the tests assert the notes are marked spent, not merely absent from the unspent set. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
@thepastaclaw on the blocker that is not inline ("Clearing shielded state can make a proved failure return as success"): deferring it, tracked in #6060 (I added this case there: #6060) and #5868. The finding is accurate, but it is not something this PR introduces or can fix narrowly. The fallback to the captured Pending row when the stored row is gone is shared by every note spend's result handler and predates this change. The fix it needs is the one the finding names: shared operation admission held through settlement in the wallet entry points, so Clear waits for the result. That is the admission and Clear-rules work already in progress on The other blocker (the expiry release) and two of the suggestions are fixed in da940a4; replies are on their threads. |
|
Your move: thepastaclaw left review threads unresolved; resolve them. |
|
@QuantumExplorer on it — I've queued this as job |
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
Reviewsys handles review findings, including deferrals and fix follow-ups. It will respond on the finding’s thread and re-review on push. |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
New on this head: This update marks an expired shielded spend’s activity row Failed under the same store lock that releases its reservation, so a waiting snapshot cannot confirm the row after release. It also adds a regression test for that handoff and removes the error message’s unconditional retry advice. No code checks were failing at review time; the Kotlin emulator build and tests and PR Hygiene were still pending.
🟡 2 suggestion(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
Still open from earlier rounds (1)
- 🟡 Suggestion: A failed activity lookup can turn an ambiguous spend result into success —
packages/rs-platform-wallet/src/wallet/shielded/operations.rs:481-491(thread)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — The fix requires reasoning about concurrent wallet state updates and reservation release, but it does not change transaction execution, coin selection, or consensus rules. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(lane failed),glm-5.3-flash(not used above high effort; tier asks max) - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/rs-platform-wallet/src/wallet/shielded/coordinator.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/shielded/coordinator.rs:6187-6194: The expiry handoff test passes its spent-note check when a selected note is missing
Impact: A regression that drops either selected note instead of retaining it as spent can pass the new expiry handoff test.
The test can pass without showing that both inputs were marked spent. It runs `all` over the rows returned by `get_all_notes`, so one surviving spent row—or no rows at all—satisfies the assertion. Start from the two selected inputs and require a stored spent row for each nullifier, as the updated top-up tests do.
In `packages/rs-platform-wallet/src/wallet/shielded/operations.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/shielded/operations.rs:481-491: A failed activity lookup can turn an ambiguous spend result into success
(carried; thread: https://github.com/dashpay/platform/pull/6183#discussion_r4673524247)
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.
- A snapshot that arrives before the scan can leave a failed spend confirmed — Settling the snapshot first removes the saved transition that the scan needs to identify a competing spend. The later scan also only fails Pending rows, so it cannot correct the heightless Confirmed row.
- Follow-up: Continue the separate fix tracked in #6180.
|
Bots are done — your move: post |
… handoff test The assertion ran over the stored notes, so a missing note passed it. It now starts from the selected notes and requires a stored, spent row for each. Also documents why a row that does not read counts as not proved failed in confirm_unless_proved_failed. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
New on this head: This update makes the expiry handoff test require every selected note to remain present and marked spent, and documents why the production activity lookup cannot fail during settlement. The Kotlin SDK emulator check failed in the unrelated MasternodeVotingKeySigningTest with Android Keystore’s User not authenticated error; the native build and Kotlin unit-test steps passed. PR Hygiene and the PastaClaw review check were still pending.
🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — The fix requires reasoning across snapshot settlement, scan results, and reservation release, but changes wallet bookkeeping and error reporting rather than funds movement, coin selection, or consensus rules. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(lane failed),glm-5.3-flash(not used above high effort; tier asks max) - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.
No unresolved findings remain from the prior review on this head.
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.
- A snapshot that arrives before the competing action is scanned can still report success — If a snapshot settles first, a top-up or private document payment can remain Confirmed even though another transaction spent its inputs. Settlement marks the notes spent and drops the saved transition the scan uses to attribute the spend; the scan’s failure writer also only updates Pending rows.
- Follow-up: Address the snapshot-first ordering in #6180 by retaining the evidence needed for later attribution separately from the record that controls rebroadcast and payment holds.
|
Bots are done — your move: post |
Basic explanation
What this does: two shielded spends, the identity top-up from the shielded pool (type 22) and the private document create from the shielded pool (type 29), learn their result from a snapshot that shows the spend's nullifiers spent. The snapshot does not say which transaction spent them. If a second device restored from the same seed spent the same notes first, that snapshot still looks like success. Since #6151 the note scan can prove such a spend failed (it reads the other transaction's action for one of the spend's notes) and marks the row Failed. A snapshot that arrived after that wrote Confirmed over the Failed row and told the app the spend succeeded. Now a row already proved failed stays Failed, and the app is told the spend did not execute.
Value: the activity list no longer shows Confirmed for a top-up or a private document payment that never happened, and the app no longer gets a success result for it.
Risks: low. The change is in
rs-platform-walletonly and only acts when the row already reads Failed at the moment the snapshot arrives. The ordinary case is unchanged: the spend is confirmed at once, without waiting for a sync. One new Rust error variant; no FFI, JNI, Swift or Kotlin code changes.Issue being fixed or feature implemented
Closes #6160.
No other open PR or issue covers it (searched open PRs and issues on 2026-11-24). Background: #6151 (the scan fails a pending spend on proof), #6108.
What was done?
packages/rs-platform-wallet/src/wallet/shielded/operations.rsidentity_top_up_from_pool_with_metadataandsettle_private_document_payment) had the same code: write the row as Confirmed, then mark the notes spent. Both now call one function,settle_affected_state_spend.settle_affected_state_spendconfirms the row throughconfirm_unless_proved_failed. That reads the stored row and writes it under one store write guard, so a scan pass cannot fail the row between the read and the write. If the stored row reads Failed, it is left untouched and the spend is reported asPlatformWalletError::ShieldedSpendNotExecuted.record_activity_statuskeeps its behaviour for every other caller. Its body moved intowrite_activity_status, which takes one more flag.Why a Failed row at that moment always rests on proof. I checked every place that writes Failed on an activity row. While a note spend waits for its result, only two can run: the scan's competing-action proof (
fail_spends_spent_elsewhere, #6151) and the anchor expiry release (release_stranded_spends, which needs the anchor proven pruned with the scan covering that height). The others are the spend's own failure branches, which cannot be followed by its own success, and the token pool sweep, which only touches token pool spends. The doc comment onconfirm_unless_proved_failedrecords this.packages/rs-platform-wallet/src/wallet/shielded/coordinator.rsrelease_stranded_spends(the anchor expiry release) cleared a spend's reservation under the store guard, dropped the guard, and wrote the row as Failed afterwards. A snapshot settling in between found the row Pending, confirmed it and returned success, and the release then failed the row. The row is now failed under the guard that clears the reservation (fail_released_spend_row), and the host is told after the guard is released. Found in review, reproduced with a test before fixing.packages/rs-platform-wallet/src/error.rs: the newShieldedSpendNotExecuted { operation }variant.Where this departs from the issue, and why
The notes are still marked spent. The issue asks that the notes of a spend proved failed are not marked spent by the late result, on the assumption that some of them may be unspent. The proof check rules that out: for both transition types,
verify_state_transition_was_executed_with_proofrejects the proof unless every nullifier of the transition reads spent (rs-drive/src/verify/state_transition/verify_state_transition_was_executed_with_proof/v0/mod.rs, theIdentityTopUpFromShieldedPoolandPrivateDocumentCreateFromShieldedPoolarms). So when a snapshot arrives at all, each selected note is spent on chain, by whichever transaction. Leaving one unmarked would show a balance that is too high until the next scan reaches it. The test asserts this: the scan frees the second note, and the snapshot then marks it spent.This also means the conflict can only occur for a bundle with no padding action (every action spends one of the wallet's notes). A padding action spends a dummy note whose nullifier no other transaction can produce, so a snapshot showing it spent proves the spend executed, and the scan cannot have proved the opposite.
The other order is not fixed here. The issue also asks that the proof wins when the snapshot arrives first and the scan reads the competing action later. That needs new saved state: marking the notes spent drops the saved transition the scan compares against, so after the snapshot the scan no longer knows the spend's inputs. Keeping that record alive would make the redrive pass, the pair holds and the Clear rules see an unresolved spend. I filed it as #6180 with what a fix needs.
How Has This Been Tested?
New tests in
wallet::shielded::operations::affected_state_result_tests, no network:should_keep_a_payment_failed_when_its_result_arrives_after_the_scan_proved_it_failed: the race end to end through the private document flow. The payment is saved and "broadcast" (the broadcast is intercepted, as other tests of this flow do). Inside the wait, a real scan pass (sync_notes_from_stream) reads another transaction's action for the first note: the row turns Failed and the second note is freed. Then the snapshot is returned. The call returnsShieldedSpendNotExecuted, the row is still Failed, both notes are spent, no saved transition is left.should_report_a_top_up_as_not_executed_when_its_row_already_reads_failed: the shared settlement for a top-up whose row reads Failed and whose notes were released.should_confirm_a_top_up_at_once_when_nothing_proved_it_failed: the ordinary case still confirms immediately and marks the notes spent.And in
wallet::shielded::coordinator::tests:should_fail_an_expired_spend_s_row_before_a_waiting_result_can_confirm_it: the actual expiry release (release_stranded_spends) with a top-up's settlement queued right behind it on the store lock. The settlement returnsShieldedSpendNotExecutedand the row ends Failed. Before the coordinator fix the settlement returned success.All of these check
is_spenton each selected note, not only that the note is absent from the unspent set (a reserved note is absent too).The race tests fail without their fix: the first two with
settle_affected_state_spendstill calling the old unconditional confirm, the coordinator one with the row still written after the guard was dropped. Each got a success result.The identity top-up handler itself builds a real proof and broadcasts through the SDK, so it is not driven end to end in a unit test. It is covered through the shared function it now calls.
Run locally:
Not yet verified
Not covered
Public interface changes
New Rust error variant:
PlatformWalletError::ShieldedSpendNotExecuted { operation: &'static str }(packages/rs-platform-wallet/src/error.rs).PlatformWallet::shielded_identity_top_up_from_pool,PlatformWallet::create_private_document_entryand the private contact request payment, and byoperations::identity_top_up_from_pool, in one situation only: the result snapshot arrived for a spend whose row the wallet had already failed on proof. Before, these calls returnedOkthere.ShieldedSpendUnconfirmed, a new attempt cannot pay twice. Whether a new attempt is admitted is separate: a private contact request keeps its pair held after this error and a new request to the same contact is refused withPrivateContactRequestPending(platform-wallet: free a private contact request's pair once its payment is proven unable to execute #6161).operationnames the spend:"identity top up from shielded pool"or"private document create from shielded pool".PlatformWalletErrorgained a variant, so an exhaustivematchon it outside this repository needs a new arm. Nothing in this repository matches it exhaustively (platform-wallet-fficompiles unchanged).FFI, Swift, Kotlin: no code changes. The new variant has no dedicated FFI result code. Through the existing mapping in
platform-wallet-ffi(map_spend_result, which the top-up export uses) it reaches a host as the generic wallet-operation failure (ErrorWalletOperation) with the message above, which is how hosts already show a failed spend. A host that showed "top-up succeeded" in this case now shows that failure instead, next to a row that reads Failed. A dedicated code can be added if a host needs to branch on it.Activity rows: a row can no longer go from Failed to Confirmed through these two results. No new status and no schema change.
Breaking Changes
None for consensus. The added error variant is described above.
Checklist:
structure.rs, regeneratedgrovedb-structure.json, and checked the structure viewer link posted on this pull requestFor repository code-owners and collaborators only
🤖 Generated with Claude Code
PR Hygiene ·
6e24337/self-reviewedrs-platform-wallet(packages/rs-platform-wallet/src/error.rs,packages/rs-platform-wallet/src/wallet/shielded/coordinator.rs,packages/rs-platform-wallet/src/wallet/shielded/operations.rsand 1 more) — HashEngineering or ZocoLini or 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.