Skip to content

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

Closed
wants to merge 1 commit into from
Closed

BIP443: stack order fixup #1859

wants to merge 1 commit into from

Conversation

halseth
Copy link
Contributor

@halseth halseth commented May 29, 2025

@jonatack jonatack added Proposed BIP modification Pending acceptance This BIP modification requires sign-off by the champion of the BIP being modified labels May 29, 2025
@@ -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:
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

@halseth halseth May 29, 2025

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).

Copy link
Contributor

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.

Copy link
Contributor

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.

@jonatack jonatack changed the title Update bip-0443.mediawiki BIP443: stack order fixup May 29, 2025
@jonatack jonatack removed the Pending acceptance This BIP modification requires sign-off by the champion of the BIP being modified label May 29, 2025
@jonatack
Copy link
Member

jonatack commented Jun 2, 2025

Done in #1864 and credited to you (thanks!), so closing here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants