summaryrefslogtreecommitdiff
path: root/b1/e9023c7cda087d8ed9080c10d2f797782f8ad4
blob: bdba5904cc1b58222a0a1acc8150acc0b81999b4 (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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
Return-Path: <sergio.d.lerner@gmail.com>
Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org
	[172.17.192.35])
	by mail.linuxfoundation.org (Postfix) with ESMTPS id B6EC8B30
	for <bitcoin-dev@lists.linuxfoundation.org>;
	Thu, 13 Jul 2017 03:11:37 +0000 (UTC)
X-Greylist: whitelisted by SQLgrey-1.7.6
Received: from mail-qt0-f171.google.com (mail-qt0-f171.google.com
	[209.85.216.171])
	by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 2A037AD
	for <bitcoin-dev@lists.linuxfoundation.org>;
	Thu, 13 Jul 2017 03:11:37 +0000 (UTC)
Received: by mail-qt0-f171.google.com with SMTP id i2so28092531qta.3
	for <bitcoin-dev@lists.linuxfoundation.org>;
	Wed, 12 Jul 2017 20:11:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc; bh=5MpO2g21Wlu2F3upZ+dGMcwH9dU6ITN19fEL/0tXJfk=;
	b=jp0pEDC3YKAYfzZQmelpQgPRwbpm7w+wQqDnXoDdDBwsiWaAV5tUxUiEZ4xKOlC8ol
	Q8/IrWK2DDDs2BoF0/ZxjQligW3kuMFK4tY6nLr4t/5pgg0CHijVkIWhwjPGqo/ha6zG
	FpEEqPCbUhua/e1SlCoN1RSf8UlwFWxzeqhFhai7OW/+cDJX9uo6mv06s8tNkfMj1SdD
	BbQ/Nwb5dmwKq5aWBYDpu9IfZdd6mdp1hFHWlPRk9Rp90YNV6jKrBW1TkNK2OQSATWDw
	9f9oq9BkV1xysk8El2RlqfoYbLs4j5Xsq0fQl98yzm4W8DJ7bj+jVqdLCloHtJm79D+o
	AsAg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:in-reply-to:references:from:date
	:message-id:subject:to:cc;
	bh=5MpO2g21Wlu2F3upZ+dGMcwH9dU6ITN19fEL/0tXJfk=;
	b=WuOrNfiz2PmGf77M5Dg8QL92D8fi6GoEHGdvzOUvl12dRd7+ql4czwjwrTAcHXmTqY
	z6e8Ya/yJlsIPVphKeO/O0+v8brOwqOyTAOwiierfwIxDSgQplvfcdyFEKGGRfm0sR5q
	6YqR7AzW8tk/9semcOLcKuy96MyLH5qmpavmDCKlik2/JIZmXHbUZMaXsNLAocQgfe27
	KPxD4FJ0PuZVZrDEuaQdU2UQClQDRSSxDQkO3tN47vbgLmIEPsXDeS28BrVUzAO4afKr
	9/Z8EiZ8cya1rMuerWOYUQEyjL6sqEC9WgM6WseOfxvCr1AObwlBHwwFL1X9AI9r4ge+
	Gq1Q==
X-Gm-Message-State: AIVw113udbyeKz8TIhmZT9AV/nZdq5wmJOhvp6V98bdEvQpn1uHiE8OY
	cva/hNuHur4lT2HHpQxqMGmDfYuOYikxMT0=
X-Received: by 10.200.3.132 with SMTP id t4mr2304497qtg.232.1499915496322;
	Wed, 12 Jul 2017 20:11:36 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.12.135.113 with HTTP; Wed, 12 Jul 2017 20:10:55 -0700 (PDT)
In-Reply-To: <CAAS2fgRAdKFu8JqbmtAES3NkX2BK27LucSf=heZ2xyz30BKetw@mail.gmail.com>
References: <CAKzdR-qCmuj02yobAj9YDYq7Ed309z2VUaMtbL_i9vF3zkp5mw@mail.gmail.com>
	<CAAS2fgRAdKFu8JqbmtAES3NkX2BK27LucSf=heZ2xyz30BKetw@mail.gmail.com>
From: Sergio Demian Lerner <sergio.d.lerner@gmail.com>
Date: Thu, 13 Jul 2017 00:10:55 -0300
Message-ID: <CAKzdR-pkiWXuZKH1NLR_=OD+NUGxzOgX03beJ7pc1QGVdmg3VA@mail.gmail.com>
To: Gregory Maxwell <greg@xiph.org>
Content-Type: multipart/alternative; boundary="f40304379a4859fc8f05542a4a00"
X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,
	DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, HTML_MESSAGE,
	RCVD_IN_DNSWL_NONE, 
	RCVD_IN_SORBS_SPAM autolearn=no version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
	smtp1.linux-foundation.org
X-Mailman-Approved-At: Thu, 13 Jul 2017 03:20:27 +0000
Cc: bitcoin-dev <bitcoin-dev@lists.linuxfoundation.org>
Subject: Re: [bitcoin-dev] A Segwit2x BIP
X-BeenThere: bitcoin-dev@lists.linuxfoundation.org
X-Mailman-Version: 2.1.12
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: Thu, 13 Jul 2017 03:11:37 -0000

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

Some responses..

>
> The proposal adds another gratuitous limit to the system: A maximum
> transaction size where none existed before, yet this limit is almost
> certainly too small to prevent actual DOS attacks while it is also
> technically larger than any transaction that can be included today
> (the largest possible transaction today is 1mb minus the block
> overheads).  The maximum resource usage for maliciously crafted 1MB
> transaction is enormous and permitting two of them greatly exacerbates
> the existing vulnerability.
>
>
I think that limiting the maximum transaction size may not be the best
possible solution to the N^2 hashing problem, yet it is not a bad start.

There are several viable soft-forking solutions to it:

1- Soft-fork to perform periodic reductions in the maximum non-segwit
checksigs per input (down to 20)
2- Soft-fork to perform periodic reductions in the number of non-segwit
checksigs per transaction. (down to 5K)
3- Soft-fork to perform periodic reductions in the amount of data hashed by
non-segwit checksigs.

Regardless which one one picks, the soft-fork can be deployed with enough
time in advance to reduce the exposure. The risk is still low. Four years
have passed since I reported this vulnerability and yet nobody has
exploited it. The attack is highly anti-economical, yet every discussion
about the block size ends up citing this vulnerability.

,

> > Assuming the current transaction pattern is replicated in a 2 MB
> plain-sized block that is 100% filled with transactions, then the
> witness-serialized block would occupy 3.6 MB
>
> But in a worst case the result would be 8MB, which this document fails
> to mention.
>

I will mention this worst case in the BIP.

Even if artificially filling the witness space up to 8 MB is
anti-economical, Segwit exacerbates this problem because each witness byte
costs 1/4th of a non-witness byte, so the block bloat attack gets cheaper
than before. I think the guilt lies more in Segwit discount factor than in
the plain block size increase.
I would remove the discount factor altogether, and add a fixed (40 bytes)
discount for each input with respect to outputs (not for certain input
types), to incentivize the cleaning of the UTXO set. A discount for inputs
cannot be used to bloat an unlimited number of blocks, because for each
input the attacker needs to first create an output (without discount).
There is no need to incentivize removing the signatures from blocks,
because there is already an incentive to do so to save disk space.


>
> > Deploy a modified BIP91 to activate Segwit. The only modification is
> that the signal "segsignal" is replaced by "segwit2x".
>
> This means that BIP-91 and your proposal are indistinguishable on the
> network, because the string "segsignal" is merely a variable name used
> in the software.
>
> No, it is exposed to the rpc mining interface (getblocktemplate). It must
be redefined, even if it's not a consensus change.


>

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

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote"><div=
>Some responses..=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1=
ex">
<br>
The proposal adds another gratuitous limit to the system: A maximum<br>
transaction size where none existed before, yet this limit is almost<br>
certainly too small to prevent actual DOS attacks while it is also<br>
technically larger than any transaction that can be included today<br>
(the largest possible transaction today is 1mb minus the block<br>
overheads).=C2=A0 The maximum resource usage for maliciously crafted 1MB<br=
>
transaction is enormous and permitting two of them greatly exacerbates<br>
the existing vulnerability.<br>
<br></blockquote><div><br></div><div>I think that limiting the maximum tran=
saction size may not be the best possible solution to the N^2 hashing probl=
em, yet it is not a bad start.</div><div><br></div><div>There are several v=
iable soft-forking solutions to it:</div><div><br></div><div>1- Soft-fork t=
o perform periodic reductions in the maximum non-segwit checksigs per input=
 (down to 20)<br></div><div>2- Soft-fork to perform periodic reductions in =
the number of non-segwit checksigs per transaction. (down to 5K)<br></div><=
div>3- Soft-fork to perform periodic reductions in the=C2=A0amount of data =
hashed by non-segwit checksigs.</div><div><br></div><div>Regardless which o=
ne one picks, the soft-fork can be deployed with enough time in advance to =
reduce the exposure. The risk is still low. Four years have passed since I =
reported this vulnerability and yet nobody has exploited it. The attack is =
highly anti-economical, yet every discussion about the block size ends up c=
iting this vulnerability.</div><div><br></div><div>,=C2=A0</div><blockquote=
 class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px so=
lid rgb(204,204,204);padding-left:1ex">
&gt; Assuming the current transaction pattern is replicated in a 2 MB plain=
-sized block that is 100% filled with transactions, then the witness-serial=
ized block would occupy 3.6 MB<br>
<br>
But in a worst case the result would be 8MB, which this document fails<br>
to mention.<br></blockquote><div><br></div><div>I will mention this worst c=
ase in the BIP.=C2=A0</div><div><br></div><div>Even if artificially filling=
 the witness space up to 8 MB is anti-economical, Segwit exacerbates this p=
roblem because each witness byte costs 1/4th of a non-witness byte, so the =
block bloat attack gets cheaper than before. I think the guilt lies more in=
 Segwit discount factor than in the plain block size increase.</div><div>I =
would remove the discount factor altogether, and add a fixed (40 bytes) dis=
count for each input with respect to outputs (not for certain input types),=
 to incentivize the cleaning of the UTXO set. A discount for inputs cannot =
be used to bloat an unlimited number of blocks, because for each input the =
attacker needs to first create an output (without discount). There is no ne=
ed to incentivize removing the signatures from blocks, because there is alr=
eady an incentive to do so to save disk space.</div><div><br></div><blockqu=
ote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px=
 solid rgb(204,204,204);padding-left:1ex"><br>
<span class=3D"gmail-"><br>
&gt; Deploy a modified BIP91 to activate Segwit. The only modification is t=
hat the signal &quot;segsignal&quot; is replaced by &quot;segwit2x&quot;.<b=
r>
<br>
</span>This means that BIP-91 and your proposal are indistinguishable on th=
e<br>
network, because the string &quot;segsignal&quot; is merely a variable name=
 used<br>
in the software.<br>
<span class=3D"gmail-"><br></span></blockquote><div>No, it is exposed to th=
e rpc mining interface (getblocktemplate). It must be redefined, even if it=
&#39;s not a consensus change.</div><div><br></div><blockquote class=3D"gma=
il_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,2=
04,204);padding-left:1ex"><br></blockquote></div></div></div>

--f40304379a4859fc8f05542a4a00--