|
|
|
@ -73,6 +73,7 @@ var ( |
|
|
|
|
BerlinBlock: big.NewInt(12_244_000), |
|
|
|
|
LondonBlock: big.NewInt(12_965_000), |
|
|
|
|
ArrowGlacierBlock: big.NewInt(13_773_000), |
|
|
|
|
GrayGlacierBlock: big.NewInt(15_050_000), |
|
|
|
|
Ethash: new(EthashConfig), |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -259,16 +260,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), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), 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), 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), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, 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), big.NewInt(0), nil, nil, 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), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, 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), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, new(EthashConfig), nil} |
|
|
|
|
TestRules = TestChainConfig.Rules(new(big.Int), false) |
|
|
|
|
) |
|
|
|
|
|
|
|
|
@ -357,6 +358,7 @@ type ChainConfig struct { |
|
|
|
|
BerlinBlock *big.Int `json:"berlinBlock,omitempty"` // Berlin switch block (nil = no fork, 0 = already on berlin)
|
|
|
|
|
LondonBlock *big.Int `json:"londonBlock,omitempty"` // London switch block (nil = no fork, 0 = already on london)
|
|
|
|
|
ArrowGlacierBlock *big.Int `json:"arrowGlacierBlock,omitempty"` // Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already activated)
|
|
|
|
|
GrayGlacierBlock *big.Int `json:"grayGlacierBlock,omitempty"` // Eip-5133 (bomb delay) switch block (nil = no fork, 0 = already activated)
|
|
|
|
|
MergeNetsplitBlock *big.Int `json:"mergeNetsplitBlock,omitempty"` // Virtual fork after The Merge to use as a network splitter
|
|
|
|
|
|
|
|
|
|
// TerminalTotalDifficulty is the amount of total difficulty reached by
|
|
|
|
@ -438,6 +440,9 @@ func (c *ChainConfig) String() string { |
|
|
|
|
if c.ArrowGlacierBlock != nil { |
|
|
|
|
banner += fmt.Sprintf(" - Arrow Glacier: %-8v (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/arrow-glacier.md)\n", c.ArrowGlacierBlock) |
|
|
|
|
} |
|
|
|
|
if c.GrayGlacierBlock != nil { |
|
|
|
|
banner += fmt.Sprintf(" - Gray Glacier: %-8v (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/gray-glacier.md)\n", c.GrayGlacierBlock) |
|
|
|
|
} |
|
|
|
|
banner += "\n" |
|
|
|
|
|
|
|
|
|
// Add a special section for the merge as it's non-obvious
|
|
|
|
@ -520,6 +525,11 @@ func (c *ChainConfig) IsArrowGlacier(num *big.Int) bool { |
|
|
|
|
return isForked(c.ArrowGlacierBlock, num) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// IsGrayGlacier returns whether num is either equal to the Gray Glacier (EIP-5133) fork block or greater.
|
|
|
|
|
func (c *ChainConfig) IsGrayGlacier(num *big.Int) bool { |
|
|
|
|
return isForked(c.GrayGlacierBlock, num) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// IsTerminalPoWBlock returns whether the given block is the last block of PoW stage.
|
|
|
|
|
func (c *ChainConfig) IsTerminalPoWBlock(parentTotalDiff *big.Int, totalDiff *big.Int) bool { |
|
|
|
|
if c.TerminalTotalDifficulty == nil { |
|
|
|
@ -569,6 +579,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error { |
|
|
|
|
{name: "berlinBlock", block: c.BerlinBlock}, |
|
|
|
|
{name: "londonBlock", block: c.LondonBlock}, |
|
|
|
|
{name: "arrowGlacierBlock", block: c.ArrowGlacierBlock, optional: true}, |
|
|
|
|
{name: "grayGlacierBlock", block: c.GrayGlacierBlock, optional: true}, |
|
|
|
|
{name: "mergeNetsplitBlock", block: c.MergeNetsplitBlock, optional: true}, |
|
|
|
|
} { |
|
|
|
|
if lastFork.name != "" { |
|
|
|
@ -642,6 +653,9 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *Confi |
|
|
|
|
if isForkIncompatible(c.ArrowGlacierBlock, newcfg.ArrowGlacierBlock, head) { |
|
|
|
|
return newCompatError("Arrow Glacier fork block", c.ArrowGlacierBlock, newcfg.ArrowGlacierBlock) |
|
|
|
|
} |
|
|
|
|
if isForkIncompatible(c.GrayGlacierBlock, newcfg.GrayGlacierBlock, head) { |
|
|
|
|
return newCompatError("Gray Glacier fork block", c.GrayGlacierBlock, newcfg.GrayGlacierBlock) |
|
|
|
|
} |
|
|
|
|
if isForkIncompatible(c.MergeNetsplitBlock, newcfg.MergeNetsplitBlock, head) { |
|
|
|
|
return newCompatError("Merge netsplit fork block", c.MergeNetsplitBlock, newcfg.MergeNetsplitBlock) |
|
|
|
|
} |
|
|
|
|