<p>Correct. A Miniscript satisfier needs to provide the 0/1 in the witness for these fragments.</p>
<p>To give more than a one-word answer, we assume MINIMALIF in our analysis (for size/fee estimation). Our original design enforced it in script using the opcodes <code>SIZE EQUALVERIFY</code>, but we dropped it because our design assumes standardness everywhere. (If we did not assume standardness we'd have a lot of very expensive checks to add to avoid malleability ... e.g. to check that signatures are either valid or empty is pretty expensive to do in Script).</p>

CC BY-SA 4.0
2020-11-18T17:04:25.343Z
2020-11-18T17:04:25.343Z
Andrew Poelstra
<p>The question: is the following description of the behavior of these fragments correct?</p>
<p>The <code>or_i</code> fragment and <code>d:</code> wrappers all have an <code>IF</code> in their script that does not take the value from the argument(s), but from some external source. This external source cannot be the result of another miniscript fragment, because the fragments are composed as nested expression, not as a sequence of actions. This means that an input to <code>IF</code> in <code>or_i</code>, <code>d:</code> have to come from the witness that is specified at the spending time (that should be 1 or 0 due to <code>MINIMALIF</code>).</p>
<p>EDIT: removed <code>j:</code> wrapper from the question and the description because it does not take the value from external source, it just checks for the size of the data that X consumes</p>

<miniscript>
Miniscript or_i, d: - do they always imply a witness input?
Dmitry Petukhov
# Miniscript or_i, d: - do they always imply a witness input?

(Asked by: username_0 on 2020-11-18)

The question: is the following description of the behavior of these fragments correct?

The `or_i` fragment and `d:` wrappers all have an `IF` in their script that does not take the value from the argument(s), but from some external source. This external source cannot be the result of another miniscript fragment, because the fragments are composed as nested expression, not as a sequence of actions. This means that an input to `IF` in `or_i`, `d:` have to come from the witness that is specified at the spending time (that should be 1 or 0 due to `MINIMALIF`).

EDIT: removed `j:` wrapper from the question and the description because it does not take the value from external source, it just checks for the size of the data that X consumes

**Tags:** miniscript


---

## 1 answers

### Answer by username_1 on 2020-11-18. Score: 5 | Accepted answer

Correct. A Miniscript satisfier needs to provide the 0/1 in the witness for these fragments.

To give more than a one-word answer, we assume MINIMALIF in our analysis (for size/fee estimation). Our original design enforced it in script using the opcodes `SIZE EQUALVERIFY`, but we dropped it because our design assumes standardness everywhere. (If we did not assume standardness we'd have a lot of very expensive checks to add to avoid malleability ... e.g. to check that signatures are either valid or empty is pretty expensive to do in Script).


---

