Skip to content

Commit

Permalink
Merge pull request #237 from testinprod-io/feature/mininny/update-con…
Browse files Browse the repository at this point in the history
…fig-from-superchain-registry

Apply optimism-related configs from superchain-registry to erigon chain config
  • Loading branch information
mininny authored Jan 1, 2025
2 parents eed42e9 + ee92311 commit 8f7b270
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
5 changes: 5 additions & 0 deletions erigon-lib/chain/chain_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ func (c *Config) String() string {
c.GraniteTime,
c.HoloceneTime,
)
configString += fmt.Sprintf("{EIP1559Elasticity: %v, EIP1559Denominator: %v, EIP1559DenominatorCanyon: %v}",
c.Optimism.EIP1559Elasticity,
c.Optimism.EIP1559Denominator,
c.Optimism.EIP1559DenominatorCanyon,
)
}
return configString
}
Expand Down
28 changes: 12 additions & 16 deletions params/superchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,7 @@ func LoadSuperChainConfig(opStackChainCfg *superchain.ChainConfig) *chain.Config
TerminalTotalDifficultyPassed: true,
Ethash: nil,
Clique: nil,
Optimism: &chain.OptimismConfig{
EIP1559Elasticity: 6,
EIP1559Denominator: 50,
EIP1559DenominatorCanyon: 250,
},
Optimism: nil,
}

if chConfig.CanyonTime != nil {
Expand All @@ -144,6 +140,17 @@ func LoadSuperChainConfig(opStackChainCfg *superchain.ChainConfig) *chain.Config
if chConfig.HoloceneTime != nil {
out.HoloceneTime = new(big.Int).SetUint64(*chConfig.HoloceneTime)
}

if chConfig.Optimism != nil {
out.Optimism = &chain.OptimismConfig{
EIP1559Elasticity: chConfig.Optimism.EIP1559Elasticity,
EIP1559Denominator: chConfig.Optimism.EIP1559Denominator,
}
if chConfig.Optimism.EIP1559DenominatorCanyon != nil {
out.Optimism.EIP1559DenominatorCanyon = *chConfig.Optimism.EIP1559DenominatorCanyon
}
}

// special overrides for OP-Stack chains with pre-Regolith upgrade history
switch opStackChainCfg.ChainID {
case OPMainnetChainID:
Expand All @@ -153,17 +160,6 @@ func LoadSuperChainConfig(opStackChainCfg *superchain.ChainConfig) *chain.Config
out.GrayGlacierBlock = big.NewInt(105235063)
out.MergeNetsplitBlock = big.NewInt(105235063)
out.BedrockBlock = big.NewInt(105235063)
case baseSepoliaChainID:
out.Optimism.EIP1559Elasticity = 10
case pgnSepoliaChainID:
out.Optimism.EIP1559Elasticity = 2
out.Optimism.EIP1559Denominator = 8
case devnetChainID:
out.RegolithTime = devnetRegolithTime
out.Optimism.EIP1559Elasticity = 10
case chaosnetChainID:
out.RegolithTime = chaosnetRegolithTime
out.Optimism.EIP1559Elasticity = 10
}

return out
Expand Down

0 comments on commit 8f7b270

Please sign in to comment.