@@ -131,6 +131,7 @@ var (
131
131
PetersburgBlock : big .NewInt (0 ),
132
132
IstanbulBlock : big .NewInt (3_230_000 ),
133
133
NeoBlock : big .NewInt (4_650_000 ),
134
+ MercuryBlock : MERCURY_MAINNET ,
134
135
TerminalTotalDifficulty : nil ,
135
136
TerminalTotalDifficultyPassed : false ,
136
137
Cuckoo : new (CuckooConfig ),
@@ -151,6 +152,7 @@ var (
151
152
PetersburgBlock : big .NewInt (0 ),
152
153
IstanbulBlock : big .NewInt (0 ),
153
154
NeoBlock : big .NewInt (5_000_000 ),
155
+ MercuryBlock : nil ,
154
156
TerminalTotalDifficulty : nil ,
155
157
TerminalTotalDifficultyPassed : false ,
156
158
Clique : & CliqueConfig {
@@ -174,6 +176,7 @@ var (
174
176
PetersburgBlock : big .NewInt (0 ),
175
177
IstanbulBlock : big .NewInt (0 ),
176
178
NeoBlock : big .NewInt (0 ),
179
+ MercuryBlock : nil ,
177
180
TerminalTotalDifficulty : nil ,
178
181
TerminalTotalDifficultyPassed : false ,
179
182
Cuckoo : new (CuckooConfig ),
@@ -194,6 +197,7 @@ var (
194
197
PetersburgBlock : big .NewInt (0 ),
195
198
IstanbulBlock : big .NewInt (0 ),
196
199
NeoBlock : big .NewInt (0 ),
200
+ MercuryBlock : nil ,
197
201
TerminalTotalDifficulty : nil ,
198
202
TerminalTotalDifficultyPassed : false ,
199
203
Clique : & CliqueConfig {
@@ -221,6 +225,7 @@ var (
221
225
PetersburgBlock : big .NewInt (0 ),
222
226
IstanbulBlock : nil ,
223
227
NeoBlock : nil ,
228
+ MercuryBlock : nil ,
224
229
TerminalTotalDifficulty : nil ,
225
230
TerminalTotalDifficultyPassed : false ,
226
231
Cuckoo : new (CuckooConfig ),
@@ -231,9 +236,9 @@ var (
231
236
//
232
237
// This configuration is intentionally not using keyed fields to force anyone
233
238
// adding flags to the config to also have to set these fields.
234
- AllCliqueProtocolChanges = & ChainConfig {big .NewInt (1337 ), big .NewInt (0 ), nil , false , big .NewInt (0 ), common.Hash {}, big .NewInt (0 ), big .NewInt (0 ), big .NewInt (0 ), big .NewInt (0 ), nil , nil , nil , nil , false , nil , & CliqueConfig {Period : 0 , Epoch : 30000 }}
239
+ AllCliqueProtocolChanges = & ChainConfig {big .NewInt (1337 ), big .NewInt (0 ), nil , false , big .NewInt (0 ), common.Hash {}, big .NewInt (0 ), big .NewInt (0 ), big .NewInt (0 ), big .NewInt (0 ), nil , nil , nil , nil , nil , false , nil , & CliqueConfig {Period : 0 , Epoch : 30000 }}
235
240
236
- TestChainConfig = & ChainConfig {big .NewInt (1 ), big .NewInt (0 ), nil , false , big .NewInt (0 ), common.Hash {}, big .NewInt (0 ), big .NewInt (0 ), big .NewInt (0 ), big .NewInt (0 ), nil , nil , nil , nil , false , new (CuckooConfig ), nil }
241
+ TestChainConfig = & ChainConfig {big .NewInt (1 ), big .NewInt (0 ), nil , false , big .NewInt (0 ), common.Hash {}, big .NewInt (0 ), big .NewInt (0 ), big .NewInt (0 ), big .NewInt (0 ), nil , nil , nil , nil , nil , false , new (CuckooConfig ), nil }
237
242
TestRules = TestChainConfig .Rules (new (big.Int ), false , 0 )
238
243
)
239
244
@@ -269,6 +274,7 @@ type ChainConfig struct {
269
274
PetersburgBlock * big.Int `json:"petersburgBlock,omitempty"` // Petersburg switch block (nil = same as Constantinople)
270
275
IstanbulBlock * big.Int `json:"istanbulBlock,omitempty"` // Istanbul switch block (nil = no fork, 0 = already on istanbul)
271
276
NeoBlock * big.Int `json:"neoBlock,omitempty"`
277
+ MercuryBlock * big.Int `json:"mercuryBlock,omitempty"`
272
278
// TerminalTotalDifficulty is the amount of total difficulty reached by
273
279
// the network that triggers the consensus upgrade.
274
280
TerminalTotalDifficulty * big.Int `json:"terminalTotalDifficulty,omitempty"`
@@ -311,7 +317,7 @@ func (c *ChainConfig) String() string {
311
317
default :
312
318
engine = "unknown"
313
319
}
314
- return fmt .Sprintf ("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v TangerineWhistle(EIP150): %v SpuriousDragon(EIP155): %v SpuriousDragon(EIP158): %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v Neo:%v Engine: %v}" ,
320
+ return fmt .Sprintf ("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v TangerineWhistle(EIP150): %v SpuriousDragon(EIP155): %v SpuriousDragon(EIP158): %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v Neo:%v Mercury:%v Engine: %v}" ,
315
321
c .ChainID ,
316
322
c .HomesteadBlock ,
317
323
c .DAOForkBlock ,
@@ -324,6 +330,7 @@ func (c *ChainConfig) String() string {
324
330
c .PetersburgBlock ,
325
331
c .IstanbulBlock ,
326
332
c .NeoBlock ,
333
+ c .MercuryBlock ,
327
334
engine ,
328
335
)
329
336
}
@@ -378,6 +385,10 @@ func (c *ChainConfig) IsNeo(num *big.Int) bool {
378
385
return isForked (c .NeoBlock , num )
379
386
}
380
387
388
+ func (c * ChainConfig ) IsMercury (num * big.Int ) bool {
389
+ return isForked (c .MercuryBlock , num )
390
+ }
391
+
381
392
// IsTerminalPoWBlock returns whether the given block is the last block of PoW stage.
382
393
func (c * ChainConfig ) IsTerminalPoWBlock (parentTotalDiff * big.Int , totalDiff * big.Int ) bool {
383
394
if c .TerminalTotalDifficulty == nil {
@@ -442,6 +453,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
442
453
{name : "petersburgBlock" , block : c .PetersburgBlock },
443
454
{name : "istanbulBlock" , block : c .IstanbulBlock },
444
455
{name : "neoBlock" , block : c .NeoBlock },
456
+ {name : "mercuryBlock" , block : c .MercuryBlock },
445
457
} {
446
458
if lastFork .name != "" {
447
459
// Next one must be higher number
@@ -505,6 +517,10 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *Confi
505
517
if isForkIncompatible (c .NeoBlock , newcfg .NeoBlock , head ) {
506
518
return newCompatError ("Neo fork block" , c .NeoBlock , newcfg .NeoBlock )
507
519
}
520
+
521
+ if isForkIncompatible (c .MercuryBlock , newcfg .MercuryBlock , head ) {
522
+ return newCompatError ("Mercury fork block" , c .MercuryBlock , newcfg .MercuryBlock )
523
+ }
508
524
return nil
509
525
}
510
526
@@ -622,10 +638,10 @@ func (err *ConfigCompatError) Error() string {
622
638
// Rules is a one time interface meaning that it shouldn't be used in between transition
623
639
// phases.
624
640
type Rules struct {
625
- ChainID * big.Int
626
- IsHomestead , IsEIP150 , IsEIP155 , IsEIP158 bool
627
- IsByzantium , IsConstantinople , IsPetersburg , IsIstanbul , IsNeo bool
628
- IsMerge bool
641
+ ChainID * big.Int
642
+ IsHomestead , IsEIP150 , IsEIP155 , IsEIP158 bool
643
+ IsByzantium , IsConstantinople , IsPetersburg , IsIstanbul , IsNeo , IsMercury bool
644
+ IsMerge bool
629
645
}
630
646
631
647
// Rules ensures c's ChainID is not nil.
@@ -634,7 +650,7 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules
634
650
if chainID == nil {
635
651
chainID = new (big.Int )
636
652
}
637
- return Rules {ChainID : new (big.Int ).Set (chainID ), IsHomestead : c .IsHomestead (num ), IsEIP150 : c .IsEIP150 (num ), IsEIP155 : c .IsEIP155 (num ), IsEIP158 : c .IsEIP158 (num ), IsByzantium : c .IsByzantium (num ), IsPetersburg : c .IsPetersburg (num ), IsIstanbul : c .IsIstanbul (num ), IsNeo : c .IsNeo (num ), IsMerge : isMerge }
653
+ return Rules {ChainID : new (big.Int ).Set (chainID ), IsHomestead : c .IsHomestead (num ), IsEIP150 : c .IsEIP150 (num ), IsEIP155 : c .IsEIP155 (num ), IsEIP158 : c .IsEIP158 (num ), IsByzantium : c .IsByzantium (num ), IsPetersburg : c .IsPetersburg (num ), IsIstanbul : c .IsIstanbul (num ), IsNeo : c .IsNeo (num ), IsMercury : c . IsMercury ( num ), IsMerge : isMerge }
638
654
}
639
655
640
656
// Get Mature Block
0 commit comments