|
|
@ -128,6 +128,7 @@ var ( |
|
|
|
ShanghaiTime: nil, |
|
|
|
ShanghaiTime: nil, |
|
|
|
CancunTime: nil, |
|
|
|
CancunTime: nil, |
|
|
|
PragueTime: nil, |
|
|
|
PragueTime: nil, |
|
|
|
|
|
|
|
VerkleTime: nil, |
|
|
|
TerminalTotalDifficulty: nil, |
|
|
|
TerminalTotalDifficulty: nil, |
|
|
|
TerminalTotalDifficultyPassed: true, |
|
|
|
TerminalTotalDifficultyPassed: true, |
|
|
|
Ethash: new(EthashConfig), |
|
|
|
Ethash: new(EthashConfig), |
|
|
@ -157,6 +158,7 @@ var ( |
|
|
|
ShanghaiTime: nil, |
|
|
|
ShanghaiTime: nil, |
|
|
|
CancunTime: nil, |
|
|
|
CancunTime: nil, |
|
|
|
PragueTime: nil, |
|
|
|
PragueTime: nil, |
|
|
|
|
|
|
|
VerkleTime: nil, |
|
|
|
TerminalTotalDifficulty: nil, |
|
|
|
TerminalTotalDifficulty: nil, |
|
|
|
TerminalTotalDifficultyPassed: false, |
|
|
|
TerminalTotalDifficultyPassed: false, |
|
|
|
Ethash: nil, |
|
|
|
Ethash: nil, |
|
|
@ -186,6 +188,7 @@ var ( |
|
|
|
ShanghaiTime: nil, |
|
|
|
ShanghaiTime: nil, |
|
|
|
CancunTime: nil, |
|
|
|
CancunTime: nil, |
|
|
|
PragueTime: nil, |
|
|
|
PragueTime: nil, |
|
|
|
|
|
|
|
VerkleTime: nil, |
|
|
|
TerminalTotalDifficulty: nil, |
|
|
|
TerminalTotalDifficulty: nil, |
|
|
|
TerminalTotalDifficultyPassed: false, |
|
|
|
TerminalTotalDifficultyPassed: false, |
|
|
|
Ethash: new(EthashConfig), |
|
|
|
Ethash: new(EthashConfig), |
|
|
@ -215,6 +218,7 @@ var ( |
|
|
|
ShanghaiTime: nil, |
|
|
|
ShanghaiTime: nil, |
|
|
|
CancunTime: nil, |
|
|
|
CancunTime: nil, |
|
|
|
PragueTime: nil, |
|
|
|
PragueTime: nil, |
|
|
|
|
|
|
|
VerkleTime: nil, |
|
|
|
TerminalTotalDifficulty: nil, |
|
|
|
TerminalTotalDifficulty: nil, |
|
|
|
TerminalTotalDifficultyPassed: false, |
|
|
|
TerminalTotalDifficultyPassed: false, |
|
|
|
Ethash: new(EthashConfig), |
|
|
|
Ethash: new(EthashConfig), |
|
|
@ -264,6 +268,7 @@ type ChainConfig struct { |
|
|
|
ShanghaiTime *uint64 `json:"shanghaiTime,omitempty"` // Shanghai switch time (nil = no fork, 0 = already on shanghai)
|
|
|
|
ShanghaiTime *uint64 `json:"shanghaiTime,omitempty"` // Shanghai switch time (nil = no fork, 0 = already on shanghai)
|
|
|
|
CancunTime *uint64 `json:"cancunTime,omitempty"` // Cancun switch time (nil = no fork, 0 = already on cancun)
|
|
|
|
CancunTime *uint64 `json:"cancunTime,omitempty"` // Cancun switch time (nil = no fork, 0 = already on cancun)
|
|
|
|
PragueTime *uint64 `json:"pragueTime,omitempty"` // Prague switch time (nil = no fork, 0 = already on prague)
|
|
|
|
PragueTime *uint64 `json:"pragueTime,omitempty"` // Prague switch time (nil = no fork, 0 = already on prague)
|
|
|
|
|
|
|
|
VerkleTime *uint64 `json:"verkleTime,omitempty"` // Verkle switch time (nil = no fork, 0 = already on verkle)
|
|
|
|
|
|
|
|
|
|
|
|
// TerminalTotalDifficulty is the amount of total difficulty reached by
|
|
|
|
// TerminalTotalDifficulty is the amount of total difficulty reached by
|
|
|
|
// the network that triggers the consensus upgrade.
|
|
|
|
// the network that triggers the consensus upgrade.
|
|
|
@ -384,6 +389,9 @@ func (c *ChainConfig) Description() string { |
|
|
|
if c.PragueTime != nil { |
|
|
|
if c.PragueTime != nil { |
|
|
|
banner += fmt.Sprintf(" - Prague: @%-10v\n", *c.PragueTime) |
|
|
|
banner += fmt.Sprintf(" - Prague: @%-10v\n", *c.PragueTime) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if c.VerkleTime != nil { |
|
|
|
|
|
|
|
banner += fmt.Sprintf(" - Verkle: @%-10v\n", *c.VerkleTime) |
|
|
|
|
|
|
|
} |
|
|
|
return banner |
|
|
|
return banner |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -482,6 +490,11 @@ func (c *ChainConfig) IsPrague(num *big.Int, time uint64) bool { |
|
|
|
return c.IsLondon(num) && isTimestampForked(c.PragueTime, time) |
|
|
|
return c.IsLondon(num) && isTimestampForked(c.PragueTime, time) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// IsVerkle returns whether num is either equal to the Verkle fork time or greater.
|
|
|
|
|
|
|
|
func (c *ChainConfig) IsVerkle(num *big.Int, time uint64) bool { |
|
|
|
|
|
|
|
return c.IsLondon(num) && isTimestampForked(c.VerkleTime, time) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// CheckCompatible checks whether scheduled fork transitions have been imported
|
|
|
|
// CheckCompatible checks whether scheduled fork transitions have been imported
|
|
|
|
// with a mismatching chain configuration.
|
|
|
|
// with a mismatching chain configuration.
|
|
|
|
func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height uint64, time uint64) *ConfigCompatError { |
|
|
|
func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height uint64, time uint64) *ConfigCompatError { |
|
|
@ -536,6 +549,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error { |
|
|
|
{name: "shanghaiTime", timestamp: c.ShanghaiTime}, |
|
|
|
{name: "shanghaiTime", timestamp: c.ShanghaiTime}, |
|
|
|
{name: "cancunTime", timestamp: c.CancunTime, optional: true}, |
|
|
|
{name: "cancunTime", timestamp: c.CancunTime, optional: true}, |
|
|
|
{name: "pragueTime", timestamp: c.PragueTime, optional: true}, |
|
|
|
{name: "pragueTime", timestamp: c.PragueTime, optional: true}, |
|
|
|
|
|
|
|
{name: "verkleTime", timestamp: c.VerkleTime, optional: true}, |
|
|
|
} { |
|
|
|
} { |
|
|
|
if lastFork.name != "" { |
|
|
|
if lastFork.name != "" { |
|
|
|
switch { |
|
|
|
switch { |
|
|
@ -639,6 +653,9 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int, |
|
|
|
if isForkTimestampIncompatible(c.PragueTime, newcfg.PragueTime, headTimestamp) { |
|
|
|
if isForkTimestampIncompatible(c.PragueTime, newcfg.PragueTime, headTimestamp) { |
|
|
|
return newTimestampCompatError("Prague fork timestamp", c.PragueTime, newcfg.PragueTime) |
|
|
|
return newTimestampCompatError("Prague fork timestamp", c.PragueTime, newcfg.PragueTime) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if isForkTimestampIncompatible(c.VerkleTime, newcfg.VerkleTime, headTimestamp) { |
|
|
|
|
|
|
|
return newTimestampCompatError("Verkle fork timestamp", c.VerkleTime, newcfg.VerkleTime) |
|
|
|
|
|
|
|
} |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -784,6 +801,7 @@ type Rules struct { |
|
|
|
IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool |
|
|
|
IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool |
|
|
|
IsBerlin, IsLondon bool |
|
|
|
IsBerlin, IsLondon bool |
|
|
|
IsMerge, IsShanghai, IsCancun, IsPrague bool |
|
|
|
IsMerge, IsShanghai, IsCancun, IsPrague bool |
|
|
|
|
|
|
|
IsVerkle bool |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Rules ensures c's ChainID is not nil.
|
|
|
|
// Rules ensures c's ChainID is not nil.
|
|
|
@ -808,5 +826,6 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules |
|
|
|
IsShanghai: c.IsShanghai(num, timestamp), |
|
|
|
IsShanghai: c.IsShanghai(num, timestamp), |
|
|
|
IsCancun: c.IsCancun(num, timestamp), |
|
|
|
IsCancun: c.IsCancun(num, timestamp), |
|
|
|
IsPrague: c.IsPrague(num, timestamp), |
|
|
|
IsPrague: c.IsPrague(num, timestamp), |
|
|
|
|
|
|
|
IsVerkle: c.IsVerkle(num, timestamp), |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|