fix(ui-spv): address PR #837 review feedback#838
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis pull request consolidates single-key wallet warning messaging into shared components, improves error logging in transaction cleanup logic with explicit handling of mutex acquisition failures, and simplifies backend test cases by removing RPC mode branching logic. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
⏳ Review in progress (commit 9283f74) |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
tests/backend-e2e/core_tasks.rs (1)
234-315: Consider dropping the funding step now that the send path is unreachable.TC-009 still funds the single-key wallet via
SendWalletPayment+ a 5s sleep before assertingRefreshSingleKeyWalletInfofails withOperationRequiresDashCore. Since the refresh short-circuits before any UTXO is consumed, the funding transfer and sleep add ~5s and real on-chain activity without affecting the assertion. The comment calls this "parity with the RPC scenario," which is reasonable, but you could tighten the test to just construct the SKW and assert the typed error — matching TC-003's shape and cutting harness runtime/flakiness.If the funding is intentionally retained as a smoke check that
SendWalletPaymentitself still works end-to-end in SPV mode, consider calling that out explicitly in the comment so the intent is obvious to future readers.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/backend-e2e/core_tasks.rs` around lines 234 - 315, The test test_tc009_send_single_key_wallet_payment performs an unnecessary funding step (the run_task call with BackendTask::CoreTask(CoreTask::SendWalletPayment { .. }) and the subsequent tokio::time::sleep) even though RefreshSingleKeyWalletInfo is expected to short-circuit with TaskError::OperationRequiresDashCore; remove the funding run_task and the 5s sleep so the test simply constructs the SingleKeyWallet (skw/skw_arc) and immediately calls run_task(app_context, BackendTask::CoreTask(CoreTask::RefreshSingleKeyWalletInfo(skw_arc))).await expecting an error, or if you want to keep the funding as an explicit smoke check, update the test comment to state that intent and keep the funding block guarded by an explanatory comment.src/backend_task/shielded/bundle.rs (1)
502-567: Minor inconsistency: blockinglock()on broadcast-failure path vstry_lock()on timeout path.The broadcast-failure cleanup (Line 502) uses blocking
lock(), while the timeout cleanup (Line 555) usestry_lock(). The sibling implementation insrc/context/transaction_processing.rs(seebroadcast_asset_lock_transaction_internalaround line 140) usestry_lock()on the broadcast-failure path for fire-and-forget cleanup. Since the only failure mode forlock()here is a poisoned mutex (contention with the SPV finality listener is brief), this is not a correctness issue, but aligning both paths totry_lock()would make the semantics and logging symmetric and avoid any chance of this cleanup step itself blocking on a poisoned lock while we're already on an error path.Also consider including
%tx_id/ structured fields rather than embedding into the message, but that's purely stylistic.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/backend_task/shielded/bundle.rs` around lines 502 - 567, In the broadcast-failure cleanup path replace the blocking transactions_waiting_for_finality.lock() call with transactions_waiting_for_finality.try_lock() (same pattern as the timeout loop) and update the Err branch to use tracing::warn with the same message structure used in the timeout path (including tx_id and lock_err); keep the proofs.remove(&tx_id) on the Ok path and ensure error handling returns Err(e) as before so behavior is symmetric with broadcast_asset_lock_transaction_internal.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/backend_task/shielded/bundle.rs`:
- Around line 502-567: In the broadcast-failure cleanup path replace the
blocking transactions_waiting_for_finality.lock() call with
transactions_waiting_for_finality.try_lock() (same pattern as the timeout loop)
and update the Err branch to use tracing::warn with the same message structure
used in the timeout path (including tx_id and lock_err); keep the
proofs.remove(&tx_id) on the Ok path and ensure error handling returns Err(e) as
before so behavior is symmetric with broadcast_asset_lock_transaction_internal.
In `@tests/backend-e2e/core_tasks.rs`:
- Around line 234-315: The test test_tc009_send_single_key_wallet_payment
performs an unnecessary funding step (the run_task call with
BackendTask::CoreTask(CoreTask::SendWalletPayment { .. }) and the subsequent
tokio::time::sleep) even though RefreshSingleKeyWalletInfo is expected to
short-circuit with TaskError::OperationRequiresDashCore; remove the funding
run_task and the 5s sleep so the test simply constructs the SingleKeyWallet
(skw/skw_arc) and immediately calls run_task(app_context,
BackendTask::CoreTask(CoreTask::RefreshSingleKeyWalletInfo(skw_arc))).await
expecting an error, or if you want to keep the funding as an explicit smoke
check, update the test comment to state that intent and keep the funding block
guarded by an explanatory comment.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ebd3f984-ecee-44a7-942d-e891bb372674
📒 Files selected for processing (5)
src/backend_task/shielded/bundle.rssrc/ui/wallets/mod.rssrc/ui/wallets/single_key_send_screen.rssrc/ui/wallets/wallets_screen/single_key_view.rstests/backend-e2e/core_tasks.rs
69a5ce2 to
f7d548d
Compare
- Move the "single-key wallets require Dash Core" copy and its MessageBanner rendering into a shared ui::wallets helper (SINGLE_KEY_REQUIRES_CORE_MESSAGE + render_single_key_requires_core_banner) so single_key_view and single_key_send_screen consume one source of truth. - Revert wallets_screen::single_key_view back to private now that the constant no longer needs to cross module boundaries. - Use try_lock() with WouldBlock/Poisoned handling on the shield_from_asset_lock broadcast-failure cleanup path so a contended transactions_waiting_for_finality mutex can never block the error return. Matches the style of the existing timeout-path cleanup, which is kept intact (WouldBlock -> debug, Poisoned -> warn + recover). - Simplify tests/backend-e2e/core_tasks.rs TC-003 to the SPV-only path: the harness runs in SPV mode, so the RPC branch was dead code. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
f7d548d to
9283f74
Compare
|
Following up on the CodeRabbit review here: I’m not taking further changes on #838. PR #837 already merged with the relevant fixes, and this helper PR is now closed/superseded. So the remaining suggestions on this draft helper branch are obsolete against the merged branch state rather than something I’m carrying in a follow-up. |
Summary
helper that keeps MessageBanner warning styling and centralized copy.
longer look enabled.
the harness actually runs.
transactions_waiting_for_finalitycannot be locked during shielded asset-lock cleanup.
Context
This is a helper PR against
#837
(
fix/spv-rpc-path-audit) to address the concrete review comments fromLukasz and Copilot.
Validation
cargo fmt --check✅cargo check --all-features✅cargo clippy --workspace --all-targets -- -D warningspre-existing
backend-e2etest-harness code on this branch/worktree(missing feature-gated helpers/accessors such as
AppContext::wallets()/db()/sdk()anddatabase::test_helpers).cargo test --test backend-e2e --all-features -- --ignored --nocapture test_tc003_refresh_single_key_wallet_info test_tc009_send_single_key_wallet_paymentrequired
E2E_WALLET_MNEMONIC.Summary by CodeRabbit
Release Notes
New Features
Improvements