65
65
ChurritoBlock : big .NewInt (6774000 ),
66
66
DonutBlock : big .NewInt (6774000 ),
67
67
EspressoBlock : big .NewInt (11838440 ),
68
+ GForkBlock : nil ,
68
69
Istanbul : & IstanbulConfig {
69
70
Epoch : 17280 ,
70
71
ProposerPolicy : 2 ,
90
91
ChurritoBlock : big .NewInt (2719099 ),
91
92
DonutBlock : big .NewInt (5002000 ),
92
93
EspressoBlock : big .NewInt (9195000 ),
94
+ GForkBlock : nil ,
93
95
Istanbul : & IstanbulConfig {
94
96
Epoch : 17280 ,
95
97
ProposerPolicy : 2 ,
@@ -115,6 +117,7 @@ var (
115
117
ChurritoBlock : big .NewInt (4960000 ),
116
118
DonutBlock : big .NewInt (4960000 ),
117
119
EspressoBlock : big .NewInt (9472000 ),
120
+ GForkBlock : nil ,
118
121
Istanbul : & IstanbulConfig {
119
122
Epoch : 17280 ,
120
123
ProposerPolicy : 2 ,
@@ -124,28 +127,28 @@ var (
124
127
},
125
128
}
126
129
127
- DeveloperChainConfig = & 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 ), big .NewInt (0 ), big .NewInt (0 ), nil , big .NewInt (0 ), big .NewInt (0 ), nil , & IstanbulConfig {
130
+ DeveloperChainConfig = & 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 ), big .NewInt (0 ), big .NewInt (0 ), nil , big .NewInt (0 ), big .NewInt (0 ), nil , nil , & IstanbulConfig {
128
131
Epoch : 300 ,
129
132
ProposerPolicy : 0 ,
130
133
RequestTimeout : 1000 ,
131
134
BlockPeriod : 1 ,
132
135
}, true , false }
133
136
134
- IstanbulTestChainConfig = & 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 ), big .NewInt (0 ), big .NewInt (0 ), nil , big .NewInt (0 ), nil , nil , & IstanbulConfig {
137
+ IstanbulTestChainConfig = & 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 ), big .NewInt (0 ), big .NewInt (0 ), nil , big .NewInt (0 ), nil , nil , nil , & IstanbulConfig {
135
138
Epoch : 300 ,
136
139
ProposerPolicy : 0 ,
137
140
RequestTimeout : 1000 ,
138
141
BlockPeriod : 1 ,
139
142
}, true , false }
140
143
141
- IstanbulEHFTestChainConfig = & 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 ), big .NewInt (0 ), big .NewInt (0 ), nil , big .NewInt (0 ), big .NewInt (0 ), big .NewInt (0 ), & IstanbulConfig {
144
+ IstanbulEHFTestChainConfig = & 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 ), big .NewInt (0 ), big .NewInt (0 ), nil , big .NewInt (0 ), big .NewInt (0 ), big .NewInt (0 ), big . NewInt ( 0 ), & IstanbulConfig {
142
145
Epoch : 300 ,
143
146
ProposerPolicy : 0 ,
144
147
RequestTimeout : 1000 ,
145
148
BlockPeriod : 1 ,
146
149
}, true , false }
147
150
148
- 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 ), big .NewInt (0 ), big .NewInt (0 ), nil , big .NewInt (0 ), nil , nil , & IstanbulConfig {
151
+ 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 ), big .NewInt (0 ), big .NewInt (0 ), nil , big .NewInt (0 ), nil , nil , nil , & IstanbulConfig {
149
152
Epoch : 30000 ,
150
153
ProposerPolicy : 0 ,
151
154
}, true , true }
@@ -230,6 +233,7 @@ type ChainConfig struct {
230
233
ChurritoBlock * big.Int `json:"churritoBlock,omitempty"` // Churrito switch block (nil = no fork, 0 = already activated)
231
234
DonutBlock * big.Int `json:"donutBlock,omitempty"` // Donut switch block (nil = no fork, 0 = already activated)
232
235
EspressoBlock * big.Int `json:"espressoBlock,omitempty"` // Espresso switch block (nil = no fork, 0 = already activated)
236
+ GForkBlock * big.Int `json:"gForkBlock,omitempty"` // G Fork switch block (nil = no fork, 0 = already activated)
233
237
234
238
Istanbul * IstanbulConfig `json:"istanbul,omitempty"`
235
239
// This does not belong here but passing it to every function is not possible since that breaks
@@ -271,7 +275,7 @@ func (c *ChainConfig) String() string {
271
275
} else {
272
276
engine = "MockEngine"
273
277
}
274
- 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, Engine: %v}" ,
278
+ 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, GFork: %v, Engine: %v}" ,
275
279
c .ChainID ,
276
280
c .HomesteadBlock ,
277
281
c .DAOForkBlock ,
@@ -286,6 +290,7 @@ func (c *ChainConfig) String() string {
286
290
c .ChurritoBlock ,
287
291
c .DonutBlock ,
288
292
c .EspressoBlock ,
293
+ c .GForkBlock ,
289
294
engine ,
290
295
)
291
296
}
@@ -352,11 +357,16 @@ func (c *ChainConfig) IsDonut(num *big.Int) bool {
352
357
return isForked (c .DonutBlock , num )
353
358
}
354
359
355
- // IsEspresso returns whether num represents a block number after the E fork
360
+ // IsEspresso returns whether num represents a block number after the Espresso fork
356
361
func (c * ChainConfig ) IsEspresso (num * big.Int ) bool {
357
362
return isForked (c .EspressoBlock , num )
358
363
}
359
364
365
+ // IsGFork returns whether num represents a block number after the G fork
366
+ func (c * ChainConfig ) IsGFork (num * big.Int ) bool {
367
+ return isForked (c .GForkBlock , num )
368
+ }
369
+
360
370
// CheckCompatible checks whether scheduled fork transitions have been imported
361
371
// with a mismatching chain configuration.
362
372
func (c * ChainConfig ) CheckCompatible (newcfg * ChainConfig , height uint64 ) * ConfigCompatError {
@@ -396,6 +406,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
396
406
{name : "churritoBlock" , block : c .ChurritoBlock },
397
407
{name : "donutBlock" , block : c .DonutBlock },
398
408
{name : "espressoBlock" , block : c .EspressoBlock },
409
+ {name : "gForkBlock" , block : c .GForkBlock },
399
410
} {
400
411
if lastFork .name != "" {
401
412
// Next one must be higher number
@@ -466,7 +477,10 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *Confi
466
477
return newCompatError ("Donut fork block" , c .DonutBlock , newcfg .DonutBlock )
467
478
}
468
479
if isForkIncompatible (c .EspressoBlock , newcfg .EspressoBlock , head ) {
469
- return newCompatError ("E fork block" , c .EspressoBlock , newcfg .EspressoBlock )
480
+ return newCompatError ("Espresso fork block" , c .EspressoBlock , newcfg .EspressoBlock )
481
+ }
482
+ if isForkIncompatible (c .GForkBlock , newcfg .GForkBlock , head ) {
483
+ return newCompatError ("G fork block" , c .GForkBlock , newcfg .GForkBlock )
470
484
}
471
485
return nil
472
486
}
@@ -535,7 +549,7 @@ type Rules struct {
535
549
ChainID * big.Int
536
550
IsHomestead , IsEIP150 , IsEIP155 , IsEIP158 bool
537
551
IsByzantium , IsConstantinople , IsPetersburg , IsIstanbul bool
538
- IsChurrito , IsDonut , IsEspresso bool
552
+ IsChurrito , IsDonut , IsEspresso , IsGFork bool
539
553
}
540
554
541
555
// Rules ensures c's ChainID is not nil.
@@ -557,5 +571,6 @@ func (c *ChainConfig) Rules(num *big.Int) Rules {
557
571
IsChurrito : c .IsChurrito (num ),
558
572
IsDonut : c .IsDonut (num ),
559
573
IsEspresso : c .IsEspresso (num ),
574
+ IsGFork : c .IsGFork (num ),
560
575
}
561
576
}
0 commit comments