@@ -74,8 +74,10 @@ func TestCreation(t *testing.T) {
74
74
{15049999 , 0 , ID {Hash : checksumToBytes (0x20c327fc ), Next : 15050000 }}, // Last Arrow Glacier block
75
75
{15050000 , 0 , ID {Hash : checksumToBytes (0xf0afd0e3 ), Next : 1681338455 }}, // First Gray Glacier block
76
76
{20000000 , 1681338454 , ID {Hash : checksumToBytes (0xf0afd0e3 ), Next : 1681338455 }}, // Last Gray Glacier block
77
- {20000000 , 1681338455 , ID {Hash : checksumToBytes (0xdce96c2d ), Next : 0 }}, // First Shanghai block
78
- {30000000 , 2000000000 , ID {Hash : checksumToBytes (0xdce96c2d ), Next : 0 }}, // Future Shanghai block
77
+ {20000000 , 1681338455 , ID {Hash : checksumToBytes (0xdce96c2d ), Next : 1710338135 }}, // First Shanghai block
78
+ {30000000 , 1710338134 , ID {Hash : checksumToBytes (0xdce96c2d ), Next : 1710338135 }}, // Last Shanghai block
79
+ {40000000 , 1710338135 , ID {Hash : checksumToBytes (0x9f3d2254 ), Next : 0 }}, // First Cancun block
80
+ {50000000 , 2000000000 , ID {Hash : checksumToBytes (0x9f3d2254 ), Next : 0 }}, // Future Cancun block
79
81
},
80
82
},
81
83
// Goerli test cases
@@ -141,6 +143,7 @@ func TestValidation(t *testing.T) {
141
143
// Config that has not timestamp enabled
142
144
legacyConfig := * params .MainnetChainConfig
143
145
legacyConfig .ShanghaiTime = nil
146
+ legacyConfig .CancunTime = nil
144
147
145
148
tests := []struct {
146
149
config * params.ChainConfig
@@ -213,14 +216,10 @@ func TestValidation(t *testing.T) {
213
216
// at some future block 88888888, for itself, but past block for local. Local is incompatible.
214
217
//
215
218
// This case detects non-upgraded nodes with majority hash power (typical Ropsten mess).
216
- //
217
- // TODO(karalabe): This testcase will fail once mainnet gets timestamped forks, make legacy chain config
218
219
{& legacyConfig , 88888888 , 0 , ID {Hash : checksumToBytes (0xf0afd0e3 ), Next : 88888888 }, ErrLocalIncompatibleOrStale },
219
220
220
221
// Local is mainnet Byzantium. Remote is also in Byzantium, but announces Gopherium (non existing
221
222
// fork) at block 7279999, before Petersburg. Local is incompatible.
222
- //
223
- // TODO(karalabe): This testcase will fail once mainnet gets timestamped forks, make legacy chain config
224
223
{& legacyConfig , 7279999 , 0 , ID {Hash : checksumToBytes (0xa00bc324 ), Next : 7279999 }, ErrLocalIncompatibleOrStale },
225
224
226
225
//------------------------------------
@@ -297,34 +296,25 @@ func TestValidation(t *testing.T) {
297
296
// Local is mainnet currently in Shanghai only (so it's aware of Cancun), remote announces
298
297
// also Shanghai, but it's not yet aware of Cancun (e.g. non updated node before the fork).
299
298
// In this case we don't know if Cancun passed yet or not.
300
- //
301
- // TODO(karalabe): Enable this when Cancun is specced
302
- //{params.MainnetChainConfig, 20000000, 1668000000, ID{Hash: checksumToBytes(0x71147644), Next: 0}, nil},
299
+ {params .MainnetChainConfig , 20000000 , 1668000000 , ID {Hash : checksumToBytes (0xdce96c2d ), Next : 0 }, nil },
303
300
304
301
// Local is mainnet currently in Shanghai only (so it's aware of Cancun), remote announces
305
302
// also Shanghai, and it's also aware of Cancun (e.g. updated node before the fork). We
306
303
// don't know if Cancun passed yet (will pass) or not.
307
- //
308
- // TODO(karalabe): Enable this when Cancun is specced and update next timestamp
309
- //{params.MainnetChainConfig, 20000000, 1668000000, ID{Hash: checksumToBytes(0x71147644), Next: 1678000000}, nil},
304
+ {params .MainnetChainConfig , 20000000 , 1668000000 , ID {Hash : checksumToBytes (0xdce96c2d ), Next : 1710338135 }, nil },
310
305
311
306
// Local is mainnet currently in Shanghai only (so it's aware of Cancun), remote announces
312
307
// also Shanghai, and it's also aware of some random fork (e.g. misconfigured Cancun). As
313
308
// neither forks passed at neither nodes, they may mismatch, but we still connect for now.
314
- //
315
- // TODO(karalabe): Enable this when Cancun is specced
316
- //{params.MainnetChainConfig, 20000000, 1668000000, ID{Hash: checksumToBytes(0x71147644), Next: math.MaxUint64}, nil},
309
+ {params .MainnetChainConfig , 20000000 , 1668000000 , ID {Hash : checksumToBytes (0xdce96c2d ), Next : math .MaxUint64 }, nil },
317
310
318
311
// Local is mainnet exactly on Cancun, remote announces Shanghai + knowledge about Cancun. Remote
319
312
// is simply out of sync, accept.
320
- //
321
- // TODO(karalabe): Enable this when Cancun is specced, update local head and time, next timestamp
322
- // {params.MainnetChainConfig, 21000000, 1678000000, ID{Hash: checksumToBytes(0x71147644), Next: 1678000000}, nil},
313
+ {params .MainnetChainConfig , 21000000 , 1710338135 , ID {Hash : checksumToBytes (0xdce96c2d ), Next : 1710338135 }, nil },
323
314
324
315
// Local is mainnet Cancun, remote announces Shanghai + knowledge about Cancun. Remote
325
316
// is simply out of sync, accept.
326
- // TODO(karalabe): Enable this when Cancun is specced, update local head and time, next timestamp
327
- //{params.MainnetChainConfig, 21123456, 1678123456, ID{Hash: checksumToBytes(0x71147644), Next: 1678000000}, nil},
317
+ {params .MainnetChainConfig , 21123456 , 1710338136 , ID {Hash : checksumToBytes (0xdce96c2d ), Next : 1710338135 }, nil },
328
318
329
319
// Local is mainnet Prague, remote announces Shanghai + knowledge about Cancun. Remote
330
320
// is definitely out of sync. It may or may not need the Prague update, we don't know yet.
@@ -333,9 +323,7 @@ func TestValidation(t *testing.T) {
333
323
//{params.MainnetChainConfig, 0, 0, ID{Hash: checksumToBytes(0x3edd5b10), Next: 4370000}, nil},
334
324
335
325
// Local is mainnet Shanghai, remote announces Cancun. Local is out of sync, accept.
336
- //
337
- // TODO(karalabe): Enable this when Cancun is specced, update remote checksum
338
- //{params.MainnetChainConfig, 21000000, 1678000000, ID{Hash: checksumToBytes(0x00000000), Next: 0}, nil},
326
+ {params .MainnetChainConfig , 21000000 , 1700000000 , ID {Hash : checksumToBytes (0x9f3d2254 ), Next : 0 }, nil },
339
327
340
328
// Local is mainnet Shanghai, remote announces Cancun, but is not aware of Prague. Local
341
329
// out of sync. Local also knows about a future fork, but that is uncertain yet.
@@ -345,34 +333,28 @@ func TestValidation(t *testing.T) {
345
333
346
334
// Local is mainnet Cancun. remote announces Shanghai but is not aware of further forks.
347
335
// Remote needs software update.
348
- //
349
- // TODO(karalabe): Enable this when Cancun is specced, update local head and time
350
- //{params.MainnetChainConfig, 21000000, 1678000000, ID{Hash: checksumToBytes(0x71147644), Next: 0}, ErrRemoteStale},
336
+ {params .MainnetChainConfig , 21000000 , 1710338135 , ID {Hash : checksumToBytes (0xdce96c2d ), Next : 0 }, ErrRemoteStale },
351
337
352
338
// Local is mainnet Shanghai, and isn't aware of more forks. Remote announces Shanghai +
353
339
// 0xffffffff. Local needs software update, reject.
354
340
{params .MainnetChainConfig , 20000000 , 1681338455 , ID {Hash : checksumToBytes (checksumUpdate (0xdce96c2d , math .MaxUint64 )), Next : 0 }, ErrLocalIncompatibleOrStale },
355
341
356
342
// Local is mainnet Shanghai, and is aware of Cancun. Remote announces Cancun +
357
343
// 0xffffffff. Local needs software update, reject.
358
- //
359
- // TODO(karalabe): Enable this when Cancun is specced, update remote checksum
360
- //{params.MainnetChainConfig, 20000000, 1668000000, ID{Hash: checksumToBytes(checksumUpdate(0x00000000, math.MaxUint64)), Next: 0}, ErrLocalIncompatibleOrStale},
344
+ {params .MainnetChainConfig , 20000000 , 1668000000 , ID {Hash : checksumToBytes (checksumUpdate (0x9f3d2254 , math .MaxUint64 )), Next : 0 }, ErrLocalIncompatibleOrStale },
361
345
362
346
// Local is mainnet Shanghai, remote is random Shanghai.
363
347
{params .MainnetChainConfig , 20000000 , 1681338455 , ID {Hash : checksumToBytes (0x12345678 ), Next : 0 }, ErrLocalIncompatibleOrStale },
364
348
365
- // Local is mainnet Shanghai , far in the future. Remote announces Gopherium (non existing fork)
349
+ // Local is mainnet Cancun , far in the future. Remote announces Gopherium (non existing fork)
366
350
// at some future timestamp 8888888888, for itself, but past block for local. Local is incompatible.
367
351
//
368
352
// This case detects non-upgraded nodes with majority hash power (typical Ropsten mess).
369
- {params .MainnetChainConfig , 88888888 , 8888888888 , ID {Hash : checksumToBytes (0xdce96c2d ), Next : 8888888888 }, ErrLocalIncompatibleOrStale },
353
+ {params .MainnetChainConfig , 88888888 , 8888888888 , ID {Hash : checksumToBytes (0x9f3d2254 ), Next : 8888888888 }, ErrLocalIncompatibleOrStale },
370
354
371
355
// Local is mainnet Shanghai. Remote is also in Shanghai, but announces Gopherium (non existing
372
356
// fork) at timestamp 1668000000, before Cancun. Local is incompatible.
373
- //
374
- // TODO(karalabe): Enable this when Cancun is specced
375
- //{params.MainnetChainConfig, 20999999, 1677999999, ID{Hash: checksumToBytes(0x71147644), Next: 1678000000}, ErrLocalIncompatibleOrStale},
357
+ {params .MainnetChainConfig , 20999999 , 1699999999 , ID {Hash : checksumToBytes (0x71147644 ), Next : 1700000000 }, ErrLocalIncompatibleOrStale },
376
358
}
377
359
genesis := core .DefaultGenesisBlock ().ToBlock ()
378
360
for i , tt := range tests {
0 commit comments