Skip to content

refactor: extract key-wallet-manager crate from key-wallet#594

Merged
QuantumExplorer merged 2 commits intov0.42-devfrom
refactor/key-wallet-manager
Mar 30, 2026
Merged

refactor: extract key-wallet-manager crate from key-wallet#594
QuantumExplorer merged 2 commits intov0.42-devfrom
refactor/key-wallet-manager

Conversation

@xdustinface
Copy link
Copy Markdown
Collaborator

@xdustinface xdustinface commented Mar 29, 2026

Reverts the manager module from key-wallet back into its own key-wallet-manager` crate like it was before.

This also reverts the parallel-filter feature which was added along the way when there were issues in platform after the merge of the crates.

Summary by CodeRabbit

  • Refactor

    • Wallet management has been moved into a dedicated key-wallet-manager package for clearer modularity; internal references updated accordingly.
    • The original key-wallet package was simplified by removing its manager feature.
  • Chores

    • CI group membership and coverage tracking were updated to include the new wallet manager package.

Moves the manager module from `key-wallet` back into its own key-wallet-manager` crate.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7b22fbac-e5bf-4a9c-b066-9ee735500d24

📥 Commits

Reviewing files that changed from the base of the PR and between 5523d26 and 2620bca.

📒 Files selected for processing (3)
  • dash-spv/Cargo.toml
  • key-wallet-manager/Cargo.toml
  • key-wallet-manager/src/matching.rs
✅ Files skipped from review due to trivial changes (1)
  • key-wallet-manager/Cargo.toml
🚧 Files skipped from review as they are similar to previous changes (2)
  • key-wallet-manager/src/matching.rs
  • dash-spv/Cargo.toml

📝 Walkthrough

Walkthrough

Extracted wallet-manager logic into a new crate key-wallet-manager; updated workspace, CI, and coverage to include the new crate; replaced imports across the workspace to reference key_wallet_manager types (WalletManager, WalletInterface, WalletEvent, FilterMatchKey, test_utils), and adjusted Cargo features/dependencies accordingly.

Changes

Cohort / File(s) Summary
Workspace & CI
Cargo.toml, .codecov.yml, .github/ci-groups.yml
Added key-wallet-manager as workspace member; included key-wallet-manager/src/ in Codecov wallet group paths and added workspace crate to wallet CI group.
New crate manifest & public surface
key-wallet-manager/Cargo.toml, key-wallet-manager/src/lib.rs
Added new key-wallet-manager crate with features (parallel-filters, bincode, test-utils), public re-exports (pub use key_wallet), and conditional test_utils module.
New crate internals & tests
key-wallet-manager/src/*, key-wallet-manager/examples/*, key-wallet-manager/tests/*, key-wallet-manager/src/test_utils/*
Moved/rewired wallet-manager modules to new crate; adjusted internal imports to use key_wallet for core wallet types; added test_utils::MockWallet re-exports.
key-wallet package changes
key-wallet/Cargo.toml, key-wallet/src/lib.rs, key-wallet/src/test_utils/mod.rs
Removed manager feature and parallel-filters from defaults; removed manager module export and mock-wallet re-exports; moved manager-related test utilities to new crate.
dash-spv & examples
dash-spv/Cargo.toml, dash-spv/examples/*, dash-spv/src/lib.rs, dash-spv/src/main.rs, dash-spv/src/validation/filter.rs
Replaced key_wallet::manager imports with key_wallet_manager for WalletManager/WalletEvent/FilterMatchKey; updated feature/dependency references.
dash-spv client modules
dash-spv/src/client/... (core.rs, event_handler.rs, events.rs, lifecycle.rs, mempool.rs, mod.rs, queries.rs, sync_coordinator.rs, transactions.rs)
Switched WalletInterface/WalletManager/WalletEvent imports to key_wallet_manager paths; tests updated accordingly.
dash-spv sync subsystems
dash-spv/src/sync/... (blocks/*, filters/*, mempool/*, events.rs, sync_coordinator.rs, pipeline.rs)
Updated FilterMatchKey and WalletInterface imports to key_wallet_manager; test mocks updated to key_wallet_manager::test_utils::MockWallet.
dash-spv tests & test_utils
dash-spv/src/test_utils/event_handler.rs, dash-spv/tests/dashd_sync/*, dash-spv/tests/*
Changed wallet-related imports (WalletManager, WalletEvent, WalletId) to key_wallet_manager; no logic changes in tests.
dash-spv-ffi integration
dash-spv-ffi/Cargo.toml, dash-spv-ffi/src/{callbacks.rs,client.rs,tests/*}
Added key-wallet-manager dependency; updated FFI usages and generics to use key_wallet_manager::{WalletManager, WalletEvent}.
key-wallet-ffi integration & tests
key-wallet-ffi/Cargo.toml, key-wallet-ffi/src/{error.rs,wallet_manager.rs,wallet_manager_tests.rs}, key-wallet-ffi/tests/*
Removed key-wallet manager feature usage; added key-wallet-manager deps and feature wiring; updated error conversion impls and test imports to key_wallet_manager::WalletError and manager types.
Cross-crate import rewires
multiple files across the repo (see diff)
Numerous internal use changes to swap key_wallet::manager::... and some crate::... imports to key_wallet_manager::... or key_wallet::... as appropriate; mostly import/path changes without control-flow edits.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 I hopped a crate across the tree,

Wallets now live where they roam free.
Imports shifted, tests still play,
A tidy hop — new home today! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: extracting the key-wallet-manager crate from key-wallet, which is the primary objective visible throughout the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/key-wallet-manager

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@xdustinface
Copy link
Copy Markdown
Collaborator Author

@CodeRabbit review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 29, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 29, 2026

Codecov Report

❌ Patch coverage is 60.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.21%. Comparing base (fcdffa7) to head (2620bca).
⚠️ Report is 4 commits behind head on v0.42-dev.

Files with missing lines Patch % Lines
key-wallet-manager/src/lib.rs 63.63% 4 Missing ⚠️
key-wallet-ffi/src/wallet_manager.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##           v0.42-dev     #594      +/-   ##
=============================================
- Coverage      67.40%   67.21%   -0.20%     
=============================================
  Files            318      318              
  Lines          67020    67018       -2     
=============================================
- Hits           45175    45046     -129     
- Misses         21845    21972     +127     
Flag Coverage Δ
core 75.21% <ø> (ø)
ffi 36.01% <50.00%> (-0.43%) ⬇️
rpc 19.92% <ø> (ø)
spv 83.70% <ø> (-0.16%) ⬇️
wallet 66.64% <63.63%> (-0.34%) ⬇️
Files with missing lines Coverage Δ
dash-spv-ffi/src/callbacks.rs 80.59% <ø> (ø)
dash-spv-ffi/src/client.rs 58.60% <100.00%> (ø)
dash-spv/src/client/core.rs 46.00% <ø> (ø)
dash-spv/src/client/event_handler.rs 95.71% <ø> (ø)
dash-spv/src/client/events.rs 100.00% <ø> (ø)
dash-spv/src/client/lifecycle.rs 65.31% <ø> (ø)
dash-spv/src/client/mempool.rs 63.63% <ø> (ø)
dash-spv/src/client/mod.rs 98.64% <ø> (ø)
dash-spv/src/client/queries.rs 14.28% <ø> (ø)
dash-spv/src/client/sync_coordinator.rs 82.45% <ø> (ø)
... and 23 more

... and 28 files with indirect coverage changes

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
dash-spv-ffi/Cargo.toml (1)

35-39: ⚠️ Potential issue | 🔴 Critical

key-wallet-manager must be included with the bincode feature to support tests.

The test at dash-spv-ffi/tests/test_wallet_manager.rs:79 calls create_wallet_from_mnemonic_return_serialized_bytes, which is gated behind #[cfg(feature = "bincode")] in key-wallet-manager. Since bincode is not a default feature in key-wallet-manager/Cargo.toml and the current dependency declaration in dash-spv-ffi/Cargo.toml:31 omits the bincode feature, the method will not be compiled and the test will fail.

Add the bincode feature to the key-wallet-manager dependency:

key-wallet-manager = { path = "../key-wallet-manager", features = ["bincode"] }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@dash-spv-ffi/Cargo.toml` around lines 35 - 39, The dependency declaration for
key-wallet-manager in dash-spv-ffi's Cargo.toml is missing the bincode feature
so the test calling create_wallet_from_mnemonic_return_serialized_bytes (which
is gated by #[cfg(feature = "bincode")]) won't be compiled; update the
dev-dependencies entry for key-wallet-manager to include the bincode feature
(i.e., change the dependency declaration for key-wallet-manager to specify
features = ["bincode"]) so the bincode-gated functions are available to tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@dash-spv-ffi/Cargo.toml`:
- Around line 35-39: The dependency declaration for key-wallet-manager in
dash-spv-ffi's Cargo.toml is missing the bincode feature so the test calling
create_wallet_from_mnemonic_return_serialized_bytes (which is gated by
#[cfg(feature = "bincode")]) won't be compiled; update the dev-dependencies
entry for key-wallet-manager to include the bincode feature (i.e., change the
dependency declaration for key-wallet-manager to specify features = ["bincode"])
so the bincode-gated functions are available to tests.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 15af4040-0d81-4e33-9af9-2709af3c912d

📥 Commits

Reviewing files that changed from the base of the PR and between 472131a and 5523d26.

📒 Files selected for processing (63)
  • .codecov.yml
  • .github/ci-groups.yml
  • Cargo.toml
  • dash-spv-ffi/Cargo.toml
  • dash-spv-ffi/src/callbacks.rs
  • dash-spv-ffi/src/client.rs
  • dash-spv-ffi/tests/test_wallet_manager.rs
  • dash-spv/Cargo.toml
  • dash-spv/examples/filter_sync.rs
  • dash-spv/examples/simple_sync.rs
  • dash-spv/examples/spv_with_wallet.rs
  • dash-spv/src/client/core.rs
  • dash-spv/src/client/event_handler.rs
  • dash-spv/src/client/events.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/mempool.rs
  • dash-spv/src/client/mod.rs
  • dash-spv/src/client/queries.rs
  • dash-spv/src/client/sync_coordinator.rs
  • dash-spv/src/client/transactions.rs
  • dash-spv/src/lib.rs
  • dash-spv/src/main.rs
  • dash-spv/src/sync/blocks/manager.rs
  • dash-spv/src/sync/blocks/pipeline.rs
  • dash-spv/src/sync/blocks/sync_manager.rs
  • dash-spv/src/sync/events.rs
  • dash-spv/src/sync/filters/batch.rs
  • dash-spv/src/sync/filters/batch_tracker.rs
  • dash-spv/src/sync/filters/manager.rs
  • dash-spv/src/sync/filters/pipeline.rs
  • dash-spv/src/sync/filters/sync_manager.rs
  • dash-spv/src/sync/mempool/manager.rs
  • dash-spv/src/sync/mempool/sync_manager.rs
  • dash-spv/src/sync/sync_coordinator.rs
  • dash-spv/src/test_utils/event_handler.rs
  • dash-spv/src/validation/filter.rs
  • dash-spv/tests/dashd_sync/helpers.rs
  • dash-spv/tests/dashd_sync/setup.rs
  • dash-spv/tests/dashd_sync/tests_basic.rs
  • dash-spv/tests/peer_test.rs
  • dash-spv/tests/wallet_integration_test.rs
  • key-wallet-ffi/Cargo.toml
  • key-wallet-ffi/src/error.rs
  • key-wallet-ffi/src/wallet_manager.rs
  • key-wallet-ffi/src/wallet_manager_tests.rs
  • key-wallet-ffi/tests/test_error_conversions.rs
  • key-wallet-manager/Cargo.toml
  • key-wallet-manager/examples/wallet_creation.rs
  • key-wallet-manager/src/event_tests.rs
  • key-wallet-manager/src/events.rs
  • key-wallet-manager/src/lib.rs
  • key-wallet-manager/src/matching.rs
  • key-wallet-manager/src/process_block.rs
  • key-wallet-manager/src/test_helpers.rs
  • key-wallet-manager/src/test_utils/mock_wallet.rs
  • key-wallet-manager/src/test_utils/mod.rs
  • key-wallet-manager/src/wallet_interface.rs
  • key-wallet-manager/tests/integration_test.rs
  • key-wallet-manager/tests/spv_integration_tests.rs
  • key-wallet-manager/tests/test_serialized_wallets.rs
  • key-wallet/Cargo.toml
  • key-wallet/src/lib.rs
  • key-wallet/src/test_utils/mod.rs
💤 Files with no reviewable changes (2)
  • key-wallet/src/lib.rs
  • key-wallet/src/test_utils/mod.rs

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 29, 2026
@github-actions github-actions bot added the ready-for-review CodeRabbit has approved this PR label Mar 29, 2026
@github-actions github-actions bot removed the ready-for-review CodeRabbit has approved this PR label Mar 30, 2026
@github-actions github-actions bot added the ready-for-review CodeRabbit has approved this PR label Mar 30, 2026
@QuantumExplorer QuantumExplorer merged commit 5004b52 into v0.42-dev Mar 30, 2026
41 checks passed
@QuantumExplorer QuantumExplorer deleted the refactor/key-wallet-manager branch March 30, 2026 09:34
QuantumExplorer added a commit that referenced this pull request Mar 30, 2026
Follow-up to #594. Improves the key-wallet-manager crate structure:

- Extract WalletManager accessor methods into accessors.rs
  (wallet creation, import, removal, lookup — ~213 lines)
- Extract WalletError into error.rs (~99 lines)
- Slim lib.rs to core struct definition and field management
- Move examples and integration tests from key-wallet-manager
  to key-wallet (they test wallet primitives, not the manager)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review CodeRabbit has approved this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants