Return-Path: Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id AC6BAC0001 for ; 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 ; 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 ; 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 ; 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 ; Mon, 1 Mar 2021 15:32:46 -0500 Received: by mail-io1-f54.google.com with SMTP id 81so15597015iou.11 for ; 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 Date: Mon, 1 Mar 2021 12:32:34 -0800 X-Gmail-Original-Message-ID: Message-ID: To: Bitcoin development mailing list 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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
The short script* below could function as a cross platform= (need only have python 2 and curl) way to make a LOT=3DFalse function like= a LOT=3Dtrue node. This sort of scrip= t was mentioned recently in the ##taproot-activation IRC channel.

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's relationshi= p to DoS rules.

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.
<= div>
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't want user'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.

*completely untested, u= nverified, never even run mind = you -- obviously needs review b= efore actually running it

1 =C2=A0 =C2=A0 =C2=A0 =C2=A0 import sys, json, subprocess
= =C2=A02 =C2=A0 =C2=A0 =C2=A0 =C2=A0 from time import sleep
=C2=A03 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 LOTHEIGHT=3D600000
=C2=A04 =C2=A0 =C2=A0 =C2=A0= =C2=A0 LOTSTOP=3D LOTHEIGHT + 2016
=C2=A05 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = FORK=3D"taproot"
=C2=A06 =C2=A0 =C2=A0 =C2=A0 =C2=A0 credentia= l=3D"blah:blah"
=C2=A07 =C2=A0 =C2=A0 =C2=A0 =C2=A0 host =3D &= quot;http://127.0.0.1:8332"
= =C2=A08 =C2=A0 =C2=A0 =C2=A0 =C2=A0 contenttype =3D'content-type:text/p= lain;'
=C2=A09 =C2=A0 =C2=A0 =C2=A0 =C2=A0 def make_command(command,= args):
10 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return json.dumps({= "jsonrpc": "1.0",
11 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 "id":"curltext",
12 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 "method": command,
13 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 "params": args})
14 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 def call(command, args):
15 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 res =3D subprocess.run("curl", ["--user", cr= edential, "--data-binary", make_command(command, args), "-H&= quot;, contenttype, host])
16 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = return res.stdout
17 =C2=A0
18 =C2=A0 =C2=A0 =C2=A0 =C2=A0 should_sle= ep =3D False
19 =C2=A0 =C2=A0 =C2=A0 =C2=A0 while True:
20 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if should_sleep: sleep(10)
21 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 should_sleep =3D True
22 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 try:
23 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 data =3D json.load(call("getblockchaininfo",= []))
24 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 possibl= e =3D True
25 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if= data['blocks'] =C2=A0>=3D LOTHEIGHT and data['blocks'] = < LOTSTOP:
26 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 if not data['softforks'][FORK]['statistics']= ['possible']:
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("invalidateblock", [d= ata["bestblockhash"]])
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
= 29 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 except: pass

--0000000000003d387e05bc7f85a3--