@ -65,6 +65,7 @@ var (
ByzantiumBlock : big . NewInt ( 4370000 ) ,
ByzantiumBlock : big . NewInt ( 4370000 ) ,
ConstantinopleBlock : big . NewInt ( 7280000 ) ,
ConstantinopleBlock : big . NewInt ( 7280000 ) ,
PetersburgBlock : big . NewInt ( 7280000 ) ,
PetersburgBlock : big . NewInt ( 7280000 ) ,
IstanbulBlock : nil ,
Ethash : new ( EthashConfig ) ,
Ethash : new ( EthashConfig ) ,
}
}
@ -102,6 +103,7 @@ var (
ByzantiumBlock : big . NewInt ( 1700000 ) ,
ByzantiumBlock : big . NewInt ( 1700000 ) ,
ConstantinopleBlock : big . NewInt ( 4230000 ) ,
ConstantinopleBlock : big . NewInt ( 4230000 ) ,
PetersburgBlock : big . NewInt ( 4939394 ) ,
PetersburgBlock : big . NewInt ( 4939394 ) ,
IstanbulBlock : nil ,
Ethash : new ( EthashConfig ) ,
Ethash : new ( EthashConfig ) ,
}
}
@ -139,6 +141,7 @@ var (
ByzantiumBlock : big . NewInt ( 1035301 ) ,
ByzantiumBlock : big . NewInt ( 1035301 ) ,
ConstantinopleBlock : big . NewInt ( 3660663 ) ,
ConstantinopleBlock : big . NewInt ( 3660663 ) ,
PetersburgBlock : big . NewInt ( 4321234 ) ,
PetersburgBlock : big . NewInt ( 4321234 ) ,
IstanbulBlock : nil ,
Clique : & CliqueConfig {
Clique : & CliqueConfig {
Period : 15 ,
Period : 15 ,
Epoch : 30000 ,
Epoch : 30000 ,
@ -177,6 +180,7 @@ 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 : nil ,
Clique : & CliqueConfig {
Clique : & CliqueConfig {
Period : 15 ,
Period : 15 ,
Epoch : 30000 ,
Epoch : 30000 ,
@ -209,16 +213,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 ) , 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 ) , 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 ) , 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 ) , 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 ) , 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 ) , nil , nil , new ( EthashConfig ) , nil }
TestRules = TestChainConfig . Rules ( new ( big . Int ) )
TestRules = TestChainConfig . Rules ( new ( big . Int ) )
)
)
@ -287,6 +291,7 @@ type ChainConfig struct {
ByzantiumBlock * big . Int ` json:"byzantiumBlock,omitempty" ` // Byzantium switch block (nil = no fork, 0 = already on byzantium)
ByzantiumBlock * big . Int ` json:"byzantiumBlock,omitempty" ` // Byzantium switch block (nil = no fork, 0 = already on byzantium)
ConstantinopleBlock * big . Int ` json:"constantinopleBlock,omitempty" ` // Constantinople switch block (nil = no fork, 0 = already activated)
ConstantinopleBlock * big . Int ` json:"constantinopleBlock,omitempty" ` // Constantinople switch block (nil = no fork, 0 = already activated)
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)
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)
// Various consensus engines
// Various consensus engines
@ -324,7 +329,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 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 Engine: %v}" ,
c . ChainID ,
c . ChainID ,
c . HomesteadBlock ,
c . HomesteadBlock ,
c . DAOForkBlock ,
c . DAOForkBlock ,
@ -335,6 +340,7 @@ func (c *ChainConfig) String() string {
c . ByzantiumBlock ,
c . ByzantiumBlock ,
c . ConstantinopleBlock ,
c . ConstantinopleBlock ,
c . PetersburgBlock ,
c . PetersburgBlock ,
c . IstanbulBlock ,
engine ,
engine ,
)
)
}
}
@ -381,6 +387,11 @@ func (c *ChainConfig) IsPetersburg(num *big.Int) bool {
return isForked ( c . PetersburgBlock , num ) || c . PetersburgBlock == nil && isForked ( c . ConstantinopleBlock , num )
return isForked ( c . PetersburgBlock , num ) || c . PetersburgBlock == nil && isForked ( c . ConstantinopleBlock , num )
}
}
// IsIstanbul returns whether num is either equal to the Istanbul fork block or greater.
func ( c * ChainConfig ) IsIstanbul ( num * big . Int ) bool {
return isForked ( c . IstanbulBlock , 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
func ( c * ChainConfig ) IsEWASM ( num * big . Int ) bool {
func ( c * ChainConfig ) IsEWASM ( num * big . Int ) bool {
return isForked ( c . EWASMBlock , num )
return isForked ( c . EWASMBlock , num )
@ -435,6 +446,9 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *Confi
if isForkIncompatible ( c . PetersburgBlock , newcfg . PetersburgBlock , head ) {
if isForkIncompatible ( c . PetersburgBlock , newcfg . PetersburgBlock , head ) {
return newCompatError ( "Petersburg fork block" , c . PetersburgBlock , newcfg . PetersburgBlock )
return newCompatError ( "Petersburg fork block" , c . PetersburgBlock , newcfg . PetersburgBlock )
}
}
if isForkIncompatible ( c . IstanbulBlock , newcfg . IstanbulBlock , head ) {
return newCompatError ( "Istanbul fork block" , c . IstanbulBlock , newcfg . IstanbulBlock )
}
if isForkIncompatible ( c . EWASMBlock , newcfg . EWASMBlock , head ) {
if isForkIncompatible ( c . EWASMBlock , newcfg . EWASMBlock , head ) {
return newCompatError ( "ewasm fork block" , c . EWASMBlock , newcfg . EWASMBlock )
return newCompatError ( "ewasm fork block" , c . EWASMBlock , newcfg . EWASMBlock )
}
}
@ -502,9 +516,9 @@ func (err *ConfigCompatError) Error() string {
// Rules is a one time interface meaning that it shouldn't be used in between transition
// Rules is a one time interface meaning that it shouldn't be used in between transition
// phases.
// phases.
type Rules struct {
type Rules struct {
ChainID * big . Int
ChainID * big . Int
IsHomestead , IsEIP150 , IsEIP155 , IsEIP158 bool
IsHomestead , IsEIP150 , IsEIP155 , IsEIP158 bool
IsByzantium , IsConstantinople , IsPetersburg bool
IsByzantium , IsConstantinople , IsPetersburg , IsIstanbul bool
}
}
// Rules ensures c's ChainID is not nil.
// Rules ensures c's ChainID is not nil.
@ -522,5 +536,6 @@ func (c *ChainConfig) Rules(num *big.Int) Rules {
IsByzantium : c . IsByzantium ( num ) ,
IsByzantium : c . IsByzantium ( num ) ,
IsConstantinople : c . IsConstantinople ( num ) ,
IsConstantinople : c . IsConstantinople ( num ) ,
IsPetersburg : c . IsPetersburg ( num ) ,
IsPetersburg : c . IsPetersburg ( num ) ,
IsIstanbul : c . IsIstanbul ( num ) ,
}
}
}
}