Skip to content

CHECKSIGFROMSTACK should not have VERIFY semantics - #203

Closed
instagibbs wants to merge 1 commit into
ElementsProject:elements-0.14.1from
instagibbs:csgsv
Closed

instagibbs wants to merge 1 commit into
ElementsProject:elements-0.14.1from
instagibbs:csgsv

Conversation

@instagibbs

@instagibbs instagibbs commented Jul 10, 2017 •

Copy link
Copy Markdown
Contributor

Resolves #202

@jtimon jtimon added the 0.14.1 label Jul 13, 2017

if (opcode == OP_CHECKSIGFROMSTACKVERIFY)
popstack(stack);
{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tiny style nit: '{' should be after the if condition.

@jtimon jtimon Jul 13, 2017 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EDIT: in fact, more style nits:

if (opcode == OP_CHECKSIGFROMSTACKVERIFY) {
    if (fSuccess) {
        popstack(stack);
    } else {
        return set_error(serror, SCRIPT_ERR_CHECKSIGFROMSTACKVERIFY);
    }
}

But perhaps it is better to have it like the rest (checksigverify and OP_CHECKMULTISIGVERIFY) as an exception to the style rules?

@jtimon

jtimon commented Jul 13, 2017

Copy link
Copy Markdown
Contributor

Yeah, I think it should mimic checksigverify and OP_CHECKMULTISIGVERIFY unless I'm missing something. utACK 3aaca6c

@maaku

maaku commented Jul 21, 2017

Copy link
Copy Markdown
Contributor

Russell's comments is jogging a distant memory that the original behavior was actually a purposeful design. One of the Alpha features was going to be the removal of expensive non-VERIFY checks, particularly the CHECKSIG codes so we can do batch validation, however this ended up being too invasive as it breaks standard P2PKH scripts, among other things. So only the new opcodes, CHECKSIGFROMSTACK for example, got this behavior. And it seems to be fully undocumented.

So either this behavior needs to be better documented, the actual engineering work done to make the other CHECKSIG opcodes have the same semantics, or this PR needs to be accepted and the behavior normalized.

IMHO the best approach is to normalize semantics with how CHECKSIG works by accepting the changes in this pull request, and then doing batch validation when non-verify CHECKSIG* opcodes are the last opcodes to be executed. But given the history I'm not sure this is something any one of us can decide unilaterally.

@jtimon

jtimon commented Oct 1, 2017

Copy link
Copy Markdown
Contributor

Can you rebase to let us know what travis thinks about all this?
It looks like a clean rebase.

@jtimon

jtimon commented Sep 7, 2018

Copy link
Copy Markdown
Contributor

what's the status on this? it doesn't need rebase anymore.

@jtimon jtimon removed the 0.14.1 label Oct 16, 2018
@jtimon jtimon added 0.14.1 and removed 0.14.1 labels Oct 16, 2018
@instagibbs

Copy link
Copy Markdown
Contributor Author

Since we've already deployed, I'm not sure of the status of this. Future segwit version update instead with taproot? Closing for now.

@instagibbs instagibbs closed this Mar 25, 2019
@maaku

maaku commented Mar 25, 2019

Copy link
Copy Markdown
Contributor

I won't object to closing, but this is the elements repo not liquid.

@instagibbs

Copy link
Copy Markdown
Contributor Author

At a minimum needs port to master.

@apoelstra

Copy link
Copy Markdown
Member

Yes, I think we'll reconsider this opcode when we add Taproot. Probably we'll add a Schnorr analogue to the VERIFY version and drop the non-VERIFY version. This is analogous to what the Taproot proposal will do for CHECKSIG, and the reasoning is that non-validating signatures are never useful, but the possibility of them complicates batch verification.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants