-
Notifications
You must be signed in to change notification settings - Fork 20.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
consensus/ethash, params: implement eip-2384: bump difficulty bomb #20347
Changes from 5 commits
b039981
cdeba14
a966a37
da43f2c
de424f3
51172f0
ae43a47
b726125
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,7 @@ var ( | |
ConstantinopleBlock: big.NewInt(7280000), | ||
PetersburgBlock: big.NewInt(7280000), | ||
IstanbulBlock: big.NewInt(9069000), | ||
EIP2384Block: big.NewInt(9200000), | ||
Ethash: new(EthashConfig), | ||
} | ||
|
||
|
@@ -104,6 +105,7 @@ var ( | |
ConstantinopleBlock: big.NewInt(4230000), | ||
PetersburgBlock: big.NewInt(4939394), | ||
IstanbulBlock: big.NewInt(6485846), | ||
EIP2384Block: big.NewInt(7117117), | ||
Ethash: new(EthashConfig), | ||
} | ||
|
||
|
@@ -213,16 +215,16 @@ var ( | |
// | ||
// This configuration is intentionally not using keyed fields to force anyone | ||
// 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, 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), nil, nil, new(EthashConfig), nil} | ||
|
||
// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced | ||
// and accepted by the Ethereum core developers into the Clique consensus. | ||
// | ||
// This configuration is intentionally not using keyed fields to force anyone | ||
// 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, 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), 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, 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), nil, nil, new(EthashConfig), nil} | ||
TestRules = TestChainConfig.Rules(new(big.Int)) | ||
) | ||
|
||
|
@@ -292,6 +294,7 @@ type ChainConfig struct { | |
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) | ||
IstanbulBlock *big.Int `json:"istanbulBlock,omitempty"` // Istanbul switch block (nil = no fork, 0 = already on istanbul) | ||
EIP2384Block *big.Int `json:"muirGlacierBlock,omitempty"` // Eip-2384 (bomb delay) switch block (nil = no fork, 0 = already activated) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please change to MuirGlacierBlock |
||
EWASMBlock *big.Int `json:"ewasmBlock,omitempty"` // EWASM switch block (nil = no fork, 0 = already activated) | ||
|
||
// Various consensus engines | ||
|
@@ -329,7 +332,7 @@ func (c *ChainConfig) String() string { | |
default: | ||
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 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, EIP-2384: %v, Engine: %v}", | ||
c.ChainID, | ||
c.HomesteadBlock, | ||
c.DAOForkBlock, | ||
|
@@ -341,6 +344,7 @@ func (c *ChainConfig) String() string { | |
c.ConstantinopleBlock, | ||
c.PetersburgBlock, | ||
c.IstanbulBlock, | ||
c.EIP2384Block, | ||
engine, | ||
) | ||
} | ||
|
@@ -380,6 +384,11 @@ func (c *ChainConfig) IsConstantinople(num *big.Int) bool { | |
return isForked(c.ConstantinopleBlock, num) | ||
} | ||
|
||
// IsMuirGlacier returns whether num is either equal to the Muir Glacier (EIP-2384) fork block or greater. | ||
func (c *ChainConfig) IsMuirGlacier(num *big.Int) bool { | ||
return isForked(c.EIP2384Block, num) | ||
} | ||
|
||
// IsPetersburg returns whether num is either | ||
// - equal to or greater than the PetersburgBlock fork block, | ||
// - OR is nil, and Constantinople is active | ||
|
@@ -432,6 +441,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error { | |
{"constantinopleBlock", c.ConstantinopleBlock}, | ||
{"petersburgBlock", c.PetersburgBlock}, | ||
{"istanbulBlock", c.IstanbulBlock}, | ||
{"eip2384Block", c.EIP2384Block}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please fix name, both sides actually. |
||
} { | ||
if lastFork.name != "" { | ||
// Next one must be higher number | ||
|
@@ -485,6 +495,9 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *Confi | |
if isForkIncompatible(c.IstanbulBlock, newcfg.IstanbulBlock, head) { | ||
return newCompatError("Istanbul fork block", c.IstanbulBlock, newcfg.IstanbulBlock) | ||
} | ||
if isForkIncompatible(c.EIP2384Block, newcfg.EIP2384Block, head) { | ||
return newCompatError("EIP-2348 fork block", c.EIP2384Block, newcfg.EIP2384Block) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please change the error message to Muir Glacier |
||
} | ||
if isForkIncompatible(c.EWASMBlock, newcfg.EWASMBlock, head) { | ||
return newCompatError("ewasm fork block", c.EWASMBlock, newcfg.EWASMBlock) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments are off