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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
|
Delivery-date: Wed, 19 Mar 2025 02:04:42 -0700
Received: from mail-yw1-f184.google.com ([209.85.128.184])
by mail.fairlystable.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
(Exim 4.94.2)
(envelope-from <bitcoindev+bncBCY3VBMZVAMRBIER5K7AMGQEBB5HY2Y@googlegroups.com>)
id 1tupLt-0000Ol-Kg
for bitcoindev@gnusha.org; Wed, 19 Mar 2025 02:04:42 -0700
Received: by mail-yw1-f184.google.com with SMTP id 00721157ae682-6fec1d75f7asf77843317b3.0
for <bitcoindev@gnusha.org>; Wed, 19 Mar 2025 02:04:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=googlegroups.com; s=20230601; t=1742375075; x=1742979875; darn=gnusha.org;
h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
:list-id:mailing-list:precedence:x-original-sender:mime-version
:subject:references:in-reply-to:message-id:to:from:date:sender:from
:to:cc:subject:date:message-id:reply-to;
bh=fPlj/wsJjE+LaFiRw2xNq+nFuwALGL3AzqFya5tZhPg=;
b=VCWj3wEmOomzRa43JSc4Bvho9e8K7a/7JZTra+qiXrMSaLdXC3THnNzUU+7i8CElnp
sOjJTSEBhsnvVW3cdKNvE0o71gpRvS/gRWmGdjb2Nmmb/SuUueD5VqFRemqbcmx/I2LP
KiVCoAcCIUxy8k9PNP0c3G3ppQVFTMIuG57sfE+FYwJ6XYjwujlnH9alEAJQSAandmsI
BRIoDYwWhnlKI6xkVzEUvoubSdC5tWrLLHu5wNN7pIrWgvKH2zw55c1O9chw0PQPnhBU
sLIYbhL9SuRCJescZwDR//5osYPG43dihA9SYBD3kHqeRRmszsl8j98Ys6h4pE2oA9hR
Rcbw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1742375075; x=1742979875; darn=gnusha.org;
h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
:list-id:mailing-list:precedence:x-original-sender:mime-version
:subject:references:in-reply-to:message-id:to:from:date:from:to:cc
:subject:date:message-id:reply-to;
bh=fPlj/wsJjE+LaFiRw2xNq+nFuwALGL3AzqFya5tZhPg=;
b=XEvg+/ijTT5V4JT2suI0wNxfLPPyZNiVfD+eLC1Cf48ClX3WPAsM0JZyc5JGgM+SYL
FvuHYHZBTVWdx/s8csuLmG1miR6NeQLoc56KVmxN3FtqZAyXhqEEXzBmq1ukzd62A1QN
tv1Ock5ji9NuxbZIG9dsXJwOYhqBuMRX5EXU6VkuV8WhRBjRbNl1pHLJTpKeQKtbmGTh
qZ3qtXjhySIwv8HyBW28+wR/GR1wAplbPzzJtXzwSCdUJkxgjKy3+kU5TPpwIS0HlKKz
loJpjGhqr2mfwgUX+Ki33pkSs1tHwJv3pVkS4HnRVkQax9R/GstUv12n2/UeZHMJeX6X
rdvQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1742375075; x=1742979875;
h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
:list-id:mailing-list:precedence:x-original-sender:mime-version
:subject:references:in-reply-to:message-id:to:from:date:x-beenthere
:x-gm-message-state:sender:from:to:cc:subject:date:message-id
:reply-to;
bh=fPlj/wsJjE+LaFiRw2xNq+nFuwALGL3AzqFya5tZhPg=;
b=PKyZJxuSRoi75VxudwJaHgOZlzCPjP6VVnPXNPFH1KTEbY9i3PX3CU+P3SwT+HOVQc
gSJUhOeGMVmPgl7NtYIIdoELwhgmaNbQFuU8TRP8HlatJPGuj8zsuuU+EN9Bzw53qXoL
RC5E6/6CcD5XdApHtbNzyDMnIDSbCxrte1botxTrriMPR4gGOF3tty0cSn+IeNAWXg9z
//NELcVg5ktc1VRlUGJGrstFLamhUerPaj/Kxbs4Unv4EtWlFuvCiAX8+0kqxVNxzLr/
8XUFTE39EsEwothZHu2Q8Z2uUIthsRh1SFw3N0PLFAPPwPervm1q4QnflrMfsQvXorHY
8lfg==
Sender: bitcoindev@googlegroups.com
X-Forwarded-Encrypted: i=1; AJvYcCVjvhgkhMoe1+jw25xGBj6eO5KmIJw/3XVdnXpPclvoLREin/Pui9Xm7xtJSAa+R4uAGifZxEQ6uhMP@gnusha.org
X-Gm-Message-State: AOJu0YxTLaoJWtxm4R0zvcay/4m+GVaDHFYZ+HutnXnGBsYImwu3XxRr
VW4mm8ZHj1/r5VRaupDyH7uxdpL/M444IPC6yhk0B7GEx0HU/RyC
X-Google-Smtp-Source: AGHT+IGtfhvIQWAROdYUp3wFiRurv8SdT/Wj8wVr1AgD7NH8hMzpP7bXS1cVqXURkGf9X9JQmJe4OQ==
X-Received: by 2002:a05:6902:2303:b0:e63:7760:4842 with SMTP id 3f1490d57ef6-e667b44859cmr2182263276.47.1742375075523;
Wed, 19 Mar 2025 02:04:35 -0700 (PDT)
X-BeenThere: bitcoindev@googlegroups.com; h=ARLLPALLv1xAz44OL0cdbaMNMxW7nBt9Ok77sk6I6pSuo8JgLg==
Received: by 2002:a25:7243:0:b0:e61:1c4c:6d6b with SMTP id 3f1490d57ef6-e66779a4dbals875315276.2.-pod-prod-02-us;
Wed, 19 Mar 2025 02:04:32 -0700 (PDT)
X-Received: by 2002:a05:690c:c14:b0:6fd:4473:5184 with SMTP id 00721157ae682-7009c161100mr26560427b3.35.1742375072008;
Wed, 19 Mar 2025 02:04:32 -0700 (PDT)
Received: by 2002:a05:690c:6a86:b0:6ef:590d:3213 with SMTP id 00721157ae682-7009ba67b03ms7b3;
Wed, 19 Mar 2025 01:43:17 -0700 (PDT)
X-Received: by 2002:a05:690c:4913:b0:6f9:525d:a096 with SMTP id 00721157ae682-7009bf4a40bmr25482587b3.3.1742373796383;
Wed, 19 Mar 2025 01:43:16 -0700 (PDT)
Date: Wed, 19 Mar 2025 01:43:16 -0700 (PDT)
From: Garlo Nicon <garlonicon@gmail.com>
To: Bitcoin Development Mailing List <bitcoindev@googlegroups.com>
Message-Id: <66e51750-56d3-4fc7-b55b-eb838c07adb4n@googlegroups.com>
In-Reply-To: <688E575D-C370-4D7D-A6DB-11E0B56710B1@sprovoost.nl>
References: <hU75DurC5XToqizyA-vOKmVtmzd3uZGDKOyXuE_ogE6eQ8tPCrvX__S08fG_nrW5CjH6IUx7EPrq8KwM5KFy9ltbFBJZQCHR2ThoimRbMqU=@protonmail.com>
<f0cace2b-d734-4b36-b8a1-d4364a573a19n@googlegroups.com>
<688E575D-C370-4D7D-A6DB-11E0B56710B1@sprovoost.nl>
Subject: Re: [bitcoindev] Unbreaking testnet4
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_113040_143961308.1742373796070"
X-Original-Sender: garlonicon@gmail.com
Precedence: list
Mailing-list: list bitcoindev@googlegroups.com; contact bitcoindev+owners@googlegroups.com
List-ID: <bitcoindev.googlegroups.com>
X-Google-Group-Id: 786775582512
List-Post: <https://groups.google.com/group/bitcoindev/post>, <mailto:bitcoindev@googlegroups.com>
List-Help: <https://groups.google.com/support/>, <mailto:bitcoindev+help@googlegroups.com>
List-Archive: <https://groups.google.com/group/bitcoindev
List-Subscribe: <https://groups.google.com/group/bitcoindev/subscribe>, <mailto:bitcoindev+subscribe@googlegroups.com>
List-Unsubscribe: <mailto:googlegroups-manage+786775582512+unsubscribe@googlegroups.com>,
<https://groups.google.com/group/bitcoindev/subscribe>
X-Spam-Score: -0.5 (/)
------=_Part_113040_143961308.1742373796070
Content-Type: multipart/alternative;
boundary="----=_Part_113041_938972227.1742373796070"
------=_Part_113041_938972227.1742373796070
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
It seems you are right. However, this rule is based on block timestamps,=20
which gives me another idea: what about simply invalidating a block, if the=
=20
block time difference is bigger than 20 minutes? Because that's what ASIC=
=20
miners would want to do anyway, to reorg a long chain of CPU-mined blocks:=
=20
if the difficulty is 12345678, and you can see hundreds of blocks with=20
difficulty 1, then a single block with difficulty 12345678 will reorg all=
=20
of these CPU-mined blocks in a single shot.
By the way: if we are entering a hard-fork territory, and if testnet4 coins=
=20
are traded, then what about switching to testnet5 with new rules instead?
And also, in case of any forks, there is a question, how many miners will=
=20
actually support new changes. Because in case of new timewarp rules, we saw=
=20
hundreds of blocks being reorged, because some ASIC miners didn't upgrade=
=20
their code: https://github.com/bitcoin/bitcoin/issues/30786
And even when mempool.space upgraded their code, a few weeks after that, I=
=20
could still see some ASIC nodes in the wild, which were mining on the wrong=
=20
branch, and with just a CPU, it was possible to fork them once every 2016=
=20
blocks, for a few hundred blocks.
=C5=9Broda, 19 marca 2025 o 08:59:26 UTC+1 Sjors Provoost napisa=C5=82(a):
>
>
> > Op 19 mrt 2025, om 08:01 heeft Garlo Nicon <garlo...@gmail.com> het=20
> volgende geschreven:
> >=20
> > > I propose to fix this by removing the difficulty reset rule from=20
> testnet4 through a flag day hard fork on 2026-01-01.
> >=20
> > You can do that in a soft-fork way. Just rejecting blocks with=20
> difficulty=3D1, and requiring always a block with the true network=20
> difficulty, is a valid soft-fork.
>
> Unfortunately it's a hard-fork.
>
> > So, I assume if you change "fPowAllowMinDifficultyBlocks" from "true" t=
o=20
> "false", when block time will be greater than unix time "1767225600", the=
n=20
> you will get a valid soft-fork.
>
>
> The fPowAllowMinDifficultyBlocks rule says that after 20 minutes the new=
=20
> block MUST have difficulty 1. A block with the real difficulty will be=20
> rejected.
>
> This is because in general the block nBits value, which announces how muc=
h=20
> work the block has, must have an exact value. It can't be higher.
>
> In validation.cpp we have this:
>
> if (block.nBits !=3D GetNextWorkRequired(pindexPrev, &block,=20
> consensusParams))
> return state.Invalid(BlockValidationResult::BLOCK_INVALID_HEADER,=20
> "bad-diffbits", "incorrect proof of work");
>
> Inside GetNextWorkRequired there is the testnet exception rule, which=20
> Antoine proposes to drop:
>
> if (params.fPowAllowMinDifficultyBlocks) {
> // Special difficulty rule for testnet:
> // If the new block's timestamp is more than 2* 10 minutes
> // then allow mining of a min-difficulty block.
> if (pblock->GetBlockTime() > pindexLast->GetBlockTime() +=20
> params.nPowTargetSpacing*2)
> return nProofOfWorkLimit;
> else
> ... (same difficulty as last block, unless it's a retarget)
>
> The code comment is misleading, "allow" should be "require".
>
> - Sjors
--=20
You received this message because you are subscribed to the Google Groups "=
Bitcoin Development Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to bitcoindev+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/bitcoindev/=
66e51750-56d3-4fc7-b55b-eb838c07adb4n%40googlegroups.com.
------=_Part_113041_938972227.1742373796070
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
It seems you are right. However, this rule is based on block timestamps, wh=
ich gives me another idea: what about simply invalidating a block, if the b=
lock time difference is bigger than 20 minutes? Because that's what ASIC mi=
ners would want to do anyway, to reorg a long chain of CPU-mined blocks: if=
the difficulty is 12345678, and you can see hundreds of blocks with diffic=
ulty 1, then a single block with difficulty 12345678 will reorg all of thes=
e CPU-mined blocks in a single shot.<br /><br />By the way: if we are enter=
ing a hard-fork territory, and if testnet4 coins are traded, then what abou=
t switching to testnet5 with new rules instead?<br /><br />And also, in cas=
e of any forks, there is a question, how many miners will actually support =
new changes. Because in case of new timewarp rules, we saw hundreds of bloc=
ks being reorged, because some ASIC miners didn't upgrade their code: https=
://github.com/bitcoin/bitcoin/issues/30786<br /><br />And even when mempool=
.space upgraded their code, a few weeks after that, I could still see some =
ASIC nodes in the wild, which were mining on the wrong branch, and with jus=
t a CPU, it was possible to fork them once every 2016 blocks, for a few hun=
dred blocks.<br /><br /><div class=3D"gmail_quote"><div dir=3D"auto" class=
=3D"gmail_attr">=C5=9Broda, 19 marca 2025 o=C2=A008:59:26 UTC+1 Sjors Provo=
ost napisa=C5=82(a):<br/></div><blockquote class=3D"gmail_quote" style=3D"m=
argin: 0 0 0 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left=
: 1ex;">
<br>
<br>> Op 19 mrt 2025, om 08:01 heeft Garlo Nicon <<a href data-email-=
masked rel=3D"nofollow">garlo...@gmail.com</a>> het volgende geschreven:
<br>>=20
<br>> > I propose to fix this by removing the difficulty reset rule f=
rom testnet4 through a flag day hard fork on 2026-01-01.
<br>>=20
<br>> You can do that in a soft-fork way. Just rejecting blocks with dif=
ficulty=3D1, and requiring always a block with the true network difficulty,=
is a valid soft-fork.
<br>
<br>Unfortunately it's a hard-fork.
<br>
<br>> So, I assume if you change "fPowAllowMinDifficultyBlocks"=
; from "true" to "false", when block time will be great=
er than unix time "1767225600", then you will get a valid soft-fo=
rk.
<br>
<br>
<br>The fPowAllowMinDifficultyBlocks rule says that after 20 minutes the ne=
w block MUST have difficulty 1. A block with the real difficulty will be r=
ejected.
<br>
<br>This is because in general the block nBits value, which announces how m=
uch work the block has, must have an exact value. It can't be higher.
<br>
<br>In validation.cpp we have this:
<br>
<br>if (block.nBits !=3D GetNextWorkRequired(pindexPrev, &block, consen=
susParams))
<br> return state.Invalid(BlockValidationResult::BLOCK_INVALID_HEADER, &=
quot;bad-diffbits", "incorrect proof of work");
<br>
<br>Inside GetNextWorkRequired there is the testnet exception rule, which A=
ntoine proposes to drop:
<br>
<br> if (params.fPowAllowMinDifficultyBlocks) {
<br> // Special difficulty rule for testnet:
<br> // If the new block's timestamp is more than 2* 10 minutes
<br> // then allow mining of a min-difficulty block.
<br> if (pblock->GetBlockTime() > pindexLast->GetBlockTime() + =
params.nPowTargetSpacing*2)
<br> return nProofOfWorkLimit;
<br> else
<br> ... (same difficulty as last block, unless it's a retarget)
<br>
<br>The code comment is misleading, "allow" should be "requi=
re".
<br>
<br>- Sjors</blockquote></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;Bitcoin Development Mailing List" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:bitcoindev+unsubscribe@googlegroups.com">bitcoind=
ev+unsubscribe@googlegroups.com</a>.<br />
To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/=
bitcoindev/66e51750-56d3-4fc7-b55b-eb838c07adb4n%40googlegroups.com?utm_med=
ium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid/bitcoind=
ev/66e51750-56d3-4fc7-b55b-eb838c07adb4n%40googlegroups.com</a>.<br />
------=_Part_113041_938972227.1742373796070--
------=_Part_113040_143961308.1742373796070--
|