diff --git a/cmd/geth/config.go b/cmd/geth/config.go index 81128ab007..194f779842 100644 --- a/cmd/geth/config.go +++ b/cmd/geth/config.go @@ -180,6 +180,11 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) { cfg.Eth.OverrideOptimismCanyon = &v } + if ctx.IsSet(utils.OverrideOptimismInterop.Name) { + v := ctx.Uint64(utils.OverrideOptimismInterop.Name) + cfg.Eth.OverrideOptimismInterop = &v + } + if ctx.IsSet(utils.OverrideVerkle.Name) { v := ctx.Uint64(utils.OverrideVerkle.Name) cfg.Eth.OverrideVerkle = &v diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 88021a1a3a..d19641986b 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -68,6 +68,7 @@ var ( utils.OverrideCancun, utils.OverrideVerkle, utils.OverrideOptimismCanyon, + utils.OverrideOptimismInterop, utils.EnablePersonal, utils.TxPoolLocalsFlag, utils.TxPoolNoLocalsFlag, diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 96e4ff9cb2..0c4c077c92 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -267,6 +267,11 @@ var ( Usage: "Manually specify the Optimsim Canyon 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", + Category: flags.EthCategory, + } SyncModeFlag = &flags.TextMarshalerFlag{ Name: "syncmode", Usage: `Blockchain sync mode ("snap", "full" or "light")`, diff --git a/core/genesis.go b/core/genesis.go index f46c849f48..e5126de1cb 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -259,6 +259,7 @@ type ChainOverrides struct { // optimism OverrideOptimismCanyon *uint64 ApplySuperchainUpgrades bool + OverrideOptimismInterop *uint64 } // SetupGenesisBlock writes or updates the genesis block in db. @@ -318,6 +319,9 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *trie.Database, gen config.Optimism.EIP1559DenominatorCanyon = 250 } } + if overrides != nil && overrides.OverrideOptimismInterop != nil { + config.InteropTime = overrides.OverrideOptimismInterop + } } } // Just commit the new block if there is no stored genesis block. diff --git a/eth/backend.go b/eth/backend.go index 0f5d8a9d5c..d8e34503d4 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -223,6 +223,9 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { if config.OverrideOptimismCanyon != nil { overrides.OverrideOptimismCanyon = config.OverrideOptimismCanyon } + if config.OverrideOptimismInterop != nil { + overrides.OverrideOptimismInterop = config.OverrideOptimismInterop + } overrides.ApplySuperchainUpgrades = config.ApplySuperchainUpgrades eth.blockchain, err = core.NewBlockChain(chainDb, cacheConfig, config.Genesis, &overrides, eth.engine, vmConfig, eth.shouldPreserve, &config.TransactionHistory) if err != nil { diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index 32b4cfe181..ff164ed841 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -173,6 +173,8 @@ type Config struct { OverrideOptimismCanyon *uint64 `toml:",omitempty"` + OverrideOptimismInterop *uint64 `toml:",omitempty"` + // ApplySuperchainUpgrades requests the node to load chain-configuration from the superchain-registry. ApplySuperchainUpgrades bool `toml:",omitempty"` diff --git a/params/config.go b/params/config.go index 22041b76e6..3f9cabc159 100644 --- a/params/config.go +++ b/params/config.go @@ -359,6 +359,8 @@ type ChainConfig struct { RegolithTime *uint64 `json:"regolithTime,omitempty"` // Regolith switch time (nil = no fork, 0 = already on optimism regolith) CanyonTime *uint64 `json:"canyonTime,omitempty"` // Canyon switch time (nil = no fork, 0 = already on optimism canyon) + InteropTime *uint64 `json:"interopTime,omitempty"` // Interop switch time (nil = no fork, 0 = already on optimism interop) + // TerminalTotalDifficulty is the amount of total difficulty reached by // the network that triggers the consensus upgrade. TerminalTotalDifficulty *big.Int `json:"terminalTotalDifficulty,omitempty"` @@ -505,6 +507,9 @@ func (c *ChainConfig) Description() string { if c.CanyonTime != nil { banner += fmt.Sprintf(" - Canyon: @%-10v\n", *c.CanyonTime) } + if c.InteropTime != nil { + banner += fmt.Sprintf(" - Interop: @%-10v\n", *c.InteropTime) + } return banner } @@ -621,6 +626,10 @@ func (c *ChainConfig) IsCanyon(time uint64) bool { return isTimestampForked(c.CanyonTime, time) } +func (c *ChainConfig) IsInterop(time uint64) bool { + return isTimestampForked(c.InteropTime, time) +} + // IsOptimism returns whether the node is an optimism node or not. func (c *ChainConfig) IsOptimism() bool { return c.Optimism != nil