Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canyon Hard Fork #28

Merged
merged 7 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ on:
- stable
- alpha
- op-erigon
- tip/canyon
pull_request:
branches:
- main
- stable
- alpha
- op-erigon
- tip/canyon
env:
CGO_ENABLED: "1"
CGO_CXXFLAGS: "-g -O2 -std=c++17"
Expand Down
21 changes: 18 additions & 3 deletions chain/chain_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@

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 All @@ -85,8 +86,9 @@

// OptimismConfig is the optimism config.
type OptimismConfig struct {
EIP1559Elasticity uint64 `json:"eip1559Elasticity"`
EIP1559Denominator uint64 `json:"eip1559Denominator"`
EIP1559Elasticity uint64 `json:"eip1559Elasticity"`
EIP1559Denominator uint64 `json:"eip1559Denominator"`
EIP1559DenominatorCanyon uint64 `json:"eip1559DenominatorCanyon"`
}

// String implements the stringer interface, returning the optimism fee config details.
Expand Down Expand Up @@ -231,6 +233,10 @@
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,17 +251,24 @@
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)
}

// BaseFeeChangeDenominator bounds the amount the base fee can change between blocks.
func (c *Config) BaseFeeChangeDenominator(defaultParam int) uint64 {
func (c *Config) BaseFeeChangeDenominator(defaultParam, time uint64) uint64 {
if c.IsOptimism() {
if c.IsCanyon(time) {
return c.Optimism.EIP1559DenominatorCanyon
}
return c.Optimism.EIP1559Denominator
}
return uint64(defaultParam)

Check failure on line 271 in chain/chain_config.go

View workflow job for this annotation

GitHub Actions / tests (ubuntu-20.04)

unnecessary conversion (unconvert)
}

// ElasticityMultiplier bounds the maximum gas limit an EIP-1559 block may have.
Expand Down Expand Up @@ -572,6 +585,7 @@
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 +613,7 @@
IsAura: c.Aura != nil,
IsOptimismBedrock: c.IsOptimismBedrock(num),
IsOptimismRegolith: c.IsOptimismRegolith(time),
IsOptimismCanyon: c.IsOptimismCanyon(time),
}
}

Expand Down
27 changes: 14 additions & 13 deletions txpool/txpoolcfg/txpoolcfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading