summaryrefslogtreecommitdiff
path: root/61/d1ff41ace250f6bb0ee1c5028b0c2b28f6bf80
blob: 2d0206c14b28f8aa5ec969f27715860888106cc0 (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: <jlrubin@mit.edu>
Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133])
 by lists.linuxfoundation.org (Postfix) with ESMTP id AC6BAC0001
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Mon,  1 Mar 2021 20:32:49 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by smtp2.osuosl.org (Postfix) with ESMTP id 920A643117
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Mon,  1 Mar 2021 20:32:49 +0000 (UTC)
X-Virus-Scanned: amavisd-new at osuosl.org
X-Spam-Flag: NO
X-Spam-Score: -0.699
X-Spam-Level: 
X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5
 tests=[HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001,
 WEIRD_PORT=0.001] autolearn=ham autolearn_force=no
Received: from smtp2.osuosl.org ([127.0.0.1])
 by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id CC4A8kxpo5c8
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Mon,  1 Mar 2021 20:32:48 +0000 (UTC)
X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0
Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])
 by smtp2.osuosl.org (Postfix) with ESMTPS id 43D6F430CD
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Mon,  1 Mar 2021 20:32:48 +0000 (UTC)
Received: from mail-io1-f54.google.com (mail-io1-f54.google.com
 [209.85.166.54]) (authenticated bits=0)
 (User authenticated as jlrubin@ATHENA.MIT.EDU)
 by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 121KWkZK030523
 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NOT)
 for <bitcoin-dev@lists.linuxfoundation.org>; Mon, 1 Mar 2021 15:32:46 -0500
Received: by mail-io1-f54.google.com with SMTP id 81so15597015iou.11
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Mon, 01 Mar 2021 12:32:46 -0800 (PST)
X-Gm-Message-State: AOAM5332/fW+kE+3rMOOLBuf2umbwLm/RxXkK21bH3vE23EOIpFziSpa
 sEpXlGLn3HE96LdbQHDhupIfyoo8pQ7Z8aSm15o=
X-Google-Smtp-Source: ABdhPJxuqoM6Bv3GCfjZoegIq60XQkShwA+nm5NUxbchemMQAuQGAtQSoNrnAA4BTTmzVh8lhewTAaAE/KFYOhsTG2o=
X-Received: by 2002:a02:93e9:: with SMTP id z96mr17854649jah.73.1614630765802; 
 Mon, 01 Mar 2021 12:32:45 -0800 (PST)
MIME-Version: 1.0
From: Jeremy <jlrubin@mit.edu>
Date: Mon, 1 Mar 2021 12:32:34 -0800
X-Gmail-Original-Message-ID: <CAD5xwhidE-cnNe_g=7PvxUtp2=_RCGfOSadYgtx8FO6Tj634Hw@mail.gmail.com>
Message-ID: <CAD5xwhidE-cnNe_g=7PvxUtp2=_RCGfOSadYgtx8FO6Tj634Hw@mail.gmail.com>
To: Bitcoin development mailing list <bitcoin-dev@lists.linuxfoundation.org>
Content-Type: multipart/alternative; boundary="0000000000003d387e05bc7f85a3"
Subject: [bitcoin-dev] In defense of a configurable LOT if LOT=false is
	released
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: Mon, 01 Mar 2021 20:32:49 -0000

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

The short script* below could function as a cross platform (need only have
python 2 and curl) way to make a LOT=False function like a LOT=true node.
This sort of script was mentioned recently in the ##taproot-activation IRC
channel.

It is unclear to me with this sort of script what happens if a LOT=false
but running this script announces a to-be-marked-bad block to a similar
peer that has already marked that block invalid. It could lead to nodes
partitioning themselves from one another, but I am uncertain of the
particulars of invalidate block's relationship to DoS rules.

Therefore it may be a harm reduction, should core release with LOT=false,
to have opt-in configurability natively. Configurability is superior to a
situation where, near to the timeout with LOT=true seeming more likely,
users unable to switch binaries reach for such a convenience script.

The counterargument would be that running a script is still a hoop to jump
through more difficult than a config flag and we don't want user's choosing
consensus rules via config flags. However, it seems more in the spirit of
user choice to make the core release suitable for either preference.

*completely untested, unverified, never even run mind you -- obviously needs
review before actually running it

1         import sys, json, subprocess
 2         from time import sleep
 3         LOTHEIGHT=600000
 4         LOTSTOP= LOTHEIGHT + 2016
 5         FORK="taproot"
 6         credential="blah:blah"
 7         host = "http://127.0.0.1:8332"
 8         contenttype ='content-type:text/plain;'
 9         def make_command(command, args):
10             return json.dumps({"jsonrpc": "1.0",
11             "id":"curltext",
12             "method": command,
13             "params": args})
14         def call(command, args):
15             res = subprocess.run("curl", ["--user", credential,
"--data-binary", make_command(command, args), "-H", contenttype, host])
16             return res.stdout
17
18         should_sleep = False
19         while True:
20             if should_sleep: sleep(10)
21             should_sleep = True
22             try:
23                 data = json.load(call("getblockchaininfo", []))
24                 possible = True
25                 if data['blocks']  >= LOTHEIGHT and data['blocks'] <
LOTSTOP:
26                     if not
data['softforks'][FORK]['statistics']['possible']:
27                         call("invalidateblock", [data["bestblockhash"]])
28                         should_sleep = False
29             except: pass

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

<div dir=3D"ltr"><div><span class=3D"gmail_default" style=3D"font-family:ar=
ial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)">T</span>he <span=
 class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-serif;fo=
nt-size:small;color:rgb(0,0,0)">short</span> script<span class=3D"gmail_def=
ault" style=3D"font-family:arial,helvetica,sans-serif;font-size:small;color=
:rgb(0,0,0)">*</span> below<span class=3D"gmail_default" style=3D"font-fami=
ly:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)"></span> <sp=
an class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-serif;=
font-size:small;color:rgb(0,0,0)">could </span>function as a cross platform=
 (need only have python 2 and curl) way to make a LOT=3DFalse function like=
 a<span class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-s=
erif;font-size:small;color:rgb(0,0,0)"> LOT=3Dtrue node. This sort of scrip=
t was mentioned recently in the ##taproot-activation IRC channel.<br></span=
></div><div><span class=3D"gmail_default" style=3D"font-family:arial,helvet=
ica,sans-serif;font-size:small;color:rgb(0,0,0)"><br></span></div><div><spa=
n class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-serif;f=
ont-size:small;color:rgb(0,0,0)"><span class=3D"gmail_default" style=3D"fon=
t-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)"></spa=
n><span class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-s=
erif;font-size:small;color:rgb(0,0,0)">It is unclear to me with this sort o=
f script what happens if a LOT=3Dfalse but running this script announces a =
to-be-marked-bad block to a similar peer that has already marked that block=
 invalid. It could lead to nodes partitioning themselves from one another, =
but I am uncertain of the particulars of invalidate block&#39;s relationshi=
p to DoS rules.<br></span></span></div><div><span class=3D"gmail_default" s=
tyle=3D"font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,=
0,0)"><br></span></div><div><span class=3D"gmail_default" style=3D"font-fam=
ily:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)">Therefore =
it may be a harm reduction, should core release with LOT=3Dfalse, to have o=
pt-in configurability natively. Configurability is superior to a situation =
where, near to the timeout with LOT=3Dtrue seeming more likely, users unabl=
e to switch binaries reach for such a convenience script.<br></span></div><=
div><span class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans=
-serif;font-size:small;color:rgb(0,0,0)"><br></span></div><div><span class=
=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-serif;font-siz=
e:small;color:rgb(0,0,0)">The counterargument would be that running a scrip=
t is still a hoop to jump through more difficult than a config flag and we =
don&#39;t want user&#39;s choosing consensus rules via config flags. Howeve=
r, it seems more in the spirit of user choice to make the core release suit=
able for either preference.<br></span></div><div><span class=3D"gmail_defau=
lt" style=3D"font-family:arial,helvetica,sans-serif;font-size:small;color:r=
gb(0,0,0)"><br></span></div><div><span class=3D"gmail_default" style=3D"fon=
t-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)"></spa=
n><span class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-s=
erif;font-size:small;color:rgb(0,0,0)">*<span class=3D"gmail_default" style=
=3D"font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)=
"></span>completely untested<span class=3D"gmail_default" style=3D"font-fam=
ily:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)">,</span> u=
nverified<span class=3D"gmail_default" style=3D"font-family:arial,helvetica=
,sans-serif;font-size:small;color:rgb(0,0,0)">, never even run</span> mind =
you -- obviously <span class=3D"gmail_default" style=3D"font-family:arial,h=
elvetica,sans-serif;font-size:small;color:rgb(0,0,0)">needs review </span>b=
efore actually running it</span></div><br><span class=3D"gmail_default" sty=
le=3D"font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,=
0)"> </span>1 =C2=A0 =C2=A0 =C2=A0 =C2=A0 import sys, json, subprocess<br>=
=C2=A02 =C2=A0 =C2=A0 =C2=A0 =C2=A0 from time import sleep<br>=C2=A03 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 LOTHEIGHT=3D600000<br>=C2=A04 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 LOTSTOP=3D LOTHEIGHT + 2016<br>=C2=A05 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
FORK=3D&quot;taproot&quot;<br>=C2=A06 =C2=A0 =C2=A0 =C2=A0 =C2=A0 credentia=
l=3D&quot;blah:blah&quot;<br>=C2=A07 =C2=A0 =C2=A0 =C2=A0 =C2=A0 host =3D &=
quot;<a href=3D"http://127.0.0.1:8332">http://127.0.0.1:8332</a>&quot;<br>=
=C2=A08 =C2=A0 =C2=A0 =C2=A0 =C2=A0 contenttype =3D&#39;content-type:text/p=
lain;&#39;<br>=C2=A09 =C2=A0 =C2=A0 =C2=A0 =C2=A0 def make_command(command,=
 args):<br>10 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return json.dumps({=
&quot;jsonrpc&quot;: &quot;1.0&quot;,<br>11 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 &quot;id&quot;:&quot;curltext&quot;,<br>12 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 &quot;method&quot;: command,<br>13 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 &quot;params&quot;: args})<br>14 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 def call(command, args):<br>15 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 res =3D subprocess.run(&quot;curl&quot;, [&quot;--user&quot;, cr=
edential, &quot;--data-binary&quot;, make_command(command, args), &quot;-H&=
quot;, contenttype, host])<br>16 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
return res.stdout<br>17 =C2=A0<br>18 =C2=A0 =C2=A0 =C2=A0 =C2=A0 should_sle=
ep =3D False<br>19 =C2=A0 =C2=A0 =C2=A0 =C2=A0 while True:<br>20 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if should_sleep: sleep(10)<br>21 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 should_sleep =3D True<br>22 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 try:<br>23 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 data =3D json.load(call(&quot;getblockchaininfo&quot;,=
 []))<br>24 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 possibl=
e =3D True<br>25 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if=
 data[&#39;blocks&#39;] =C2=A0&gt;=3D LOTHEIGHT and data[&#39;blocks&#39;] =
&lt; LOTSTOP:<br>26 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 if not data[&#39;softforks&#39;][FORK][&#39;statistics&#39;]=
[&#39;possible&#39;]:<br>27 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 call(&quot;invalidateblock&quot;, [d=
ata[&quot;bestblockhash&quot;]])<br>28 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 should_sleep =3D False<br>=
29 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 except: pass<br><br></div>

--0000000000003d387e05bc7f85a3--