Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
codecov:
notify:
# Must match the number of coverage-uploading groups (core, spv, wallet, ffi, rpc)
after_n_builds: 5
# Must match the number of coverage-uploading groups (core, spv, wallet, rpc)
after_n_builds: 4

coverage:
status:
Expand Down Expand Up @@ -36,10 +36,6 @@ flags:
paths:
- key-wallet/src/
- key-wallet-manager/src/
ffi:
paths:
- dash-spv-ffi/src/
- key-wallet-ffi/src/
rpc:
paths:
- rpc-client/src/
Expand Down
4 changes: 0 additions & 4 deletions .github/ci-groups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ groups:
- key-wallet
- key-wallet-manager

ffi:
- dash-spv-ffi
- key-wallet-ffi

rpc:
- dashcore-rpc
- dashcore-rpc-json
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
strategy:
fail-fast: false
matrix:
group: ["core", "spv", "wallet", "ffi", "rpc"]
group: ["core", "spv", "wallet", "rpc"]
env:
RUST_BACKTRACE: 1
steps:
Expand All @@ -49,14 +49,14 @@ jobs:

# Set up dashd and test data for groups that need it
- name: Cache dashd and test data
if: matrix.group == 'spv' || matrix.group == 'ffi'
if: matrix.group == 'spv'
uses: actions/cache@v5
with:
path: .rust-dashcore-test
key: rust-dashcore-test-${{ inputs.os }}-${{ env.DASHVERSION }}-${{ env.TEST_DATA_REPO }}-${{ env.TEST_DATA_VERSION }}

- name: Setup dashd for integration tests
if: matrix.group == 'spv' || matrix.group == 'ffi'
if: matrix.group == 'spv'
env:
CACHE_DIR: ${{ github.workspace }}/.rust-dashcore-test
shell: bash
Expand All @@ -65,7 +65,7 @@ jobs:
- name: Run tests
id: tests
env:
DASHD_TEST_RETAIN_DIR: ${{ (matrix.group == 'spv' || matrix.group == 'ffi') && format('{0}/dashd-test-logs', runner.temp) || '' }}
DASHD_TEST_RETAIN_DIR: ${{ matrix.group == 'spv' && format('{0}/dashd-test-logs', runner.temp) || '' }}
run: >
python .github/scripts/ci_config.py run-group ${{ matrix.group }}
--os ${{ inputs.os }}
Expand All @@ -85,15 +85,10 @@ jobs:
fail_ci_if_error: true

- name: Upload failed dashd test logs
if: failure() && (matrix.group == 'spv' || matrix.group == 'ffi')
if: failure() && matrix.group == 'spv'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.group }}-test-logs-${{ inputs.os }}
path: ${{ runner.temp }}/dashd-test-logs/
retention-days: 7
if-no-files-found: ignore
- name: Validate headers
if: matrix.group == 'ffi' && inputs.os == 'ubuntu-latest'
run: |
sudo apt update && sudo apt install -y build-essential
bash ffi-c-tests/validate-headers.sh ./target/llvm-cov-target/debug/include
6 changes: 0 additions & 6 deletions .github/workflows/sanitizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ on:
- 'v**-dev'
pull_request:
paths:
- 'key-wallet-ffi/**'
- 'dash-spv-ffi/**'
- 'dashcore/**'
- 'dashcore_hashes/**'
- 'key-wallet/**'
Expand Down Expand Up @@ -40,10 +38,6 @@ jobs:
LSAN_OPTIONS: "fast_unwind_on_malloc=0"
SKIP_DASHD_TESTS: 1
run: |
# FFI crates (C interop)
cargo +nightly test -Zbuild-std --target x86_64-unknown-linux-gnu \
-p key-wallet-ffi -p dash-spv-ffi --lib --tests

# Core crypto crates (unsafe optimizations)
cargo +nightly test -Zbuild-std --target x86_64-unknown-linux-gnu \
-p dashcore -p dashcore_hashes --lib --tests
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ coordination.md

# Build artifacts
**/*.rs.bk
dash-spv-ffi/include/
key-wallet-ffi/include/
*.a
*.so
*.dylib
Expand Down
8 changes: 0 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,6 @@ repos:
types: [rust]
pass_filenames: false

- id: verify-ffi
name: verify FFI
description: Verify FFI documentation is up to date
entry: contrib/verify_ffi.py
language: python
pass_filenames: false
files: ^(key-wallet-ffi|dash-spv-ffi)/.*\.(rs|toml|py)$

# ============================================================================
# SLOW CHECKS - Run on git push only.
# ============================================================================
Expand Down
7 changes: 3 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# Repository Guidelines

## Project Structure & Module Organization
- Workspace with crates: `dash`, `hashes`, `internals`, `dash-spv`, `key-wallet`, `rpc-*`, utilities (`fuzz`, `test-utils`), and FFI crates (`*-ffi`).
- Workspace with crates: `dash`, `hashes`, `internals`, `dash-spv`, `key-wallet`, `rpc-*`, and utilities (`fuzz`, `test-utils`).
- Each crate keeps sources in `src/`; unit tests live alongside code with `#[cfg(test)]`. Integration tests use `tests/` (e.g., `rpc-integration-test`).
- FFI bindings are in `*-ffi`. Shared helpers in `internals/` and `test-utils/`.
- Shared helpers in `internals/` and `test-utils/`.

## Build, Test, and Development Commands
- MSRV: 1.89. Build all: `cargo build --workspace --all-features`
- Test all: `cargo test --workspace --all-features` or `./contrib/test.sh` (set `DO_COV=true`, `DO_LINT=true`, `DO_FMT=true` as needed)
- Targeted tests: `cargo test -p dash-spv --all-features`
- FFI iOS builds: `cd key-wallet-ffi && ./build-ios.sh`
- Lint/format: `cargo clippy --workspace --all-targets -- -D warnings` and `cargo fmt --all`
- Docs: `cargo doc --workspace` (add `--open` locally)

Expand All @@ -28,7 +27,7 @@
- Prefer Conventional Commits: `feat:`, `fix:`, `refactor:`, `chore:`, `docs:`. Keep subject ≤72 chars with clear scope and rationale.
- Target branches: feature work to `v**-dev` (development), hotfixes/docs to `master` unless directed otherwise.
- Pre‑PR checks: `cargo fmt`, `cargo clippy`, `cargo test` (workspace). Update docs/CHANGELOG if user-facing.
- Include in PRs: description, linked issues, test evidence (commands/output), and notes on features/FFI impacts.
- Include in PRs: description, linked issues, test evidence (commands/output), and notes on feature impacts.

## Security & Configuration Tips
- Not for consensus‑critical validation; do not rely on exact Dash Core consensus behavior.
Expand Down
22 changes: 3 additions & 19 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ rust-dashcore is a Rust implementation of the Dash cryptocurrency protocol libra
- Network protocol implementation
- SPV (Simplified Payment Verification) client
- HD wallet functionality (BIP32/BIP39/DIP9)
- FFI bindings for C and Swift integration
- JSON-RPC client for Dash Core nodes

**IMPORTANT**: This library should NOT be used for consensus code. The exact behavior of the consensus-critical parts of Dash Core cannot be replicated without an exact copy of the C++ code.
Expand All @@ -24,11 +23,9 @@ rust-dashcore is a Rust implementation of the Dash cryptocurrency protocol libra

### SPV
- `dash-spv/` - SPV client implementation
- `dash-spv-ffi/` - C-compatible FFI bindings for SPV client

### Wallet & Keys
- `key-wallet/` - Comprehensive HD wallet implementation with multi-account support, address pools, and transaction management (see key-wallet/CLAUDE.md for detailed architecture)
- `key-wallet-ffi/` - C-compatible FFI bindings for wallet functionality

### RPC & Integration
- `rpc-client/` - JSON-RPC client for Dash Core nodes
Expand All @@ -52,12 +49,6 @@ cargo build --release
cargo build -p dash-spv
```

### FFI Library Build
```bash
# Build iOS libraries for key-wallet-ffi
cd key-wallet-ffi && ./build-ios.sh
```

### iOS/macOS Targets
```bash
# Add iOS targets
Expand Down Expand Up @@ -101,9 +92,9 @@ DO_FMT=true ./contrib/test.sh

### Integration Tests (dashd)

The `dash-spv` and `dash-spv-ffi` crates include integration tests that run against a real `dashd` regtest node. These tests cover SPV sync, wallet operations, restarts, disconnections, and transactions.
The `dash-spv` crate includes integration tests that run against a real `dashd` regtest node. These tests cover SPV sync, wallet operations, restarts, disconnections, and transactions.

**Setup:** `contrib/setup-dashd.py` downloads the dashd binary and regtest blockchain test data, caching them in `~/.rust-dashcore-test/`. It outputs the required environment variables. Always run this before testing `dash-spv` or `dash-spv-ffi` — integration tests catch critical bugs (restart, resync, disconnection) that unit tests miss.
**Setup:** `contrib/setup-dashd.py` downloads the dashd binary and regtest blockchain test data, caching them in `~/.rust-dashcore-test/`. It outputs the required environment variables. Always run this before testing `dash-spv`. Integration tests catch critical bugs (restart, resync, disconnection) that unit tests miss.

```bash
eval $(python3 contrib/setup-dashd.py)
Expand All @@ -112,7 +103,6 @@ eval $(python3 contrib/setup-dashd.py)
**Running:** Always run with integration tests enabled after setting up dashd. Do not use `SKIP_DASHD_TESTS=1`. Use `DASHD_TEST_RETAIN_DIR` so test logs are available for debugging failures.
```bash
DASHD_TEST_RETAIN_DIR=/tmp/dashd-test-logs cargo test -p dash-spv
DASHD_TEST_RETAIN_DIR=/tmp/dashd-test-logs cargo test -p dash-spv-ffi --test dashd_sync
```

**Debugging:** When tests fail, check the retained logs at the path specified by `DASHD_TEST_RETAIN_DIR`. Each test creates a subdirectory with SPV logs (`spv/logs/run.log`) and dashd data.
Expand All @@ -121,9 +111,8 @@ DASHD_TEST_RETAIN_DIR=/tmp/dashd-test-logs cargo test -p dash-spv-ffi --test das

**Key files:**
- `dash-spv/tests/dashd_sync/` — test modules (basic, restart, disconnect, transaction)
- `dash-spv-ffi/tests/dashd_sync/` — FFI test modules (basic, restart, transaction, callback)
- `dash-spv/src/test_utils/` — shared infrastructure (`DashdTestContext`, `DashCoreNode`)
- `.github/ci-groups.yml` — CI test group definitions (`spv` and `ffi` groups run dashd tests)
- `.github/ci-groups.yml` — CI test group definitions (`spv` group runs dashd tests)

## Development Commands

Expand Down Expand Up @@ -162,7 +151,6 @@ cargo doc --open
### Architecture Highlights
- **Workspace-based**: Multiple crates with clear separation of concerns
- **Async/Await**: Modern async Rust throughout
- **FFI Support**: C and Swift bindings for cross-platform usage
- **Comprehensive Testing**: Unit, integration, and fuzz testing
- **MSRV**: Rust 1.89 minimum supported version

Expand All @@ -172,7 +160,6 @@ cargo doc --open
- **No Hardcoded Values**: Never hardcode network parameters, addresses, or keys
- **Error Handling**: Use proper error types (thiserror) and propagate errors appropriately
- **Async Code**: Use tokio runtime for async operations
- **Memory Safety**: Careful handling in FFI boundaries
- **Feature Flags**: Use conditional compilation for optional features

### Testing Requirements
Expand All @@ -188,7 +175,6 @@ cargo doc --open
## Current Status

The project is actively developing:
- FFI bindings improvements
- Support for Dash Core versions 0.18.0 - 0.23.x

## Security Considerations
Expand All @@ -197,7 +183,6 @@ The project is actively developing:
- Always validate inputs from untrusted sources
- Use secure random number generation for keys
- Never log or expose private keys
- Be careful with FFI memory management

## API Stability

Expand All @@ -207,5 +192,4 @@ The API is currently unstable (version 0.x.x). Breaking changes may occur in min

- Cannot replicate exact consensus behavior of Dash Core
- Not suitable for mining or consensus validation
- FFI bindings have limited error propagation
- Some Dash Core RPC methods not yet implemented
6 changes: 2 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ changes to this document in a pull request.

## General

We welcome contributions of all kinds: bug fixes, features, tests, docs, and reviews. This codebase powers Dash protocol libraries (networking, SPV, wallet, FFI). Changes must be reviewed with security and backward‑compatibility in mind.
We welcome contributions of all kinds: bug fixes, features, tests, docs, and reviews. This codebase powers Dash protocol libraries (networking, SPV, wallet). Changes must be reviewed with security and backward‑compatibility in mind.


## Communication
Expand Down Expand Up @@ -110,8 +110,6 @@ That's it! Hooks run automatically from now on.

**On git push** (~30-90 seconds additional):
- `cargo clippy` — Strict linting on entire workspace
- `verify-ffi-headers` — Ensures FFI C headers are up to date
- `verify-ffi-docs` — Ensures FFI API documentation is current

**Note:** CI runs the exact same checks, so passing locally = passing in CI.

Expand Down Expand Up @@ -179,7 +177,7 @@ Use Rust standards: `UpperCamelCase` for types/traits, `snake_case` for modules/

### Unsafe code

Minimize `unsafe`. When required (especially across FFI boundaries), encapsulate it, document invariants, add tests, and consider Miri/sanitizers.
Minimize `unsafe`. When required, encapsulate it, document invariants, add tests, and consider Miri/sanitizers.


## Security
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["dash", "dash-network", "hashes", "internals", "fuzz", "rpc-client", "rpc-json", "rpc-integration-test", "key-wallet", "key-wallet-manager", "key-wallet-ffi", "dash-spv", "dash-spv-ffi", "dash-network-seeds", "masternode-seeds-fetcher"]
members = ["dash", "dash-network", "hashes", "internals", "fuzz", "rpc-client", "rpc-json", "rpc-integration-test", "key-wallet", "key-wallet-manager", "dash-spv", "dash-network-seeds", "masternode-seeds-fetcher"]
resolver = "2"

[workspace.package]
Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
| core | dashcore, dashcore_hashes, dashcore-private | [![codecov](https://codecov.io/gh/dashpay/rust-dashcore/graph/badge.svg?flag=core)](https://codecov.io/gh/dashpay/rust-dashcore?flags[0]=core) |
| spv | dash-spv | [![codecov](https://codecov.io/gh/dashpay/rust-dashcore/graph/badge.svg?flag=spv)](https://codecov.io/gh/dashpay/rust-dashcore?flags[0]=spv) |
| wallet | key-wallet | [![codecov](https://codecov.io/gh/dashpay/rust-dashcore/graph/badge.svg?flag=wallet)](https://codecov.io/gh/dashpay/rust-dashcore?flags[0]=wallet) |
| ffi | dash-spv-ffi, key-wallet-ffi | [![codecov](https://codecov.io/gh/dashpay/rust-dashcore/graph/badge.svg?flag=ffi)](https://codecov.io/gh/dashpay/rust-dashcore?flags[0]=ffi) |
| rpc | dashcore-rpc, dashcore-rpc-json | [![codecov](https://codecov.io/gh/dashpay/rust-dashcore/graph/badge.svg?flag=rpc)](https://codecov.io/gh/dashpay/rust-dashcore?flags[0]=rpc) |

</details>
Expand All @@ -45,7 +44,6 @@ Supports (or should support)
* PSBT creation, manipulation, merging and finalization
* Pay-to-contract support as in Appendix A of the [Blockstream sidechains whitepaper](https://www.blockstream.com/sidechains.pdf)
* JSONRPC interaction with Dash Core
* FFI bindings for C/Swift integration (dash-spv-ffi, key-wallet-ffi)
* High-level wallet management with transaction building and UTXO management

# Known limitations
Expand Down Expand Up @@ -99,7 +97,6 @@ See `client/examples/` for more usage examples.
This library provides comprehensive wallet functionality through multiple components:

* **key-wallet**: Low-level cryptographic primitives for HD wallets, mnemonic generation, and key derivation; and high-level wallet management with transaction building, UTXO tracking, and coin selection
* **key-wallet-ffi**: C/Swift FFI bindings for mobile integration
* **dash-spv**: SPV (Simplified Payment Verification) client implementation

# Supported Dash Core Versions
Expand Down
72 changes: 0 additions & 72 deletions contrib/verify_ffi.py

This file was deleted.

Loading
Loading