<p>OP_CHECKSEQUENCEVERIFY is a redefined OP_NOP code, so it cannot manipulate the stack - only abort or continue. In your script, that means it leaves the <code>10</code> on the stack, and no <code>&lt;any-nonzero&gt;</code> is necessary in the witness (and adding one would be a violation of the CLEANSTACK standardness rule).</p>

CC BY-SA 4.0
2020-11-04T08:02:37.750Z
Oh right, my mistake. It seems that I was looking at CHECKSIGVERIFY code that pops the arg, and thought that I was looking at CHECKSEQUENCEVERIFY.
Dmitry Petukhov
CC BY-SA 4.0
2020-11-04T07:56:00.897Z
2020-11-04T07:56:00.897Z
Pieter Wuille
<pre><code>$ ./miniscript 

and(older(10),pk(A))
X    110.0000000000    37 and_v(v:pk(A),older(10)) and(older(10),pk(A))

and_v(v:pk(A),older(10))
      1 scriptlen=37 maxops=2 type=B safe=yes nonmal=yes dissat=no input=1n output=nonzero miniscript=and_v(v:pk(A),older(10))
&lt;A&gt; OP_CHECKSIGVERIFY 10 OP_CHECKSEQUENCEVERIFY
</code></pre>
<p>(the last line shows the compiled script because I added <code>printf(&quot;%s&quot;, Disassemble(ret-&gt;ToScript(COMPILER_CTX)).c_str());</code> to the command line-based tool output)</p>
<p>AFAICT nothing says that this cannot be top-level (but I may be missing something). It also says <code>nonmal=yes</code>, that this is not malleable.</p>
<p>The witness that is needed for this script to be successfully executed in the spending check is <code>[&lt;A_signature&gt;, &lt;any-nonzero&gt;]</code>, and of course the <code>CHECKSEQUENCEVERIFY</code> condition must pass. The <code>CHECKSIGVERIFY</code> will consume <code>&lt;A_signature&gt;</code>, and then <code>&lt;any-nonzero&gt;</code> will be checked as the sole item on the stack, that indicates success (after <code>CastToBool()</code>)</p>
<p>But <code>&lt;any-nonzero&gt;</code> can be just that, anything, and thus malleable.</p>
<p>What am I missing ?</p>

<script><miniscript>
and(older(10),pk(A)) malleable if top-level, can it be top-level? EDIT: not malleable, was mistaken
Dmitry Petukhov
# and(older(10),pk(A)) malleable if top-level, can it be top-level? EDIT: not malleable, was mistaken

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

```
$ ./miniscript 

and(older(10),pk(A))
X    110.0000000000    37 and_v(v:pk(A),older(10)) and(older(10),pk(A))

and_v(v:pk(A),older(10))
      1 scriptlen=37 maxops=2 type=B safe=yes nonmal=yes dissat=no input=1n output=nonzero miniscript=and_v(v:pk(A),older(10))
<A> OP_CHECKSIGVERIFY 10 OP_CHECKSEQUENCEVERIFY

```

(the last line shows the compiled script because I added `printf("%s", Disassemble(ret->ToScript(COMPILER_CTX)).c_str());` to the command line-based tool output)

AFAICT nothing says that this cannot be top-level (but I may be missing something). It also says `nonmal=yes`, that this is not malleable.

The witness that is needed for this script to be successfully executed in the spending check is `[<A_signature>, <any-nonzero>]`, and of course the `CHECKSEQUENCEVERIFY` condition must pass. The `CHECKSIGVERIFY` will consume `<A_signature>`, and then `<any-nonzero>` will be checked as the sole item on the stack, that indicates success (after `CastToBool()`)

But `<any-nonzero>` can be just that, anything, and thus malleable.

What am I missing ?

**Tags:** script, miniscript


---

## 1 answers

### Answer by username_1 on 2020-11-04. Score: 1 | Accepted answer

OP\_CHECKSEQUENCEVERIFY is a redefined OP\_NOP code, so it cannot manipulate the stack - only abort or continue. In your script, that means it leaves the `10` on the stack, and no `<any-nonzero>` is necessary in the witness (and adding one would be a violation of the CLEANSTACK standardness rule).

> **Comments:**
> **username_0**: Oh right, my mistake. It seems that I was looking at CHECKSIGVERIFY code that pops the arg, and thought that I was looking at CHECKSEQUENCEVERIFY.  

---

