-
Notifications
You must be signed in to change notification settings - Fork 10
Feat/mempool bloom filters chain management #102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
QuantumExplorer
merged 50 commits into
v0.40-dev
from
feat/mempool-bloom-filters-chain-management
Aug 15, 2025
Merged
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
87eb512
Revert "chore: run `cargo fmt`"
PastaPastaPasta 5638718
fix(swift-sdk): remove DashSPVFFI target for unified SDK compatibility
1775e35
fix: handle filter sync skip properly in sequential sync manager
0b3fe78
build: add test-utils workspace member and dependencies
d8e1d71
feat(dash): add LLMQ DKG window calculations and fix intervals
9646d5f
feat(dash-spv-ffi): implement platform integration FFI functions
30c7072
feat(dash-spv): add client methods for querying masternode lists and …
a6483ae
fix(dash-spv): correct header sync counting and storage checkpoint logic
03e173e
feat(dash-spv): implement smart DKG-based masternode list fetching
d9f0863
feat(swift-sdk): expose FFI client handle for Platform SDK integration
90ce94d
refactor(dash-spv-ffi): improve error handling traits
a116a6b
test(dash-spv-ffi): add platform integration tests and documentation
9d8d1ba
refactor(ffi): replace underscore-prefixed parameters with standard n…
PastaPastaPasta cd2f0a4
docs: add documentation to masternode list engine
PastaPastaPasta a1f5bea
feat: re-work and simplify ffi_dash_spv_get_quorum_public_key to use …
PastaPastaPasta fda38d0
feat: implement Phase 1 QRInfo support for dash-spv, implement Phase …
PastaPastaPasta ce652d1
feat(dash-spv): implement Phase 4 - comprehensive validation for QRIn…
7f5cf39
fix(dash-spv): resolve build errors from QRInfo implementation changes
a4ac88d
feat(dash-spv): integrate QRInfo-driven masternode sync
af65bda
refactor(ffi): replace underscore-prefixed parameters with standard n…
85bcd9c
perf(dash-spv): eliminate N+1 query bottleneck in header sync
dd3b30f
feat: update mainnet checkpoints to match dash-cli
PastaPastaPasta cd522f8
Refactor: Adjust header sync timeouts
PastaPastaPasta eb50d60
refactor(dash-spv): remove unused parallel sync modules
PastaPastaPasta fe5ddaf
refactor(dash-spv): remove correlation module reference
PastaPastaPasta b5f3b10
docs(dash-spv): improve storage API documentation
PastaPastaPasta c821df1
refactor(dash-spv): simplify sync logic following dash-evo-tool pattern
PastaPastaPasta 85c4502
chore: run `cargo fmt`
PastaPastaPasta 23696ce
feat(dash-spv): add checkpoint for block 2300000
PastaPastaPasta 28f6c46
feat: re-export common dashcore types through spv
pauldelucia 699dc86
Merge pull request #97 from dashpay/feat/mempool-bloom-filters-reexport
PastaPastaPasta 194410a
refactor: simplify the code, fix various test compilation issues (#98)
PastaPastaPasta 7fcdf8b
fix(dash-spv): unify status display height calculation for genesis an…
PastaPastaPasta f93af53
chore: run `cargo fmt`
PastaPastaPasta 66dff9d
refactor: remove legacy key tracking and simplify signature verification
PastaPastaPasta 030585c
chore: bump blsful to latest
PastaPastaPasta 4fd651f
chore: run `cargo fmt`
PastaPastaPasta 7aeacd9
Merge remote-tracking branch 'upstream/v0.40-dev' into feat/mempool-b…
PastaPastaPasta 998949a
feat: add in a key wallet manager
QuantumExplorer 558b504
a lot of fixes
QuantumExplorer 015151a
cleanup
QuantumExplorer bbabc7c
fixes
QuantumExplorer 5a89472
refactoring of key-wallet
QuantumExplorer 1f904cd
various fixes
QuantumExplorer 16a7511
fixes for wallet manager
QuantumExplorer 1c04598
Merge remote-tracking branch 'upstream/v0.40-dev' into feat/mempool-b…
PastaPastaPasta 7239161
feat: enhance masternode sync manager with embedded MNListDiff support
PastaPastaPasta d5ea6d4
chore: remove misc unneeded .md files
PastaPastaPasta 0d583ef
fix: resolve all dash-spv test compilation errors and failures
PastaPastaPasta 26ad93c
chore: run `cargo fmt`
PastaPastaPasta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,145 @@ | ||
| # CLAUDE.md | ||
|
|
||
| This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
|
||
| ## Overview | ||
|
|
||
| dash-spv-ffi provides C-compatible FFI bindings for the Dash SPV (Simplified Payment Verification) client. It wraps the Rust dash-spv library to enable usage from C, Swift, and other languages via a stable ABI. | ||
|
|
||
| ## Build Commands | ||
|
|
||
| ### Rust Library Build | ||
| ```bash | ||
| # Debug build | ||
| cargo build | ||
|
|
||
| # Release build (recommended for production) | ||
| cargo build --release | ||
|
|
||
| # Build for specific iOS targets | ||
| cargo build --release --target aarch64-apple-ios | ||
| cargo build --release --target aarch64-apple-ios-sim | ||
| ``` | ||
|
|
||
| ### Header Generation | ||
| The C header is auto-generated by the build script. To regenerate manually: | ||
| ```bash | ||
| cbindgen --config cbindgen.toml --crate dash-spv-ffi --output include/dash_spv_ffi.h | ||
| ``` | ||
|
|
||
| ### Unified SDK Build | ||
| For iOS integration with platform-ios: | ||
| ```bash | ||
| # First build dash-spv-ffi for iOS targets (REQUIRED!) | ||
| cargo build --release --target aarch64-apple-ios | ||
| cargo build --release --target aarch64-apple-ios-sim | ||
|
|
||
| # Then build the unified SDK | ||
| cd ../../platform-ios/packages/rs-sdk-ffi | ||
| ./build_ios.sh | ||
|
|
||
| # Copy to iOS project | ||
| cp -R build/DashUnifiedSDK.xcframework ../../../dashpay-ios/DashPayiOS/Libraries/ | ||
| ``` | ||
|
|
||
| **Important**: The unified SDK build process (`build_ios.sh`) merges dash-spv-ffi with platform SDK. You MUST build dash-spv-ffi first or changes won't be included! | ||
|
|
||
| ## Testing | ||
|
|
||
| ### Rust Tests | ||
| ```bash | ||
| # Run all tests | ||
| cargo test | ||
|
|
||
| # Run specific test | ||
| cargo test test_client_lifecycle | ||
|
|
||
| # Run with output | ||
| cargo test -- --nocapture | ||
|
|
||
| # Run tests with real Dash node (requires DASH_SPV_IP env var) | ||
| DASH_SPV_IP=192.168.1.100 cargo test -- --ignored | ||
| ``` | ||
|
|
||
| ### C Tests | ||
| ```bash | ||
| cd tests/c_tests | ||
|
|
||
| # Build and run all tests | ||
| make test | ||
|
|
||
| # Run specific test | ||
| make test_basic && ./test_basic | ||
|
|
||
| # Clean build artifacts | ||
| make clean | ||
| ``` | ||
|
|
||
| ## Architecture | ||
|
|
||
| ### Core Components | ||
|
|
||
| **FFI Wrapper Layer** (`src/`): | ||
| - `client.rs` - SPV client operations (connect, sync, broadcast) | ||
| - `config.rs` - Client configuration (network, peers, validation) | ||
| - `wallet.rs` - Wallet operations (addresses, balances, UTXOs) | ||
| - `callbacks.rs` - Async callback system for progress/events | ||
| - `types.rs` - FFI-safe type conversions | ||
| - `error.rs` - Thread-local error handling | ||
| - `platform_integration.rs` - Platform SDK integration support | ||
|
|
||
| **Key Design Patterns**: | ||
| 1. **Opaque Pointers**: Complex Rust types are exposed as opaque pointers (`FFIDashSpvClient*`) | ||
| 2. **Explicit Memory Management**: All FFI types have corresponding `_destroy()` functions | ||
| 3. **Error Handling**: Uses thread-local storage for error propagation | ||
| 4. **Callbacks**: Async operations use C function pointers for progress/completion | ||
|
|
||
| ### FFI Safety Rules | ||
|
|
||
| 1. **String Handling**: | ||
| - Rust strings are returned as `*const c_char` (caller must free with `dash_string_free`) | ||
| - Input strings are `*const c_char` (borrowed, not freed) | ||
|
|
||
| 2. **Memory Ownership**: | ||
| - Functions returning pointers transfer ownership (caller must destroy) | ||
| - Functions taking pointers borrow (caller retains ownership) | ||
|
|
||
| 3. **Thread Safety**: | ||
| - Client operations are thread-safe | ||
| - Callbacks may be invoked from any thread | ||
|
|
||
| ### Integration with Unified SDK | ||
|
|
||
| This crate can be used standalone or as part of the unified SDK: | ||
| - **Standalone**: Produces `libdash_spv_ffi.a` with `dash_spv_ffi.h` | ||
| - **Unified**: Combined with platform SDK in `DashUnifiedSDK.xcframework` | ||
|
|
||
| The unified SDK merges headers and resolves type conflicts between Core and Platform layers. | ||
|
|
||
| ## Common Development Tasks | ||
|
|
||
| ### Adding New FFI Functions | ||
| 1. Implement Rust function in appropriate module with `#[no_mangle] extern "C"` | ||
| 2. Add cbindgen annotations for complex types | ||
| 3. Run `cargo build` to regenerate header | ||
| 4. Add corresponding test in `tests/unit/` | ||
| 5. Add C test in `tests/c_tests/` | ||
|
|
||
| ### Debugging FFI Issues | ||
| - Check `dash_spv_ffi_get_last_error()` for error details | ||
| - Use `RUST_LOG=debug` for verbose logging | ||
| - Verify memory management (matching create/destroy calls) | ||
| - Test with AddressSanitizer: `RUSTFLAGS="-Z sanitizer=address" cargo test` | ||
|
|
||
| ### Platform-Specific Builds | ||
| - iOS: Use `--target aarch64-apple-ios` or `aarch64-apple-ios-sim` | ||
| - Android: Use appropriate NDK target | ||
| - Linux/macOS: Default target works | ||
|
|
||
| ## Dependencies | ||
|
|
||
| Key dependencies from Cargo.toml: | ||
| - `dash-spv` - Core SPV implementation (local path) | ||
| - `dashcore` - Dash protocol types (local path) | ||
| - `tokio` - Async runtime | ||
| - `cbindgen` - C header generation (build dependency) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| //! Minimal platform integration test to verify FFI functions | ||
|
|
||
| use dash_spv_ffi::*; | ||
| use std::ptr; | ||
|
|
||
| #[test] | ||
| fn test_basic_null_checks() { | ||
| unsafe { | ||
| // Test null pointer handling | ||
| let handle = ffi_dash_spv_get_core_handle(ptr::null_mut()); | ||
| assert!(handle.is_null()); | ||
|
|
||
| // Test error code | ||
| let mut height: u32 = 0; | ||
| let result = | ||
| ffi_dash_spv_get_platform_activation_height(ptr::null_mut(), &mut height as *mut u32); | ||
| assert_eq!(result.error_code, FFIErrorCode::NullPointer as i32); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Unsafe raw copy from an opaque public key type risks UB; copy serialized bytes instead.
Casting
public_keyto*const u8assumes a packed 48-byte layout. If this is a struct, this is undefined behavior. Extract the 48-byte representation via a dedicated API then copy.Suggested approach (pick the API that exists on your
public_keytype):If the engine stores
[u8; 48]directly, use that array and copy its.as_ptr(); otherwise, expose a conversion on the key type and use it here.🤖 Prompt for AI Agents