@@ -130,6 +130,7 @@ var (
130130 ConstantinopleBlock : big .NewInt (0 ),
131131 PetersburgBlock : big .NewInt (0 ),
132132 IstanbulBlock : big .NewInt (3_230_000 ),
133+ NeoBlock : big .NewInt (4_650_000 ),
133134 Cuckoo : new (CuckooConfig ),
134135 }
135136
@@ -147,6 +148,7 @@ var (
147148 ConstantinopleBlock : big .NewInt (0 ),
148149 PetersburgBlock : big .NewInt (0 ),
149150 IstanbulBlock : big .NewInt (0 ),
151+ NeoBlock : nil ,
150152 Clique : & CliqueConfig {
151153 Period : 3 ,
152154 Epoch : 30000 ,
@@ -167,6 +169,7 @@ var (
167169 ConstantinopleBlock : big .NewInt (0 ),
168170 PetersburgBlock : big .NewInt (0 ),
169171 IstanbulBlock : big .NewInt (0 ),
172+ NeoBlock : nil ,
170173 Cuckoo : new (CuckooConfig ),
171174 }
172175
@@ -184,6 +187,7 @@ var (
184187 ConstantinopleBlock : big .NewInt (0 ),
185188 PetersburgBlock : big .NewInt (0 ),
186189 IstanbulBlock : big .NewInt (0 ),
190+ NeoBlock : nil ,
187191 Clique : & CliqueConfig {
188192 Period : 15 ,
189193 Epoch : 30000 ,
@@ -208,6 +212,7 @@ var (
208212 ConstantinopleBlock : big .NewInt (0 ),
209213 PetersburgBlock : big .NewInt (0 ),
210214 IstanbulBlock : nil ,
215+ NeoBlock : nil ,
211216 Cuckoo : new (CuckooConfig ),
212217 Clique : nil }
213218
@@ -216,9 +221,9 @@ var (
216221 //
217222 // This configuration is intentionally not using keyed fields to force anyone
218223 // adding flags to the config to also have to set these fields.
219- 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 , & CliqueConfig {Period : 0 , Epoch : 30000 }}
224+ 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 , & CliqueConfig {Period : 0 , Epoch : 30000 }}
220225
221- 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 , new (CuckooConfig ), nil }
226+ 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 , new (CuckooConfig ), nil }
222227 TestRules = TestChainConfig .Rules (new (big.Int ))
223228)
224229
@@ -246,6 +251,7 @@ type ChainConfig struct {
246251 ConstantinopleBlock * big.Int `json:"constantinopleBlock,omitempty"` // Constantinople switch block (nil = no fork, 0 = already activated)
247252 PetersburgBlock * big.Int `json:"petersburgBlock,omitempty"` // Petersburg switch block (nil = same as Constantinople)
248253 IstanbulBlock * big.Int `json:"istanbulBlock,omitempty"` // Istanbul switch block (nil = no fork, 0 = already on istanbul)
254+ NeoBlock * big.Int `json:"neoBlock,omitempty"`
249255 // Various consensus engines
250256 Cuckoo * CuckooConfig `json:"cuckoo,omitempty"`
251257 Clique * CliqueConfig `json:"clique,omitempty"`
@@ -280,7 +286,7 @@ func (c *ChainConfig) String() string {
280286 default :
281287 engine = "unknown"
282288 }
283- 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 Engine: %v}" ,
289+ 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}" ,
284290 c .ChainID ,
285291 c .HomesteadBlock ,
286292 c .DAOForkBlock ,
@@ -292,6 +298,7 @@ func (c *ChainConfig) String() string {
292298 c .ConstantinopleBlock ,
293299 c .PetersburgBlock ,
294300 c .IstanbulBlock ,
301+ c .NeoBlock ,
295302 engine ,
296303 )
297304}
@@ -342,6 +349,10 @@ func (c *ChainConfig) IsIstanbul(num *big.Int) bool {
342349 return isForked (c .IstanbulBlock , num )
343350}
344351
352+ func (c * ChainConfig ) IsNeo (num * big.Int ) bool {
353+ return isForked (c .NeoBlock , num )
354+ }
355+
345356// GasTable returns the gas table corresponding to the current phase (homestead or homestead reprice).
346357//
347358// The returned GasTable's fields shouldn't, under any circumstances, be changed.
@@ -397,6 +408,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
397408 {name : "constantinopleBlock" , block : c .ConstantinopleBlock },
398409 {name : "petersburgBlock" , block : c .PetersburgBlock },
399410 {name : "istanbulBlock" , block : c .IstanbulBlock },
411+ {name : "neoBlock" , block : c .NeoBlock },
400412 } {
401413 if lastFork .name != "" {
402414 // Next one must be higher number
@@ -456,6 +468,10 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *Confi
456468 if isForkIncompatible (c .IstanbulBlock , newcfg .IstanbulBlock , head ) {
457469 return newCompatError ("Istanbul fork block" , c .IstanbulBlock , newcfg .IstanbulBlock )
458470 }
471+
472+ if isForkIncompatible (c .NeoBlock , newcfg .NeoBlock , head ) {
473+ return newCompatError ("Neo fork block" , c .NeoBlock , newcfg .NeoBlock )
474+ }
459475 return nil
460476}
461477
@@ -521,9 +537,9 @@ func (err *ConfigCompatError) Error() string {
521537// Rules is a one time interface meaning that it shouldn't be used in between transition
522538// phases.
523539type Rules struct {
524- ChainID * big.Int
525- IsHomestead , IsEIP150 , IsEIP155 , IsEIP158 bool
526- IsByzantium , IsConstantinople , IsPetersburg , IsIstanbul bool
540+ ChainID * big.Int
541+ IsHomestead , IsEIP150 , IsEIP155 , IsEIP158 bool
542+ IsByzantium , IsConstantinople , IsPetersburg , IsIstanbul , IsNeo bool
527543}
528544
529545// Rules ensures c's ChainID is not nil.
@@ -532,7 +548,7 @@ func (c *ChainConfig) Rules(num *big.Int) Rules {
532548 if chainID == nil {
533549 chainID = new (big.Int )
534550 }
535- 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 )}
551+ 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 ) }
536552}
537553
538554// Get Mature Block
0 commit comments