summaryrefslogtreecommitdiff
path: root/39/ce76a4bfbc0ebce80a43495efa9d5e7b9dd5dd
blob: 92f1b5c3e1ec616805d2127ca183fcd02966966f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
Return-Path: <salvatore.ingala@gmail.com>
Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137])
 by lists.linuxfoundation.org (Postfix) with ESMTP id 46570C0032
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Wed,  9 Aug 2023 08:39:02 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by smtp4.osuosl.org (Postfix) with ESMTP id 28BD0416F2
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Wed,  9 Aug 2023 08:39:02 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 28BD0416F2
Authentication-Results: smtp4.osuosl.org;
 dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com
 header.a=rsa-sha256 header.s=20221208 header.b=J5VGdUvP
X-Virus-Scanned: amavisd-new at osuosl.org
X-Spam-Flag: NO
X-Spam-Score: -2.098
X-Spam-Level: 
X-Spam-Status: No, score=-2.098 tagged_above=-999 required=5
 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
 DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Received: from smtp4.osuosl.org ([127.0.0.1])
 by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id MZz7ItS_f-vB
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Wed,  9 Aug 2023 08:39:01 +0000 (UTC)
Received: from mail-il1-x133.google.com (mail-il1-x133.google.com
 [IPv6:2607:f8b0:4864:20::133])
 by smtp4.osuosl.org (Postfix) with ESMTPS id EA5C441602
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Wed,  9 Aug 2023 08:39:00 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org EA5C441602
Received: by mail-il1-x133.google.com with SMTP id
 e9e14a558f8ab-348db491d0eso29193065ab.3
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Wed, 09 Aug 2023 01:39:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1691570340; x=1692175140;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=lj5na6c9F2Zhjjp9bhn9Sib9egD26RadLy7vFHltc8k=;
 b=J5VGdUvPY3Kn7XX3tJ6B+eWXFqZFcyQk9j73H5qHxVh0cvTqHGFHsdQ/iQFm8W/PgP
 mR5xAbwAaf3N+Kh/feBN1EZWJ/CmzZRaoKanpimGDQ5JMPARpjgtpvcOm3fMvqiRDdv0
 2Czs40SwnOHtTnPoEd/bGhBLVkmAtXKQCf5XBIR7zdkDVIxaAc7WqT+yguD2lgRW1+AS
 /HJuxlQ55OECjTQ0nrV55Wnr+XuaELshU797wJDsO+LGhVlRfmr/bh6GpY0rbhsNBPIx
 /0t4spN7SVp3x59qJUhFlLfYL6R60+/nQ6lV+vLD5xoYLHYMpzbTHYPhuDQN/drj3Y5y
 8h0Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1691570340; x=1692175140;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=lj5na6c9F2Zhjjp9bhn9Sib9egD26RadLy7vFHltc8k=;
 b=i17ND4Mh9JrOJZ1dWQct3syErSnldD+Or4HhJXEuMopiFqQ0uPucWCzT5m+fXdLXFy
 Wmg84lExlU1IPjqIbwj67Bp/0ILFbGd+DyTToLUcZP9CxaWCACYjf3e7H6m22c/1PZcz
 eXCzE9/NY/+5wbmJCLX+RcksLyEKriUAGVobHOdpllQqQ7cuc3sF3ntnldyqSYtlJAz+
 FQ+qJ0lGIuAp7RgnijKLah1x5Fh9Bodn6r4tC9ZkrOINLC5Ra4PCi7uBSVocfc/dhdn4
 CGV4NhikB+dHuraec6RxkhEHJGn6MXMyhQyOuHvWUEeJqz7IlG8MdVw8Yau3pFJjACPK
 lEKQ==
X-Gm-Message-State: AOJu0YzpzEJ1C2c9r4AFTOowAu6insS8+OLMCzFe4Bo8BMq7NBwNwsOk
 HhqrAmfVN2US4RLWw1xq/zL4npwnvrxjdo/MF18=
X-Google-Smtp-Source: AGHT+IEV3Y5dfZRdSXKmC5wieE3TAqO2nOOR7ogBHHP8uz2Lm+3TbagjoeVu1x/aTS17r7XqOSYtqqoHA0gy+bFpSlQ=
X-Received: by 2002:a05:6e02:1bc6:b0:349:779e:895d with SMTP id
 x6-20020a056e021bc600b00349779e895dmr2961325ilv.29.1691570339895; Wed, 09 Aug
 2023 01:38:59 -0700 (PDT)
MIME-Version: 1.0
References: <CAMhCMoFYF+9NL1sqKfn=ma3C_mfQv7mj2fqbqO5WXVwd6vyhLw@mail.gmail.com>
 <CAD3i26AxcRCewX7vt5KV9vQp_mD=DaH1GEmqQQ1Ct8v_oW-WXQ@mail.gmail.com>
In-Reply-To: <CAD3i26AxcRCewX7vt5KV9vQp_mD=DaH1GEmqQQ1Ct8v_oW-WXQ@mail.gmail.com>
From: Salvatore Ingala <salvatore.ingala@gmail.com>
Date: Wed, 9 Aug 2023 10:38:48 +0200
Message-ID: <CAMhCMoEoSiGPBczQerBe1TDJvo2Gkf4gbXOPUayKkNLsC_y4SQ@mail.gmail.com>
To: =?UTF-8?Q?Johan_Tor=C3=A5s_Halseth?= <johanth@gmail.com>
Content-Type: multipart/alternative; boundary="00000000000038de960602796918"
X-Mailman-Approved-At: Wed, 09 Aug 2023 10:56:24 +0000
Cc: Bitcoin Protocol Discussion <bitcoin-dev@lists.linuxfoundation.org>
Subject: Re: [bitcoin-dev] Concrete MATT opcodes
X-BeenThere: bitcoin-dev@lists.linuxfoundation.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Bitcoin Protocol Discussion <bitcoin-dev.lists.linuxfoundation.org>
List-Unsubscribe: <https://lists.linuxfoundation.org/mailman/options/bitcoin-dev>, 
 <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=unsubscribe>
List-Archive: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/>
List-Post: <mailto:bitcoin-dev@lists.linuxfoundation.org>
List-Help: <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=help>
List-Subscribe: <https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev>, 
 <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=subscribe>
X-List-Received-Date: Wed, 09 Aug 2023 08:39:02 -0000

--00000000000038de960602796918
Content-Type: text/plain; charset="UTF-8"

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

--00000000000038de960602796918
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">Hi Johan,<br><br>Thanks a lot for the com=
ments, and the independent=C2=A0implementation!<br><br>&gt; - For the opcod=
e parameter ordering, it feels unnatural for the two<br>&gt; tweaks (data, =
taptree) to be separated by the internal key. A more<br>&gt; natural orderi=
ng of parameters IMO would be (of course this is all<br>&gt; subjective):<b=
r>&gt; &lt;data&gt; &lt;taptree&gt; &lt;internalkey&gt; &lt;index&gt; &lt;f=
lags&gt; OP_CCV.<br>&gt;<br>&gt; If you disagree, I would love some rationa=
le for the ordering you<br>&gt; chose! (looks like you also changed it agai=
n after your last post?).<br><br>The main concern for the reordering was to=
 put &lt;data&gt; at the bottom,<br>as that&#39;s typically passed via the =
witness stack.<br><br>I put the &lt;index&gt; right next, as I suspect ther=
e are use cases for<br>specifying via the witness what is the input index w=
here a certain<br>(CCV-encumbered) UTXO is to be found, or which output sho=
uld funds<br>be sent to, instead of hard-coding this in the script. This mi=
ght<br>help in designing contracts that are more flexible in the way they<b=
r>are spent, for example by allowing batching their transactions.<br><br>In=
stead, I expect the other parameters to almost always be hardcoded,<br>or p=
ropagated from the current input with the &lt;-1&gt; special values.<br><br=
>I agree that your ordering is more aesthetically pleasing, though.<br><br>=
&gt; I&#39;m wondering what other use cases you had in mind for the deferre=
d<br>&gt; output amount check? Maybe I have missed something, but if not it=
<br>&gt; would perhaps be better to leave out the amount preservation check=
, or<br>&gt; go the extra mile and propose a more powerful amount introspec=
tion<br>&gt; machinery.<br><br>Yes, the deferred output amount check is not=
 enough for coinpools;<br>however, it comes at no cost if we have a &lt;fla=
gs&gt; parameter anyway,<br>as OP_2 (value for CCV_IGNORE_OUTPUT_AMOUNT) is=
 a single byte opcode.<br><br>The intent of preserving amounts for many-to-=
one contracts (vaults),<br>or the one-to-one cases (channels, any 2-party c=
ontract, etc.) seems<br>common enough to deserve 1 bit in the flags, IMHO.<=
br>Efforts to define and add explicit introspection to cover your<br>(excit=
ing!) use cases can proceed independently, but I don&#39;t think<br>they wo=
uld nullify the advantages of this (optional) feature of CCV.</div><div dir=
=3D"ltr"><br>Best,<br>Salvatore</div></div>

--00000000000038de960602796918--