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

Load EIP1559 parameters from superchain #118

Merged
merged 6 commits into from
Sep 27, 2024
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
6 changes: 5 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ jobs:
description: The make target to execute
type: string
docker:
- image: us-docker.pkg.dev/${GCP_PROJECT_ID}/${GCP_ARTIFACT_REPOSITORY}/images/ci-builder:v1.3.0
- image: us-docker.pkg.dev/${GCP_PROJECT_ID}/${GCP_ARTIFACT_REPOSITORY}/images/ci-builder:v1.4.0
resource_class: xlarge
steps:
- attach_workspace: { at: "." }
Expand Down Expand Up @@ -166,6 +166,10 @@ jobs:
name: Cannon-prestate
command: make cannon-prestate
working_directory: ~/project/boba
- run:
name: Build Contracts
command: make build-contracts
working_directory: ~/project/boba
- run:
name: print go's available MIPS targets
command: go tool dist list | grep mips
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ require (
github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf
github.com/edsrzf/mmap-go v1.1.0
github.com/emicklei/dot v1.6.1
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240726164940-d2a098074a5d
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240916154111-a90e302558bc
github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c
github.com/gballet/go-verkle v0.0.0-20221121182333-31427a1f2d35
github.com/gfx-labs/sse v0.0.0-20231226060816-f747e26a9baa
Expand Down
47 changes: 24 additions & 23 deletions params/superchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package params

import (
"bytes"
"fmt"
"math/big"
"strings"

Expand Down Expand Up @@ -95,13 +96,13 @@ func ChainConfigByOpStackGenesisHash(genesisHash common.Hash) *chain.Config {
// LoadSuperChainConfig loads superchain config from superchain registry for given chain, and builds erigon chain config.
// This implementation is based on op-geth(https://github.com/ethereum-optimism/op-geth/blob/c7871bc4454ffc924eb128fa492975b30c9c46ad/params/superchain.go#L39)
func LoadSuperChainConfig(opStackChainCfg *superchain.ChainConfig) *chain.Config {
superchainConfig, ok := superchain.Superchains[opStackChainCfg.Superchain]
chConfig, ok := superchain.OPChains[opStackChainCfg.ChainID]
if !ok {
panic("unknown superchain: " + opStackChainCfg.Superchain)
panic("unknown superchain: " + fmt.Sprint(opStackChainCfg.ChainID))
}
out := &chain.Config{
ChainName: opStackChainCfg.Name,
ChainID: new(big.Int).SetUint64(opStackChainCfg.ChainID),
ChainName: chConfig.Name,
ChainID: new(big.Int).SetUint64(chConfig.ChainID),
HomesteadBlock: common.Big0,
DAOForkBlock: nil,
TangerineWhistleBlock: common.Big0,
Expand Down Expand Up @@ -129,31 +130,31 @@ func LoadSuperChainConfig(opStackChainCfg *superchain.ChainConfig) *chain.Config
TerminalTotalDifficultyPassed: true,
Ethash: nil,
Clique: nil,
Optimism: &chain.OptimismConfig{
EIP1559Elasticity: 6,
EIP1559Denominator: 50,
EIP1559DenominatorCanyon: 250,
},
}

if opStackChainCfg.CanyonTime != nil {
out.ShanghaiTime = new(big.Int).SetUint64(*opStackChainCfg.CanyonTime) // Shanghai activates with Canyon
out.CanyonTime = new(big.Int).SetUint64(*opStackChainCfg.CanyonTime)
if chConfig.CanyonTime != nil {
out.ShanghaiTime = new(big.Int).SetUint64(*chConfig.CanyonTime) // Shanghai activates with Canyon
out.CanyonTime = new(big.Int).SetUint64(*chConfig.CanyonTime)
}
if opStackChainCfg.EcotoneTime != nil {
out.CancunTime = new(big.Int).SetUint64(*opStackChainCfg.EcotoneTime) // CancunTime activates with Ecotone
out.EcotoneTime = new(big.Int).SetUint64(*opStackChainCfg.EcotoneTime)
if chConfig.EcotoneTime != nil {
out.CancunTime = new(big.Int).SetUint64(*chConfig.EcotoneTime) // CancunTime activates with Ecotone
out.EcotoneTime = new(big.Int).SetUint64(*chConfig.EcotoneTime)
}
if opStackChainCfg.FjordTime != nil {
out.FjordTime = new(big.Int).SetUint64(*opStackChainCfg.FjordTime)
if chConfig.FjordTime != nil {
out.FjordTime = new(big.Int).SetUint64(*chConfig.FjordTime)
}
if opStackChainCfg.GraniteTime != nil {
out.GraniteTime = new(big.Int).SetUint64(*opStackChainCfg.GraniteTime)
if chConfig.GraniteTime != nil {
out.GraniteTime = new(big.Int).SetUint64(*chConfig.GraniteTime)
}
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
}
}

// note: no actual parameters are being loaded, yet.
// Future superchain upgrades are loaded from the superchain chConfig and applied to the geth ChainConfig here.
_ = superchainConfig.Config

// special overrides for OP-Stack chains with pre-Regolith upgrade history
switch opStackChainCfg.ChainID {
Expand Down
Loading