Skip to content

Conversation

@QuantumExplorer
Copy link
Member

@QuantumExplorer QuantumExplorer commented Aug 12, 2025

This PR creates the key-wallet manager and separates the logic between the base wallet and the managed wallet manager that reflects the state of transactions and the chain sync.

Summary by CodeRabbit

  • New Features

    • Added high-level wallet manager with multi-wallet/accounts, UTXO tracking, coin selection, fee estimation, and transaction building/signing.
    • Expanded (de)serialization support (Serde/Bincode) for Dash addresses/PSBT; exposed taproot/crypto modules.
    • Key Wallet: BIP38 encryption, derivation builder, gap-limit/address pools, seed type, account management, wallet initialization, watch-only support; fee tools.
  • Breaking Changes

    • Replaced key-wallet Address with dashcore Address; adjusted public exports (removed some re-exports, PSBT module visibility).
  • Documentation

    • New/updated READMEs, implementation summaries, CI guidance; MSRV raised and build docs updated.
  • Tests

    • Added extensive unit and integration tests.
  • Chores

    • Added project TODOs.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 12, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds a new high-level wallet-management crate (key-wallet-manager) and extensive key-wallet refactors (accounts, gap limits, seed, PSBT, BIP38). In dash, replaces actual-serde with serde, adds (de)serialization gates, exposes crypto modules, and adjusts public exports. Workspace and docs updated. Multiple new modules, tests, and example rewrites introduced.

Changes

Cohort / File(s) Summary
Workspace & Manifests
Cargo.toml, dash/Cargo.toml, key-wallet/Cargo.toml, key-wallet-manager/Cargo.toml
Adds key-wallet-manager to workspace; replaces actual-serde with serde; adds/updates features (serde, bincode, bip38); updates deps to dashcore/dashcore_hashes; config tweaks.
Documentation
README.md, TODOS.md, key-wallet/IMPLEMENTATION_SUMMARY.md, key-wallet/CI_TESTING.md, key-wallet/src/missing_tests.md, key-wallet/src/utxo_integration_summary.md, key-wallet-manager/README.md, key-wallet-manager/missing_tests.md
Adds wallet management docs, testing plans, CI notes; MSRV update; duplicated wallet-management section; new crate README.
Dash: Serde/bincode refactor
dash/src/address.rs, .../amount.rs, .../blockdata/*, .../crypto/*, .../ephemerealdata/*, .../network/*, .../pow.rs, .../serde_utils.rs, .../sml/*, dash/src/lib.rs
Removes actual-serde aliases; gates serde/bincode; adds serde/bincode impls (Address/AddressType etc.); makes crypto and serde_utils public; removes psbt and some re-exports.
Dash: PSBT serialization core
dash/src/serialize.rs
Introduces PSBT value-type Serialize/Deserialize traits with implementations and tests (Taproot, keys, scripts).
Dash: Tests/aux changes
dash/src/blockdata/script/tests.rs, dash/src/signer.rs, dash/src/crypto/sighash.rs, dash/src/consensus/serde.rs
Test path updates from actual_serde to serde; minor API usage changes (to_bytes); doc/test tweaks.
Key-wallet: Address removal & API reorg
key-wallet/src/lib.rs, key-wallet/src/address.rs (removed), key-wallet/examples/basic_usage.rs
Removes internal Address module; re-exports dashcore::{Address, AddressType}; example rewritten to direct BIP32 usage.
Key-wallet: Accounts and pools
key-wallet/src/account/*, key-wallet/src/gap_limit.rs, key-wallet/src/wallet/account_collection.rs
Adds AddressPool, ManagedAccount(+collection), Account types, gap limit management, CoinJoin pools, metadata, scan results.
Key-wallet: Wallet construction & helpers
key-wallet/src/wallet/* (initialization.rs, helper.rs, accounts.rs, balance.rs, bip38.rs)
Adds wallet init from mnemonic/seed/xpub, account management, helpers, balance type, BIP38 export/import (feature-gated).
Key-wallet: BIP32/Seed/Mnemonic
key-wallet/src/bip32.rs, key-wallet/src/seed.rs, key-wallet/src/mnemonic.rs, key-wallet/src/mnemonic_tests.rs
Switches to dashcore_hashes; adds bincode impls; introduces Seed type; adds Portuguese language and serde derives; expands tests.
Key-wallet: PSBT refactor
key-wallet/src/psbt/*
Migrates PSBT to dashcore paths; renames errors (PsbtUtxoOutOfBounds); updates serde utils paths; adjusts serialize/deserialize plumbing.
Key-wallet: Errors & DIP9
key-wallet/src/error.rs, key-wallet/src/dip9.rs
Adds new Error variants; adds BIP44CoinType to DerivationPathReference with serde/bincode derives.
Key-wallet-manager: New crate
key-wallet-manager/src/lib.rs, .../coin_selection.rs, .../fee.rs, .../transaction_builder.rs, .../utxo.rs, .../wallet_manager.rs, tests/integration_test.rs
Introduces high-level wallet manager: UTXO model, coin selection strategies, fee framework, transaction builder/signing, multi-wallet manager, and integration tests.

Sequence Diagram(s)

sequenceDiagram
  participant App
  participant WalletManager
  participant TransactionBuilder
  participant CoinSelector
  participant FeeEstimator
  participant DashCore as dashcore

  App->>WalletManager: send_transaction(wallet_id, acct, recipients, fee_level)
  WalletManager->>TransactionBuilder: new(network)
  TransactionBuilder->>CoinSelector: select_coins(utxos, target, fee_rate, height)
  CoinSelector-->>TransactionBuilder: SelectionResult(selected, fee, change)
  TransactionBuilder->>FeeEstimator: estimate_fee_level(fee_level)
  FeeEstimator-->>TransactionBuilder: FeeRate
  TransactionBuilder->>DashCore: assemble Transaction (inputs/outputs/change)
  TransactionBuilder->>DashCore: sign inputs (P2PKH)
  DashCore-->>TransactionBuilder: Transaction
  TransactionBuilder-->>WalletManager: Transaction
  WalletManager-->>App: Transaction
Loading
sequenceDiagram
  participant App
  participant Wallet as key-wallet
  participant Builder as DerivationPathBuilder
  participant Accounts

  App->>Wallet: from_mnemonic(..., network)
  Wallet->>Builder: for_network_and_type(network, Standard, 0)
  Builder-->>Wallet: DerivationPath
  Wallet->>Accounts: add_account(index=0, Standard, network)
  Accounts-->>Wallet: Account
  Wallet-->>App: Wallet ready
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

Suggested reviewers

  • ogabrielides
  • pankcuf

Poem

A hop, a skip, new wallets bloom,
I nibble bytes in key-room gloom.
Coins align, fees estimate—tick!
UTXOs dance, selections pick.
With PSBTs and seeds in tow,
I sign, I bounce—let Dash flow! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch v0.40-dev-sam-changes-clean

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@QuantumExplorer QuantumExplorer marked this pull request as ready for review August 12, 2025 20:36
@PastaPastaPasta
Copy link
Member

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 12, 2025

✅ 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.

@QuantumExplorer QuantumExplorer changed the title V0.40 dev sam changes clean feat: improvement of key-wallet and creation of key wallet manager Aug 12, 2025
@QuantumExplorer QuantumExplorer merged commit 0901ab1 into v0.40-dev Aug 12, 2025
16 of 17 checks passed
@QuantumExplorer QuantumExplorer deleted the v0.40-dev-sam-changes-clean branch October 20, 2025 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants