Skip to content

Conversation

@PastaPastaPasta
Copy link
Member

@PastaPastaPasta PastaPastaPasta commented Aug 16, 2025

Summary

This PR resolves multiple compilation errors across the rust-dashcore workspace that were preventing successful builds and test compilation.

Build Fixes

  • PSBT module: Fixed import paths from dashcore::psbt to key_wallet::psbt in fuzz targets
  • Dependencies: Added missing key-wallet dependency to fuzz/Cargo.toml
  • Address handling: Fixed non-existent address module imports in key-wallet-ffi
  • Error patterns: Added missing error pattern matches for CoinJoinNotEnabled, Serialization, and InvalidParameter
  • Type conversions: Fixed mismatches between secp256k1::PublicKey and dashcore::PublicKey
  • Address validation: Proper handling of Address<NetworkUnchecked> vs Address<NetworkChecked>
  • AddressGenerator: Implemented using BIP44 derivation since the original struct was missing

Test Fixes

  • Platform integration: Fixed type mismatches in safety tests with proper null pointer handling
  • ChainState: Added missing fields sync_base_height and synced_from_checkpoint
  • SpvStats: Added missing fields connected_peers, total_peers, header_height, and filter_height

Verification

  • cargo build - All workspace crates compile successfully
  • cargo test --no-run - All tests compile successfully
  • cargo fmt - Code formatting applied

Summary by CodeRabbit

  • New Features

    • Added support for derivation paths and account-level extended keys (private/public).
    • Introduced address type bridging for better interoperability.
  • Improvements

    • Reworked address generation to derive addresses directly from extended public keys.
    • Enforced stricter network validation when creating and using addresses.
    • Expanded error reporting with more descriptive error mappings.
  • Tests

    • Updated tests to cover new fields and safety around null handle lifecycles.
  • Chores

    • Updated fuzzing setup to use the new PSBT source dependency.

PastaPastaPasta and others added 2 commits August 15, 2025 22:59
This commit fixes multiple compilation errors across the workspace:

Build Fixes:
- Fix PSBT module import in dash-fuzz: change from dashcore::psbt to key_wallet::psbt
- Add key-wallet dependency to fuzz/Cargo.toml
- Fix address module import in key-wallet-ffi: remove non-existent address module
- Add missing Error pattern matches: CoinJoinNotEnabled, Serialization, InvalidParameter
- Fix type mismatches: secp256k1::PublicKey vs dashcore::PublicKey conversions
- Fix Address<NetworkUnchecked> vs Address<NetworkChecked> using require_network()
- Implement AddressGenerator using BIP44 derivation instead of missing struct

Test Fixes:
- Fix platform integration safety test: separate null pointers for different types
- Add missing ChainState fields: sync_base_height, synced_from_checkpoint
- Add missing SpvStats fields: connected_peers, total_peers, header_height, filter_height

All workspace crates now compile successfully with both cargo build and cargo test.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 16, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Tests adjust null-handle usage and type conversions; core structs gain new fields; fuzz target switches PSBT types to key-wallet; fuzz manifest adds key-wallet dependency; key-wallet-ffi refactors address bridging, error mappings, introduces derivation/account key types, and reworks Address/AddressGenerator to use KwAddress and direct network-driven derivation.

Changes

Cohort / File(s) Summary of Changes
Dash SPV FFI tests
dash-spv-ffi/tests/test_platform_integration_safety.rs, dash-spv-ffi/tests/unit/test_type_conversions.rs
Distinguish null client vs null handle in lifecycle test and explicitly release null handle; update tests to include new ChainState and SpvStats fields in initializations.
Core structs: ChainState & SpvStats
dash-spv/src/chain_state.rs, dash-spv/src/stats.rs
Add fields: ChainState.sync_base_height, ChainState.synced_from_checkpoint; SpvStats.connected_peers, total_peers, header_height, filter_height.
Fuzz: PSBT + deps
fuzz/fuzz_targets/dash/deserialize_psbt.rs, fuzz/Cargo.toml
Switch PSBT types/IO from dashcore::psbt to key_wallet::psbt; add key-wallet path dependency.
key-wallet-ffi bridge & address generation
key-wallet-ffi/src/lib.rs
Introduce KwAddress/KwAddressType bridging, From conversions both ways; expand KeyWalletError mappings incl. address::Error; add public DerivationPath, AccountXPriv, AccountXPub; change Address inner to KwAddress; refactor AddressGenerator to store Network and derive addresses via ckd_pub; update accessors and validation via require_network.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant AddressGenerator
  participant XPub
  participant Network
  participant KwAddress

  Caller->>AddressGenerator: generate(index)
  AddressGenerator->>XPub: ckd_pub(account/chain/index)
  XPub-->>AddressGenerator: child pubkey
  AddressGenerator->>KwAddress: construct P2PKH(child pubkey)
  AddressGenerator->>KwAddress: require_network(Network)
  KwAddress-->>AddressGenerator: Address
  AddressGenerator-->>Caller: Address
Loading
sequenceDiagram
  participant Test
  participant FFI
  participant CoreHandle

  Test->>FFI: ffi_dash_spv_get_core_handle(null FFIDashSpvClient)
  FFI-->>Test: null CoreSDKHandle
  Test->>FFI: ffi_dash_spv_release_core_handle(null CoreSDKHandle)
  FFI-->>Test: no-op
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • ogabrielides

Poem

A hop, a skip, new keys in tow,
I nip the wires where addresses grow.
Nulls are tamed, the handles rest,
Stats and chains puff out their chest.
PSBTs waltz with wallets new—
Carrot-typed paths, I follow through.
Thump-thump! Refactors, fresh as dew. 🥕🐇

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1c133ef and 2bea21c.

📒 Files selected for processing (5)
  • dash-spv-ffi/tests/test_platform_integration_safety.rs (1 hunks)
  • dash-spv-ffi/tests/unit/test_type_conversions.rs (2 hunks)
  • fuzz/Cargo.toml (1 hunks)
  • fuzz/fuzz_targets/dash/deserialize_psbt.rs (1 hunks)
  • key-wallet-ffi/src/lib.rs (9 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/build-and-test-compilation-errors

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 merged commit ab71a7a into v0.40-dev Aug 16, 2025
15 of 16 checks passed
@QuantumExplorer QuantumExplorer deleted the fix/build-and-test-compilation-errors 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