Skip to content

backport #839 (DefiniteDescriptorKey fixes) to 9.x #843

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

Open
wants to merge 11 commits into
base: 9.x-branch
Choose a base branch
from

Conversation

apoelstra
Copy link
Member

Builds on #837

apoelstra added 9 commits July 5, 2025 02:48
Aside from not being future-proof at all, it's actually extremely hard
to pin dependencies for this version of the library to get ones that work
with 9.x. We have an ancient version of `bitcoind` in our deps, which in
turn unconditionally depends on several crates which all have bad
behavior (at least, the versions that we depend on).

For example, both `zip` many versions and `bitcoind` itself have maximum
`flate2` versions which are incompatible with each other. The latest
version of `zip` 0.5.x removes the max version, but has an incorrectly
stated minimum version of `thiserror`, which manifests in compilation
errors because some trait impls aren't created by the `thiserror` macro.
(And of course, you can't just use the latest `thiserror` because that
does not compile with 1.41.1 for many reasons.)

This is just one example. There are probably 10 such cases.

Anyway now we have a lockfile and we can just forget about all this crap
forever.

As a secondary change: change all the `deny`s in lib.rs, except the one
about unsafe code which seems likely to be future-proof, to `warn`s. The
library doesn't compile on nightly otherwise, since e.g. the definition
of `dead_code` has expanded.

On my system I can now compile the library with both 1.41.1 and nightly
2025-06-23, with the same lockfile.
Sigh, after all the work I did to get a lockfile for the previous commit,
it turns out that all the bitcoind tests were disabled anyway, with the
explanation "breaking change in bitcoind".

This commit deletes them entirely. We have no plans to fix them. If we
ever want to regression test miniscript 9.x, we should do it externally
by adding a fuzztest in master which pulls it in and tries to parse
stuff. Then it will be actively exercised and maintained and not require
ancient broken dependencies.

This commit is all red EXCEPT a change to a test in src/miniscript/mod.rs.
What's happening here is that we had one test (asserting on the string
representation of errors from rust-bitcoin) which fails when the std
feature is off. As it turns out, `bitcoind` unconditionally turns on that
feature. So by having `bitcoind` as a dev-dependency it was impossible
for us to ever test the nostd feature properly. Sigh.
As in other PRs, the meaningful changes here are: 'A'..'Z' becoming 'A'..='Z',
and the partial_cmp replacements.
Remove the deprecated (well, renamed) "allow broken intradoc links" cfg
flag, which exposes a ton of broken doc links. Mostly just uses of []
or <> that aren't in backticks. Fix them all.

The one morally questionable change is to change two doclink references
to Policy::enumerate_policy_tree to no longer be doclinks. The problem
is that this function only exists when the `compiler` flag is on. In
master in ebaa31b we just removed
these references as well, but arguably we should have fixed them.

Anyway in 9.x we're certainly not going to bend over backward to fix
stuff like this.
Split off because I imagine these ones will be easier to review.
We have a `pub mod tests` module which is commented as being public
"in case dependent libraries want to use these functions". However,
it's also gated by #[cfg(test)]. I am not aware of any way that
dependent libraries could compile *this* one with cfg(test) on. So
this module was, in effect, never public.

Make it non-pub to make things clearer, and also to silence all the
"missing docs" warnings that appear when running clippy with --all-targets.

This is NOT an API-breaking change even though it removes a public module,
because the module was never actually usable.
Copy link
Member

@sanket1729 sanket1729 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK f3bcfab.

The test failure is real here.

@apoelstra apoelstra force-pushed the 2025-07_more_key-9.x branch from f3bcfab to 5777a05 Compare July 5, 2025 21:54
@apoelstra
Copy link
Member Author

Ah, yep, I accidentally deleted a character in the unit test.

apoelstra added 2 commits July 5, 2025 22:06
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.

This is a backport, so it introduces the `has_hardened_steps` helper function
but does *not* make it pub, in the interest of avoiding gratuitious API changes.
@apoelstra apoelstra force-pushed the 2025-07_more_key-9.x branch from 5777a05 to d34188c Compare July 5, 2025 22:06
Copy link
Member

@sanket1729 sanket1729 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK d34188c

@apoelstra
Copy link
Member Author

Does this also count as an ACK on #837? (That is, can I just close that and merge this one?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants