Skip to content

Thresh bug with equal verify #236

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 1 commit into from
Jul 8, 2021
Merged

Conversation

sanket1729
Copy link
Member

@sanket1729 sanket1729 commented Feb 26, 2021

Parsing an EQUALVERIFY ending thresh fragment failed roundtrip.

Comment on lines +879 to +882
roundtrip(
&ms_str!("tv:thresh(1,pk(02d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e))", ),
"Script(OP_PUSHBYTES_33 02d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e OP_CHECKSIG OP_PUSHNUM_1 OP_EQUALVERIFY OP_PUSHNUM_1)",
);
Copy link
Contributor

@darosior darosior Apr 26, 2021

Choose a reason for hiding this comment

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

I seem to only be able to reproduce it with a single subpolicy, which is not a valid Miniscript (see #242 ). EDIT: not the case anymore.

Also, a broader Miniscript question: why isn't the Script here 1 <pk> CHECKSIG ADD 1 EQUALVERIFY 1 (as i would have expected of a thresh wrapped in a v, wrapped in a and_v(X, 1)) ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, I have been away for a while. Will catch up with all the miniscript stuff this week.

Copy link
Member Author

Choose a reason for hiding this comment

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

and_or is a ternary fragment(3 args) and this is binary fragment(2 args). Why should we have and_or here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, i meant and_v. Editing now.

Copy link
Contributor

@darosior darosior Jun 15, 2021

Choose a reason for hiding this comment

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

And i think i answered the question myself, ADD is only appended if k > 1. Sorry for the noise :)

Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ack 865bf4b

@apoelstra apoelstra merged commit fe9d2be into rust-bitcoin:master Jul 8, 2021
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