LearnBitcoin

Bitcoin Dev Archive 2024

CHECKSIGFROMSTACK(VERIFY/ADD)

5 messages, 14 to 23 Nov 2024. Started by Brandon Black.

moonsettler (2), Brandon Black, Murch, Antoine Poinsot

Permalink Original thread on gnusha.org

Brandon Black permalink original

Hi list,

As we're working toward numbering and merge for the CHECKSIGFROMSTACK (CSFS) BIP, there are 2 open questions[1] that may be worth resolving before it is merged as a draft:

* Should CHECKSIGFROMSTACKVERIFY (CSFSV) be added to pre-tapscript?

The proposed opcode always evaluates BIP340 Schnorr signatures regardless of script version, so making it available in earlier script versions makes Schnorr signatures available on those script versions for certain use cases.

My personal thinking in initially including CSFSV in earlier script versions was basically that it's compatible with NOP forking, so why not. Because LNHANCE includes CTV which is designed as a NOP compatible upgrade, also including CSFSV fits well with CTV.

The other side of the argument is that we shouldn't include compatibility with earlier script versions unless there's a concrete benefit to doing so. For CTV, the possibility of bare CTV is a compelling reason to add it to earlier script versions, but there's not a similarly compelling reason to include CSFSV.

Using a scarce NOP to provide Schnorr signed commitments to earlier scripts may not be worthwhile.

* Should we include CHECKSIGFROMSTACKADD?

Obviously, if script multisig is going to be a common use case for checking signatures on stack data CHECKSIGFROMSTACKADD simplifies the corresponding scripts by a few WU per key. As MuSig2 and FROST are progressing in standardization and implementation, I do not expect script multisig to be a dominant use for these opcodes, so I did not include CSFSA initially.

Here the argument is somewhat the inverse of CSFSV on legacy: We have many OP_SUCCESSes available, so the cost of allocating one for CSFSA is low, and the benefit is that making script multisigs with CSFSA (such as those produced by miniscript) is simpler and less error prone.

moonsettler in reply to Brandon Black permalink original

Hi Brandon,

For what it's worth, I also think signature aggregation will be the dominant form of CSFS use. LNhance at it's core is CTV + CSFS, and so it makes sense to have both of those available in pre-tapscript.

No strong opinion on CHECKSIGFROMSTACKADD, agree with the general reasoning.

It's a bit weird to backport Schnorr this way, and the NOP upgrade path leaving 3 elements on the stack is also unfortunate. On the other hand, reverting CSFSV to use ECDSA in pre-tapscript would force us to consider implementing script multisig, to do anything really worthwhile there.

BR, moonsettler

Sent with Proton Mail secure email.

On Thursday, November 14th, 2024 at 11:02 PM, Brandon Black <freedom@reardencode•com> wrote:

Quoted text (58 lines)
> Hi list,
>
> As we're working toward numbering and merge for the CHECKSIGFROMSTACK
> (CSFS) BIP, there are 2 open questions[1] that may be worth resolving
> before it is merged as a draft:
>
> * Should CHECKSIGFROMSTACKVERIFY (CSFSV) be added to pre-tapscript?
>
> The proposed opcode always evaluates BIP340 Schnorr signatures
> regardless of script version, so making it available in earlier script
> versions makes Schnorr signatures available on those script versions for
> certain use cases.
>
> My personal thinking in initially including CSFSV in earlier script
> versions was basically that it's compatible with NOP forking, so why
> not. Because LNHANCE includes CTV which is designed as a NOP compatible
> upgrade, also including CSFSV fits well with CTV.
>
> The other side of the argument is that we shouldn't include
> compatibility with earlier script versions unless there's a concrete
> benefit to doing so. For CTV, the possibility of bare CTV is a
> compelling reason to add it to earlier script versions, but there's not
> a similarly compelling reason to include CSFSV.
>
> Using a scarce NOP to provide Schnorr signed commitments to earlier
> scripts may not be worthwhile.
>
>
> * Should we include CHECKSIGFROMSTACKADD?
>
> Obviously, if script multisig is going to be a common use case for
> checking signatures on stack data CHECKSIGFROMSTACKADD simplifies the
> corresponding scripts by a few WU per key. As MuSig2 and FROST are
> progressing in standardization and implementation, I do not expect
> script multisig to be a dominant use for these opcodes, so I did not
> include CSFSA initially.
>
> Here the argument is somewhat the inverse of CSFSV on legacy: We have
> many OP_SUCCESSes available, so the cost of allocating one for CSFSA is
> low, and the benefit is that making script multisigs with CSFSA (such as
> those produced by miniscript) is simpler and less error prone.
>
> --
>
> I would love to hear thoughts about both of these questions from the
> list, and will update the BIP and implementations of CSFS(V/A) based on
> your feedback.
>
> Thanks much!
>
> --Brandon
>
> [1]: https://github.com/bitcoin/bips/pull/1535#issuecomment-2111195930
>
> --
> You received this message because you are subscribed to the Google Groups "Bitcoin Development Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bitcoindev+unsubscribe@googlegroups•com.
> To view this discussion visit https://groups.google.com/d/msgid/bitcoindev/ZzZziZOy4IrTNbNG%40console.
Murch in reply to Brandon Black permalink original

Hi everyone,

On 2024-11-14 17:02, Brandon Black wrote:

Quoted text (3 lines)
> * Should CHECKSIGFROMSTACKVERIFY (CSFSV) be added to pre-tapscript
> […]
> My personal thinking in initially including CSFSV in earlier script versions was basically that it's compatible with NOP forking, so why not.

If there is no compelling use case or concrete benefit, I don’t think "it’s compatible, why not" is convincing motivation, especially at the cost of a NOP.

On 2024-11-14 17:02, Brandon Black wrote:

Quoted text (1 line)
> * Should we include CHECKSIGFROMSTACKADD?

I feel similar about this. If there is currently no demand for this, and future demand also seems unlikely, I would prefer a smaller, more focused set of changes.

Cheers, Murch

Antoine Poinsot in reply to Murch permalink original

To add to Murch's point, from my experience working with Script in general and trying to estimate the cost of validation of legacy script as part of the consensus cleanup in particular, i think we should refrain from modifying legacy Script and further complicate reasoning about the worst case unless strictly necessary.

Best, Antoine

On Friday, November 15th, 2024 at 9:57 AM, Murch <murch@murch•one> wrote:

Quoted text (25 lines)
> Hi everyone,
>
> On 2024-11-14 17:02, Brandon Black wrote:
>
> > * Should CHECKSIGFROMSTACKVERIFY (CSFSV) be added to pre-tapscript
> > […]
> > My personal thinking in initially including CSFSV in earlier script versions was basically that it's compatible with NOP forking, so why not.
>
>
> If there is no compelling use case or concrete benefit, I don’t think "it’s compatible, why not" is convincing motivation, especially at the cost of a NOP.
>
> On 2024-11-14 17:02, Brandon Black wrote:
>
> > * Should we include CHECKSIGFROMSTACKADD?
>
>
> I feel similar about this. If there is currently no demand for this, and future demand also seems unlikely, I would prefer a smaller, more focused set of changes.
>
> Cheers,
> Murch
>
> --
> You received this message because you are subscribed to the Google Groups "Bitcoin Development Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bitcoindev+unsubscribe@googlegroups•com.
> To view this discussion visit https://groups.google.com/d/msgid/bitcoindev/c91269ac-e579-4089-bf9a-fdc076e34727%40murch.one.
moonsettler in reply to Antoine Poinsot permalink original

Dear List,

Can anyone think of a reason to keep OP_CHECKSIGFROMSTACKVERIFY as NOP5 available in legacy script?

Currently Brandon and I are leaning towards simply removing CSFSV from LNhance and from the CSFS BIP.

Reasoning: * CSFS is more likely to be used in Symmetry * In case where CSFSV is desired OP_CSFS OP_VERIFY is perfectly workable. * Simplifies code * Don't have an actual use case for CSFSV in legacy rn * Upgradeable NOPs are scarce * Backporting tapscript would bring all functionality to legacy

BR, moonsettler

Sent with Proton Mail secure email.

On Friday, November 15th, 2024 at 4:33 PM, 'Antoine Poinsot' via Bitcoin Development Mailing List <bitcoindev@googlegroups•com> wrote:

Quoted text (40 lines)
> To add to Murch's point, from my experience working with Script in general and
> trying to estimate the cost of validation of legacy script as part of the
> consensus cleanup in particular, i think we should refrain from modifying legacy
> Script and further complicate reasoning about the worst case unless strictly
> necessary.
>
> Best,
> Antoine
>
> On Friday, November 15th, 2024 at 9:57 AM, Murch murch@murch•one wrote:
>
> > Hi everyone,
> >
> > On 2024-11-14 17:02, Brandon Black wrote:
> >
> > > * Should CHECKSIGFROMSTACKVERIFY (CSFSV) be added to pre-tapscript
> > > […]
> > > My personal thinking in initially including CSFSV in earlier script versions was basically that it's compatible with NOP forking, so why not.
> >
> > If there is no compelling use case or concrete benefit, I don’t think "it’s compatible, why not" is convincing motivation, especially at the cost of a NOP.
> >
> > On 2024-11-14 17:02, Brandon Black wrote:
> >
> > > * Should we include CHECKSIGFROMSTACKADD?
> >
> > I feel similar about this. If there is currently no demand for this, and future demand also seems unlikely, I would prefer a smaller, more focused set of changes.
> >
> > Cheers,
> > Murch
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Bitcoin Development Mailing List" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to bitcoindev+unsubscribe@googlegroups•com.
> > To view this discussion visit https://groups.google.com/d/msgid/bitcoindev/c91269ac-e579-4089-bf9a-fdc076e34727%40murch.one.
>
>
> --
> You received this message because you are subscribed to the Google Groups "Bitcoin Development Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bitcoindev+unsubscribe@googlegroups•com.
> To view this discussion visit https://groups.google.com/d/msgid/bitcoindev/nRFLHRhwXER56TrZy50tJ2HmvipjteXzPfz6mEs_VmyZ5sXDNVUIUniPppSphF5SOVCQmpRZSjmBN8_eIMZEbdFgl3vJn-8XSEmpAFmj5SM%3D%40protonmail.com.