-
Notifications
You must be signed in to change notification settings - Fork 5.6k
BIP443: stack order fixup #1859
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
Conversation
@@ -135,7 +135,7 @@ The tapscript opcode <code>OP_SUCCESS187</code> (<code>0xbb</code>) is constrain | |||
<code>OP_CHECKCONTRACTVERIFY</code>. | |||
|
|||
When evaluating <code>OP_CHECKCONTRACTVERIFY</code> (<code>OP_SUCCESS187</code>, | |||
<code>0xbb</code>), the expected format of the stack, shown bottom to top, is: | |||
<code>0xbb</code>), the expected format of the stack, shown top to bottom, is: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@halseth: Are you surprised that the order used to present the stack is top to bottom, or did you notice a mismatch between the description and the spec?
If it’s the former, the presentation of stacks bottom to top seems to be the established order, see e.g., https://en.bitcoin.it/wiki/Script
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that might well be it, in such a case the order of the elements in the code block should be reversed.
I'll let @bigspider comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@murchandamus to answer your question, I believe it is a mismatch between the wording and the order of elements (mode
should be the top element).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @halseth - indeed it appears I messed up, as <mode>
is the top element (it would basically always be pushed right before CCV
, and never come from the witness - as in the Script examples below).
I think my confusion comes from looking at the description in BIP-0345 where the arguments are presented indeed presented top to bottom.
I'll let @murchandamus advise whether this PR should be merged, or the order of the parameters should be reversed to actually be bottom to top - I don't have strong feelings either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@halseth: Sorry, I think I wasn’t fully awake when I commented yesterday, I meant "surprised that it is not top to bottom". But either way, I think the established order is bottom to top (if it is written in one line), and I would then suggest to adjust the order of the elements to match that.
Done in #1864 and credited to you (thanks!), so closing here. |
@bigspider