Skip to content

Commit

Permalink
Merge pull request #191 from ethereum-optimism/interop-activation
Browse files Browse the repository at this point in the history
params: interopTime configuration and override option
  • Loading branch information
protolambda authored Nov 23, 2023
2 parents 32ddd8b + 6ad221a commit 25fd986
Show file tree
Hide file tree
Showing 7 changed files with 29 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 @@ -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
Expand Down
1 change: 1 addition & 0 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ var (
utils.OverrideCancun,
utils.OverrideVerkle,
utils.OverrideOptimismCanyon,
utils.OverrideOptimismInterop,
utils.EnablePersonal,
utils.TxPoolLocalsFlag,
utils.TxPoolNoLocalsFlag,
Expand Down
5 changes: 5 additions & 0 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")`,
Expand Down
4 changes: 4 additions & 0 deletions core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ type ChainOverrides struct {
// optimism
OverrideOptimismCanyon *uint64
ApplySuperchainUpgrades bool
OverrideOptimismInterop *uint64
}

// SetupGenesisBlock writes or updates the genesis block in db.
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions eth/ethconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`

Expand Down
9 changes: 9 additions & 0 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 25fd986

Please sign in to comment.