1

The "A 3-of-3 that turns into a 2-of-3 after 90 days" policy:

thresh(3,pk(key_1),pk(key_2),pk(key_3),older(12960))

compiled to this Miniscript a few months ago:

thresh(3,pk(key_1),s:pk(key_2),s:pk(key_3),sdv:older(12960))

which can be decoded to this script:

<key_1> OP_CHECKSIG OP_SWAP <key_2> OP_CHECKSIG OP_ADD OP_SWAP <key_3>
OP_CHECKSIG OP_ADD OP_SWAP OP_DUP OP_IF
  <a032> OP_CHECKSEQUENCEVERIFY OP_VERIFY
OP_ENDIF
OP_ADD 3 OP_EQUAL

Today it compiles to this Miniscript instead (note the sln wrapper instead of the sdv wrapper:

thresh(3,pk(key_1),s:pk(key_2),s:pk(key_3),sln:older(12960))

which can be decoded to this script:

<key_1> OP_CHECKSIG OP_SWAP <key_2> OP_CHECKSIG OP_ADD OP_SWAP <key_3>
OP_CHECKSIG OP_ADD OP_SWAP OP_IF
  0
OP_ELSE
  <a032> OP_CHECKSEQUENCEVERIFY OP_0NOTEQUAL
OP_ENDIF
OP_ADD 3 OP_EQUAL

Why has it changed?

1
  • 2
    Just a note, there is no "the miniscript for a policy". The compiler has a lot of freedom in determining what miniscript to compile a policy too, and in theory an improved compiler could do better than current version. Commented Sep 19, 2022 at 16:36

1 Answer 1

2

thresh(3,pk(key_1),s:pk(key_2),s:pk(key_3),sdv:older(12960)) is no longer a valid Miniscript and won't successfully pass through the Miniscript analyzer on sipa's site.

The reason for this is there was a MINIMALIF bug where:

The wrapper d (OP_DUP OP_IF [X] OP_ENDIF) was incorrectly marked to have the u property. The u property states "When [X] is satisfied, this expression will put an exact 1 on the stack (as opposed to any nonzero value)". However, this is only true if we have a MINIMALIF consensus rule.

If you don't respect the MINIMALIF rule (only introduced with Taproot) <3> <> <> <> satisfies the old script without any signatures if the timelock is satisfied.

thresh requires the u type modifier which d: doesn't have since the bug fix so d: can no longer be used within a thresh.

Thanks to darosior for answering this on IRC.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.