@ -56,18 +56,19 @@ var (
// MainnetChainConfig is the chain parameters to run a node on the main network.
// MainnetChainConfig is the chain parameters to run a node on the main network.
MainnetChainConfig = & ChainConfig {
MainnetChainConfig = & ChainConfig {
ChainID : big . NewInt ( 1 ) ,
ChainID : big . NewInt ( 1 ) ,
HomesteadBlock : big . NewInt ( 1150000 ) ,
HomesteadBlock : big . NewInt ( 1_ 150_ 000 ) ,
DAOForkBlock : big . NewInt ( 1920000 ) ,
DAOForkBlock : big . NewInt ( 1_ 920_ 000 ) ,
DAOForkSupport : true ,
DAOForkSupport : true ,
EIP150Block : big . NewInt ( 2463000 ) ,
EIP150Block : big . NewInt ( 2_ 463_ 000 ) ,
EIP150Hash : common . HexToHash ( "0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0" ) ,
EIP150Hash : common . HexToHash ( "0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0" ) ,
EIP155Block : big . NewInt ( 2675000 ) ,
EIP155Block : big . NewInt ( 2_675_000 ) ,
EIP158Block : big . NewInt ( 2675000 ) ,
EIP158Block : big . NewInt ( 2_675_000 ) ,
ByzantiumBlock : big . NewInt ( 4370000 ) ,
ByzantiumBlock : big . NewInt ( 4_370_000 ) ,
ConstantinopleBlock : big . NewInt ( 7280000 ) ,
ConstantinopleBlock : big . NewInt ( 7_280_000 ) ,
PetersburgBlock : big . NewInt ( 7280000 ) ,
PetersburgBlock : big . NewInt ( 7_280_000 ) ,
IstanbulBlock : big . NewInt ( 9069000 ) ,
IstanbulBlock : big . NewInt ( 9_069_000 ) ,
MuirGlacierBlock : big . NewInt ( 9200000 ) ,
MuirGlacierBlock : big . NewInt ( 9_200_000 ) ,
BerlinBlock : big . NewInt ( 12_244_000 ) ,
Ethash : new ( EthashConfig ) ,
Ethash : new ( EthashConfig ) ,
}
}
@ -102,11 +103,12 @@ var (
EIP150Hash : common . HexToHash ( "0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d" ) ,
EIP150Hash : common . HexToHash ( "0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d" ) ,
EIP155Block : big . NewInt ( 10 ) ,
EIP155Block : big . NewInt ( 10 ) ,
EIP158Block : big . NewInt ( 10 ) ,
EIP158Block : big . NewInt ( 10 ) ,
ByzantiumBlock : big . NewInt ( 1700000 ) ,
ByzantiumBlock : big . NewInt ( 1_700_000 ) ,
ConstantinopleBlock : big . NewInt ( 4230000 ) ,
ConstantinopleBlock : big . NewInt ( 4_230_000 ) ,
PetersburgBlock : big . NewInt ( 4939394 ) ,
PetersburgBlock : big . NewInt ( 4_939_394 ) ,
IstanbulBlock : big . NewInt ( 6485846 ) ,
IstanbulBlock : big . NewInt ( 6_485_846 ) ,
MuirGlacierBlock : big . NewInt ( 7117117 ) ,
MuirGlacierBlock : big . NewInt ( 7_117_117 ) ,
BerlinBlock : big . NewInt ( 9_812_189 ) ,
Ethash : new ( EthashConfig ) ,
Ethash : new ( EthashConfig ) ,
}
}
@ -141,11 +143,12 @@ var (
EIP150Hash : common . HexToHash ( "0x9b095b36c15eaf13044373aef8ee0bd3a382a5abb92e402afa44b8249c3a90e9" ) ,
EIP150Hash : common . HexToHash ( "0x9b095b36c15eaf13044373aef8ee0bd3a382a5abb92e402afa44b8249c3a90e9" ) ,
EIP155Block : big . NewInt ( 3 ) ,
EIP155Block : big . NewInt ( 3 ) ,
EIP158Block : big . NewInt ( 3 ) ,
EIP158Block : big . NewInt ( 3 ) ,
ByzantiumBlock : big . NewInt ( 1035301 ) ,
ByzantiumBlock : big . NewInt ( 1_ 035_ 301 ) ,
ConstantinopleBlock : big . NewInt ( 3660663 ) ,
ConstantinopleBlock : big . NewInt ( 3_ 660_ 663 ) ,
PetersburgBlock : big . NewInt ( 4321234 ) ,
PetersburgBlock : big . NewInt ( 4_ 321_ 234 ) ,
IstanbulBlock : big . NewInt ( 5435345 ) ,
IstanbulBlock : big . NewInt ( 5_ 435_ 345 ) ,
MuirGlacierBlock : nil ,
MuirGlacierBlock : nil ,
BerlinBlock : big . NewInt ( 8_290_928 ) ,
Clique : & CliqueConfig {
Clique : & CliqueConfig {
Period : 15 ,
Period : 15 ,
Epoch : 30000 ,
Epoch : 30000 ,
@ -184,8 +187,9 @@ var (
ByzantiumBlock : big . NewInt ( 0 ) ,
ByzantiumBlock : big . NewInt ( 0 ) ,
ConstantinopleBlock : big . NewInt ( 0 ) ,
ConstantinopleBlock : big . NewInt ( 0 ) ,
PetersburgBlock : big . NewInt ( 0 ) ,
PetersburgBlock : big . NewInt ( 0 ) ,
IstanbulBlock : big . NewInt ( 1561651 ) ,
IstanbulBlock : big . NewInt ( 1_ 561_ 651 ) ,
MuirGlacierBlock : nil ,
MuirGlacierBlock : nil ,
BerlinBlock : big . NewInt ( 4_460_644 ) ,
Clique : & CliqueConfig {
Clique : & CliqueConfig {
Period : 15 ,
Period : 15 ,
Epoch : 30000 ,
Epoch : 30000 ,
@ -227,6 +231,7 @@ var (
PetersburgBlock : big . NewInt ( 0 ) ,
PetersburgBlock : big . NewInt ( 0 ) ,
IstanbulBlock : big . NewInt ( 0 ) ,
IstanbulBlock : big . NewInt ( 0 ) ,
MuirGlacierBlock : nil ,
MuirGlacierBlock : nil ,
BerlinBlock : nil , // Don't enable Berlin directly, we're YOLOing it
YoloV3Block : big . NewInt ( 0 ) ,
YoloV3Block : big . NewInt ( 0 ) ,
Clique : & CliqueConfig {
Clique : & CliqueConfig {
Period : 15 ,
Period : 15 ,
@ -239,16 +244,16 @@ var (
//
//
// This configuration is intentionally not using keyed fields to force anyone
// This configuration is intentionally not using keyed fields to force anyone
// adding flags to the config to also have to set these fields.
// adding flags to the config to also have to set these fields.
AllEthashProtocolChanges = & 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 , nil , nil , new ( EthashConfig ) , nil }
AllEthashProtocolChanges = & 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 ) , big . NewInt ( 0 ) , big . NewInt ( 0 ) , nil , nil , new ( EthashConfig ) , nil }
// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced
// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced
// and accepted by the Ethereum core developers into the Clique consensus.
// and accepted by the Ethereum core developers into the Clique consensus.
//
//
// This configuration is intentionally not using keyed fields to force anyone
// This configuration is intentionally not using keyed fields to force anyone
// adding flags to the config to also have to set these fields.
// adding flags to the config to also have to set these fields.
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 ) , big . NewInt ( 0 ) , big . NewInt ( 0 ) , nil , big . NewInt ( 0 ) , nil , nil , & CliqueConfig { Period : 0 , Epoch : 30000 } }
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 ) , big . NewInt ( 0 ) , big . NewInt ( 0 ) , big . NewInt ( 0 ) , big . NewInt ( 0 ) , nil , nil , nil , & CliqueConfig { Period : 0 , Epoch : 30000 } }
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 , new ( EthashConfig ) , nil }
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 ) , big . NewInt ( 0 ) , big . NewInt ( 0 ) , nil , nil , new ( EthashConfig ) , nil }
TestRules = TestChainConfig . Rules ( new ( big . Int ) )
TestRules = TestChainConfig . Rules ( new ( big . Int ) )
)
)
@ -319,6 +324,7 @@ type ChainConfig struct {
PetersburgBlock * big . Int ` json:"petersburgBlock,omitempty" ` // Petersburg switch block (nil = same as Constantinople)
PetersburgBlock * big . Int ` json:"petersburgBlock,omitempty" ` // Petersburg switch block (nil = same as Constantinople)
IstanbulBlock * big . Int ` json:"istanbulBlock,omitempty" ` // Istanbul switch block (nil = no fork, 0 = already on istanbul)
IstanbulBlock * big . Int ` json:"istanbulBlock,omitempty" ` // Istanbul switch block (nil = no fork, 0 = already on istanbul)
MuirGlacierBlock * big . Int ` json:"muirGlacierBlock,omitempty" ` // Eip-2384 (bomb delay) switch block (nil = no fork, 0 = already activated)
MuirGlacierBlock * big . Int ` json:"muirGlacierBlock,omitempty" ` // Eip-2384 (bomb delay) switch block (nil = no fork, 0 = already activated)
BerlinBlock * big . Int ` json:"berlinBlock,omitempty" ` // Berlin switch block (nil = no fork, 0 = already on berlin)
YoloV3Block * big . Int ` json:"yoloV3Block,omitempty" ` // YOLO v3: Gas repricings TODO @holiman add EIP references
YoloV3Block * big . Int ` json:"yoloV3Block,omitempty" ` // YOLO v3: Gas repricings TODO @holiman add EIP references
EWASMBlock * big . Int ` json:"ewasmBlock,omitempty" ` // EWASM switch block (nil = no fork, 0 = already activated)
EWASMBlock * big . Int ` json:"ewasmBlock,omitempty" ` // EWASM switch block (nil = no fork, 0 = already activated)
@ -358,7 +364,7 @@ func (c *ChainConfig) String() string {
default :
default :
engine = "unknown"
engine = "unknown"
}
}
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, Muir Glacier: %v, YOLO v3: %v, Engine: %v}" ,
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, Muir Glacier: %v, Berlin: %v, YOLO v3: %v, Engine: %v}" ,
c . ChainID ,
c . ChainID ,
c . HomesteadBlock ,
c . HomesteadBlock ,
c . DAOForkBlock ,
c . DAOForkBlock ,
@ -371,6 +377,7 @@ func (c *ChainConfig) String() string {
c . PetersburgBlock ,
c . PetersburgBlock ,
c . IstanbulBlock ,
c . IstanbulBlock ,
c . MuirGlacierBlock ,
c . MuirGlacierBlock ,
c . BerlinBlock ,
c . YoloV3Block ,
c . YoloV3Block ,
engine ,
engine ,
)
)
@ -428,9 +435,9 @@ func (c *ChainConfig) IsIstanbul(num *big.Int) bool {
return isForked ( c . IstanbulBlock , num )
return isForked ( c . IstanbulBlock , num )
}
}
// IsYoloV3 returns whether num is either equal to the YoloV3 fork block or greater.
// IsBerlin returns whether num is either equal to the Berlin fork block or greater.
func ( c * ChainConfig ) IsYoloV3 ( num * big . Int ) bool {
func ( c * ChainConfig ) IsBerlin ( num * big . Int ) bool {
return isForked ( c . YoloV3Block , num )
return isForked ( c . BerlinBlock , num ) || isForked ( c . YoloV3Block , num )
}
}
// IsEWASM returns whether num represents a block number after the EWASM fork
// IsEWASM returns whether num represents a block number after the EWASM fork
@ -476,7 +483,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
{ name : "petersburgBlock" , block : c . PetersburgBlock } ,
{ name : "petersburgBlock" , block : c . PetersburgBlock } ,
{ name : "istanbulBlock" , block : c . IstanbulBlock } ,
{ name : "istanbulBlock" , block : c . IstanbulBlock } ,
{ name : "muirGlacierBlock" , block : c . MuirGlacierBlock , optional : true } ,
{ name : "muirGlacierBlock" , block : c . MuirGlacierBlock , optional : true } ,
{ name : "yoloV3 Block" , block : c . YoloV3 Block} ,
{ name : "berlin Block" , block : c . Berlin Block} ,
} {
} {
if lastFork . name != "" {
if lastFork . name != "" {
// Next one must be higher number
// Next one must be higher number
@ -540,6 +547,9 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *Confi
if isForkIncompatible ( c . MuirGlacierBlock , newcfg . MuirGlacierBlock , head ) {
if isForkIncompatible ( c . MuirGlacierBlock , newcfg . MuirGlacierBlock , head ) {
return newCompatError ( "Muir Glacier fork block" , c . MuirGlacierBlock , newcfg . MuirGlacierBlock )
return newCompatError ( "Muir Glacier fork block" , c . MuirGlacierBlock , newcfg . MuirGlacierBlock )
}
}
if isForkIncompatible ( c . BerlinBlock , newcfg . BerlinBlock , head ) {
return newCompatError ( "Berlin fork block" , c . BerlinBlock , newcfg . BerlinBlock )
}
if isForkIncompatible ( c . YoloV3Block , newcfg . YoloV3Block , head ) {
if isForkIncompatible ( c . YoloV3Block , newcfg . YoloV3Block , head ) {
return newCompatError ( "YOLOv3 fork block" , c . YoloV3Block , newcfg . YoloV3Block )
return newCompatError ( "YOLOv3 fork block" , c . YoloV3Block , newcfg . YoloV3Block )
}
}
@ -613,7 +623,7 @@ type Rules struct {
ChainID * big . Int
ChainID * big . Int
IsHomestead , IsEIP150 , IsEIP155 , IsEIP158 bool
IsHomestead , IsEIP150 , IsEIP155 , IsEIP158 bool
IsByzantium , IsConstantinople , IsPetersburg , IsIstanbul bool
IsByzantium , IsConstantinople , IsPetersburg , IsIstanbul bool
IsYoloV3 bool
IsBerlin bool
}
}
// Rules ensures c's ChainID is not nil.
// Rules ensures c's ChainID is not nil.
@ -632,6 +642,6 @@ func (c *ChainConfig) Rules(num *big.Int) Rules {
IsConstantinople : c . IsConstantinople ( num ) ,
IsConstantinople : c . IsConstantinople ( num ) ,
IsPetersburg : c . IsPetersburg ( num ) ,
IsPetersburg : c . IsPetersburg ( num ) ,
IsIstanbul : c . IsIstanbul ( num ) ,
IsIstanbul : c . IsIstanbul ( num ) ,
IsYoloV3 : c . IsYoloV3 ( num ) ,
IsBerlin : c . IsBerlin ( num ) ,
}
}
}
}