Shanghai activation

This commit is contained in:
philip-morlier 2024-01-26 13:09:03 -08:00
parent 291340f09c
commit 3a2484e12d
2 changed files with 20 additions and 3 deletions

View File

@ -524,10 +524,14 @@ func (c *ChainConfig) IsTerminalPoWBlock(parentTotalDiff *big.Int, totalDiff *bi
return parentTotalDiff.Cmp(c.TerminalTotalDifficulty) < 0 && totalDiff.Cmp(c.TerminalTotalDifficulty) >= 0
}
// begin Plugeth injection -- the following code is being commented to enable network plugins to initiate the shanghai fork
// IsShanghai returns whether time is either equal to the Shanghai fork time or greater.
func (c *ChainConfig) IsShanghai(num *big.Int, time uint64) bool {
return c.IsLondon(num) && isTimestampForked(c.ShanghaiTime, time)
}
// func (c *ChainConfig) IsShanghai(num *big.Int, time uint64) bool {
// return c.IsLondon(num) && isTimestampForked(c.ShanghaiTime, time)
// }
// end PluGeth injection
// IsCancun returns whether num is either equal to the Cancun fork time or greater.
func (c *ChainConfig) IsCancun(num *big.Int, time uint64) bool {

View File

@ -39,3 +39,16 @@ func (c *ChainConfig) IsEIP160(num *big.Int) bool {
}
return c.IsEIP158(num)
}
// IsShanghai is modified here to return whether num is either equal to the Shanghai fork block or greater, if the chain supports Shanghai
// the foundation implementation has been commented out
func (c *ChainConfig) IsShanghai(num *big.Int, time uint64) bool {
if plugins.DefaultPluginLoader == nil {
log.Warn("Attempting isPluginShanghai, but default PluginLoader has not been initialized")
return c.IsLondon(num) && isTimestampForked(c.ShanghaiTime, time)
}
if active, ok := PluginEIPCheck(plugins.DefaultPluginLoader, "IsShanghai", num); ok {
return active
}
return c.IsLondon(num) && isTimestampForked(c.ShanghaiTime, time)
}