Repository navigation
fix(keymap): backport use of correct derivation_path for keys with origin - #867
Conversation
|
Do you want review mate? Why's it draft? |
Yeah, I was just waiting for CI, it should be ready to go. |
|
I'll move this one back to draft while I fix the issue mentioned at the summit, and backport all the fixes at once. |
51df447 to
d6a94e3
Compare
|
@oleonardolima just a ping, can this be updated and made ready to review now? |
I'll rebase it and get it ready for review today. |
@notmandatory I updated the original fix in #872 (also needs review), I'm backporting it here now. |
f3d1b63 to
3f77767
Compare
I updated this PR and added new test scenarios, it should be ready to review. cc'in @noahjoeris as you had interest in this and a review would be appreciated. |
|
ping @tcharding @apoelstra for awareness. |
|
@apoelstra thanks for the quick review in #872, let me know if I need to do any update here in the backport. |
|
Sorry, the problem is on my end. My local CI is not passing on the 12.x branch and I need to investigate why. |
|
Oh, no, the problem is on your end :). In 122105d your original test does not compile: In this project we require that all commits compile and pass unit tests. Sorry again for the long delay on my part! I had some weird NixOS issues all week and had assumed that the failure here was part of that. |
- backports rust-bitcoin#872 fixes for the implementation of `GetKey` for `Xprv` with `KeyRequest::Bip32`, when the the key_origin information is available.
- backports introduced rust-bitcoin#872 table-driven test cases for `get_key_xpriv_with_key_origin` with named fields - drop redundant key parsing, and build requests from explicit key sources Assisted-by: Claude Opus 4.8
3f77767 to
d01ee72
Compare
Oh, sorry for the oversight! I updated the first commit 1053799 to drop the broken and newly added test as it was being refactored in the second one d01ee72. Let me know if there's anything else to address. |
3a3cd6f deprecate(wallet): wallet-owned signer and policy APIs (Noah Joeris) 6b7a8b2 feat(wallet): add TxBuilder::set_condition (Noah Joeris) 7031448 refactor(wallet): migrate signing to caller-owned keys (Noah Joeris) Pull request description: ### Description Partially addresses #70 Deprecates wallet-owned signing APIs, migrating examples, tests, and documentation toward caller-owned keys using `bitcoin::Psbt::sign` and `Wallet::sign_with_signers`. Depends on: - rust-bitcoin/rust-miniscript#872 - rust-bitcoin/rust-miniscript#867 ### Notes to the reviewers - I migrated examples, docs and tests to use `bitcoin::Psbt::sign` where possible. And used `Wallet::sign_with_signers` if we need SignOptions. ### Changelog notice ``` - Deprecated `Wallet::{add_signer, set_keymap, set_keymaps, get_signers, sign, policies}`, `CreateParams::keymap`, `LoadParams::{keymap, extract_keys}`, and `TxBuilder::policy_path` in favor of caller-owned keys with `bitcoin::Psbt::sign` / `Wallet::sign_with_signers`, and `TxBuilder::set_condition`. - Changed `FullyNodedExport::export_wallet` to not export secret keys anymore. - Added `TxBuilder::set_condition` as replacement for `TxBuilder::policy_path`. ``` ### Before submitting - [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk_wallet/blob/master/CONTRIBUTING.md) - [ ] This PR breaks the existing API ACKs for top commit: ValuedMammal: reACK 3a3cd6f 110CodingP: ACK 3a3cd6f Tree-SHA512: 690039f597d2aab334f6ac8f4623a49c4df9470af8978adbdad8d2061f2fd2582122943e11cec2b5be21a296ef12f9d80113f99e1bf87876aa6b58805fe8ca76
backports #872
Description
It backports the fix for deriving the private key correctly in scenarios where the key origin is available, see #872.
The GetKey for DescriptorSecretKey (and thus KeyMap) returned the wrong key when an extended private key with key origin info was queried via KeyRequest::Bip32.
The key request path is master-relative, but the xkey is anchored at its origin (e.g. [d34db33f/84h/1h/0h]). The old code stripped the path returned by matches(); the fix strips the origin prefix instead (and uses the full path when there is no origin) before deriving from the xkey.
cherry-picks 20ae466 and a2f4497.
Changelog notice
Checklists
Bugfixes: