Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 10FD79DA for ; Sat, 9 Mar 2019 18:29:38 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-it1-f177.google.com (mail-it1-f177.google.com [209.85.166.177]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 9A3767FC for ; Sat, 9 Mar 2019 18:29:36 +0000 (UTC) Received: by mail-it1-f177.google.com with SMTP id z131so1245728itf.5 for ; Sat, 09 Mar 2019 10:29:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blockstream.io; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NDCwEewVOSMrObagWDqB3Up4U+r7guKg1jvrFlVRY/E=; b=wlLCyxR3IG2llbwrMNZt3Sy76dYnX2VnQZwjSk0qo3ZinR08duhw8E08N0Z9GwhpRD pqivNsimWuuZLgoYP23qclGSfgpYbdPDmd+JjyJkN5QgZ0YiJhkgfCC5nhFofDTP1Bqj Za4YgwacUi1upAgfZ4BwMwYRf3xfrVM/i+OM8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NDCwEewVOSMrObagWDqB3Up4U+r7guKg1jvrFlVRY/E=; b=pOyFpH12GqzGTZwWfeH2oao9m1H2e+RcQAIpsXVoIdnuR3eY2eyinQ0e68XbA/+7Bx LIg+hQdlrE0FVQpztPt7bSFJL315exBpuFzh2qaDbj4EOmH6e5TRQPoX6ctRfaBRv8Nq AC3PbsKJQPWouHfMNLAKLnJjqpfM2Mvmy2tWMTg1yMfTOrCFQdAsTOpIxR5VG24kuhRU R2QB3A0fszC7zKKJpyq2tC01/RnRcJdgEX/VihVeSRHpc8L21OKwLjdJ4SpMPTQ9s/5T wgFRsqHxg7qMSqPJOJzxoyuJ216zRb9X/Xb+U0wUL9A7YRSk1gMO6icmfAEunvio5KqU 7lwQ== X-Gm-Message-State: APjAAAX4VlcQBDMx5kNQX5afg18bTeW3EIIgzqHnGv67P/teU5NuAxC8 bhJ0cyMjB/04al1jYHd32o1n+EEY2wS4lulMnMOeKw== X-Google-Smtp-Source: APXvYqxT08o40Sbh9J+Q6c4nw8aJbLR6qGZejMk++jqd5Fkc+Y4air5fWdDKqDPkfZrvlVdWZ050AvTqZKxvPZ9iGvE= X-Received: by 2002:a24:e506:: with SMTP id g6mr11308356iti.127.1552156175812; Sat, 09 Mar 2019 10:29:35 -0800 (PST) MIME-Version: 1.0 References: <6bb308f5-f478-d5ec-064f-e4972709f29c@mattcorallo.com> In-Reply-To: From: "Russell O'Connor" Date: Sat, 9 Mar 2019 13:29:24 -0500 Message-ID: To: Matt Corallo Content-Type: multipart/alternative; boundary="0000000000007ee4a80583ad85ee" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HTML_MESSAGE, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org X-Mailman-Approved-At: Sat, 09 Mar 2019 22:19:30 +0000 Cc: Bitcoin Protocol Discussion Subject: Re: [bitcoin-dev] OP_CODESEPARATOR Re: BIP Proposal: The Great Consensus Cleanup X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2019 18:29:38 -0000 --0000000000007ee4a80583ad85ee Content-Type: text/plain; charset="UTF-8" Hi Matt, On Fri, Mar 8, 2019 at 1:35 PM Matt Corallo wrote: > Replies inline. > > On 3/8/19 3:57 PM, Russell O'Connor wrote: > > On Thu, Mar 7, 2019 at 2:50 PM Matt Corallo > > wrote: > > It's very easy to construct a practical script using OP_CODESEPARATOR. > > > > IF <2> <2> CHECKMULTISIGVERIFY ELSE > > CODESEPARATOR CHECKSIGVERFY ENDIF > > > > Now when someone hands Alice, the CFO of XYZ corp., some transaction, > > she has the option of either signing it unilaterally herself, or > > creating a partial signature such that the transaction additionally > > needs Bob, the CEOs signature as well, and Alice's choice is committed > > to the blockchain for auditing purposes later. > > > > Now, there are many things you might object about this scheme, but my > > point is that (A) regardless of what you think about this scheme, it, or > > similar schemes, may have been devised by users, and (B) users may have > > already committed funds to such schemes, and due to P2SH you cannot know > > that this is not the case. > > The common way to set that up is to have a separate key, but, ok, fair > enough. That said, the argument that "it may be hidden by P2SH!" isn't > sufficient here. It has to *both* be hidden by P2SH and have never been > spent from (either on mainnet or testnet) or be lock-timed a year in the > future. I'm seriously skeptical that someone is using a highly esoteric > scheme and has just been pouring money into it without ever having > tested it or having withdrawn any money from it whatsoever. This is just > a weird argument. > No one is required to test their Scripts on a public testnet; they can use regtest. Because these transactions are non-standard on mainnet, it could take years to arrange for these funds to be recovered by having their transactions mined directly, or take years to become valuable enough to be worth bothering having them directly mined. As I have noted elsewhere, you cannot first make transactions non-standard and then use the fact that you don't see them being used on mainnet to justify a soft-fork. My argument isn't weird; it is principled. You are skeptical that any uses of OP_CODESEPARATOR have P2SH commitments. I am also skeptical, and so is everyone reading this mailing list. But none of us know this with certainty, and it is /wrong/ for any of us to gamble with other people's money that our assumptions are true. Instead, it is this soft-fork proposal that is unprecedented. Let me reiterate what I posted in another thread: Bitcoin has *never* made a soft-fork, since the time of Satoishi, that invalidated transactions that send secured inputs to secured outputs (excluding uses of OP_NOP1-OP_NOP10). The fact that Bitcoin has stuck to this principle gives me and everyone else confidence in the protocol; that anyone can secure their funds by whatever scheme they dream up, and deploy it without needing permission or anyone else to vet their Scripts. So long as they are not impairing the Bitcoin protocol itself, the most that Bitcoin Core will do is stop relaying their transactions by default. Undermining this principle means undermining what provides Bitcoin's value in the first place. The problem in this particular case is that there exist valid secure transactions that make use OP_CODESEPARATOR such that these transactions themselves impair the Bitcoin protocol (through excessive validation costs) in a way that, AFAIU, is fundamental to the nature of such transactions (in particular, it isn't just due to an implementation detail of Bitcoin Core). Thus to fix this vulnerability we must necessarily violate the principle of not invalidating, secure transactions. However, this fact isn't license to freely invalidate any transactions we want. We ought to strive to minimize the scope of violation of this principle. Alice and Bob from XYZ. corp should be able to keep their benign transaction illustrated above, and we only eliminate those transactions that actually impair the Bitcoin protocol. This is the perfect opportunity to show the world that Bitcoin Core simply doesn't take chances when it comes to other people money. > Please don't strawman my position. I am not suggesting we don't fix a > > vulnerability in Bitcoin. I am suggesting we find another way. One > > that limits the of risk destroying other people's money. > > > > Here is a more concrete proposal: No matter how bad OP_CODESEPARATOR > > is, it cannot be worse than instead including another input that spends > > another identically sized UTXO. So how about we soft-fork in a rule > > that says that an input's weight is increased by an amount equal to the > > number of OP_CODESEPARATORs executed times the sum of weight of the UTXO > > being spent and 40 bytes, the weight of a stripped input. The risk of > > destroying other people's money is limited and AFAIU it would completely > > address the vulnerabilities caused by OP_CODESEPARATOR. > > You're already arguing that someone has such an esoteric use of script, > suggesting they aren't *also* creating pre-signed, long-locktimed > transactions with many inputs isn't much of a further stretch > (especially since this may result in the fee being non-standardly low if > you artificially increase its weight). > There is no consensus rule about minimum fees, and CPFP could add the more fees. But yes, I am saying that Alice and Bob could be building on their transaction illustrated above, but not creating a many input tx that wouldn't fit into a block with my proposed added weight, because if their transaction won't fit into a block with the added weight then it was a malicious transaction to begin with. Do you not recognize the material difference between a soft-fork that doubles the cost of a transaction like Alice and Bob's versus making their transaction entirely illegal? > Note that "just limit number of OP_CODESEPARATOR calls" results in a ton > of complexity and reduces the simple analysis that fees (almost) have > today vs just removing it allows us to also remove a ton of code. Further note that if you don't remove it getting the efficiency wins > right is even harder because instead of being able to cache sighashes > you now have to (at a minimum) wipe the cache between each > OP_CODESEPARATOR call, which results in a ton of additional > implementation complexity. > How can this be "additional" complexity when this is how the protocol works today? All you have to do is not change the semantics of OP_CODESEPARATOR. It is literally no work. Regarding the efficiency wins, let me repeat myself: The performance costs of wiping the cached sighashs is not worse than what the performance costs would be if the transaction had an additional input spending an equally sized UTXO. > > > I suggest an alternative whereby the execution of OP_CODESEPARATOR > > > increases the transactions weight suitably as to temper the > > > vulnerability caused by it. Alternatively there could be some > > sort of > > > limit (maybe 1) on the maximum number of OP_CODESEPARATORs > > allowed to be > > > executed per script, but that would require an argument as to why > > > exceeding that limit isn't reasonable. > > > > You could equally argue, however, that any such limit could render > some > > moderately-large transaction unspendable, so I'm somewhat skeptical > of > > this argument. Note that OP_CODESEPARATOR is non-standard, so getting > > them mined is rather difficult in any case. > > > > > > I already know of people who's funds are tied up due to in other changes > > to Bitcoin Core's default relay policy. Non-standardness is not an > > excuse to take other people's tied up funds and destroy them permanently. > > Huh?! The whole point of non-standardness in this context is to (a) make > soft-forking something out safer by derisking miners not upgrading right > away and (b) signal something that may be a candidate for soft-forking > out so that we get feedback. Who is getting things disabled who isn't > bothering to *tell* people that their use-case is being hurt?! > People have told me that they are hurt by some other non-standardness changes and I understand that they have been sitting on those funds for years. Maybe they don't realize their is some place to complain or maybe they think there must be a good reason why they are not allowed to do what they were previously allowed to do. Perhaps others don't want to risk blowing their pseudonymity. Perhaps they think that attempting to undo some of these non-standardness changes is futile. I can bring up the specific cases I've encountered in a new thread if you think it is worthwhile. Regarding OP_CODESEAPRATOR specifically, disabling the rely of such transactions partially mitigates the vulnerability. Once the vulnerability is properly patched, for example by suitably increasing the weight of the operation or opcode, we could drop the prohibition on relaying such transactions. Non-standardness is not necessarily a path to a new consensus rule. We have several non-standardness rules in place that are never intended to become new consensus rules. Sometimes non-standardness is a temporary mitigation. --0000000000007ee4a80583ad85ee Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Matt,
=
On Fri= , Mar 8, 2019 at 1:35 PM Matt Corallo <lf-lists@mattcorallo.com> wrote:
Rep= lies inline.

On 3/8/19 3:57 PM, Russell O'Connor wrote:
> On Thu, Mar 7, 2019 at 2:50 PM Matt Corallo <
lf-lists@mattcor= allo.com
> <mailto:lf-lists@mattcorallo.com>> wrote:
> It's very easy to construct a practical script using OP_CODESEPARA= TOR.
>
> IF <2> <ALICEPUBKEY> <BOBPUBKEY> <2> CHECKMULT= ISIGVERIFY ELSE
> CODESEPARATOR <ALICEPUBKEY> CHECKSIGVERFY ENDIF
>
> Now when someone hands Alice, the CFO of XYZ corp., some transaction, =
> she has the option of either signing it unilaterally herself, or
> creating a partial signature such that the transaction additionally > needs Bob, the CEOs signature as well, and Alice's choice is commi= tted
> to the blockchain for auditing purposes later.
>
> Now, there are many things you might object about this scheme, but my =
> point is that (A) regardless of what you think about this scheme, it, = or
> similar schemes, may have been devised by users, and (B) users may hav= e
> already committed funds to such schemes, and due to P2SH you cannot kn= ow
> that this is not the case.

The common way to set that up is to have a separate key, but, ok, fair
enough. That said, the argument that "it may be hidden by P2SH!" = isn't
sufficient here. It has to *both* be hidden by P2SH and have never been spent from (either on mainnet or testnet) or be lock-timed a year in the future. I'm seriously skeptical that someone is using a highly esoteric=
scheme and has just been pouring money into it without ever having
tested it or having withdrawn any money from it whatsoever. This is just a weird argument.

No one is required to test their Scripts on a = public testnet; they can use regtest. Because these transactions are non-st= andard on mainnet, it could take years to arrange for these funds to be rec= overed by having their transactions mined directly, or take years to become= valuable enough to be worth bothering having them directly mined.=C2=A0 As= I have noted elsewhere, you cannot first make transactions non-standard an= d then use the fact that you don't see them being used on mainnet to ju= stify a soft-fork.

My argument isn't weir= d; it is principled.=C2=A0 You are skeptical that any uses of OP_CODESEPARA= TOR have P2SH=20 commitments.=C2=A0 I am also skeptical, and so is everyone reading this=20 mailing list.=C2=A0 But none of us know this with certainty, and it is /wro= ng/ for any of us to gamble with other people's money that our assumptions = are true.

Instead, it is this soft-fork propo= sal that is unprecedented. Let me reiterate what I posted in another thread= :

Bitcoin has=20 *never* made a soft-fork, since the time of Satoishi, that invalidated=20 transactions that send secured inputs to secured outputs (excluding uses of= OP_NOP1-OP_NOP10).

The fact that Bitcoin has stuck to this principle gives me and everyone else=20 confidence in the protocol; that anyone can secure their funds by=20 whatever scheme they dream up, and deploy it without needing permission=20 or anyone else to vet their Scripts. So long as they are not=20 impairing the Bitcoin protocol itself, the most that Bitcoin Core will do i= s stop relaying their transactions by default.

Undermining thi= s principle means undermining what provides Bitcoin's value in the firs= t place.

The problem in this particular case is th= at there exist valid secure transactions that make=20 use OP_CODESEPARATOR such that these transactions themselves impair the Bit= coin protocol (through excessive validation costs) in a way that, AFAIU, is fundamental to the nature of such transactions (in particular, it isn't just due to a= n implementation detail of Bitcoin Core).=C2=A0 Thus to fix this vulnerabil= ity we must=20 necessarily violate the principle of not invalidating, secure=20 transactions.=C2=A0 However, this fact isn't license to freely invalida= te any=20 transactions we want.=C2=A0 We ought to strive to minimize the scope of vio= lation of=20 this principle.=C2=A0 Alice and Bob from XYZ. corp should be able to keep t= heir benign transaction illustrated above,=20 and we only eliminate those transactions that actually impair the=20 Bitcoin protocol.

This is the perfect opportunity to sh= ow the world that Bitcoin Core simply doesn't take chances when it come= s to other people money.

> Please don't strawman my position.=C2=A0 I am = not suggesting we don't fix a
> vulnerability in Bitcoin.=C2=A0 I am suggesting we find another way.= =C2=A0 One
> that limits the of risk destroying other people's money.
>
> Here is a more concrete proposal:=C2=A0 No matter how bad OP_CODESEPAR= ATOR
> is, it cannot be worse than instead including another input that spend= s
> another identically sized UTXO.=C2=A0 So how about we soft-fork in a r= ule
> that says that an input's weight is increased by an amount equal t= o the
> number of OP_CODESEPARATORs executed times the sum of weight of the UT= XO
> being spent and 40 bytes, the weight of a stripped input. The risk of =
> destroying other people's money is limited and AFAIU it would comp= letely
> address the vulnerabilities caused by OP_CODESEPARATOR.

You're already arguing that someone has such an esoteric use of script,=
suggesting they aren't *also* creating pre-signed, long-locktimed
transactions with many inputs isn't much of a further stretch
(especially since this may result in the fee being non-standardly low if you artificially increase its weight).

= There is no consensus rule about minimum fees, and CPFP could add the more = fees. But yes, I am saying that Alice and Bob could be building on their tr= ansaction illustrated above, but not creating a many input tx that wouldn&#= 39;t fit into a block with my proposed added weight, because if their trans= action won't fit into a block with the added weight then it was a malic= ious transaction to begin with.

Do you not recognize the material difference between a soft-for= k that doubles the cost of a transaction like Alice and Bob's versus ma= king their transaction entirely illegal?
=C2=A0
Note that "just limit number of OP_CODESEPARATOR calls" results i= n a ton
of complexity and reduces the simple analysis that fees (almost) have
today vs just removing it allows us to also remove a ton of code.
Further note that if you don't remove it getting the efficiency wins right is even harder because instead of being able to cache sighashes
you now have to (at a minimum) wipe the cache between each
OP_CODESEPARATOR call, which results in a ton of additional
implementation complexity.

How can this= be "additional" complexity when this is how the protocol works t= oday?=C2=A0 All you have to do is not change the semantics of OP_CODESEPARA= TOR.=C2=A0 It is literally no work.
Regarding the efficiency wins= , let me repeat myself: The performance costs of wiping the cached sighashs= is not worse than what the performance costs would be if the transaction h= ad an additional input spending an equally sized UTXO.
=C2=A0=
>=C2=A0 =C2=A0 =C2=A0 > I suggest an alternative whereby the executio= n of OP_CODESEPARATOR
>=C2=A0 =C2=A0 =C2=A0 > increases the transactions weight suitably as= to temper the
>=C2=A0 =C2=A0 =C2=A0 > vulnerability caused by it.=C2=A0 Alternative= ly there could be some
>=C2=A0 =C2=A0 =C2=A0sort of
>=C2=A0 =C2=A0 =C2=A0 > limit (maybe 1) on the maximum number of OP_C= ODESEPARATORs
>=C2=A0 =C2=A0 =C2=A0allowed to be
>=C2=A0 =C2=A0 =C2=A0 > executed per script, but that would require a= n argument as to why
>=C2=A0 =C2=A0 =C2=A0 > exceeding that limit isn't reasonable. >
>=C2=A0 =C2=A0 =C2=A0You could equally argue, however, that any such lim= it could render some
>=C2=A0 =C2=A0 =C2=A0moderately-large transaction unspendable, so I'= m somewhat skeptical of
>=C2=A0 =C2=A0 =C2=A0this argument. Note that OP_CODESEPARATOR is non-st= andard, so getting
>=C2=A0 =C2=A0 =C2=A0them mined is rather difficult in any case.
>
>
> I already know of people who's funds are tied up due to in other c= hanges
> to Bitcoin Core's default relay policy.=C2=A0 Non-standardness is = not an
> excuse to take other people's tied up funds and destroy them perma= nently.

Huh?! The whole point of non-standardness in this context is to (a) make soft-forking something out safer by derisking miners not upgrading right away and (b) signal something that may be a candidate for soft-forking
out so that we get feedback. Who is getting things disabled who isn't <= br> bothering to *tell* people that their use-case is being hurt?!

People have told me that they are hurt by some othe= r non-standardness changes and I understand that they have been sitting on = those funds for years.=C2=A0 Maybe they don't realize their is some pla= ce to complain or maybe they think there must be a good reason why they are= not allowed to do what they were previously allowed to do.=C2=A0 Perhaps o= thers don't want to risk blowing their pseudonymity.=C2=A0 Perhaps they= think that attempting to undo some of these non-standardness changes is fu= tile.=C2=A0 I can bring up the specific cases I've encountered in a new= thread if you think it is worthwhile.

Regardi= ng OP_CODESEAPRATOR specifically, disabling the rely of such transactions p= artially mitigates the vulnerability.=C2=A0 Once the vulnerability is prope= rly patched, for example by suitably increasing the weight of the operation= or opcode, we could drop the prohibition on relaying such transactions.=C2= =A0 Non-standardness is not necessarily a path to a new consensus rule. We = have several non-standardness rules in place that are never intended to bec= ome new consensus rules.=C2=A0 Sometimes non-standardness is a temporary m= itigation.

--0000000000007ee4a80583ad85ee--