-
Notifications
You must be signed in to change notification settings - Fork 10
chore: Some restructuring in dash-spv::sync
#236
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
Conversation
|
Warning Rate limit exceeded@xdustinface has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 23 minutes and 9 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (16)
WalkthroughModule reorganization: relocating SyncManager from Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
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. Comment |
8172ac9 to
c495f85
Compare
c495f85 to
29cb8f5
Compare
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.
Actionable comments posted: 1
🧹 Nitpick comments (3)
dash-spv/src/client/message_handler.rs (1)
3-9: Message handler now uses top-level SyncManager importSwitching to
crate::sync::SyncManagerkeeps the handler’s interactions with the sync layer intact and consistent with the rest of the client modules.You may later want to drop “Sequential” from log messages now that the module path is just
sync, but this is non‑blocking.dash-spv/src/client/filter_sync.rs (1)
3-7: FilterSyncCoordinator now depends on crate::sync::SyncManagerImporting
SyncManagerfromcrate::synckeeps the coordinated filter sync logic intact and consistent with the refactored sync module.Non‑blocking: some comments still say “sequential sync”; you might later refresh wording to reflect the generalized
syncmodule.dash-spv/src/sync/manager.rs (1)
250-261: Consider logging or propagating the error fromreset_pending_requests.The result of
header_sync.reset_pending_requests()is silently discarded withlet _ =. Per coding guidelines, library code should use proper error handling. Consider logging the error at minimum, or changing the method signature if errors during reset are expected and non-fatal.pub fn reset_pending_requests(&mut self) { // Reset all sync manager states - let _ = self.header_sync.reset_pending_requests(); + if let Err(e) = self.header_sync.reset_pending_requests() { + tracing::warn!("Failed to reset header sync pending requests: {}", e); + } self.filter_sync.reset_pending_requests(); // Masternode sync doesn't have pending requests to reset
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (16)
dash-spv/src/client/core.rs(1 hunks)dash-spv/src/client/filter_sync.rs(1 hunks)dash-spv/src/client/lifecycle.rs(1 hunks)dash-spv/src/client/message_handler.rs(1 hunks)dash-spv/src/client/message_handler_test.rs(1 hunks)dash-spv/src/client/progress.rs(1 hunks)dash-spv/src/sync/headers/manager.rs(2 hunks)dash-spv/src/sync/headers/mod.rs(1 hunks)dash-spv/src/sync/headers2/mod.rs(1 hunks)dash-spv/src/sync/manager.rs(2 hunks)dash-spv/src/sync/masternodes/embedded_data.rs(1 hunks)dash-spv/src/sync/masternodes/mod.rs(1 hunks)dash-spv/src/sync/mod.rs(1 hunks)dash-spv/src/sync/sequential/lifecycle.rs(0 hunks)dash-spv/src/sync/sequential/mod.rs(0 hunks)dash-spv/tests/chainlock_validation_test.rs(1 hunks)
💤 Files with no reviewable changes (2)
- dash-spv/src/sync/sequential/mod.rs
- dash-spv/src/sync/sequential/lifecycle.rs
🧰 Additional context used
📓 Path-based instructions (6)
**/*.rs
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.rs: Never hardcode network parameters, addresses, or keys in Rust code
Use proper error types with thiserror crate and propagate errors appropriately in Rust code
Use tokio runtime for async operations in Rust code
Use conditional compilation with feature flags for optional features
Write unit tests for new functionality in Rust
Format Rust code with cargo fmt before committing
Ensure clippy passes with all warnings as errors on all Rust code
**/*.rs: Each crate keeps sources insrc/; unit tests live alongside code with#[cfg(test)]
Maintain MSRV of 1.89 for Rust code
Format Rust code withrustfmt(seerustfmt.toml); runcargo fmt --allbefore commits
Lint Rust code withclippy; avoidunwrap()/expect()in library code; use error types (e.g.,thiserror)
Usesnake_casefor function and variable names in Rust
UseUpperCamelCasefor types and traits in Rust
UseSCREAMING_SNAKE_CASEfor constants in Rust
Follow mixed editions (2021/2024) and crate-specific idioms; prefer async viatokiowhere applicable
Unit tests should be placed near code with descriptive names (e.g.,test_parse_address_mainnet)
Use#[ignore]for network-dependent or long-running tests; run with-- --ignoredflag
Never commit secrets or real keys; avoid logging sensitive data in Rust code
Keep test vectors deterministic in Rust test code
Files:
dash-spv/src/client/filter_sync.rsdash-spv/src/sync/masternodes/embedded_data.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/message_handler_test.rsdash-spv/src/client/progress.rsdash-spv/src/sync/headers2/mod.rsdash-spv/src/client/message_handler.rsdash-spv/src/sync/headers/mod.rsdash-spv/src/sync/headers/manager.rsdash-spv/tests/chainlock_validation_test.rsdash-spv/src/sync/masternodes/mod.rsdash-spv/src/client/core.rsdash-spv/src/sync/mod.rsdash-spv/src/sync/manager.rs
dash-spv/**/*.rs
📄 CodeRabbit inference engine (dash-spv/CLAUDE.md)
dash-spv/**/*.rs: Use trait-based abstractions for core components likeNetworkManagerandStorageManagerto enable swappable implementations
Use async/await throughout the codebase with tokio runtime for all asynchronous operations
Use Minimum Rust Version (MSRV) 1.89 and ensure all code compiles withcargo check --all-features
Files:
dash-spv/src/client/filter_sync.rsdash-spv/src/sync/masternodes/embedded_data.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/message_handler_test.rsdash-spv/src/client/progress.rsdash-spv/src/sync/headers2/mod.rsdash-spv/src/client/message_handler.rsdash-spv/src/sync/headers/mod.rsdash-spv/src/sync/headers/manager.rsdash-spv/tests/chainlock_validation_test.rsdash-spv/src/sync/masternodes/mod.rsdash-spv/src/client/core.rsdash-spv/src/sync/mod.rsdash-spv/src/sync/manager.rs
dash-spv/src/client/**/*.rs
📄 CodeRabbit inference engine (dash-spv/CLAUDE.md)
Client module should provide high-level API through
DashSpvClientand configuration viaClientConfig
Files:
dash-spv/src/client/filter_sync.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/message_handler_test.rsdash-spv/src/client/progress.rsdash-spv/src/client/message_handler.rsdash-spv/src/client/core.rs
dash-spv/src/sync/**/*.rs
📄 CodeRabbit inference engine (dash-spv/CLAUDE.md)
Synchronization should use
SyncManagerfor phase-based coordination: Phase 1 (Headers), Phase 2 (Masternode List), Phase 3 (Filter Headers), Phase 4 (Filters), Phase 5 (Blocks)
Files:
dash-spv/src/sync/masternodes/embedded_data.rsdash-spv/src/sync/headers2/mod.rsdash-spv/src/sync/headers/mod.rsdash-spv/src/sync/headers/manager.rsdash-spv/src/sync/masternodes/mod.rsdash-spv/src/sync/mod.rsdash-spv/src/sync/manager.rs
**/tests/**/*.rs
📄 CodeRabbit inference engine (CLAUDE.md)
**/tests/**/*.rs: Write integration tests for network operations in Rust
Test both mainnet and testnet configurations
Use proptest for property-based testing where appropriate in RustIntegration tests use
tests/directory (e.g.,rpc-integration-test)
Files:
dash-spv/tests/chainlock_validation_test.rs
dash-spv/tests/**/*.rs
📄 CodeRabbit inference engine (dash-spv/CLAUDE.md)
Integration tests should be organized in
tests/directory with comprehensive test suites for network layer, storage layer, header sync, and real network integration
Files:
dash-spv/tests/chainlock_validation_test.rs
🧠 Learnings (30)
📓 Common learnings
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-04T15:51:59.617Z
Learning: Applies to dash-spv/src/sync/**/*.rs : Synchronization should use `SyncManager` for phase-based coordination: Phase 1 (Headers), Phase 2 (Masternode List), Phase 3 (Filter Headers), Phase 4 (Filters), Phase 5 (Blocks)
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-01T08:01:18.174Z
Learning: Organize workspace with crates: `dash`, `hashes`, `internals`, `dash-network`, `dash-spv`, `key-wallet`, `rpc-*`, utilities (`fuzz`, `test-utils`), and FFI crates (`*-ffi`)
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-04T15:51:59.617Z
Learning: Applies to dash-spv/tests/**/*.rs : Integration tests should be organized in `tests/` directory with comprehensive test suites for network layer, storage layer, header sync, and real network integration
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-01T08:01:18.174Z
Learning: Keep Rust modules focused and organized
📚 Learning: 2025-12-04T15:51:59.617Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-04T15:51:59.617Z
Learning: Applies to dash-spv/src/sync/**/*.rs : Synchronization should use `SyncManager` for phase-based coordination: Phase 1 (Headers), Phase 2 (Masternode List), Phase 3 (Filter Headers), Phase 4 (Filters), Phase 5 (Blocks)
Applied to files:
dash-spv/src/client/filter_sync.rsdash-spv/src/sync/masternodes/embedded_data.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/message_handler_test.rsdash-spv/src/client/progress.rsdash-spv/src/sync/headers2/mod.rsdash-spv/src/client/message_handler.rsdash-spv/src/sync/headers/mod.rsdash-spv/src/sync/headers/manager.rsdash-spv/tests/chainlock_validation_test.rsdash-spv/src/sync/masternodes/mod.rsdash-spv/src/client/core.rsdash-spv/src/sync/mod.rsdash-spv/src/sync/manager.rs
📚 Learning: 2025-12-04T15:51:59.617Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-04T15:51:59.617Z
Learning: Applies to dash-spv/**/*.rs : Use trait-based abstractions for core components like `NetworkManager` and `StorageManager` to enable swappable implementations
Applied to files:
dash-spv/src/client/filter_sync.rsdash-spv/src/sync/masternodes/embedded_data.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/message_handler_test.rsdash-spv/src/client/progress.rsdash-spv/src/sync/headers2/mod.rsdash-spv/src/client/message_handler.rsdash-spv/src/sync/headers/mod.rsdash-spv/src/sync/headers/manager.rsdash-spv/src/sync/masternodes/mod.rsdash-spv/src/client/core.rsdash-spv/src/sync/mod.rsdash-spv/src/sync/manager.rs
📚 Learning: 2025-12-04T15:51:59.617Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-04T15:51:59.617Z
Learning: Applies to dash-spv/**/*.rs : Use async/await throughout the codebase with tokio runtime for all asynchronous operations
Applied to files:
dash-spv/src/client/filter_sync.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/message_handler_test.rsdash-spv/src/client/progress.rsdash-spv/src/client/message_handler.rsdash-spv/src/sync/headers/manager.rsdash-spv/tests/chainlock_validation_test.rsdash-spv/src/client/core.rsdash-spv/src/sync/mod.rs
📚 Learning: 2025-12-04T15:51:59.617Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-04T15:51:59.617Z
Learning: Applies to dash-spv/src/client/**/*.rs : Client module should provide high-level API through `DashSpvClient` and configuration via `ClientConfig`
Applied to files:
dash-spv/src/client/filter_sync.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/message_handler_test.rsdash-spv/src/client/progress.rsdash-spv/src/sync/headers2/mod.rsdash-spv/src/client/message_handler.rsdash-spv/src/sync/headers/mod.rsdash-spv/src/client/core.rsdash-spv/src/sync/mod.rsdash-spv/src/sync/manager.rs
📚 Learning: 2025-12-01T08:00:50.618Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: swift-dash-core-sdk/CLAUDE.md:0-0
Timestamp: 2025-12-01T08:00:50.618Z
Learning: Applies to swift-dash-core-sdk/**/*.rs : Implement new FFI functions in Rust with `#[no_mangle] extern "C"` annotation in dash-spv-ffi
Applied to files:
dash-spv/src/client/filter_sync.rsdash-spv/src/sync/masternodes/embedded_data.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/progress.rsdash-spv/src/sync/headers2/mod.rsdash-spv/src/client/message_handler.rsdash-spv/src/sync/headers/mod.rsdash-spv/src/sync/masternodes/mod.rsdash-spv/src/client/core.rs
📚 Learning: 2025-12-04T15:51:59.617Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-04T15:51:59.617Z
Learning: Applies to dash-spv/src/error.rs : Maintain domain-specific error types in `error.rs` with variants for `NetworkError`, `StorageError`, `SyncError`, `ValidationError`, and `SpvError` (top-level wrapper)
Applied to files:
dash-spv/src/client/filter_sync.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/progress.rsdash-spv/src/client/message_handler.rsdash-spv/src/sync/headers/manager.rsdash-spv/tests/chainlock_validation_test.rsdash-spv/src/sync/masternodes/mod.rsdash-spv/src/client/core.rsdash-spv/src/sync/manager.rs
📚 Learning: 2025-12-04T15:51:59.617Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-04T15:51:59.617Z
Learning: Applies to dash-spv/**/*.rs : Use Minimum Rust Version (MSRV) 1.89 and ensure all code compiles with `cargo check --all-features`
Applied to files:
dash-spv/src/client/filter_sync.rsdash-spv/src/sync/masternodes/embedded_data.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/progress.rsdash-spv/src/client/message_handler.rsdash-spv/tests/chainlock_validation_test.rsdash-spv/src/client/core.rs
📚 Learning: 2025-06-26T15:54:02.509Z
Learnt from: DCG-Claude
Repo: dashpay/rust-dashcore PR: 0
File: :0-0
Timestamp: 2025-06-26T15:54:02.509Z
Learning: The `StorageManager` trait in `dash-spv/src/storage/mod.rs` uses `&mut self` methods but is also `Send + Sync`, and implementations often use interior mutability for concurrency. This can be confusing, so explicit documentation should clarify thread-safety expectations and the rationale for the API design.
Applied to files:
dash-spv/src/client/filter_sync.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/message_handler_test.rsdash-spv/src/client/message_handler.rsdash-spv/src/sync/mod.rsdash-spv/src/sync/manager.rs
📚 Learning: 2025-12-04T15:51:59.617Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-04T15:51:59.617Z
Learning: Applies to dash-spv/src/storage/**/*.rs : Storage module should provide abstraction via `StorageManager` trait with concrete implementations for `MemoryStorageManager` and `DiskStorageManager`
Applied to files:
dash-spv/src/client/filter_sync.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/message_handler_test.rsdash-spv/src/client/progress.rsdash-spv/src/sync/headers2/mod.rsdash-spv/src/client/message_handler.rsdash-spv/src/sync/headers/mod.rsdash-spv/src/sync/headers/manager.rsdash-spv/src/sync/masternodes/mod.rsdash-spv/src/client/core.rsdash-spv/src/sync/mod.rsdash-spv/src/sync/manager.rs
📚 Learning: 2025-06-26T16:02:42.390Z
Learnt from: DCG-Claude
Repo: dashpay/rust-dashcore PR: 0
File: :0-0
Timestamp: 2025-06-26T16:02:42.390Z
Learning: Passing exclusive mutable references to network and storage managers into the sync manager in async Rust can lead to borrow checker issues or runtime contention if concurrent access is needed elsewhere. It's advisable to document this architectural tradeoff and consider refactoring to interior mutability or message passing for shared access as the codebase evolves.
Applied to files:
dash-spv/src/client/filter_sync.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/message_handler_test.rsdash-spv/src/client/progress.rsdash-spv/src/sync/headers/manager.rsdash-spv/src/client/core.rsdash-spv/src/sync/manager.rs
📚 Learning: 2025-12-04T15:51:59.617Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-04T15:51:59.617Z
Learning: Applies to dash-spv/src/wallet/**/*.rs : Wallet module should provide UTXO tracking via `Utxo` struct, balance calculation with confirmation states, and transaction processing via `TransactionProcessor`
Applied to files:
dash-spv/src/client/filter_sync.rsdash-spv/src/sync/headers2/mod.rsdash-spv/src/sync/mod.rs
📚 Learning: 2025-12-01T08:00:37.919Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-01T08:00:37.919Z
Learning: Applies to key-wallet/**/{wallet,account,managed_account,address_pool}/**/*.rs : Always validate network consistency: use the account's network type when creating addresses and assert that operations use the expected network to prevent mainnet/testnet mixing
Applied to files:
dash-spv/src/client/filter_sync.rsdash-spv/src/client/progress.rs
📚 Learning: 2025-12-04T15:51:59.617Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-04T15:51:59.617Z
Learning: Applies to dash-spv/src/network/**/*.rs : Network module should handle TCP connections, handshake management, message routing, and peer management following Dash protocol implementation
Applied to files:
dash-spv/src/client/filter_sync.rsdash-spv/src/client/message_handler_test.rsdash-spv/src/sync/headers2/mod.rsdash-spv/src/client/message_handler.rsdash-spv/src/sync/headers/mod.rsdash-spv/src/sync/masternodes/mod.rsdash-spv/src/client/core.rsdash-spv/src/sync/mod.rsdash-spv/src/sync/manager.rs
📚 Learning: 2025-12-01T08:00:37.919Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-01T08:00:37.919Z
Learning: Applies to key-wallet/**/*.rs : Never panic in library code; use `Result<T>` for all fallible operations with custom `Error` type variants and provide context in error messages
Applied to files:
dash-spv/src/client/filter_sync.rsdash-spv/src/client/progress.rs
📚 Learning: 2025-12-01T07:59:58.608Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-12-01T07:59:58.608Z
Learning: Applies to dash-spv-ffi/src/**/*.rs : Add cbindgen annotations for complex types in FFI functions
Applied to files:
dash-spv/src/sync/masternodes/embedded_data.rsdash-spv/src/client/progress.rs
📚 Learning: 2025-12-01T08:00:37.919Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-01T08:00:37.919Z
Learning: Keep test vectors updated with Dash Core, monitor for new DIPs affecting wallet structure, maintain backward compatibility for serialized wallets, and update derivation paths for Platform features
Applied to files:
dash-spv/src/sync/masternodes/embedded_data.rsdash-spv/tests/chainlock_validation_test.rs
📚 Learning: 2025-12-04T15:51:59.617Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-04T15:51:59.617Z
Learning: Applies to dash-spv/tests/**/*.rs : Integration tests should be organized in `tests/` directory with comprehensive test suites for network layer, storage layer, header sync, and real network integration
Applied to files:
dash-spv/src/sync/masternodes/embedded_data.rsdash-spv/src/client/message_handler_test.rsdash-spv/src/client/progress.rsdash-spv/src/sync/headers/mod.rsdash-spv/tests/chainlock_validation_test.rsdash-spv/src/sync/masternodes/mod.rsdash-spv/src/client/core.rsdash-spv/src/sync/mod.rsdash-spv/src/sync/manager.rs
📚 Learning: 2025-12-01T08:00:50.618Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: swift-dash-core-sdk/CLAUDE.md:0-0
Timestamp: 2025-12-01T08:00:50.618Z
Learning: Applies to swift-dash-core-sdk/**/*.swift : Use actors for state management in SPVClient to ensure thread safety
Applied to files:
dash-spv/src/client/lifecycle.rsdash-spv/src/sync/mod.rs
📚 Learning: 2025-06-26T16:01:37.609Z
Learnt from: DCG-Claude
Repo: dashpay/rust-dashcore PR: 0
File: :0-0
Timestamp: 2025-06-26T16:01:37.609Z
Learning: The mempool tracking infrastructure (UnconfirmedTransaction, MempoolState, configuration, and mempool_filter.rs) is fully implemented and integrated in the Dash SPV client as of this PR, including client logic, FFI APIs, and tests.
Applied to files:
dash-spv/src/client/lifecycle.rsdash-spv/src/client/message_handler.rsdash-spv/src/sync/manager.rs
📚 Learning: 2025-12-01T08:01:00.652Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: swift-dash-core-sdk/Examples/DashHDWalletExample/CLAUDE.md:0-0
Timestamp: 2025-12-01T08:01:00.652Z
Learning: Applies to swift-dash-core-sdk/Examples/DashHDWalletExample/**/*.swift : Enable mempool tracking on SPV connection using the appropriate strategy (.fetchAll, .bloomFilter, .selective)
Applied to files:
dash-spv/src/client/lifecycle.rsdash-spv/src/client/message_handler.rs
📚 Learning: 2025-12-01T08:00:50.618Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: swift-dash-core-sdk/CLAUDE.md:0-0
Timestamp: 2025-12-01T08:00:50.618Z
Learning: When making changes to Rust FFI in dash-spv-ffi, rebuild with `cargo build --release` and run Swift tests to verify integration
Applied to files:
dash-spv/src/client/message_handler_test.rsdash-spv/src/client/progress.rsdash-spv/tests/chainlock_validation_test.rs
📚 Learning: 2025-12-01T07:59:58.608Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-12-01T07:59:58.608Z
Learning: Applies to dash-spv-ffi/tests/unit/**/*.rs : Add corresponding unit tests in `tests/unit/` for each new FFI function
Applied to files:
dash-spv/src/client/message_handler_test.rsdash-spv/tests/chainlock_validation_test.rs
📚 Learning: 2025-12-01T08:00:37.919Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-01T08:00:37.919Z
Learning: Applies to key-wallet/**/address_pool/**/*.rs : Implement staged gap limit management using `GapLimitStage` structure with tracking of last_used_index and used_indices HashSet to enable efficient address discovery without loading entire address chains into memory
Applied to files:
dash-spv/src/client/progress.rs
📚 Learning: 2025-12-04T15:51:59.617Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-04T15:51:59.617Z
Learning: Applies to dash-spv/src/validation/**/*.rs : Validation module should support configurable validation modes (`ValidationMode::None`, `ValidationMode::Basic`, `ValidationMode::Full`) with header validation, ChainLock, and InstantLock verification
Applied to files:
dash-spv/src/sync/headers2/mod.rsdash-spv/src/sync/headers/mod.rsdash-spv/tests/chainlock_validation_test.rsdash-spv/src/sync/mod.rs
📚 Learning: 2025-12-01T08:00:50.618Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: swift-dash-core-sdk/CLAUDE.md:0-0
Timestamp: 2025-12-01T08:00:50.618Z
Learning: Run `./sync-headers.sh` to copy updated headers to Swift SDK after rebuilding dash-spv-ffi
Applied to files:
dash-spv/src/sync/headers/mod.rs
📚 Learning: 2025-12-01T08:01:18.174Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-01T08:01:18.174Z
Learning: Organize workspace with crates: `dash`, `hashes`, `internals`, `dash-network`, `dash-spv`, `key-wallet`, `rpc-*`, utilities (`fuzz`, `test-utils`), and FFI crates (`*-ffi`)
Applied to files:
dash-spv/src/sync/headers/mod.rsdash-spv/src/sync/masternodes/mod.rs
📚 Learning: 2025-12-01T08:00:37.919Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-01T08:00:37.919Z
Learning: Applies to key-wallet/**/tests/**/*.rs : Organize tests by functionality: BIP32 key derivation, mnemonic generation/validation, address generation/validation, path derivation, and PSBT serialization in separate test files
Applied to files:
dash-spv/tests/chainlock_validation_test.rs
📚 Learning: 2025-12-01T07:59:58.608Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-12-01T07:59:58.608Z
Learning: Applies to dash-spv-ffi/src/**/*.rs : Use `#[no_mangle] extern "C"` attribute when implementing new FFI functions in Rust
Applied to files:
dash-spv/src/sync/masternodes/mod.rs
📚 Learning: 2025-12-01T08:01:18.174Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-01T08:01:18.174Z
Learning: Keep Rust modules focused and organized
Applied to files:
dash-spv/src/sync/masternodes/mod.rs
🧬 Code graph analysis (1)
dash-spv/src/sync/manager.rs (3)
dash-spv/src/sync/headers/manager.rs (3)
storage(346-346)new(68-102)load_headers_from_storage(105-225)dash-spv/src/sync/transitions.rs (1)
new(19-23)dash-spv/src/sync/phases.rs (1)
name(121-143)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (19)
- GitHub Check: RPC Tests (stable, true)
- GitHub Check: Core Components Tests
- GitHub Check: SPV Components Tests
- GitHub Check: fuzz (hashes_sha1)
- GitHub Check: fuzz (hashes_sha512_256)
- GitHub Check: fuzz (hashes_sha256)
- GitHub Check: fuzz (hashes_sha512)
- GitHub Check: fuzz (hashes_cbor)
- GitHub Check: fuzz (dash_deserialize_amount)
- GitHub Check: fuzz (dash_script_bytes_to_asm_fmt)
- GitHub Check: fuzz (dash_deserialize_script)
- GitHub Check: fuzz (dash_deserialize_block)
- GitHub Check: fuzz (hashes_ripemd160)
- GitHub Check: fuzz (dash_deser_net_msg)
- GitHub Check: fuzz (hashes_json)
- GitHub Check: fuzz (dash_outpoint_string)
- GitHub Check: fuzz (dash_deserialize_address)
- GitHub Check: fuzz (dash_deserialize_witness)
- GitHub Check: Pre-commit (ubuntu-latest)
🔇 Additional comments (17)
dash-spv/src/sync/masternodes/embedded_data.rs (1)
8-15: include_bytes! paths correctly adjusted for new module locationThe extra
../in both include paths matches moving this file one directory deeper undersync/masternodes/; no behavioral change beyond fixing the artifact location.dash-spv/src/client/core.rs (1)
21-25: SyncManager import re-pointed to new sync module surfaceUsing
crate::sync::SyncManagerinstead of the oldsequentialpath keeps all existing usages intact and aligns with the new sync module layout.dash-spv/src/client/progress.rs (1)
8-13: SyncPhase import updated to top-level sync namespaceSwitching to
crate::sync::SyncPhasekeepsmap_phase_to_stagesemantics unchanged while matching the new sync module structure (phase‑based coordination).dash-spv/src/client/lifecycle.rs (1)
15-21: SyncManager import aligned with flattened sync moduleUsing
crate::sync::SyncManagermatches the new organization while preserving constructor usage and client lifecycle behavior.dash-spv/src/client/message_handler_test.rs (1)
1-18: Commented-out tests updated to new SyncManager pathThe import in the disabled test module now points at
crate::sync::SyncManager, matching the new layout. Since the block is commented out, this is purely preparatory and harmless.dash-spv/tests/chainlock_validation_test.rs (1)
355-364: SyncPhase reference in ignored test updated to new public pathEven though this section is commented and the test is ignored, switching to
dash_spv::sync::SyncPhase::FullySyncedmatches the refactored sync API and will be correct when these tests are eventually revived.dash-spv/src/sync/headers/manager.rs (2)
15-15: Import path correctly updated to match new module structure.The import path change from
crate::sync::headers2_statetocrate::sync::headers2is consistent with the restructuring whereheaders2_state.rswas moved into theheaders2/subdirectory with its contents now accessible viaheaders2::Headers2StateManager.
614-616: Pattern path correctly updated for module restructuring.The
ProcessErrorpath update aligns with the newheaders2module structure.dash-spv/src/sync/masternodes/mod.rs (1)
1-6: Clean module structure following Rust best practices.The module correctly encapsulates implementation details in the private
managermodule while exposing the publicMasternodeSyncManagerAPI. Theembedded_datamodule is appropriately public to allow access to embedded masternode data.dash-spv/src/sync/headers2/mod.rs (1)
1-5: Well-structured module with appropriate public API surface.The module encapsulates implementation in the private
managermodule while re-exporting the three public types needed by consumers:Headers2StateManagerfor state management,Headers2Statsfor metrics, andProcessErrorfor error handling.dash-spv/src/sync/headers/mod.rs (1)
1-5: Consistent module structure with appropriate exports.The module follows the same clean pattern as the other restructured modules, keeping implementation private while exposing the public
HeaderSyncManagerand its configuration typeReorgConfig.dash-spv/src/sync/mod.rs (2)
12-16: Excellent lock ordering documentation for deadlock prevention.The documented lock acquisition order (state → storage → network) is crucial for preventing deadlocks in async code. This explicit documentation helps future contributors maintain thread-safety.
31-52: Clean module organization with comprehensive public API.The new modular structure with separate modules for headers, headers2, masternodes, and the sync pipeline components (phases, transitions, etc.) provides good separation of concerns. The re-exports create a flat public API surface making it easier for consumers.
dash-spv/src/sync/manager.rs (4)
23-62: Excellent documentation on generic design rationale.The detailed explanation of why generics are used (testing, performance, delegation, zero runtime cost) provides valuable context for contributors. This documentation clearly justifies the complexity while explaining the practical benefits.
108-138: Well-structured constructor with appropriate defaults.The constructor properly initializes all sub-managers and provides sensible defaults for phase timeout (60s) and retry count (3). Error mapping to
SyncError::InvalidStateis appropriate for initialization failures.
160-176: Good defensive handling for unknown network variants.The explicit handling of unknown network variants by returning
None(line 168) is preferable to defaulting to a potentially incorrect network. The explicitdrop(wallet_guard)on line 174 is good practice for clarity, though the guard would drop naturally at function end.
3-16: Updated imports align with new module structure.The imports correctly use
super::phasesandsuper::transitionsfor sibling modules, andcrate::syncfor the re-exported sub-managers. The new dependencies (SharedFilterHeights,SpvStats,WalletInterface, etc.) are appropriately imported for the expanded constructor.
29cb8f5 to
b93ff0e
Compare
b93ff0e to
ed72f5b
Compare
ZocoLini
left a comment
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.
Love this new structure
This is some restructuring in the sync folder.
Based on:
SequentialSyncManagertoSyncManager#235Structure before:
Structure with this PR:
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.