From 293c0e76a349ab9ece9113a6b4d458620773803a Mon Sep 17 00:00:00 2001 From: pcw109550 Date: Thu, 2 Nov 2023 13:23:17 +0900 Subject: [PATCH] Add Canyon network upgrade flags --- chain/chain_config.go | 11 +++++++++++ txpool/txpoolcfg/txpoolcfg.go | 27 ++++++++++++++------------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/chain/chain_config.go b/chain/chain_config.go index 239e7aee8..bc9bb5ddd 100644 --- a/chain/chain_config.go +++ b/chain/chain_config.go @@ -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 @@ -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 @@ -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) @@ -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 @@ -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), } } diff --git a/txpool/txpoolcfg/txpoolcfg.go b/txpool/txpoolcfg/txpoolcfg.go index cac39da24..1570e5663 100644 --- a/txpool/txpoolcfg/txpoolcfg.go +++ b/txpool/txpoolcfg/txpoolcfg.go @@ -12,19 +12,20 @@ import ( ) type Config struct { - DBDir string - TracedSenders []string // List of senders for which tx pool should print out debugging info - SyncToNewPeersEvery time.Duration - ProcessRemoteTxsEvery time.Duration - CommitEvery time.Duration - LogEvery time.Duration - PendingSubPoolLimit int - BaseFeeSubPoolLimit int - QueuedSubPoolLimit int - MinFeeCap uint64 - AccountSlots uint64 // Number of executable transaction slots guaranteed per account - PriceBump uint64 // Price bump percentage to replace an already existing transaction - OverrideShanghaiTime *big.Int + DBDir string + TracedSenders []string // List of senders for which tx pool should print out debugging info + SyncToNewPeersEvery time.Duration + ProcessRemoteTxsEvery time.Duration + CommitEvery time.Duration + LogEvery time.Duration + PendingSubPoolLimit int + BaseFeeSubPoolLimit int + QueuedSubPoolLimit int + MinFeeCap uint64 + AccountSlots uint64 // Number of executable transaction slots guaranteed per account + PriceBump uint64 // Price bump percentage to replace an already existing transaction + OverrideShanghaiTime *big.Int + OverrideOptimismCanyonTime *big.Int Optimism bool NoTxGossip bool