Repository navigation
refactor(platform-wallet)!: remove the unused broadcast-and-release wrapper - #6288
llbartekll merged 2 commits into
Conversation
…rapper `CoreWallet::broadcast_transaction_releasing_reservation` and its helper `broadcast_releasing_on_rejection` have had no caller in this repository since #4323. They were also the only way to release a reservation by outpoint with neither the build's owner token nor the generation's lifecycle gate, so a caller could free a reservation on a wallet that was removed and re-created under the same id. The `reservations` module doc now says which paths release a rejected transaction's inputs and what protects each one. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
✅ Final review complete — no blockers (commit 1b44d9b) · triage: low |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
This PR removes the public broadcast-and-release wrapper, which had no in-repository production callers, and updates the documentation for the remaining reservation-release paths. Linux wallet tests and the Swift and Kotlin SDK checks passed; PastaClaw review and PR Hygiene are 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.
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:
lowbygpt-6.2-sol(effort low) — The diff removes an unused in-repository API and its dedicated tests without changing the remaining broadcast or reservation-release logic, so the breaking change is straightforward to verify. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort high); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort high); 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(zai below 15% reserve: 5h 85% left, weekly 12% left) - 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/reservations.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/reservations.rs:22-47: Following the gate-only cleanup rule can free a newer build’s reservation
Impact: A future caller that releases by outpoint while holding only the lifecycle gate can make inputs reserved by another build selectable again after a TTL sweep.
The newer build can lose its reservation even when the wallet was never removed. `payment_guard` is shared: it excludes teardown, not coin selection or TTL sweeps, and the helper’s `None` branch releases by outpoint without checking ownership. Both existing DashPay cleanup sites hold the lifecycle gate and keep the in-broadcast fence up until cleanup returns, so a competing build that selects those inputs rolls back. State both requirements in the caller contract, and distinguish the finalized path’s generation check from the owner token that protects it against reuse within that generation.
In `packages/rs-platform-wallet/src/wallet/core/broadcast.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/core/broadcast.rs:276-281: The recommended Rust send sequence can broadcast after wallet removal
Impact: A Rust consumer that follows the migration guidance can submit a finalized payment after its originating wallet has been removed or re-created.
A signed payment can reach the broadcaster after the wallet that funded it is gone. `dispatch_unexpired` looks up the wallet by ID to check reservation age and install a fence, but does not compare the transaction’s originating generation to the current registration; if the wallet is missing, the age check does not reject the send. The generation check in rejection cleanup runs too late to prevent dispatch. Document the existing caller contract: use the wallet generation that finalized the transaction, then hold its `generation_payment_guard` from the `is_current_generation` check through broadcast, as the FFI entry point does. The registry introduction should describe finalization and broadcast as two calls, not one uninterrupted step.
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.
- The native finalized broadcast API does not enforce wallet liveness — The public Rust method does not use
SignedCoreTransaction::origin_generationto authorize sending, so a retained handle can dispatch a payment from a removed generation. The FFI and deferred registry supply their own checks; the wrapper removal does not change this implementation.- Follow-up: In a separate platform-wallet PR, enforce originating-generation identity and liveness at the Rust broadcast boundary, keep teardown excluded through dispatch without re-entering the lifecycle gate, and test removal and same-ID recreation.
|
Bots are done — your move: post |
…s on The module doc said a new caller of `release_reservation_after_rejected_broadcast` needs the build's token or the lifecycle gate. The gate alone is not enough: it excludes teardown, not a TTL sweep followed by another build re-reserving the inputs. The contact send is also covered by its in-broadcast fence, and the doc now says so. `broadcast_transaction` pointed at the finalize-then-broadcast pair without saying that neither call checks the wallet is still registered. The doc now states the caller's part, as the FFI entry point does it. 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 revision changes only documentation: it clarifies the caller-held wallet-generation guard for finalized sends, describes finalization and broadcast as separate calls, and explains what protects each reservation cleanup path. Linux Rust wallet tests and the Kotlin and Swift SDK builds and tests passed; PR Hygiene is 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: platform-versioning); reviewer 6: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 7: 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 diff removes an unused public wrapper and its dedicated tests, then updates documentation without changing any active broadcast or reservation-release path. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort high); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort high); 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(zai below 15% reserve: 5h 55% left, weekly 6% left) - 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— platform-versioning (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. 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.
- Native Rust finalized sends rely on callers to check wallet liveness — A native caller that omits the documented guard can submit a finalized transaction after its originating wallet is removed. The FFI entry point already holds the lifecycle guard from the liveness check through broadcast; this revision documents that contract without changing dispatch.
- Follow-up: In a separate PR, make
platform-walletenforce the generation check under the lifecycle guard for finalized sends, so native Rust and FFI callers share the same guarded operation.
- Follow-up: In a separate PR, make
|
Bots are done — your move: post |
|
/self-reviewed |
|
Policy satisfied — this can merge. |
romchornyi
left a comment
There was a problem hiding this comment.
✅ Approve — reviewed at 1b44d9bc63, no findings
Checked:
- No reference to
broadcast_transaction_releasing_reservationorbroadcast_releasing_on_rejectionremains; thebuild_signed_txstill insigned_payment_registry.rsis that module's own test helper. - The new
reservations.rsmodule doc matches the code:- Asset lock: all three
release_reservation_after_rejected_broadcastcalls inasset_lock/build.rspass the build's token. - DashPay
send_payment: takeslifecycle_generation.payment_guard()before the build and holds it for the whole function. Both token-less releases run whilein_broadcast_pinis alive, andsettle_released()comes after the release. - FFI:
core_wallet/broadcast.rsholdsgeneration_payment_guardfrom theis_current_generationcheck throughbroadcast_finalized_transaction, as the new doc onbroadcast_transactionsays.
- Asset lock: all three
- The breaking change is described with its external consumers: dash-evo-tool
v1.0-devno longer calls the method, and the older branches pin revisions that still have it.
🤖 Reviewed with Claude Code
…let-payment-delivery Brings in #6276 (code 88 `ErrorShieldedMerkleWitnessUnavailable`, the retry-after-sync message) and #6288 (the unused broadcast-and-release wrapper removed). - FFI `error.rs`: kept this PR's `payment_class` / `outcome_message` beside the base's `retry_after_sync_message`. - FFI `shielded_send.rs`: the identity create from the pool maps every other error through `map_spend_result`, as the base does; the result still carries the wallet error's class. - JNI `funding.rs`: kept this PR's note that retry is the result's class, never the code. - Swift: `shieldedMerkleWitnessUnavailable` carries `payment` like every case (declaration, `payment`, message, mapping). - Code 88: Rust classes it NotSent (as before) and now retryable, the retry after sync #6276 promises, so `is_retryable` decides it. Kotlin's host-side `isRetryable = true` override goes: retry is the native flag. Registry row 88 states the class. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Issue being fixed or feature implemented
This removes an unused public method. It is not a bug fix: no flow in this repository can reach the behaviour described below.
CoreWallet::broadcast_transaction_releasing_reservationand its helperbroadcast_releasing_on_rejectionbroadcast a transaction and, on a definitive rejection, release its inputs by outpoint. They do that with neither the build's reservation token nor the wallet generation's lifecycle gate. Every other release path has one of the two, or a generation check. A caller of this method could therefore free a reservation that belongs to a wallet removed and re-created under the same id in the meantime.The method has had no caller in this repository since #4323 removed the v1 split build/sign surface. Only its own two tests called it.
How the remaining paths are protected (checked on
v5.2-devat 00e850e):asset_lock/build.rs)release_reservation_after_rejected_broadcastwith the build's tokenReservationTokenfrom a process-wide counter, so the release is a no-op on any reservation the build no longer owns, on any generation.send_payment, 2 call sites)release_reservation_after_rejected_broadcast, no tokenpayment_guardfrom before the build until after the release, so the wallet cannot be removed or re-created in between (should_hold_the_lifecycle_gate_through_a_send_payment_broadcast). The gate does not stop another build, so the in-broadcast fence stays up through the release: a build that selects a fenced input rolls back and leaves no newer reservation to free.CoreWallet::release_transaction_reservationWhat was done?
CoreWallet::broadcast_transaction_releasing_reservationandwallet::reservations::broadcast_releasing_on_rejection.broadcast_releases_reservation_on_rejection,broadcast_keeps_reservation_on_ambiguous_failure), thebuild_signed_txtest helper only they used, and the imports that became unused.wallet/reservations.rsmodule doc. It said every build-then-broadcast path must go throughbroadcast_releasing_on_rejection, which no production path did. It now lists the release paths and what protects each.broadcast_transactionnow also says that neither it norbroadcast_finalized_transactionchecks the wallet is still registered; the caller holdsgeneration_payment_guardfrom anis_current_generationcheck through the broadcast, as the FFI entry point does.release_reservation_after_rejected_broadcastis unchanged. It still does not check the generation itself, and the module doc now says a new caller must bring a token or hold the gate.How Has This Been Tested?
cargo fmt --allcargo clippy -p platform-wallet -p platform-wallet-ffi --all-targets: no warnings from either crate.cargo test -p platform-wallet: 1893 unit tests passed, 0 failed; integration and doc test binaries passed.The rejection and ambiguous-failure behaviour the two removed tests exercised is still covered on the paths that remain, for example
definitively_rejected_dispatch_installs_no_fencefor the finalized-transaction path and the registry's own rejection tests.Breaking Changes
CoreWallet::broadcast_transaction_releasing_reservationis removed from the public API of theplatform-walletcrate. Build withCoreWallet::finalize_transactionand send withCoreWallet::broadcast_finalized_transaction, which releases the reservation on a definitive rejection and is bound to the build's token and wallet generation.External consumers checked:
dashpay/dash-evo-tool: the default branchv1.0-devstopped calling the method on 2026-11-05 (fix(wallet): make every Max and fee match what the upstream builders accept dash-evo-tool#1107). 18 older branches still contain the call insrc/wallet_backend/payments.rs, 14 of them behind open draft pull requests. None of them adds or changes the call: each inherits it from a merge base older than 2026-11-05 and pins a platform revision that still has the method. They lose the call when they pick upv1.0-dev.platform-wallet-ffinever called it.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 ·
1b44d9bWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.