-
Notifications
You must be signed in to change notification settings - Fork 8
fix: prevent memory leaks in FFI tests #323
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
base: v0.41-dev
Are you sure you want to change the base?
Conversation
The tests were wrapping `FFIArray` in a `Box` before passing to `dash_spv_ffi_array_destroy`, but that function only frees the internal data buffer, not the struct itself. This caused the `Box` allocations to leak.
- Properly keep track of all create wallets and wallet infos and clean them up at the end. - Head allocate wallet infos like it would happen in real FFI usage and free them properly at the end.
- Modified `set_error`, `set_success`, and `ffi_error_set` macro to free previous error messages before setting new ones - Added `FFIError::free_message` helper for test cleanup - Added cleanup in all relevalt tests
📝 WalkthroughWalkthroughThis pull request refactors memory management and resource cleanup across multiple test suites and the FFI error module. Changes include introducing a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (23)
🧰 Additional context used📓 Path-based instructions (5)**/*.{rs,toml}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.rs📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*-ffi/**/*.rs📄 CodeRabbit inference engine (CLAUDE.md)
Files:
dash-spv-ffi/tests/unit/**/*.rs📄 CodeRabbit inference engine (dash-spv-ffi/CLAUDE.md)
Files:
**/tests/**/*.rs📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (46)📓 Common learnings📚 Learning: 2025-12-22T17:59:37.849ZApplied to files:
📚 Learning: 2025-12-22T17:59:37.849ZApplied to files:
📚 Learning: 2025-12-01T07:59:58.608ZApplied to files:
📚 Learning: 2025-12-01T07:59:58.608ZApplied to files:
📚 Learning: 2025-12-19T00:07:22.904ZApplied to files:
📚 Learning: 2025-12-22T17:59:51.097ZApplied to files:
📚 Learning: 2025-12-01T07:59:58.608ZApplied to files:
📚 Learning: 2025-12-01T07:59:58.608ZApplied to files:
📚 Learning: 2025-12-22T17:59:51.097ZApplied to files:
📚 Learning: 2025-06-26T15:48:36.342ZApplied to files:
📚 Learning: 2025-12-19T00:07:22.904ZApplied to files:
📚 Learning: 2025-06-26T15:49:53.811ZApplied to files:
📚 Learning: 2025-12-19T00:07:22.904ZApplied to files:
📚 Learning: 2025-12-19T00:07:22.904ZApplied to files:
📚 Learning: 2025-12-19T00:07:22.904ZApplied to files:
📚 Learning: 2025-12-19T00:07:22.904ZApplied to files:
📚 Learning: 2025-12-19T00:07:22.904ZApplied to files:
📚 Learning: 2025-12-19T00:07:22.904ZApplied to files:
📚 Learning: 2025-12-19T00:07:22.904ZApplied to files:
📚 Learning: 2025-12-01T07:59:58.608ZApplied to files:
📚 Learning: 2025-12-01T07:59:58.608ZApplied to files:
📚 Learning: 2025-12-16T09:03:55.811ZApplied to files:
📚 Learning: 2025-12-01T07:59:58.608ZApplied to files:
📚 Learning: 2025-12-22T17:59:51.097ZApplied to files:
📚 Learning: 2025-12-19T00:07:22.904ZApplied to files:
📚 Learning: 2025-12-19T00:07:22.904ZApplied to files:
📚 Learning: 2025-12-19T00:07:22.904ZApplied to files:
📚 Learning: 2025-12-19T00:07:22.904ZApplied to files:
📚 Learning: 2025-12-16T09:03:55.811ZApplied to files:
📚 Learning: 2025-08-21T05:01:58.949ZApplied to files:
📚 Learning: 2025-06-15T16:42:18.187ZApplied to files:
📚 Learning: 2025-06-15T15:31:44.136ZApplied to files:
📚 Learning: 2025-12-19T00:07:22.904ZApplied to files:
📚 Learning: 2025-02-27T05:39:16.767ZApplied to files:
📚 Learning: 2025-12-01T07:59:58.608ZApplied to files:
📚 Learning: 2025-12-22T17:59:37.849ZApplied to files:
📚 Learning: 2025-12-19T00:07:22.904ZApplied to files:
📚 Learning: 2025-12-22T17:59:37.849ZApplied to files:
📚 Learning: 2025-12-22T17:59:37.849ZApplied to files:
📚 Learning: 2025-12-16T09:03:55.811ZApplied to files:
📚 Learning: 2025-12-16T09:03:55.811ZApplied to files:
📚 Learning: 2025-06-26T16:01:37.609ZApplied to files:
📚 Learning: 2025-12-16T09:03:55.811ZApplied to files:
📚 Learning: 2025-11-27T10:30:54.015ZApplied to files:
📚 Learning: 2025-12-22T17:59:37.849ZApplied to files:
🧬 Code graph analysis (21)key-wallet-ffi/src/address_tests.rs (3)
key-wallet-ffi/src/account_tests.rs (3)
key-wallet-ffi/src/error.rs (2)
key-wallet-ffi/src/transaction_tests.rs (3)
dash-spv-ffi/tests/unit/test_type_conversions.rs (1)
key-wallet-ffi/src/address_pool.rs (3)
key-wallet-ffi/src/account_derivation_tests.rs (3)
dash-spv-ffi/tests/unit/test_memory_management.rs (1)
key-wallet-ffi/src/derivation_tests.rs (3)
key-wallet-ffi/tests/integration_test.rs (3)
key-wallet-ffi/src/wallet_tests.rs (3)
key-wallet-ffi/src/managed_wallet.rs (3)
dash-spv-ffi/tests/test_types.rs (2)
key-wallet-ffi/src/managed_wallet_tests.rs (3)
key-wallet-ffi/src/wallet_manager_tests.rs (5)
key-wallet-ffi/src/utxo_tests.rs (1)
key-wallet-ffi/tests/test_managed_account_collection.rs (3)
key-wallet-ffi/tests/test_import_wallet.rs (4)
key-wallet-ffi/src/keys_tests.rs (3)
key-wallet-ffi/src/mnemonic_tests.rs (3)
key-wallet-ffi/src/wallet_manager_serialization_tests.rs (3)
⏰ 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). (20)
🔇 Additional comments (35)
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 |
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: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
key-wallet-ffi/src/account_derivation_tests.rs (1)
225-227:c_strreturns a dangling pointer (UB across all FFI calls using it)
c_strcurrently does:fn c_str(s: &str) -> *const c_char { std::ffi::CString::new(s).unwrap().as_ptr() }The
CStringis dropped at the end ofc_str, so the returned pointer immediately dangles and every FFI call using it operates on freed memory. This is undefined behavior and breaks the “be careful with FFI memory management” guideline for*-fficode.Consider changing to something that keeps the
CStringalive for at least as long as the FFI call, e.g. by returning an owning wrapper from the tests:Suggested fix using an owning helper
-// Helper to make C string pointers -fn c_str(s: &str) -> *const c_char { - std::ffi::CString::new(s).unwrap().as_ptr() -} +// Helper type to keep CString alive for the duration of the FFI call +struct TestCString { + inner: CString, +} + +impl TestCString { + fn new(s: &str) -> Self { + Self { inner: CString::new(s).unwrap() } + } + fn as_ptr(&self) -> *const c_char { + self.inner.as_ptr() + } +}Then in tests:
let mnemonic = TestCString::new(MNEMONIC); let wallet = unsafe { wallet::wallet_create_from_mnemonic( mnemonic.as_ptr(), passphrase.as_ptr(), FFINetwork::Testnet, &mut error, ) };
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (23)
dash-spv-ffi/tests/test_types.rsdash-spv-ffi/tests/unit/test_client_lifecycle.rsdash-spv-ffi/tests/unit/test_memory_management.rsdash-spv-ffi/tests/unit/test_type_conversions.rskey-wallet-ffi/src/account_derivation_tests.rskey-wallet-ffi/src/account_tests.rskey-wallet-ffi/src/address_pool.rskey-wallet-ffi/src/address_tests.rskey-wallet-ffi/src/derivation_tests.rskey-wallet-ffi/src/error.rskey-wallet-ffi/src/keys_tests.rskey-wallet-ffi/src/managed_wallet.rskey-wallet-ffi/src/managed_wallet_tests.rskey-wallet-ffi/src/mnemonic_tests.rskey-wallet-ffi/src/transaction_tests.rskey-wallet-ffi/src/utxo_tests.rskey-wallet-ffi/src/wallet_manager_serialization_tests.rskey-wallet-ffi/src/wallet_manager_tests.rskey-wallet-ffi/src/wallet_tests.rskey-wallet-ffi/tests/integration_test.rskey-wallet-ffi/tests/test_error_conversions.rskey-wallet-ffi/tests/test_import_wallet.rskey-wallet-ffi/tests/test_managed_account_collection.rs
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{rs,toml}
📄 CodeRabbit inference engine (CLAUDE.md)
Never hardcode network parameters, addresses, or keys
Files:
key-wallet-ffi/src/address_tests.rskey-wallet-ffi/src/account_tests.rskey-wallet-ffi/src/error.rskey-wallet-ffi/src/transaction_tests.rsdash-spv-ffi/tests/unit/test_type_conversions.rskey-wallet-ffi/src/address_pool.rskey-wallet-ffi/tests/test_error_conversions.rskey-wallet-ffi/src/account_derivation_tests.rsdash-spv-ffi/tests/unit/test_memory_management.rskey-wallet-ffi/src/derivation_tests.rskey-wallet-ffi/tests/integration_test.rskey-wallet-ffi/src/wallet_tests.rskey-wallet-ffi/src/managed_wallet.rsdash-spv-ffi/tests/test_types.rskey-wallet-ffi/src/managed_wallet_tests.rskey-wallet-ffi/src/wallet_manager_tests.rskey-wallet-ffi/src/utxo_tests.rskey-wallet-ffi/tests/test_managed_account_collection.rskey-wallet-ffi/tests/test_import_wallet.rskey-wallet-ffi/src/keys_tests.rskey-wallet-ffi/src/mnemonic_tests.rskey-wallet-ffi/src/wallet_manager_serialization_tests.rsdash-spv-ffi/tests/unit/test_client_lifecycle.rs
**/*.rs
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.rs: Use proper error types (thiserror) and propagate errors appropriately
Use tokio runtime for async operations
Use conditional compilation with feature flags for optional features
Write unit tests for new functionality
Use secure random number generation for keys
Never log or expose private keys
Code must target Rust 1.89 minimum supported version (MSRV)
Format code using cargo fmt
Pass clippy linting without warnings
**/*.rs: MSRV (Minimum Supported Rust Version) is 1.89; ensure compatibility with this version for all builds
Unit tests should live alongside code with#[cfg(test)]annotation; integration tests use thetests/directory
Usesnake_casefor function and variable names
UseUpperCamelCasefor types and traits
UseSCREAMING_SNAKE_CASEfor constants
Format code withrustfmtbefore commits; ensurecargo fmt --allis run
Runcargo clippy --workspace --all-targets -- -D warningsfor linting; avoid warnings in CI
Preferasync/awaitviatokiofor asynchronous operations
Files:
key-wallet-ffi/src/address_tests.rskey-wallet-ffi/src/account_tests.rskey-wallet-ffi/src/error.rskey-wallet-ffi/src/transaction_tests.rsdash-spv-ffi/tests/unit/test_type_conversions.rskey-wallet-ffi/src/address_pool.rskey-wallet-ffi/tests/test_error_conversions.rskey-wallet-ffi/src/account_derivation_tests.rsdash-spv-ffi/tests/unit/test_memory_management.rskey-wallet-ffi/src/derivation_tests.rskey-wallet-ffi/tests/integration_test.rskey-wallet-ffi/src/wallet_tests.rskey-wallet-ffi/src/managed_wallet.rsdash-spv-ffi/tests/test_types.rskey-wallet-ffi/src/managed_wallet_tests.rskey-wallet-ffi/src/wallet_manager_tests.rskey-wallet-ffi/src/utxo_tests.rskey-wallet-ffi/tests/test_managed_account_collection.rskey-wallet-ffi/tests/test_import_wallet.rskey-wallet-ffi/src/keys_tests.rskey-wallet-ffi/src/mnemonic_tests.rskey-wallet-ffi/src/wallet_manager_serialization_tests.rsdash-spv-ffi/tests/unit/test_client_lifecycle.rs
**/*-ffi/**/*.rs
📄 CodeRabbit inference engine (CLAUDE.md)
**/*-ffi/**/*.rs: Exercise careful handling at FFI boundaries for memory safety
Be careful with FFI memory management
Files:
key-wallet-ffi/src/address_tests.rskey-wallet-ffi/src/account_tests.rskey-wallet-ffi/src/error.rskey-wallet-ffi/src/transaction_tests.rsdash-spv-ffi/tests/unit/test_type_conversions.rskey-wallet-ffi/src/address_pool.rskey-wallet-ffi/tests/test_error_conversions.rskey-wallet-ffi/src/account_derivation_tests.rsdash-spv-ffi/tests/unit/test_memory_management.rskey-wallet-ffi/src/derivation_tests.rskey-wallet-ffi/tests/integration_test.rskey-wallet-ffi/src/wallet_tests.rskey-wallet-ffi/src/managed_wallet.rsdash-spv-ffi/tests/test_types.rskey-wallet-ffi/src/managed_wallet_tests.rskey-wallet-ffi/src/wallet_manager_tests.rskey-wallet-ffi/src/utxo_tests.rskey-wallet-ffi/tests/test_managed_account_collection.rskey-wallet-ffi/tests/test_import_wallet.rskey-wallet-ffi/src/keys_tests.rskey-wallet-ffi/src/mnemonic_tests.rskey-wallet-ffi/src/wallet_manager_serialization_tests.rsdash-spv-ffi/tests/unit/test_client_lifecycle.rs
dash-spv-ffi/tests/unit/**/*.rs
📄 CodeRabbit inference engine (dash-spv-ffi/CLAUDE.md)
Add corresponding unit tests in
tests/unit/for each new FFI function
Files:
dash-spv-ffi/tests/unit/test_type_conversions.rsdash-spv-ffi/tests/unit/test_memory_management.rsdash-spv-ffi/tests/unit/test_client_lifecycle.rs
**/tests/**/*.rs
📄 CodeRabbit inference engine (CLAUDE.md)
**/tests/**/*.rs: Create integration tests for network operations
Test both mainnet and testnet configurations
Use proptest for property-based testing where appropriate
**/tests/**/*.rs: Use descriptive test names (e.g.,test_parse_address_mainnet)
Mark network-dependent or long-running tests with#[ignore]and run with-- --ignored
Files:
dash-spv-ffi/tests/unit/test_type_conversions.rskey-wallet-ffi/tests/test_error_conversions.rsdash-spv-ffi/tests/unit/test_memory_management.rskey-wallet-ffi/tests/integration_test.rsdash-spv-ffi/tests/test_types.rskey-wallet-ffi/tests/test_managed_account_collection.rskey-wallet-ffi/tests/test_import_wallet.rsdash-spv-ffi/tests/unit/test_client_lifecycle.rs
🧠 Learnings (46)
📓 Common learnings
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 : All FFI types must have corresponding `_destroy()` functions for explicit memory management
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 : Input strings in FFI functions are `*const c_char` (borrowed, not freed by C caller)
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 : Rust strings must be returned as `*const c_char` with caller responsibility to free using `dash_string_free`
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
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 thread-local storage for error propagation via `dash_spv_ffi_get_last_error()` function
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-22T17:59:37.849Z
Learning: Applies to **/*-ffi/**/*.rs : Be careful with FFI memory management
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/c_tests/**/*.{c,h} : Add corresponding C tests in `tests/c_tests/` for each new FFI function
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-22T17:59:37.849Z
Learning: Applies to **/*-ffi/**/*.rs : Exercise careful handling at FFI boundaries for memory safety
📚 Learning: 2025-12-22T17:59:37.849Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-22T17:59:37.849Z
Learning: Applies to **/*-ffi/**/*.rs : Be careful with FFI memory management
Applied to files:
key-wallet-ffi/src/address_tests.rskey-wallet-ffi/src/error.rskey-wallet-ffi/src/transaction_tests.rsdash-spv-ffi/tests/unit/test_type_conversions.rskey-wallet-ffi/src/address_pool.rskey-wallet-ffi/tests/test_error_conversions.rskey-wallet-ffi/src/account_derivation_tests.rsdash-spv-ffi/tests/unit/test_memory_management.rskey-wallet-ffi/src/derivation_tests.rskey-wallet-ffi/tests/integration_test.rskey-wallet-ffi/src/wallet_tests.rskey-wallet-ffi/src/managed_wallet.rsdash-spv-ffi/tests/test_types.rskey-wallet-ffi/src/managed_wallet_tests.rskey-wallet-ffi/src/utxo_tests.rskey-wallet-ffi/src/keys_tests.rskey-wallet-ffi/src/mnemonic_tests.rs
📚 Learning: 2025-12-22T17:59:37.849Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-22T17:59:37.849Z
Learning: Applies to **/*-ffi/**/*.rs : Exercise careful handling at FFI boundaries for memory safety
Applied to files:
key-wallet-ffi/src/address_tests.rskey-wallet-ffi/src/error.rskey-wallet-ffi/src/transaction_tests.rsdash-spv-ffi/tests/unit/test_type_conversions.rskey-wallet-ffi/tests/test_error_conversions.rskey-wallet-ffi/src/account_derivation_tests.rsdash-spv-ffi/tests/unit/test_memory_management.rskey-wallet-ffi/src/derivation_tests.rskey-wallet-ffi/tests/integration_test.rskey-wallet-ffi/src/managed_wallet.rsdash-spv-ffi/tests/test_types.rskey-wallet-ffi/src/keys_tests.rskey-wallet-ffi/src/mnemonic_tests.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:
key-wallet-ffi/src/address_tests.rskey-wallet-ffi/src/account_tests.rskey-wallet-ffi/src/transaction_tests.rsdash-spv-ffi/tests/unit/test_type_conversions.rskey-wallet-ffi/tests/test_error_conversions.rsdash-spv-ffi/tests/unit/test_memory_management.rskey-wallet-ffi/src/derivation_tests.rsdash-spv-ffi/tests/test_types.rskey-wallet-ffi/src/utxo_tests.rskey-wallet-ffi/src/wallet_manager_serialization_tests.rsdash-spv-ffi/tests/unit/test_client_lifecycle.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 : All FFI types must have corresponding `_destroy()` functions for explicit memory management
Applied to files:
key-wallet-ffi/src/address_tests.rskey-wallet-ffi/src/account_tests.rskey-wallet-ffi/src/error.rsdash-spv-ffi/tests/unit/test_type_conversions.rskey-wallet-ffi/src/address_pool.rsdash-spv-ffi/tests/unit/test_memory_management.rskey-wallet-ffi/src/derivation_tests.rsdash-spv-ffi/tests/test_types.rskey-wallet-ffi/src/utxo_tests.rsdash-spv-ffi/tests/unit/test_client_lifecycle.rs
📚 Learning: 2025-12-19T00:07:22.904Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-19T00:07:22.904Z
Learning: Applies to key-wallet/**/*.rs : Use the `?` operator for error propagation, provide context in error messages, never panic in library code, and return `Result<T>` for all fallible operations
Applied to files:
key-wallet-ffi/src/address_tests.rskey-wallet-ffi/src/account_tests.rskey-wallet-ffi/src/error.rskey-wallet-ffi/src/transaction_tests.rskey-wallet-ffi/src/address_pool.rskey-wallet-ffi/tests/test_error_conversions.rskey-wallet-ffi/src/account_derivation_tests.rskey-wallet-ffi/src/derivation_tests.rskey-wallet-ffi/tests/integration_test.rskey-wallet-ffi/src/wallet_tests.rskey-wallet-ffi/src/managed_wallet.rskey-wallet-ffi/src/managed_wallet_tests.rskey-wallet-ffi/src/wallet_manager_tests.rskey-wallet-ffi/src/utxo_tests.rskey-wallet-ffi/tests/test_managed_account_collection.rskey-wallet-ffi/tests/test_import_wallet.rskey-wallet-ffi/src/keys_tests.rskey-wallet-ffi/src/mnemonic_tests.rskey-wallet-ffi/src/wallet_manager_serialization_tests.rs
📚 Learning: 2025-12-22T17:59:51.097Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-22T17:59:51.097Z
Learning: Applies to **/tests/**/*.rs : Use descriptive test names (e.g., `test_parse_address_mainnet`)
Applied to files:
key-wallet-ffi/src/address_tests.rskey-wallet-ffi/src/account_tests.rskey-wallet-ffi/src/account_derivation_tests.rskey-wallet-ffi/src/wallet_manager_tests.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 : Input strings in FFI functions are `*const c_char` (borrowed, not freed by C caller)
Applied to files:
key-wallet-ffi/src/address_tests.rskey-wallet-ffi/src/error.rskey-wallet-ffi/src/transaction_tests.rsdash-spv-ffi/tests/unit/test_type_conversions.rsdash-spv-ffi/tests/unit/test_memory_management.rskey-wallet-ffi/src/derivation_tests.rskey-wallet-ffi/tests/integration_test.rsdash-spv-ffi/tests/test_types.rskey-wallet-ffi/src/mnemonic_tests.rsdash-spv-ffi/tests/unit/test_client_lifecycle.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 : Rust strings must be returned as `*const c_char` with caller responsibility to free using `dash_string_free`
Applied to files:
key-wallet-ffi/src/address_tests.rskey-wallet-ffi/src/error.rsdash-spv-ffi/tests/unit/test_type_conversions.rskey-wallet-ffi/src/address_pool.rsdash-spv-ffi/tests/unit/test_memory_management.rsdash-spv-ffi/tests/test_types.rskey-wallet-ffi/src/mnemonic_tests.rsdash-spv-ffi/tests/unit/test_client_lifecycle.rs
📚 Learning: 2025-12-22T17:59:51.097Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-22T17:59:51.097Z
Learning: Applies to src/**/*.rs : Avoid `unwrap()` and `expect()` in library code; use proper error types (e.g., `thiserror`)
Applied to files:
key-wallet-ffi/src/address_tests.rskey-wallet-ffi/src/transaction_tests.rskey-wallet-ffi/src/account_derivation_tests.rskey-wallet-ffi/src/derivation_tests.rskey-wallet-ffi/tests/integration_test.rskey-wallet-ffi/src/wallet_tests.rskey-wallet-ffi/src/mnemonic_tests.rs
📚 Learning: 2025-06-26T15:48:36.342Z
Learnt from: DCG-Claude
Repo: dashpay/rust-dashcore PR: 0
File: :0-0
Timestamp: 2025-06-26T15:48:36.342Z
Learning: In Rust FFI code, unwrap() must not be used on CString::new, especially for error messages or untrusted input, as it can panic if the string contains null bytes. Instead, use unwrap_or_else with a fallback to a known-safe, hardcoded string to prevent panics across FFI boundaries.
Applied to files:
key-wallet-ffi/src/address_tests.rskey-wallet-ffi/src/account_tests.rskey-wallet-ffi/src/error.rskey-wallet-ffi/src/transaction_tests.rskey-wallet-ffi/tests/test_error_conversions.rskey-wallet-ffi/src/account_derivation_tests.rsdash-spv-ffi/tests/unit/test_memory_management.rskey-wallet-ffi/src/derivation_tests.rskey-wallet-ffi/tests/integration_test.rskey-wallet-ffi/src/wallet_tests.rskey-wallet-ffi/src/managed_wallet.rsdash-spv-ffi/tests/test_types.rskey-wallet-ffi/src/managed_wallet_tests.rskey-wallet-ffi/src/keys_tests.rskey-wallet-ffi/src/mnemonic_tests.rs
📚 Learning: 2025-12-19T00:07:22.904Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-19T00:07:22.904Z
Learning: Applies to key-wallet/**/*.rs : Always validate network consistency when deriving or validating addresses; never mix mainnet and testnet operations
Applied to files:
key-wallet-ffi/src/address_tests.rskey-wallet-ffi/tests/test_error_conversions.rskey-wallet-ffi/src/account_derivation_tests.rskey-wallet-ffi/src/wallet_tests.rskey-wallet-ffi/src/managed_wallet.rskey-wallet-ffi/tests/test_managed_account_collection.rskey-wallet-ffi/tests/test_import_wallet.rskey-wallet-ffi/src/wallet_manager_serialization_tests.rs
📚 Learning: 2025-06-26T15:49:53.811Z
Learnt from: DCG-Claude
Repo: dashpay/rust-dashcore PR: 0
File: :0-0
Timestamp: 2025-06-26T15:49:53.811Z
Learning: In Rust FFI code, using thread-local storage for error reporting is unsafe in multi-threaded contexts, as callbacks may execute on different threads than the caller, leading to lost or invisible errors. FFI error handling should use global, thread-safe storage or return errors directly via return values or out parameters.
Applied to files:
key-wallet-ffi/src/address_tests.rskey-wallet-ffi/src/account_tests.rskey-wallet-ffi/src/error.rskey-wallet-ffi/src/transaction_tests.rskey-wallet-ffi/src/account_derivation_tests.rsdash-spv-ffi/tests/unit/test_memory_management.rskey-wallet-ffi/src/derivation_tests.rskey-wallet-ffi/tests/integration_test.rskey-wallet-ffi/src/managed_wallet.rskey-wallet-ffi/src/managed_wallet_tests.rskey-wallet-ffi/src/keys_tests.rskey-wallet-ffi/src/mnemonic_tests.rs
📚 Learning: 2025-12-19T00:07:22.904Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-19T00:07:22.904Z
Learning: Applies to key-wallet/**/*.rs : Separate immutable structures (`Account`, `Wallet`) containing only identity information from mutable wrappers (`ManagedAccount`, `ManagedWalletInfo`) with state management
Applied to files:
key-wallet-ffi/src/account_tests.rskey-wallet-ffi/src/account_derivation_tests.rskey-wallet-ffi/src/wallet_tests.rskey-wallet-ffi/src/managed_wallet.rskey-wallet-ffi/src/managed_wallet_tests.rskey-wallet-ffi/src/wallet_manager_tests.rskey-wallet-ffi/src/utxo_tests.rskey-wallet-ffi/tests/test_managed_account_collection.rskey-wallet-ffi/tests/test_import_wallet.rskey-wallet-ffi/src/keys_tests.rskey-wallet-ffi/src/wallet_manager_serialization_tests.rs
📚 Learning: 2025-12-19T00:07:22.904Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-19T00:07:22.904Z
Learning: Applies to key-wallet/**/account/**/*.rs : Use enum-based type system for `AccountType` with specific variants (Standard, IdentityAuthentication, IdentityEncryption, MasternodeOperator, etc.) to provide compile-time safety and clear semantics
Applied to files:
key-wallet-ffi/src/account_tests.rskey-wallet-ffi/tests/test_error_conversions.rskey-wallet-ffi/src/account_derivation_tests.rskey-wallet-ffi/tests/test_managed_account_collection.rs
📚 Learning: 2025-12-19T00:07:22.904Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-19T00:07:22.904Z
Learning: Applies to key-wallet/**/*.rs : Use `BTreeMap` for ordered data (accounts, transactions) and `HashMap` for lookups (address mappings); apply memory management strategies for old transaction data
Applied to files:
key-wallet-ffi/src/account_tests.rskey-wallet-ffi/src/transaction_tests.rskey-wallet-ffi/src/account_derivation_tests.rskey-wallet-ffi/src/wallet_tests.rskey-wallet-ffi/src/managed_wallet.rskey-wallet-ffi/src/managed_wallet_tests.rskey-wallet-ffi/src/wallet_manager_tests.rskey-wallet-ffi/src/utxo_tests.rskey-wallet-ffi/tests/test_managed_account_collection.rskey-wallet-ffi/tests/test_import_wallet.rskey-wallet-ffi/src/keys_tests.rskey-wallet-ffi/src/wallet_manager_serialization_tests.rs
📚 Learning: 2025-12-19T00:07:22.904Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-19T00:07:22.904Z
Learning: Applies to key-wallet/**/managed_account/**/*.rs : Implement atomic state updates when processing transactions: update transactions, UTXOs, balances, and address usage state together
Applied to files:
key-wallet-ffi/src/account_tests.rskey-wallet-ffi/src/transaction_tests.rskey-wallet-ffi/src/wallet_tests.rskey-wallet-ffi/src/managed_wallet.rskey-wallet-ffi/src/managed_wallet_tests.rskey-wallet-ffi/src/wallet_manager_tests.rskey-wallet-ffi/src/utxo_tests.rskey-wallet-ffi/tests/test_managed_account_collection.rskey-wallet-ffi/tests/test_import_wallet.rskey-wallet-ffi/src/wallet_manager_serialization_tests.rs
📚 Learning: 2025-12-19T00:07:22.904Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-19T00:07:22.904Z
Learning: Applies to key-wallet/**/tests/**/*.rs : Organize unit tests by functionality: separate test files for BIP32, mnemonics, addresses, derivation paths, and PSBT operations
Applied to files:
key-wallet-ffi/src/account_tests.rskey-wallet-ffi/tests/test_error_conversions.rskey-wallet-ffi/src/account_derivation_tests.rskey-wallet-ffi/src/derivation_tests.rskey-wallet-ffi/src/wallet_tests.rskey-wallet-ffi/src/managed_wallet.rskey-wallet-ffi/src/managed_wallet_tests.rskey-wallet-ffi/src/wallet_manager_tests.rskey-wallet-ffi/src/utxo_tests.rskey-wallet-ffi/tests/test_import_wallet.rskey-wallet-ffi/src/keys_tests.rskey-wallet-ffi/src/wallet_manager_serialization_tests.rs
📚 Learning: 2025-12-19T00:07:22.904Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-19T00:07:22.904Z
Learning: Applies to key-wallet/**/tests/**/*.rs : Use property-based testing for complex invariants such as gap limit constraints
Applied to files:
key-wallet-ffi/src/account_tests.rskey-wallet-ffi/src/transaction_tests.rskey-wallet-ffi/tests/test_error_conversions.rskey-wallet-ffi/src/account_derivation_tests.rskey-wallet-ffi/src/derivation_tests.rskey-wallet-ffi/src/wallet_tests.rskey-wallet-ffi/src/managed_wallet.rskey-wallet-ffi/src/managed_wallet_tests.rskey-wallet-ffi/src/wallet_manager_tests.rskey-wallet-ffi/src/utxo_tests.rskey-wallet-ffi/tests/test_managed_account_collection.rskey-wallet-ffi/tests/test_import_wallet.rskey-wallet-ffi/src/keys_tests.rs
📚 Learning: 2025-12-19T00:07:22.904Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-19T00:07:22.904Z
Learning: Applies to key-wallet/**/transaction_checking/**/*.rs : Implement transaction classification and routing through `TransactionRouter` to avoid checking all accounts for every transaction
Applied to files:
key-wallet-ffi/src/transaction_tests.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-ffi/tests/unit/test_type_conversions.rsdash-spv-ffi/tests/unit/test_memory_management.rsdash-spv-ffi/tests/test_types.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-ffi/tests/unit/test_type_conversions.rsdash-spv-ffi/tests/unit/test_memory_management.rsdash-spv-ffi/tests/test_types.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/tests/**/*.rs : Organize tests into unit tests (in-module), integration tests (tests/ directory), real network tests (with live Dash Core nodes), and performance benchmarks
Applied to files:
dash-spv-ffi/tests/unit/test_type_conversions.rsdash-spv-ffi/tests/unit/test_memory_management.rsdash-spv-ffi/tests/unit/test_client_lifecycle.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 thread-local storage for error propagation via `dash_spv_ffi_get_last_error()` function
Applied to files:
dash-spv-ffi/tests/unit/test_type_conversions.rsdash-spv-ffi/tests/unit/test_memory_management.rskey-wallet-ffi/tests/integration_test.rsdash-spv-ffi/tests/test_types.rsdash-spv-ffi/tests/unit/test_client_lifecycle.rs
📚 Learning: 2025-12-22T17:59:51.097Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-22T17:59:51.097Z
Learning: FFI bindings are organized in `*-ffi` crates; shared helpers in `internals/` and `test-utils/`
Applied to files:
dash-spv-ffi/tests/unit/test_type_conversions.rskey-wallet-ffi/tests/test_error_conversions.rsdash-spv-ffi/tests/unit/test_memory_management.rsdash-spv-ffi/tests/test_types.rs
📚 Learning: 2025-12-19T00:07:22.904Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-19T00:07:22.904Z
Learning: Applies to key-wallet/**/address_pool/**/*.rs : Generate addresses in batches using gap limit and staged generation instead of unbounded address generation to prevent memory and performance issues
Applied to files:
key-wallet-ffi/src/address_pool.rskey-wallet-ffi/src/managed_wallet.rs
📚 Learning: 2025-12-19T00:07:22.904Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-19T00:07:22.904Z
Learning: Applies to key-wallet/**/address_pool/**/*.rs : Pre-generate addresses in batches (typically 20-100) and store them in pools; only derive on-demand when the pool is exhausted
Applied to files:
key-wallet-ffi/src/address_pool.rskey-wallet-ffi/src/managed_wallet.rs
📚 Learning: 2025-12-19T00:07:22.904Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-19T00:07:22.904Z
Learning: Applies to key-wallet/**/address_pool/**/*.rs : Use staged gap limit management with `GapLimitStage` tracking `last_used_index` and `used_indices` to enable efficient address discovery without loading entire chains into memory
Applied to files:
key-wallet-ffi/src/address_pool.rskey-wallet-ffi/src/managed_wallet.rs
📚 Learning: 2025-12-19T00:07:22.904Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-19T00:07:22.904Z
Learning: Applies to key-wallet/**/address_pool/**/*.rs : Support multiple `KeySource` variants (Private, Public, NoKeySource) to enable both full wallets and watch-only wallets with the same interface
Applied to files:
key-wallet-ffi/src/address_pool.rskey-wallet-ffi/tests/test_error_conversions.rskey-wallet-ffi/src/managed_wallet_tests.rskey-wallet-ffi/tests/test_import_wallet.rskey-wallet-ffi/src/keys_tests.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: When adding new features, define traits for abstractions, implement concrete types following existing patterns, add comprehensive unit tests, add integration tests for network interaction, and update error types in error.rs
Applied to files:
key-wallet-ffi/tests/test_error_conversions.rskey-wallet-ffi/src/derivation_tests.rs
📚 Learning: 2025-08-21T05:01:58.949Z
Learnt from: QuantumExplorer
Repo: dashpay/rust-dashcore PR: 108
File: key-wallet-ffi/src/wallet_manager.rs:270-318
Timestamp: 2025-08-21T05:01:58.949Z
Learning: In the key-wallet-ffi design, wallets retrieved from the wallet manager via lookup functions should return const pointers (*const FFIWallet) to enforce read-only access and prevent unintended modifications. The wallet manager should control wallet lifecycle and mutations through specific APIs rather than allowing external mutation of retrieved wallet references.
Applied to files:
key-wallet-ffi/tests/test_error_conversions.rskey-wallet-ffi/tests/integration_test.rskey-wallet-ffi/src/managed_wallet.rskey-wallet-ffi/src/managed_wallet_tests.rskey-wallet-ffi/src/wallet_manager_tests.rskey-wallet-ffi/src/utxo_tests.rskey-wallet-ffi/tests/test_import_wallet.rskey-wallet-ffi/src/wallet_manager_serialization_tests.rs
📚 Learning: 2025-06-15T16:42:18.187Z
Learnt from: QuantumExplorer
Repo: dashpay/rust-dashcore PR: 74
File: key-wallet-ffi/src/lib_tests.rs:41-48
Timestamp: 2025-06-15T16:42:18.187Z
Learning: In key-wallet-ffi, the HDWallet::derive_xpriv method returns Result<String, KeyWalletError>, not an ExtPrivKey wrapper. When unwrapped, it yields a String that can have .is_empty() called on it.
Applied to files:
key-wallet-ffi/tests/test_error_conversions.rskey-wallet-ffi/src/account_derivation_tests.rskey-wallet-ffi/src/derivation_tests.rskey-wallet-ffi/src/wallet_tests.rskey-wallet-ffi/src/keys_tests.rs
📚 Learning: 2025-06-15T15:31:44.136Z
Learnt from: QuantumExplorer
Repo: dashpay/rust-dashcore PR: 74
File: key-wallet/src/address.rs:30-40
Timestamp: 2025-06-15T15:31:44.136Z
Learning: In the key-wallet crate, QuantumExplorer prefers keeping wildcard arms that default unknown Network variants to testnet prefixes rather than using exhaustive matches or panics. This fallback behavior is intentional.
Applied to files:
key-wallet-ffi/tests/test_error_conversions.rskey-wallet-ffi/tests/test_import_wallet.rs
📚 Learning: 2025-12-19T00:07:22.904Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-19T00:07:22.904Z
Learning: Applies to key-wallet/**/tests/**/*.rs : Use deterministic testing with known test vectors and fixed seeds for reproducible results
Applied to files:
key-wallet-ffi/src/account_derivation_tests.rskey-wallet-ffi/src/wallet_tests.rskey-wallet-ffi/src/managed_wallet_tests.rskey-wallet-ffi/src/wallet_manager_tests.rskey-wallet-ffi/tests/test_import_wallet.rskey-wallet-ffi/src/keys_tests.rskey-wallet-ffi/src/mnemonic_tests.rs
📚 Learning: 2025-02-27T05:39:16.767Z
Learnt from: QuantumExplorer
Repo: dashpay/rust-dashcore PR: 56
File: dash/src/sml/masternode_list_engine/message_request_verification.rs:91-91
Timestamp: 2025-02-27T05:39:16.767Z
Learning: In the Dash Rust codebase, unwrap() on try_into() for byte slices from hash types like QuorumSigningRequestId is safe because hash types guarantee fixed-size byte arrays (32 bytes), ensuring the slice operations and conversions will never fail.
Applied to files:
dash-spv-ffi/tests/unit/test_memory_management.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: Verify FFI callback functions may be invoked from any thread and must be thread-safe
Applied to files:
dash-spv-ffi/tests/unit/test_memory_management.rs
📚 Learning: 2025-12-22T17:59:37.849Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-22T17:59:37.849Z
Learning: Applies to **/*.rs : Use proper error types (thiserror) and propagate errors appropriately
Applied to files:
key-wallet-ffi/tests/integration_test.rs
📚 Learning: 2025-12-19T00:07:22.904Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-19T00:07:22.904Z
Learning: Applies to key-wallet/**/*.rs : Apply atomic state updates when managing watch-only wallets: validate that external signatures match expected pubkeys and never attempt signing operations
Applied to files:
key-wallet-ffi/src/wallet_tests.rskey-wallet-ffi/src/managed_wallet.rskey-wallet-ffi/src/managed_wallet_tests.rskey-wallet-ffi/src/wallet_manager_tests.rskey-wallet-ffi/src/utxo_tests.rskey-wallet-ffi/tests/test_managed_account_collection.rskey-wallet-ffi/tests/test_import_wallet.rskey-wallet-ffi/src/keys_tests.rs
📚 Learning: 2025-12-22T17:59:37.849Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-22T17:59:37.849Z
Learning: Applies to **/tests/**/*.rs : Test both mainnet and testnet configurations
Applied to files:
key-wallet-ffi/tests/test_import_wallet.rs
📚 Learning: 2025-12-22T17:59:37.849Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-22T17:59:37.849Z
Learning: Applies to **/tests/**/*.rs : Create integration tests for network operations
Applied to files:
key-wallet-ffi/tests/test_import_wallet.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/src/client/**/*.rs : Use the DashSpvClient high-level API with proper configuration via ClientConfig for client initialization
Applied to files:
dash-spv-ffi/tests/unit/test_client_lifecycle.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/tests/**/*.rs : Integration tests should gracefully handle unavailable Dash Core nodes at 127.0.0.1:9999 without failing the test suite
Applied to files:
dash-spv-ffi/tests/unit/test_client_lifecycle.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-ffi/tests/unit/test_client_lifecycle.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/**/*.rs : Use async/await throughout the codebase, built on tokio runtime
Applied to files:
dash-spv-ffi/tests/unit/test_client_lifecycle.rs
📚 Learning: 2025-11-27T10:30:54.015Z
Learnt from: xdustinface
Repo: dashpay/rust-dashcore PR: 214
File: dash-spv/examples/filter_sync.rs:48-51
Timestamp: 2025-11-27T10:30:54.015Z
Learning: The DashSpvClient::run method in dash-spv internally handles Ctrl-C shutdown by spawning a task that listens for tokio::signal::ctrl_c() and cancels the provided CancellationToken. Examples and callers should create a CancellationToken without explicitly cancelling it, as the cancellation is managed internally by the run method.
Applied to files:
dash-spv-ffi/tests/unit/test_client_lifecycle.rs
📚 Learning: 2025-12-22T17:59:37.849Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-22T17:59:37.849Z
Learning: Applies to **/{dash-network,dash-spv,key-wallet}/**/*.rs : Use async/await for async operations in network and wallet modules
Applied to files:
dash-spv-ffi/tests/unit/test_client_lifecycle.rs
🧬 Code graph analysis (21)
key-wallet-ffi/src/address_tests.rs (3)
key-wallet-ffi/src/error.rs (1)
error(44-49)key-wallet-ffi/src/managed_account.rs (1)
error(64-74)key-wallet-ffi/src/types.rs (1)
error(121-132)
key-wallet-ffi/src/account_tests.rs (3)
key-wallet-ffi/src/error.rs (1)
error(44-49)key-wallet-ffi/src/managed_account.rs (1)
error(64-74)key-wallet-ffi/src/types.rs (1)
error(121-132)
key-wallet-ffi/src/error.rs (2)
key-wallet-ffi/src/managed_account.rs (4)
error(64-74)success(55-61)std(609-609)std(667-667)key-wallet-ffi/src/types.rs (2)
error(121-132)success(112-118)
key-wallet-ffi/src/transaction_tests.rs (3)
key-wallet-ffi/src/error.rs (1)
error(44-49)key-wallet-ffi/src/managed_account.rs (1)
error(64-74)key-wallet-ffi/src/types.rs (1)
error(121-132)
dash-spv-ffi/tests/unit/test_type_conversions.rs (1)
dash-spv-ffi/src/types.rs (3)
new(24-32)new(299-313)dash_spv_ffi_array_destroy(342-357)
key-wallet-ffi/src/address_pool.rs (3)
key-wallet-ffi/src/error.rs (1)
error(44-49)key-wallet-ffi/src/managed_account.rs (1)
error(64-74)key-wallet-ffi/src/types.rs (1)
error(121-132)
key-wallet-ffi/src/account_derivation_tests.rs (3)
key-wallet-ffi/src/error.rs (1)
error(44-49)key-wallet-ffi/src/managed_account.rs (1)
error(64-74)key-wallet-ffi/src/types.rs (1)
error(121-132)
dash-spv-ffi/tests/unit/test_memory_management.rs (1)
dash-spv-ffi/src/types.rs (5)
new(24-32)new(299-313)dash_spv_ffi_array_destroy(342-357)std(310-310)std(311-311)
key-wallet-ffi/src/derivation_tests.rs (3)
key-wallet-ffi/src/error.rs (1)
error(44-49)key-wallet-ffi/src/managed_account.rs (1)
error(64-74)key-wallet-ffi/src/types.rs (1)
error(121-132)
key-wallet-ffi/tests/integration_test.rs (3)
key-wallet-ffi/src/error.rs (1)
error(44-49)key-wallet-ffi/src/managed_account.rs (1)
error(64-74)key-wallet-ffi/src/types.rs (1)
error(121-132)
key-wallet-ffi/src/wallet_tests.rs (3)
key-wallet-ffi/src/error.rs (1)
error(44-49)key-wallet-ffi/src/managed_account.rs (1)
error(64-74)key-wallet-ffi/src/types.rs (1)
error(121-132)
key-wallet-ffi/src/managed_wallet.rs (3)
key-wallet-ffi/src/error.rs (1)
error(44-49)key-wallet-ffi/src/types.rs (2)
error(121-132)new(82-86)key-wallet-ffi/src/wallet.rs (1)
wallet_free(428-434)
dash-spv-ffi/tests/test_types.rs (2)
dash-spv-ffi/tests/unit/test_memory_management.rs (1)
array(433-433)dash-spv-ffi/src/types.rs (3)
new(24-32)new(299-313)dash_spv_ffi_array_destroy(342-357)
key-wallet-ffi/src/managed_wallet_tests.rs (3)
key-wallet-ffi/src/wallet.rs (1)
wallet_free(428-434)key-wallet-ffi/src/error.rs (1)
error(44-49)key-wallet-ffi/src/types.rs (1)
error(121-132)
key-wallet-ffi/src/wallet_manager_tests.rs (5)
key-wallet-ffi/src/error.rs (1)
error(44-49)key-wallet-ffi/src/types.rs (1)
error(121-132)key-wallet-ffi/src/wallet_manager.rs (5)
wallet_manager_get_wallet(551-592)wallet_manager_get_managed_wallet_info(606-645)wallet_manager_free_wallet_ids(891-898)wallet_manager_free(874-880)wallet_manager_free_wallet_bytes(390-398)key-wallet-ffi/src/wallet.rs (1)
wallet_free(428-434)key-wallet-ffi/src/managed_wallet.rs (1)
managed_wallet_info_free(612-619)
key-wallet-ffi/src/utxo_tests.rs (1)
key-wallet-ffi/src/managed_wallet.rs (2)
new(26-30)managed_wallet_free(595-603)
key-wallet-ffi/tests/test_managed_account_collection.rs (3)
key-wallet-ffi/src/error.rs (1)
error(44-49)key-wallet-ffi/src/managed_account.rs (1)
error(64-74)key-wallet-ffi/src/types.rs (1)
error(121-132)
key-wallet-ffi/tests/test_import_wallet.rs (4)
dash-spv/src/client/core.rs (1)
wallet(158-160)key-wallet-ffi/src/wallet.rs (1)
wallet_free_const(449-457)key-wallet-ffi/src/managed_account.rs (1)
error(64-74)key-wallet-ffi/src/types.rs (1)
error(121-132)
key-wallet-ffi/src/keys_tests.rs (3)
key-wallet-ffi/src/error.rs (1)
error(44-49)key-wallet-ffi/src/managed_account.rs (1)
error(64-74)key-wallet-ffi/src/types.rs (1)
error(121-132)
key-wallet-ffi/src/mnemonic_tests.rs (3)
key-wallet-ffi/src/error.rs (1)
error(44-49)key-wallet-ffi/src/managed_account.rs (1)
error(64-74)key-wallet-ffi/src/types.rs (1)
error(121-132)
key-wallet-ffi/src/wallet_manager_serialization_tests.rs (3)
key-wallet-ffi/src/error.rs (1)
error(44-49)key-wallet-ffi/src/types.rs (1)
error(121-132)key-wallet-ffi/src/wallet_manager.rs (3)
wallet_manager_create(105-126)wallet_manager_import_wallet_from_bytes(415-486)wallet_manager_free(874-880)
⏰ 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). (20)
- GitHub Check: RPC Tests (stable, true)
- GitHub Check: SPV Components Tests
- GitHub Check: Core Components Tests
- GitHub Check: fuzz (dash_deserialize_script)
- GitHub Check: fuzz (dash_deserialize_witness)
- GitHub Check: fuzz (hashes_sha512_256)
- GitHub Check: fuzz (hashes_sha1)
- GitHub Check: fuzz (hashes_cbor)
- GitHub Check: fuzz (dash_outpoint_string)
- GitHub Check: fuzz (dash_deserialize_amount)
- GitHub Check: fuzz (dash_deserialize_block)
- GitHub Check: fuzz (hashes_json)
- GitHub Check: fuzz (dash_deserialize_address)
- GitHub Check: fuzz (hashes_ripemd160)
- GitHub Check: fuzz (hashes_sha512)
- GitHub Check: fuzz (hashes_sha256)
- GitHub Check: fuzz (dash_script_bytes_to_asm_fmt)
- GitHub Check: fuzz (dash_deser_net_msg)
- GitHub Check: Pre-commit (macos-latest)
- GitHub Check: Pre-commit (ubuntu-latest)
This fixes a bunch of memory leaks in tests detected by sanitizer in CI overhaul PR #253. Not that the leaks in tests matter much but with this we can run the sanitizer for all FFI PRs to make sure we don't introduce actual leaks somewhere in the FFI code.
See individual commit messages for more details about what was changed.
Summary by CodeRabbit
Bug Fixes
Chores
✏️ Tip: You can customize this high-level summary in your review settings.