67
67
EspressoBlock : big .NewInt (11838440 ),
68
68
GingerbreadBlock : big .NewInt (21616000 ),
69
69
GingerbreadP2Block : big .NewInt (21616000 ),
70
+ HForkBlock : nil , // TBD
71
+
70
72
Istanbul : & IstanbulConfig {
71
73
Epoch : 17280 ,
72
74
ProposerPolicy : 2 ,
94
96
EspressoBlock : big .NewInt (9195000 ),
95
97
GingerbreadBlock : big .NewInt (18785000 ),
96
98
GingerbreadP2Block : big .NewInt (19157000 ),
99
+ HForkBlock : nil , // TBD
100
+
97
101
Istanbul : & IstanbulConfig {
98
102
Epoch : 17280 ,
99
103
ProposerPolicy : 2 ,
@@ -121,6 +125,8 @@ var (
121
125
EspressoBlock : big .NewInt (9472000 ),
122
126
GingerbreadBlock : big .NewInt (19814000 ),
123
127
GingerbreadP2Block : big .NewInt (19814000 ),
128
+ HForkBlock : nil , // TBD
129
+
124
130
Istanbul : & IstanbulConfig {
125
131
Epoch : 17280 ,
126
132
ProposerPolicy : 2 ,
@@ -153,6 +159,7 @@ var (
153
159
EspressoBlock : big .NewInt (0 ),
154
160
GingerbreadBlock : big .NewInt (0 ),
155
161
GingerbreadP2Block : big .NewInt (0 ),
162
+ HForkBlock : big .NewInt (0 ),
156
163
157
164
Istanbul : & IstanbulConfig {
158
165
Epoch : 30000 ,
@@ -305,6 +312,7 @@ type ChainConfig struct {
305
312
EspressoBlock * big.Int `json:"espressoBlock,omitempty"` // Espresso switch block (nil = no fork, 0 = already activated)
306
313
GingerbreadBlock * big.Int `json:"gingerbreadBlock,omitempty"` // Gingerbread switch block (nil = no fork, 0 = already activated)
307
314
GingerbreadP2Block * big.Int `json:"gingerbreadP2Block,omitempty"` // GingerbreadP2 switch block (nil = no fork, 0 = already activated)
315
+ HForkBlock * big.Int `json:"hforkBlock,omitempty"` // HFork switch block (nil = no fork, 0 = already activated)
308
316
309
317
Istanbul * IstanbulConfig `json:"istanbul,omitempty"`
310
318
// This does not belong here but passing it to every function is not possible since that breaks
@@ -347,7 +355,7 @@ func (c *ChainConfig) String() string {
347
355
} else {
348
356
engine = "MockEngine"
349
357
}
350
- return fmt .Sprintf ("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v Churrito: %v, Donut: %v, Espresso: %v, Gingerbread: %v, Gingerbread P2: %v, Engine: %v}" ,
358
+ return fmt .Sprintf ("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v Churrito: %v, Donut: %v, Espresso: %v, Gingerbread: %v, Gingerbread P2: %v, HForkBlock: %v, Engine: %v}" ,
351
359
c .ChainID ,
352
360
c .HomesteadBlock ,
353
361
c .DAOForkBlock ,
@@ -367,6 +375,7 @@ func (c *ChainConfig) String() string {
367
375
c .EspressoBlock ,
368
376
c .GingerbreadBlock ,
369
377
c .GingerbreadP2Block ,
378
+ c .HForkBlock ,
370
379
engine ,
371
380
)
372
381
}
@@ -455,6 +464,10 @@ func (c *ChainConfig) IsGingerbreadP2(num *big.Int) bool {
455
464
return isForked (c .GingerbreadP2Block , num )
456
465
}
457
466
467
+ func (c * ChainConfig ) IsHFork (num * big.Int ) bool {
468
+ return isForked (c .HForkBlock , num )
469
+ }
470
+
458
471
// CheckCompatible checks whether scheduled fork transitions have been imported
459
472
// with a mismatching chain configuration.
460
473
func (c * ChainConfig ) CheckCompatible (newcfg * ChainConfig , height uint64 ) * ConfigCompatError {
@@ -496,6 +509,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
496
509
{name : "espressoBlock" , block : c .EspressoBlock },
497
510
{name : "gingerbreadBlock" , block : c .GingerbreadBlock },
498
511
{name : "gingerbreadP2Block" , block : c .GingerbreadP2Block },
512
+ {name : "hforkBlock" , block : c .HForkBlock },
499
513
} {
500
514
if lastFork .name != "" {
501
515
// Next one must be higher number
@@ -576,6 +590,9 @@ func (c *ChainConfig) checkCeloCompatible(newcfg *ChainConfig, head *big.Int) *C
576
590
if isForkIncompatible (c .GingerbreadP2Block , newcfg .GingerbreadP2Block , head ) {
577
591
return newCompatError ("Gingerbread p2 fork block" , c .GingerbreadP2Block , newcfg .GingerbreadP2Block )
578
592
}
593
+ if isForkIncompatible (c .HForkBlock , newcfg .HForkBlock , head ) {
594
+ return newCompatError ("HFork block" , c .HForkBlock , newcfg .HForkBlock )
595
+ }
579
596
return nil
580
597
}
581
598
@@ -692,6 +709,8 @@ func (c *ChainConfig) OverrideChainIdConfig(chainId *big.Int) *ChainConfig {
692
709
func (c * ChainConfig ) DisableGingerbread () * ChainConfig {
693
710
c .GingerbreadBlock = nil
694
711
c .GingerbreadP2Block = nil
712
+ // Since gingerbread is disabled disable following forks as well
713
+ c .HForkBlock = nil
695
714
return c
696
715
}
697
716
@@ -714,6 +733,7 @@ func (c *ChainConfig) DeepCopy() *ChainConfig {
714
733
EspressoBlock : copyBigIntOrNil (c .EspressoBlock ),
715
734
GingerbreadBlock : copyBigIntOrNil (c .GingerbreadBlock ),
716
735
GingerbreadP2Block : copyBigIntOrNil (c .GingerbreadP2Block ),
736
+ HForkBlock : copyBigIntOrNil (c .HForkBlock ),
717
737
718
738
Istanbul : & IstanbulConfig {
719
739
Epoch : c .Istanbul .Epoch ,
0 commit comments