Skip to content
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

Use threshold in Terminal and Satisfaction #676

Merged
merged 4 commits into from
Apr 8, 2024

Conversation

apoelstra
Copy link
Member

This completes the "threshold" conversion and completely drops the various ad-hoc error paths related to threshold values (most of which were just random strings).

The next set of PRs will be related to cleaning up errors in general a bit, to strongly-type things and add span information. But I am struggling a bit with how to box the associated error types for the MiniscriptKey types so it may be a while. (Very hard to do this in a std/nostd compatible way and the final result will probably be inconvenient/annoying for users.)

Miniscript rules say that for andor(x,y,z), x must be dissatisfiable
(must have the 'd' property). This means that we cannot construct a
Miniscript with a non-dissatisfiable first child of an AndOr, because we
would get a type-checking error.

However we do this check again in CompilerExtData::and_or, for some
reason. This is actually the *only* non-threshold-related error path in
CompilerExtData::type_check, and getting rid of it will let us eliminate
a ton of errors. So remove this.

NEXT, we remove the two threshold-related error paths. These are the
checks in CompilerExtData::type_check_common which check for k == 0
and for k > n. I *think* these paths are possible, but they are not
tested, so we can remove them without breaking our tests. So we remove
them here, allowing us to eliminate a ton of Ok(), ? and unwraps. The
next commit will use the new Threshold type to make these error paths
actually impossible.
Copy link
Member

@tcharding tcharding left a comment

Choose a reason for hiding this comment

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

ACK 6925ae6

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.

ACK 6925ae6

@apoelstra apoelstra merged commit 60ad2c9 into rust-bitcoin:master Apr 8, 2024
16 checks passed
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.

3 participants