Skip to content

Commit

Permalink
Add Canyon network upgrade flags
Browse files Browse the repository at this point in the history
  • Loading branch information
pcw109550 committed Nov 2, 2023
1 parent c17f9c4 commit 81603a4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions chain/chain_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ type Config struct {

BedrockBlock *big.Int `json:"bedrockBlock,omitempty"` // Bedrock switch block (nil = no fork, 0 = already on optimism bedrock)
RegolithTime *big.Int `json:"regolithTime,omitempty"` // Regolith switch time (nil = no fork, 0 = already on optimism regolith)
CanyonTime *big.Int `json:"canyonTime,omitempty"` // Canyon switch time (nil = no fork, 0 = already on optimism canyon)

Eip1559FeeCollector *common.Address `json:"eip1559FeeCollector,omitempty"` // (Optional) Address where burnt EIP-1559 fees go to
Eip1559FeeCollectorTransition *big.Int `json:"eip1559FeeCollectorTransition,omitempty"` // (Optional) Block from which burnt EIP-1559 fees go to the Eip1559FeeCollector
Expand Down Expand Up @@ -231,6 +232,10 @@ func (c *Config) IsRegolith(time uint64) bool {
return isForked(c.RegolithTime, time)
}

func (c *Config) IsCanyon(time uint64) bool {
return isForked(c.CanyonTime, time)
}

// IsOptimism returns whether the node is an optimism node or not.
func (c *Config) IsOptimism() bool {
return c.Optimism != nil
Expand All @@ -245,6 +250,10 @@ func (c *Config) IsOptimismRegolith(time uint64) bool {
return c.IsOptimism() && c.IsRegolith(time)
}

func (c *Config) IsOptimismCanyon(time uint64) bool {
return c.IsOptimism() && c.IsCanyon(time)
}

// IsOptimismPreBedrock returns true iff this is an optimism node & bedrock is not yet active
func (c *Config) IsOptimismPreBedrock(num uint64) bool {
return c.IsOptimism() && !c.IsBedrock(num)
Expand Down Expand Up @@ -572,6 +581,7 @@ type Rules struct {
IsBerlin, IsLondon, IsShanghai, IsCancun, IsPrague bool
IsEip1559FeeCollector, IsAura bool
IsOptimismBedrock, IsOptimismRegolith bool
IsOptimismCanyon bool
}

// Rules ensures c's ChainID is not nil and returns a new Rules instance
Expand Down Expand Up @@ -599,6 +609,7 @@ func (c *Config) Rules(num uint64, time uint64) *Rules {
IsAura: c.Aura != nil,
IsOptimismBedrock: c.IsOptimismBedrock(num),
IsOptimismRegolith: c.IsOptimismRegolith(time),
IsOptimismCanyon: c.IsOptimismCanyon(time),
}
}

Expand Down

0 comments on commit 81603a4

Please sign in to comment.