Skip to content

Commit

Permalink
support kepler hardfork.
Browse files Browse the repository at this point in the history
  • Loading branch information
blxdyx committed Nov 24, 2023
1 parent 4339871 commit 9a42736
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions chain/chain_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,16 @@ func (c *Config) IsOnHertz(num *big.Int) bool {
}

// IsKepler returns whether time is either equal to the IsKepler fork time or greater.
func (c *Config) IsKepler(time uint64) bool {
return isForked(c.KeplerTime, time)
func (c *Config) IsKepler(num uint64, time uint64) bool {
return c.IsLondon(num) && isForked(c.KeplerTime, time)
}

func (c *Config) IsOnKepler(lastBlockTime uint64, currentBlockTime uint64) bool {
return !c.IsKepler(lastBlockTime) && c.IsKepler(currentBlockTime)
func (c *Config) IsOnKepler(currentBlockNumber *big.Int, lastBlockTime uint64, currentBlockTime uint64) bool {
lastBlockNumber := new(big.Int)
if currentBlockNumber.Cmp(big.NewInt(1)) >= 0 {
lastBlockNumber.Sub(currentBlockNumber, big.NewInt(1))
}
return !c.IsKepler(lastBlockNumber.Uint64(), lastBlockTime) && c.IsKepler(currentBlockNumber.Uint64(), currentBlockTime)
}

// CheckCompatible checks whether scheduled fork transitions have been imported
Expand Down Expand Up @@ -744,7 +748,7 @@ func (c *Config) Rules(num uint64, time uint64) *Rules {
IsLuban: c.IsLuban(num),
IsPlato: c.IsPlato(num),
IsHertz: c.IsHertz(num),
IsKepler: c.IsKepler(time),
IsKepler: c.IsKepler(num, time),
IsEip1559FeeCollector: c.IsEip1559FeeCollector(num),
IsAura: c.Aura != nil,
IsParlia: true,
Expand Down

0 comments on commit 9a42736

Please sign in to comment.