Deprecate wallet-owned signing APIs#505
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #505 +/- ##
==========================================
+ Coverage 80.96% 81.13% +0.16%
==========================================
Files 24 24
Lines 5489 5501 +12
Branches 247 247
==========================================
+ Hits 4444 4463 +19
+ Misses 968 958 -10
- Partials 77 80 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
44a49b6 to
769b782
Compare
769b782 to
8857be6
Compare
oleonardolima
left a comment
There was a problem hiding this comment.
overall it's looking good, it's best if you fix the first commit and let the last one just adding the deprecation notice. let's us know when it's ready for final review.
Prefer bitcoin::Psbt::sign or Wallet::sign_with_signers in docs, examples, and tests instead of relying on wallet-owned signer state. Add FullyNodedExport::export_wallet_with_keymaps so private descriptor material can be supplied explicitly during export.
Mark Wallet::sign, signer/keymap accessors, keymap load/create helpers, and FullyNodedExport::export_wallet as deprecated. The replacement path is to keep KeyMaps/Xprivs outside Wallet, use bitcoin::Psbt::sign with wallet.secp_ctx(), or pass caller-owned SignersContainers to Wallet::sign_with_signers when SignOptions are needed.
8857be6 to
c810938
Compare
|
Thanks for spotting this. It seems I added the change to the last commit and not the first, my bad. I cleaned up the commits. |
|
I still need to look into |
|
For One tricky part is A possible migration path is adding Downside: policy-path users get one more builder call, and |
|
Neither
|
|
No, passing empty signers won't work. It can create different A path built from |
|
So after some discussion with @thunderbiscuit and @notmandatory we concluded that we cannot remove the signers fields unless we update TxBuilder to accept a spending policy to be passed in. If we don't want to update it (from what I heard) then the wallet signer removal is coupled to the TxBuilder removal. And it might make sense to deprecate both at the same time once we integrated |
|
|
||
| let mut psbt = tx_builder.finish()?; | ||
| let finalized = wallet.sign(&mut psbt, SignOptions::default())?; | ||
| psbt.sign(&signer, wallet.secp_ctx()) |
There was a problem hiding this comment.
@noahjoeris Just curious, is there any reason we call secp from the wallet wallet.secp_ctx() instead of just creating one? Does wallet add anything special to Secp256k1 ?
There was a problem hiding this comment.
We simply reuse it to avoid initializing another one. nothing special is added, creating and using your own context is equivalent.
Description
Partially addresses #70
Deprecates wallet-owned signing APIs, migrating examples, tests, and documentation toward caller-owned keys using
bitcoin::Psbt::signandWallet::sign_with_signers.Depends on:
Xprvwith key origin info rust-bitcoin/rust-miniscript#872derivation_pathfor keys with origin rust-bitcoin/rust-miniscript#867Notes to the reviewers
bitcoin::Psbt::signwhere possible. And usedWallet::sign_with_signersif we need SignOptions.Changelog notice
Wallet::{add_signer, set_keymap, set_keymaps, get_signers, sign},CreateParams::keymap, andLoadParams::{keymap, extract_keys}in favor of caller-owned keys andbitcoin::Psbt::signandWallet::sign_with_signers.FullyNodedExport::export_wallet; useFullyNodedExport::export_wallet_with_keymapsto supply keymaps explicitly.Before submitting