Skip to content

Commit

Permalink
Add Fjord override flags
Browse files Browse the repository at this point in the history
  • Loading branch information
danyalprout committed Apr 22, 2024
1 parent b642a5b commit 22bc5d4
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
cfg.Eth.OverrideOptimismEcotone = &v
}

if ctx.IsSet(utils.OverrideOptimismFjord.Name) {
v := ctx.Uint64(utils.OverrideOptimismFjord.Name)
cfg.Eth.OverrideOptimismFjord = &v
}

if ctx.IsSet(utils.OverrideOptimismInterop.Name) {
v := ctx.Uint64(utils.OverrideOptimismInterop.Name)
cfg.Eth.OverrideOptimismInterop = &v
Expand Down
1 change: 1 addition & 0 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ var (
utils.OverrideVerkle,
utils.OverrideOptimismCanyon,
utils.OverrideOptimismEcotone,
utils.OverrideOptimismFjord,
utils.OverrideOptimismInterop,
utils.EnablePersonal,
utils.TxPoolLocalsFlag,
Expand Down
5 changes: 5 additions & 0 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@ var (
Usage: "Manually specify the Optimism Ecotone fork timestamp, overriding the bundled setting",
Category: flags.EthCategory,
}
OverrideOptimismFjord = &cli.Uint64Flag{
Name: "override.fjord",
Usage: "Manually specify the Optimism Fjord fork timestamp, overriding the bundled setting",
Category: flags.EthCategory,
}
OverrideOptimismInterop = &cli.Uint64Flag{
Name: "override.interop",
Usage: "Manually specify the Optimsim Interop feature-set fork timestamp, overriding the bundled setting",
Expand Down
4 changes: 4 additions & 0 deletions core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ type ChainOverrides struct {
// optimism
OverrideOptimismCanyon *uint64
OverrideOptimismEcotone *uint64
OverrideOptimismFjord *uint64
ApplySuperchainUpgrades bool
OverrideOptimismInterop *uint64
}
Expand Down Expand Up @@ -336,6 +337,9 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *trie.Database, gen
config.EcotoneTime = overrides.OverrideOptimismEcotone
config.CancunTime = overrides.OverrideOptimismEcotone
}
if overrides != nil && overrides.OverrideOptimismFjord != nil {
config.FjordTime = overrides.OverrideOptimismFjord
}
if overrides != nil && overrides.OverrideOptimismInterop != nil {
config.InteropTime = overrides.OverrideOptimismInterop
}
Expand Down
3 changes: 3 additions & 0 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
if config.OverrideOptimismEcotone != nil {
overrides.OverrideOptimismEcotone = config.OverrideOptimismEcotone
}
if config.OverrideOptimismFjord != nil {
overrides.OverrideOptimismFjord = config.OverrideOptimismFjord
}
if config.OverrideOptimismInterop != nil {
overrides.OverrideOptimismInterop = config.OverrideOptimismInterop
}
Expand Down
2 changes: 2 additions & 0 deletions eth/ethconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ type Config struct {

OverrideOptimismEcotone *uint64 `toml:",omitempty"`

OverrideOptimismFjord *uint64 `toml:",omitempty"`

OverrideOptimismInterop *uint64 `toml:",omitempty"`

// ApplySuperchainUpgrades requests the node to load chain-configuration from the superchain-registry.
Expand Down
6 changes: 6 additions & 0 deletions eth/ethconfig/gen_config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ type ChainConfig struct {
CanyonTime *uint64 `json:"canyonTime,omitempty"` // Canyon switch time (nil = no fork, 0 = already on optimism canyon)
// Delta: the Delta upgrade does not affect the execution-layer, and is thus not configurable in the chain config.
EcotoneTime *uint64 `json:"ecotoneTime,omitempty"` // Ecotone switch time (nil = no fork, 0 = already on optimism ecotone)
FjordTime *uint64 `json:"fjordTime,omitempty"` // Ecotone switch time (nil = no fork, 0 = already on optimism ecotone)

InteropTime *uint64 `json:"interopTime,omitempty"` // Interop switch time (nil = no fork, 0 = already on optimism interop)

Expand Down
1 change: 1 addition & 0 deletions params/superchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func LoadOPStackChainConfig(chainID uint64) (*ChainConfig, error) {
RegolithTime: &genesisActivation,
CanyonTime: chConfig.CanyonTime,
EcotoneTime: chConfig.EcotoneTime,
FjordTime: chConfig.FjordTime,
TerminalTotalDifficulty: common.Big0,
TerminalTotalDifficultyPassed: true,
Ethash: nil,
Expand Down

0 comments on commit 22bc5d4

Please sign in to comment.