fix(ffi): validate account seed lengths#752
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ 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. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR refactors seed-length validation for BLS and EdDSA account derivation by centralizing checks into private helpers that enforce minimum 16-byte seeds, replacing inline validation that previously accepted 1-byte seeds. Tests are expanded with regression coverage for the tighter constraints. ChangesSeed-Length Validation Refactoring
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@key-wallet-ffi/src/account_derivation_tests.rs`:
- Around line 282-292: The second negative test reuses the prior FFIError
(error) so a stale error.code can mask a missing error from
bls_account_derive_private_key_from_seed; before calling
bls_account_derive_private_key_from_seed for the long_seed test,
reinitialize/reset error (e.g., create a fresh FFIError/default or zeroed
instance) so the function must set it for the assert to be valid—ensure you
reset the same variable named error used with ffi_account and too_long prior to
the call and then assert error.code == FFIErrorCode::InvalidInput.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1d48f1d3-d750-4723-91a4-211dd0735532
📒 Files selected for processing (2)
key-wallet-ffi/src/account_derivation.rskey-wallet-ffi/src/account_derivation_tests.rs
d60981f to
b20ebe0
Compare
b20ebe0 to
0d8f959
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v0.42-dev #752 +/- ##
=============================================
- Coverage 72.22% 72.11% -0.12%
=============================================
Files 320 320
Lines 69631 69651 +20
=============================================
- Hits 50294 50231 -63
- Misses 19337 19420 +83
|
FFI account seed-length validation
Summary
slicing or deriving.
SLIP-10 contract.
leaving generic secp256k1 account seed behavior unchanged.
Validation
cargo fmt -- key-wallet-ffi/src/account_derivation.rs \ key-wallet-ffi/src/account_derivation_tests.rscargo test -p key-wallet-ffi --features eddsa,bls account_derivation -- \ --nocapture— 6 passedcode-review dashpay/rust-dashcore upstream/v0.42-dev \ fix-ffi-seed-length-validation "Validate key-wallet FFI BLS/EdDSA account \ seed lengths before slicing/deriving while preserving secp256k1 generic \ account seed behavior"— no significant issues found; recommendation:ship
Notes
Draft until human review marks it ready.
Summary by CodeRabbit
Refactor
Tests