feat: bump bdk_wallet to 3.1.0#1030
Conversation
thunderbiscuit
left a comment
There was a problem hiding this comment.
This will take some time to review, but I'm adding some questions here!
| /// Also looks at the corresponding descriptor to determine the `SignerContext` to attach to | ||
| /// the signers. | ||
| #[uniffi::constructor] | ||
| pub fn from_descriptor_with_context( |
There was a problem hiding this comment.
I'd like to make sure I understand well the use case(s) for this constructor. Can we add a test showcasing this?
|
|
||
| /// Returns the number of signers in the container. | ||
| pub fn len(&self) -> u64 { | ||
| self.inner.signers().len() as u64 |
There was a problem hiding this comment.
What does this length represent? A reminder to myself to look into it.
| /// extracts keys from the provided descriptor while loading. | ||
| #[uniffi::constructor(default(lookahead = 25))] | ||
| pub fn load_from_two_path_descriptor( | ||
| two_path_descriptor: Arc<Descriptor>, |
There was a problem hiding this comment.
I added a PR on bdk_wallet bitcoindevkit/bdk_wallet#506 to fix the docs on this, and it indeed requires public descriptors to work. We should just pull that in here as well, and fix up the API docs to on the create_from_two_path_descriptor method to also copy what is now in the Rust API docs (old PR of mine too back then).
In our case the failure happens earlier than in the constructor however, since the user can't pass a string to the constructor and passes a full Descriptor type, which simply cannot be built using private+multipath (see our test for this on bdk-jvm here), so the user would never really get to the constuctor in the first place with their private multipath descriptor. Still I'd like to see the docs mention it here if possible (even though my PR 506 is not merged yet).
thunderbiscuit
left a comment
There was a problem hiding this comment.
Added a few more comments. We can keep chewing through this PR one piece at a time and eventually it'll be ready all at once, but I wonder if maybe splitting it would help work + review on all features in parallel. Your call. I feel like some of those commits are ready to merge, some not yet (or at least I have more questions).
| persister: Arc<Persister>, | ||
| lookahead: u32, | ||
| ) -> Result<Wallet, LoadWithPersistError> { | ||
| let descriptor = two_path_descriptor.to_string_with_secret(); |
There was a problem hiding this comment.
This line can be removed, as no private constructor can make it this far, and the to_string_with_secret() method doesn't do anything on public descriptors.
| } | ||
|
|
||
| /// Get the signers. | ||
| pub fn get_signers(&self, keychain: KeychainKind) -> Arc<SignersContainer> { |
There was a problem hiding this comment.
I don't have a strong reason to block exposing a method available on the wallet on the Rust side in the first place, but I'm also not sure what this is useful for, since the goal of sign_with_signers is to create your own signers at that point in time (not get them from your wallet). It's also one of the APIs that's leaving the wallet at some point because the wallet will not own any signers anymore. See bitcoindevkit/bdk_wallet#70.
I'm not against it; just not sure if adding the code surface is worth it yet, let me know what you think.
| /// | ||
| /// Returns true if the PSBT was finalized, or false otherwise. | ||
| #[uniffi::method(default(sign_options = None))] | ||
| #[allow(deprecated)] |
There was a problem hiding this comment.
Is this to pre-emptively silence the warning that will probably come with bitcoindevkit/bdk_wallet#505?
| wallet.get_signers(KeychainKind::Internal), | ||
| ]; | ||
|
|
||
| let finalized = wallet.sign_with_signers(psbt, signers, None).unwrap(); |
There was a problem hiding this comment.
This tests that the signers already present in the wallet can sign the transaction, so the sign_with_signers works, but if possible I'd like to also test the more important/new API, the ability to create signers on the fly and sign with them.
Yeah definitely something where I can break it out into separate PRs, as a reviewer how would you best like them split out? My assumption is bdk_wallet bump + foreign UTXO validation fix are ready... then split out:
... but I'd rather do whatever is easiest split for you as a reviewer because it's no sweat on my end to chop it up any way. |
|
Pretty much agree with your proposed split. I'd maybe do:
|
Cool, will start doing this and also try to bring over the questions/comments for each respectively |
Ok this Pr now has only |
Description
Dependency bump. The other commits are more experimental to see the shape of exposing new APIs.
Notes to the reviewers
Documentation
bdk_walletbitcoinuniffiChangelog
Checklists
All Submissions:
cargo fmtandcargo clippybefore committingchangelog:*labelNew Features:
Bugfixes: