-
Notifications
You must be signed in to change notification settings - Fork 20.4k
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b039981
consensus/ethash, params: implement eip-2384: bump difficulty bomb
holiman cdeba14
params: EIP 2384 compat checks
holiman a966a37
consensus, params: add Muir Glacier block number (mainnet,ropsten) + …
holiman da43f2c
core/forkid: forkid tests for muir glacier
holiman de424f3
params/config: address review concerns
holiman 51172f0
params, core/forkid: review nitpicks
holiman ae43a47
cmd/geth,eth,les: add override option for muir glacier
holiman b726125
params: nit fix
karalabe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
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) | ||
} | ||
|
||
// IsEip2384 returns whether num is equal or greater than the EIP 2384 block | ||
holiman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
func (c *ChainConfig) IsEip2384(num *big.Int) bool { | ||
holiman marked this conversation as resolved.
Show resolved
Hide resolved
holiman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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) | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Please change to MuirGlacierBlock