-
Notifications
You must be signed in to change notification settings - Fork 363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Taproot and tr()
descriptors
#593
Conversation
91921e9
to
58642ed
Compare
I've updated the PR description with a list of ideas for tests that we need for this. The list is non-exhaustive, just a point from which we can start. |
9fa9101
to
0538f6f
Compare
cca6948 Bump MSRV to 1.56 (Alekos Filini) Pull request description: ### Description Following the discussion in #331, bump the MSRV to `1.56`. We already have other PRs bumping it to at least `1.51` (#593), but I'm felling like we are always lagging behind and our CI breaks regularly. As @LLFourn suggested, this PR makes a relatively large bump, hoping this buys us enough time to finish splitting up BDK, which will allow us to have a lower MSRV for the "core" crate. ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) * [x] I ran `cargo fmt` and `cargo clippy` before committing #### New Features: * [x] I've updated `CHANGELOG.md` ACKs for top commit: notmandatory: ACK cca6948 Tree-SHA512: bc6572dc94e1c4cbb6d21f6e06a9730af5763fb4811311a61a6a6ec850b5a65664a21e4a7070a3ebcd702529fbba97b2e9a43c1277b9b9f092e194f16a39bc1a
I've started looking into the "Creating psbts" tests. Some notes on setting up a local |
331bbe7
to
c962a88
Compare
I am finding a lot of version conflict while working on this bitcoindevkit/bdk-cli#62 (comment) while trying to update bdk-cli with the latest I think the first two commit of this PR if can be merged independently of taproot into master would be really helpful.. It seems recently a lot has changed in the upstreams and we are using But to sort them in bdk-cli side I need to have the final updated version of Cargo.lock in bdk, which is done by the first two commits.. |
It also might make sense if we just make a patch release with the dependency upgrade, then the downstream libraries can fix them up. Or just having them in master would work too for time being. |
I don't think it can be released as patch upgrade because it would be a breaking change. I.e. if you depend on bdk I think I agree, I'm gonna open a new PR now with just the upgrade |
0016458 Stop using deprecated structs (Alekos Filini) a16c182 Upgrade to rust-bitcoin 0.28 and miniscript 7.0 (Alekos Filini) Pull request description: ### Description Upgrade all our dependencies to work with the new release of rust-bitcoin ### Notes to the reviewers The commits in this pr were originally part of #593 ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) * [x] I ran `cargo fmt` and `cargo clippy` before committing #### New Features: * [x] I've updated `CHANGELOG.md` ACKs for top commit: rajarshimaitra: ACK 0016458 Tree-SHA512: eef7e94246e619686b4dfffd6e4cb685630fe2eaf9447f2f0b49ed2643d67f81c50e0d89b66267db4552a05e58f638d885eb7056270648403f716803fce9e275
As discussed in our last meeting on Discord, I've added commit ea165b0 to introduce the concept of a Unfortunately since the context is static (reused for all the signatures of the same signer) I couldn't store the list of taproot leaf hashes in there, because those change with every derivation index. So I only store whether the key matches the "internal_key", but then we still rely on the PSBT to figure out the list of leaf hashes to sign for. |
I'm working on some commits to add to this PR with tests for "Interoperability with other wallets ", see: afilini#4. So far only testing with core (22.0). |
I'm working on the "signing psbts" section |
I should have addressed all the comments, here's the range-diff: https://gist.github.com/afilini/6e933f087971c83eb3b422a2a8b5f7aa |
I still have a few things I'd like to add to this, but I feel like this is growing a bit too much. We should be done with the tests, how do you feel about merging this the way it is now, and adding more improvements in a follow-up PR? The main one I have in mind is a way to ask the signer to only sign for some specific leaf hashes, or for the internal key, since we currently sign for everything we can. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 3d1f72e
I was only able to grok parts of this, but I agree with merging it now as experimental tr()
support so we can get it into users/testers hands. This is an amazing amount of work and I hope over time I and other will be able to help @afilini more on contributing to deep changes like this. From what I've seen even bitcoin core descriptor wallets don't yet have tr()
support that is as extensive as this PR provides.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Core review ACK 3d1f72e - I reviewed the code to the best of my knowledge, and it looks correct. I haven't done any manual testing, other than running cargo test
, but I can do that after this is merged.
I'm hyped about taproot being merged in BDK. Nice job!! 🚀
I've opened #616 so that we don't forget the extra stuff that we can add after this pr. I'll wait for a comment from @rajarshimaitra before merging, I'm assuming he must be close to the end since he started looking at the macro stuff. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK 8ce8da1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK 3d1f72e
All tests and changes look good so far.. I think its good to get merged as experimental taproot capabilities..
@@ -10,8 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
- New MSRV set to `1.56` | |||
- Unpinned tokio to `1` | |||
- Add traits to reuse `Blockchain`s across multiple wallets (`BlockchainFactory` and `StatelessBlockchain`). | |||
- Upgrade to rust-bitcoin `0.28` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we are removing this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, this was probably a mistake in the rebase
For whatever reason we were using a struct as an enum, so we might as well fix it in this PR since we are already breaking the API quite badly.
Also refactor our code to lookup signatures in PSBTs to use the context
We used to only look at `bip32_derivations` which is only used for ECDSA keys.
This is to ensure a Bitcoin node accepts our transactions
Co-authored-by: Daniela Brozzoni <[email protected]>
I noticed a new release of rust-bitcoin came out, I'm not sure what's new there but just in case I've updated the I've also updated the changelog with a brief list of what we support related to taproot. |
Looks like the new |
Description
This is a work-in-progress PR to update BDK to rust-bitcoin
0.28
which introduces taproot support and a few other improvements. While updating we also introduce taproot support in BDK.High level list of subtasks for this PR:
tr()
descriptors in thedescriptor!()
macrocontribution
andsatisfaction
of a PSBT inputFixes #63
Notes to the reviewers
Milestone
I'm adding this to the
0.19
milestone because now that rust-bitcoin and rust-miniscript have been released we should not waiting too long to release a version of BDK that supports the new libraries.API Breaks
Since this is an API-break because of the new version of rust-bitcoin and rust-miniscript, I'm also taking the chance to update a few things in our lib that I had been thinking about for a while.
One example is the signer interface, which had that weird
sign_whole_tx()
method. This has now been removed, and theSigner
trait replaced withTransactionSigner
andInputSigner
. I'm also starting to think that the signer should not only look at the psbt to figure out what to do, but ideally it should also receive some information about the descriptor (for example, the type) to simplify the code.One option is to add an extra parameter, but that would probably only be used by our internal signers and not much else (for example, if you ask an hardware wallet to sign, it will probably already know what kind of wallet you have).
Another option is to wrap
PrivateKey
andDescriptorXKey<ExtendedPrivKey>
which are the two internal signers we support with a struct that contains metadata about the descriptor, and then implement the signer traits on that struct. We could construct this inWallet::new()
, after miniscript parses the descriptor.MSRV Bump
Due to the update of
rust-electrum-client
, which in turn depends on an updatedwebpki
, we will have to bump our MSRV beacuse 1.46 is not supported by the newwebpki
version.Checklists
All Submissions:
cargo fmt
andcargo clippy
before committingNew Features:
CHANGELOG.md