-
Notifications
You must be signed in to change notification settings - Fork 168
more DefiniteDescriptorKey fixes and cleanups
#839
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Our current API allows constructing a DefiniteDescriptorKey with hardened steps, which means that you can't actually derive a public key. However, the point of this type is to provide a DescriptorPublicKey which implements the ToPublicKey trait. The next commits will change the API to reflect this, but this commit is on its own to make it easier for me to backport it.
These have been deprecated since 2ad6555 which made it into the 9.x release. Fine to delete them.
There is no reason callers need to provide these types explicitly. Allow them to do so anyway for backward compatibility. (This commit I pulled out of my mega-refactor branch, but it seemed useful here, so I'm pulling it in now.)
e8a88ae to
a05305a
Compare
Now that we are consistent about the rules that a DerivedDescriptor must obey, we no longer return a Result from derived_key(), which in turn eliminates a bunch of other unwraps.
Going forward, we should only derive Debug and whichever of Clone, PartialEq and Eq are possible. PartialEq is very useful for doing assertions, and Clone is often useful because it allows Results to be cloned. But the other traits are uncommon to implement on error types, have an unclear meaning, and limit our ability to compose types without breaking changes. Also adds a bunch of Eq bounds to error types that implement PartialEq. There is almost never a reason to implement PartialEq but not Eq. In the next commit I'm gonna replace ConversionError, an old error which derives all these things, with the new NonDefiniteKeyError, which will prevent these derives from working on UtxoUpdateError.
The new error type is now more descriptive and a strict superset of the old one. Furthermore, the new name is more appropriate since this error typically arises during construction of a DefiniteDescriptorKey rather than during conversion between different key types.
a05305a to
f09bf48
Compare
apoelstra
added a commit
that referenced
this pull request
Jul 5, 2025
1374ae4 bump version to 12.3.4 (Andrew Poelstra) de73db9 key: fix DefiniteDescriptorKey construction from key with hardened step (Andrew Poelstra) Pull request description: ACKs for top commit: sanket1729: ACK 1374ae4 Tree-SHA512: 4f4faac8df85e137eb901a2df42780c1b5cfda31746b8906d628942d038bb16e44be88d07255e8f952ebbc2e43f37207c72d02952c34a3a619aa68d536bd98cc
apoelstra
added a commit
that referenced
this pull request
Jul 5, 2025
e8ce03c bump version to 11.2.3 (Andrew Poelstra) ca3282c key: fix DefiniteDescriptorKey construction from key with hardened step (Andrew Poelstra) Pull request description: ACKs for top commit: sanket1729: utACK e8ce03c Tree-SHA512: 7a3e6c864fecb5ec53805af02cae7856ba265d674c80f4520fabd8e4fa7dafb6e29d640a0a2fe383b70ed86bc476406458ecfa768f8ff50c1317c87985b138a3
apoelstra
added a commit
that referenced
this pull request
Jul 5, 2025
d61103f bump version to 10.2.3 (Andrew Poelstra) ac76ce0 key: fix DefiniteDescriptorKey construction from key with hardened step (Andrew Poelstra) Pull request description: ACKs for top commit: sanket1729: utACK d61103f Tree-SHA512: 364519c25c47ebc439ee927321bf058fce9047ca790c180e4df4c73b306c1b480ff7cb14f223bb031c31751c2f42d3b5ad79a2149b952dd608b98ea87440e063
apoelstra
commented
Jul 6, 2025
Member
Author
apoelstra
left a comment
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.
On f09bf48 successfully ran local tests
sanket1729
approved these changes
Jul 8, 2025
Member
sanket1729
left a comment
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 f09bf48.
Love the cleanup with core::Infalliable and removal of unwraps! Much cleaner
apoelstra
added a commit
that referenced
this pull request
Jul 16, 2025
d34188c bump version to 9.2.1 (Andrew Poelstra) 2887782 key: fix DefiniteDescriptorKey construction from key with hardened step (Andrew Poelstra) Pull request description: Builds on #837 ACKs for top commit: sanket1729: utACK d34188c Tree-SHA512: 2f6a685b614ac4d8591781a79fba18af2f0ca9980d1bf0d6612b47bb46d4936e0a776424498a26ba98925c30abb4f8332926489e2b4b45ec3f9aa269ca1d4e78
heap-coder
added a commit
to heap-coder/rust-miniscript
that referenced
this pull request
Sep 27, 2025
…fixes and cleanups
f09bf48597ce58c16a2eaf52d455fb6749843691 fuzz: add fuzz test for parsing definite descriptor keys (Andrew Poelstra)
4930ccb76fb2ae0cc1d073fbde3e096d5ba37be8 key: replace ConversionError with NonDefiniteKeyError (Andrew Poelstra)
627d963e01e9e41e7686e5c4b1805a559776c8c5 psbt: remove derives from UtxoUpdateError and OutputUpdateError (Andrew Poelstra)
c169af02362df4fc87cd61fd4dd12b95f121009c key.rs: remove a bunch of unwrap()s which are impossible (Andrew Poelstra)
6267818faae8975a587fbf571e96bfa05b1b6c27 TranslateErr: add helper function to unwrap impossible case (Andrew Poelstra)
e1f08025be9d4fd721c735a57644614406a57089 macros: make target pk and error type optional for translate_* macros (Andrew Poelstra)
77ed78b86941426d2854a9994d64eeaf158f25e8 key.rs: remove some deprecated methods (Andrew Poelstra)
7b3b3a8f953c9013e7ba9ae735b24e6345f6df53 key: fix DefiniteDescriptorKey construction from key with hardened step (Andrew Poelstra)
Pull request description:
Again this one changes logic in a way that I need to backport, but the backport PRs will be much simpler since they are constrained not to change the API.
This one makes it impossible to construct a `DefiniteDescriptorKey` with hardened derivation steps. Previously this was usually impossible, but not always, which led to inconsistent error checks and a proliferance of `unwrap`s and generally hard-to-reason-about behavior.
ACKs for top commit:
sanket1729:
ACK f09bf48597ce58c16a2eaf52d455fb6749843691.
Tree-SHA512: b57016592bc1b41c1ebe9ceba9c68f3feec432f79782aedbb2af0c817648d5af476e28a03968243fcf0f3ecde92bf28ee10414dd6e39a4d7d4119c4f68d1a1fe
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Again this one changes logic in a way that I need to backport, but the backport PRs will be much simpler since they are constrained not to change the API.
This one makes it impossible to construct a
DefiniteDescriptorKeywith hardened derivation steps. Previously this was usually impossible, but not always, which led to inconsistent error checks and a proliferance ofunwraps and generally hard-to-reason-about behavior.