Add typed descriptor builder - #10
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughDescriptor construction was centralized behind a new public ChangesDescriptor Construction Refactoring
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
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 docstrings
🧪 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. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
Greptile SummaryThis PR replaces string-interpolated descriptor construction with a typed Confidence Score: 5/5Safe to merge — clean refactor with no behavioral regressions and good test coverage. No P0 or P1 findings. The builder correctly uses typed BIP32 structures, split_multipath_descriptor stays private (child modules access parent-private items in Rust without extra qualifiers), parse_derivation_path is strictly more correct than the old replace approach, and coin_type is evaluated before into_bip32() consumes the wrapper. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Callers] --> B[account_xpub_for_coin_type]
A --> C[DescriptorBuilder::new]
B --> D[account_derivation_path_for_coin_type]
D --> C
C --> E[build]
E --> F[MultiXPub key with multipath change derivations]
F --> G{script_type}
G -->|P2pkh| H[new_pkh]
G -->|P2shP2wpkh| I[new_sh_wpkh]
G -->|P2wpkh| J[new_wpkh]
G -->|P2tr| K[new_tr]
H & I & J & K --> L[split_multipath_descriptor]
L --> M[Descriptors: external and internal]
Reviews (2): Last reviewed commit: "Address descriptor review comments" | Re-trigger Greptile |
Improve documentation in src/descriptor/script_type.rs: expand try_from_derivation_path docs to explicitly state supported BIP44/BIP49/BIP84/BIP86 account paths and that purpose, coin type, and account components must be hardened. Add doc comments for purpose() and account_derivation_path_for_coin_type() to clarify their intent and behavior.
Add documentation and examples for DescriptorBuilder: explain using an account xpub with master fingerprint and origin account path, clarify DescriptorBuilder::new's origin_derivation_path parameter, document account_xpub_for_coin_type's BIP path/coin_type behavior, and describe build() producing a multipath xpub (<0;1>/*) then splitting into external (/0/*) and internal (/1/*) descriptors. No functional changes; improves developer guidance and example usage.
Summary by CodeRabbit
Bug Fixes
New Features
Refactor
Tests