Skip to content

miniscript: the 'd:' wrapper must not be 'u' #348

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

Closed
wants to merge 1 commit into from

Conversation

darosior
Copy link
Contributor

The value it leaves on the stack depends on the last element on the
stack. However, we can't make sure this element is OP_1 (which would
give us the 'u' property) without the MINIMALIF rule.
MINIMALIF is only policy for P2WSH, therefore giving 'd:' the 'u'
property breaks consensus soundness: it makes it possible (by consensus
but not policy) for instance to satisfy a thresh() without satisfying
at least k of its subs.

This bug was found and reported by Andrew Poelstra based on a question from Aman Kumar Kashyap.

The value it leaves on the stack depends on the last element on the
stack. However, we can't make sure this element is OP_1 (which would
give us the 'u' property) without the MINIMALIF rule.
MINIMALIF is only policy for P2WSH, therefore giving 'd:' the 'u'
property breaks consensus soundness: it makes it possible (by consensus
but not policy) for instance to satisfy a thresh() without satisfying
at least k of its subs.

This bug was found and reported by Andrew Poelstra, after a question
from Aman Kumar Kashyap.
@darosior
Copy link
Contributor Author

Related: bitcoin/bitcoin#24906 and sipa/miniscript#117

@sanket1729
Copy link
Member

I am working on fixing the tests and back porting fixes

@darosior
Copy link
Contributor Author

Oh thanks, i only ran the unit test locally and didn't check the CI.

@apoelstra
Copy link
Member

I believe this was superceded by #349

@apoelstra apoelstra closed this Apr 19, 2022
sanket1729 added a commit that referenced this pull request Apr 20, 2022
c74934b Fix compiler test cases for new typing rules (sanket1729)
9766e30 Fix bug in exec stack elements calculation (sanket1729)
db97c39 Remove `u` property from `d` (sanket1729)
77d7d79 Fix malleability rules according to website (sanket1729)
6a1ceac Fix e/o bug in miniscript threshold correctness rules (sanket1729)

Pull request description:

  Multiple type system bugs:

  The first two bugs are not severe: They relax rules so existing systems should not be affected. However the third commit is a fix that will be backported.

  Pasting description #348

  > The value it leaves on the stack depends on the last element on the
  stack. However, we can't make sure this element is OP_1 (which would
  give us the 'u' property) without the MINIMALIF rule.
  MINIMALIF is only policy for P2WSH, therefore giving 'd:' the 'u'
  property breaks consensus soundness: it makes it possible (by consensus
  but not policy) for instance to satisfy a thresh() without satisfying
  at least k of its subs.

  This bug was found and reported by Andrew Poelstra #341.

ACKs for top commit:
  apoelstra:
    ACK c74934b

Tree-SHA512: 274a3c2f93eb56b8cda3bf8f9befd9c93494f398d1564b90716330e1c73fbb503e7c1dcc1ffd232bcbae8f1c4e316bfbc705b3d5fc02b9491de1fcdb8c3dbe79
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