public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: Salvatore Ingala <salvatore.ingala@gmail.com>
To: "Johan Torås Halseth" <johanth@gmail.com>
Cc: Bitcoin Protocol Discussion <bitcoin-dev@lists.linuxfoundation.org>
Subject: Re: [bitcoin-dev] Concrete MATT opcodes
Date: Wed, 9 Aug 2023 10:38:48 +0200	[thread overview]
Message-ID: <CAMhCMoEoSiGPBczQerBe1TDJvo2Gkf4gbXOPUayKkNLsC_y4SQ@mail.gmail.com> (raw)
In-Reply-To: <CAD3i26AxcRCewX7vt5KV9vQp_mD=DaH1GEmqQQ1Ct8v_oW-WXQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2131 bytes --]

Hi Johan,

Thanks a lot for the comments, and the independent implementation!

> - For the opcode parameter ordering, it feels unnatural for the two
> tweaks (data, taptree) to be separated by the internal key. A more
> natural ordering of parameters IMO would be (of course this is all
> subjective):
> <data> <taptree> <internalkey> <index> <flags> OP_CCV.
>
> If you disagree, I would love some rationale for the ordering you
> chose! (looks like you also changed it again after your last post?).

The main concern for the reordering was to put <data> at the bottom,
as that's typically passed via the witness stack.

I put the <index> right next, as I suspect there are use cases for
specifying via the witness what is the input index where a certain
(CCV-encumbered) UTXO is to be found, or which output should funds
be sent to, instead of hard-coding this in the script. This might
help in designing contracts that are more flexible in the way they
are spent, for example by allowing batching their transactions.

Instead, I expect the other parameters to almost always be hardcoded,
or propagated from the current input with the <-1> special values.

I agree that your ordering is more aesthetically pleasing, though.

> I'm wondering what other use cases you had in mind for the deferred
> output amount check? Maybe I have missed something, but if not it
> would perhaps be better to leave out the amount preservation check, or
> go the extra mile and propose a more powerful amount introspection
> machinery.

Yes, the deferred output amount check is not enough for coinpools;
however, it comes at no cost if we have a <flags> parameter anyway,
as OP_2 (value for CCV_IGNORE_OUTPUT_AMOUNT) is a single byte opcode.

The intent of preserving amounts for many-to-one contracts (vaults),
or the one-to-one cases (channels, any 2-party contract, etc.) seems
common enough to deserve 1 bit in the flags, IMHO.
Efforts to define and add explicit introspection to cover your
(exciting!) use cases can proceed independently, but I don't think
they would nullify the advantages of this (optional) feature of CCV.

Best,
Salvatore

[-- Attachment #2: Type: text/html, Size: 2435 bytes --]

  reply	other threads:[~2023-08-09  8:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-30 21:37 [bitcoin-dev] Concrete MATT opcodes Salvatore Ingala
2023-08-06 20:13 ` David A. Harding
2023-08-07  8:31   ` Salvatore Ingala
2023-08-07 11:37 ` Johan Torås Halseth
2023-08-09  8:38   ` Salvatore Ingala [this message]
2023-08-14  3:00 ` Antoine Riard
2023-08-14 14:07   ` symphonicbtc
2023-08-18 20:12     ` Antoine Riard
2023-08-19 23:11       ` symphonicbtc
2023-09-13 20:25     ` Antoine Riard
2023-08-18 15:08   ` Salvatore Ingala
2023-09-15  0:23     ` Antoine Riard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMhCMoEoSiGPBczQerBe1TDJvo2Gkf4gbXOPUayKkNLsC_y4SQ@mail.gmail.com \
    --to=salvatore.ingala@gmail.com \
    --cc=bitcoin-dev@lists.linuxfoundation.org \
    --cc=johanth@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox