Commit e1c7dbe2 authored by Sebastian Stammler's avatar Sebastian Stammler Committed by GitHub

Add Granite and Holocene fork references (#11339)

parent 95a26147
...@@ -11,7 +11,7 @@ require ( ...@@ -11,7 +11,7 @@ require (
github.com/crate-crypto/go-kzg-4844 v0.7.0 github.com/crate-crypto/go-kzg-4844 v0.7.0
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3 github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240717194452-c01722001e88 github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240801182704-4810f97b7ee9
github.com/ethereum/go-ethereum v1.13.15 github.com/ethereum/go-ethereum v1.13.15
github.com/fsnotify/fsnotify v1.7.0 github.com/fsnotify/fsnotify v1.7.0
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb
......
...@@ -173,8 +173,8 @@ github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3 h1:RWHKLhCrQThMfch+QJ1Z ...@@ -173,8 +173,8 @@ github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3 h1:RWHKLhCrQThMfch+QJ1Z
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3/go.mod h1:QziizLAiF0KqyLdNJYD7O5cpDlaFMNZzlxYNcWsJUxs= github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3/go.mod h1:QziizLAiF0KqyLdNJYD7O5cpDlaFMNZzlxYNcWsJUxs=
github.com/ethereum-optimism/op-geth v1.101315.3-rc.1 h1:Q/B0FBdtglzsFtqurvUsiNfH8isCOFFF/pf9ss0L4eY= github.com/ethereum-optimism/op-geth v1.101315.3-rc.1 h1:Q/B0FBdtglzsFtqurvUsiNfH8isCOFFF/pf9ss0L4eY=
github.com/ethereum-optimism/op-geth v1.101315.3-rc.1/go.mod h1:h5C5tP+7gkMrlUGENuiV5ddlwJ4RxLdmdapRuTAGlnw= github.com/ethereum-optimism/op-geth v1.101315.3-rc.1/go.mod h1:h5C5tP+7gkMrlUGENuiV5ddlwJ4RxLdmdapRuTAGlnw=
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240717194452-c01722001e88 h1:pNwXkcFBM230tLKbw9mju6P568x20G6H0ka9y8pKe70= github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240801182704-4810f97b7ee9 h1:Yqi7oOCWRN3SMl3rL5zGYSHIw2MyuTJ1nqokSi7ejfU=
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240717194452-c01722001e88/go.mod h1:zy9f3TNPS7pwW4msMitF83fp0Wf452tZ6+Fg6d4JyXM= github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240801182704-4810f97b7ee9/go.mod h1:zy9f3TNPS7pwW4msMitF83fp0Wf452tZ6+Fg6d4JyXM=
github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY= github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY=
github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
......
...@@ -35,6 +35,8 @@ const ( ...@@ -35,6 +35,8 @@ const (
Delta ForkName = "delta" Delta ForkName = "delta"
Ecotone ForkName = "ecotone" Ecotone ForkName = "ecotone"
Fjord ForkName = "fjord" Fjord ForkName = "fjord"
Granite ForkName = "granite"
Holocene ForkName = "holocene"
Interop ForkName = "interop" Interop ForkName = "interop"
None ForkName = "none" None ForkName = "none"
) )
...@@ -46,6 +48,8 @@ var nextFork = map[ForkName]ForkName{ ...@@ -46,6 +48,8 @@ var nextFork = map[ForkName]ForkName{
Delta: Ecotone, Delta: Ecotone,
Ecotone: Fjord, Ecotone: Fjord,
Fjord: Interop, Fjord: Interop,
Granite: Granite,
Holocene: Holocene,
Interop: None, Interop: None,
} }
...@@ -125,6 +129,12 @@ func (s *ChainSpec) CheckForkActivation(log log.Logger, block eth.L2BlockRef) { ...@@ -125,6 +129,12 @@ func (s *ChainSpec) CheckForkActivation(log log.Logger, block eth.L2BlockRef) {
if s.config.IsFjord(block.Time) { if s.config.IsFjord(block.Time) {
s.currentFork = Fjord s.currentFork = Fjord
} }
if s.config.IsGranite(block.Time) {
s.currentFork = Fjord
}
if s.config.IsHolocene(block.Time) {
s.currentFork = Fjord
}
if s.config.IsInterop(block.Time) { if s.config.IsInterop(block.Time) {
s.currentFork = Interop s.currentFork = Interop
} }
...@@ -145,6 +155,10 @@ func (s *ChainSpec) CheckForkActivation(log log.Logger, block eth.L2BlockRef) { ...@@ -145,6 +155,10 @@ func (s *ChainSpec) CheckForkActivation(log log.Logger, block eth.L2BlockRef) {
foundActivationBlock = s.config.IsEcotoneActivationBlock(block.Time) foundActivationBlock = s.config.IsEcotoneActivationBlock(block.Time)
case Fjord: case Fjord:
foundActivationBlock = s.config.IsFjordActivationBlock(block.Time) foundActivationBlock = s.config.IsFjordActivationBlock(block.Time)
case Granite:
foundActivationBlock = s.config.IsGraniteActivationBlock(block.Time)
case Holocene:
foundActivationBlock = s.config.IsHoloceneActivationBlock(block.Time)
case Interop: case Interop:
foundActivationBlock = s.config.IsInteropActivationBlock(block.Time) foundActivationBlock = s.config.IsInteropActivationBlock(block.Time)
} }
......
...@@ -86,6 +86,7 @@ func LoadOPStackRollupConfig(chainID uint64) (*Config, error) { ...@@ -86,6 +86,7 @@ func LoadOPStackRollupConfig(chainID uint64) (*Config, error) {
DeltaTime: chConfig.DeltaTime, DeltaTime: chConfig.DeltaTime,
EcotoneTime: chConfig.EcotoneTime, EcotoneTime: chConfig.EcotoneTime,
FjordTime: chConfig.FjordTime, FjordTime: chConfig.FjordTime,
GraniteTime: chConfig.GraniteTime,
BatchInboxAddress: common.Address(chConfig.BatchInboxAddr), BatchInboxAddress: common.Address(chConfig.BatchInboxAddr),
DepositContractAddress: common.Address(addrs.OptimismPortalProxy), DepositContractAddress: common.Address(addrs.OptimismPortalProxy),
L1SystemConfigAddress: common.Address(addrs.SystemConfigProxy), L1SystemConfigAddress: common.Address(addrs.SystemConfigProxy),
......
...@@ -109,6 +109,14 @@ type Config struct { ...@@ -109,6 +109,14 @@ type Config struct {
// Active if FjordTime != nil && L2 block timestamp >= *FjordTime, inactive otherwise. // Active if FjordTime != nil && L2 block timestamp >= *FjordTime, inactive otherwise.
FjordTime *uint64 `json:"fjord_time,omitempty"` FjordTime *uint64 `json:"fjord_time,omitempty"`
// GraniteTime sets the activation time of the Granite network upgrade.
// Active if GraniteTime != nil && L2 block timestamp >= *GraniteTime, inactive otherwise.
GraniteTime *uint64 `json:"granite_time,omitempty"`
// HoloceneTime sets the activation time of the Holocene network upgrade.
// Active if HoloceneTime != nil && L2 block timestamp >= *HoloceneTime, inactive otherwise.
HoloceneTime *uint64 `json:"holocene_time,omitempty"`
// InteropTime sets the activation time for an experimental feature-set, activated like a hardfork. // InteropTime sets the activation time for an experimental feature-set, activated like a hardfork.
// Active if InteropTime != nil && L2 block timestamp >= *InteropTime, inactive otherwise. // Active if InteropTime != nil && L2 block timestamp >= *InteropTime, inactive otherwise.
InteropTime *uint64 `json:"interop_time,omitempty"` InteropTime *uint64 `json:"interop_time,omitempty"`
...@@ -322,6 +330,12 @@ func (cfg *Config) Check() error { ...@@ -322,6 +330,12 @@ func (cfg *Config) Check() error {
if err := checkFork(cfg.EcotoneTime, cfg.FjordTime, Ecotone, Fjord); err != nil { if err := checkFork(cfg.EcotoneTime, cfg.FjordTime, Ecotone, Fjord); err != nil {
return err return err
} }
if err := checkFork(cfg.FjordTime, cfg.GraniteTime, Fjord, Granite); err != nil {
return err
}
if err := checkFork(cfg.GraniteTime, cfg.HoloceneTime, Granite, Holocene); err != nil {
return err
}
return nil return nil
} }
...@@ -410,12 +424,14 @@ func (c *Config) IsFjord(timestamp uint64) bool { ...@@ -410,12 +424,14 @@ func (c *Config) IsFjord(timestamp uint64) bool {
return c.FjordTime != nil && timestamp >= *c.FjordTime return c.FjordTime != nil && timestamp >= *c.FjordTime
} }
// IsFjordActivationBlock returns whether the specified block is the first block subject to the // IsGranite returns true if the Granite hardfork is active at or past the given timestamp.
// Fjord upgrade. func (c *Config) IsGranite(timestamp uint64) bool {
func (c *Config) IsFjordActivationBlock(l2BlockTime uint64) bool { return c.GraniteTime != nil && timestamp >= *c.GraniteTime
return c.IsFjord(l2BlockTime) && }
l2BlockTime >= c.BlockTime &&
!c.IsFjord(l2BlockTime-c.BlockTime) // IsHolocene returns true if the Holocene hardfork is active at or past the given timestamp.
func (c *Config) IsHolocene(timestamp uint64) bool {
return c.HoloceneTime != nil && timestamp >= *c.HoloceneTime
} }
// IsInterop returns true if the Interop hardfork is active at or past the given timestamp. // IsInterop returns true if the Interop hardfork is active at or past the given timestamp.
...@@ -449,6 +465,30 @@ func (c *Config) IsEcotoneActivationBlock(l2BlockTime uint64) bool { ...@@ -449,6 +465,30 @@ func (c *Config) IsEcotoneActivationBlock(l2BlockTime uint64) bool {
!c.IsEcotone(l2BlockTime-c.BlockTime) !c.IsEcotone(l2BlockTime-c.BlockTime)
} }
// IsFjordActivationBlock returns whether the specified block is the first block subject to the
// Fjord upgrade.
func (c *Config) IsFjordActivationBlock(l2BlockTime uint64) bool {
return c.IsFjord(l2BlockTime) &&
l2BlockTime >= c.BlockTime &&
!c.IsFjord(l2BlockTime-c.BlockTime)
}
// IsGraniteActivationBlock returns whether the specified block is the first block subject to the
// Granite upgrade.
func (c *Config) IsGraniteActivationBlock(l2BlockTime uint64) bool {
return c.IsGranite(l2BlockTime) &&
l2BlockTime >= c.BlockTime &&
!c.IsGranite(l2BlockTime-c.BlockTime)
}
// IsHoloceneActivationBlock returns whether the specified block is the first block subject to the
// Holocene upgrade.
func (c *Config) IsHoloceneActivationBlock(l2BlockTime uint64) bool {
return c.IsHolocene(l2BlockTime) &&
l2BlockTime >= c.BlockTime &&
!c.IsHolocene(l2BlockTime-c.BlockTime)
}
func (c *Config) IsInteropActivationBlock(l2BlockTime uint64) bool { func (c *Config) IsInteropActivationBlock(l2BlockTime uint64) bool {
return c.IsInterop(l2BlockTime) && return c.IsInterop(l2BlockTime) &&
l2BlockTime >= c.BlockTime && l2BlockTime >= c.BlockTime &&
...@@ -564,6 +604,8 @@ func (c *Config) Description(l2Chains map[string]string) string { ...@@ -564,6 +604,8 @@ func (c *Config) Description(l2Chains map[string]string) string {
banner += fmt.Sprintf(" - Delta: %s\n", fmtForkTimeOrUnset(c.DeltaTime)) banner += fmt.Sprintf(" - Delta: %s\n", fmtForkTimeOrUnset(c.DeltaTime))
banner += fmt.Sprintf(" - Ecotone: %s\n", fmtForkTimeOrUnset(c.EcotoneTime)) banner += fmt.Sprintf(" - Ecotone: %s\n", fmtForkTimeOrUnset(c.EcotoneTime))
banner += fmt.Sprintf(" - Fjord: %s\n", fmtForkTimeOrUnset(c.FjordTime)) banner += fmt.Sprintf(" - Fjord: %s\n", fmtForkTimeOrUnset(c.FjordTime))
banner += fmt.Sprintf(" - Granite: %s\n", fmtForkTimeOrUnset(c.GraniteTime))
banner += fmt.Sprintf(" - Holocene: %s\n", fmtForkTimeOrUnset(c.HoloceneTime))
banner += fmt.Sprintf(" - Interop: %s\n", fmtForkTimeOrUnset(c.InteropTime)) banner += fmt.Sprintf(" - Interop: %s\n", fmtForkTimeOrUnset(c.InteropTime))
// Report the protocol version // Report the protocol version
banner += fmt.Sprintf("Node supports up to OP-Stack Protocol Version: %s\n", OPStackSupport) banner += fmt.Sprintf("Node supports up to OP-Stack Protocol Version: %s\n", OPStackSupport)
...@@ -598,6 +640,8 @@ func (c *Config) LogDescription(log log.Logger, l2Chains map[string]string) { ...@@ -598,6 +640,8 @@ func (c *Config) LogDescription(log log.Logger, l2Chains map[string]string) {
"delta_time", fmtForkTimeOrUnset(c.DeltaTime), "delta_time", fmtForkTimeOrUnset(c.DeltaTime),
"ecotone_time", fmtForkTimeOrUnset(c.EcotoneTime), "ecotone_time", fmtForkTimeOrUnset(c.EcotoneTime),
"fjord_time", fmtForkTimeOrUnset(c.FjordTime), "fjord_time", fmtForkTimeOrUnset(c.FjordTime),
"granite_time", fmtForkTimeOrUnset(c.GraniteTime),
"holocene_time", fmtForkTimeOrUnset(c.HoloceneTime),
"interop_time", fmtForkTimeOrUnset(c.InteropTime), "interop_time", fmtForkTimeOrUnset(c.InteropTime),
"plasma_mode", c.PlasmaConfig != nil, "plasma_mode", c.PlasmaConfig != nil,
) )
......
...@@ -260,6 +260,14 @@ func applyOverrides(ctx *cli.Context, rollupConfig *rollup.Config) { ...@@ -260,6 +260,14 @@ func applyOverrides(ctx *cli.Context, rollupConfig *rollup.Config) {
fjord := ctx.Uint64(opflags.FjordOverrideFlagName) fjord := ctx.Uint64(opflags.FjordOverrideFlagName)
rollupConfig.FjordTime = &fjord rollupConfig.FjordTime = &fjord
} }
if ctx.IsSet(opflags.GraniteOverrideFlagName) {
granite := ctx.Uint64(opflags.GraniteOverrideFlagName)
rollupConfig.GraniteTime = &granite
}
if ctx.IsSet(opflags.HoloceneOverrideFlagName) {
holocene := ctx.Uint64(opflags.HoloceneOverrideFlagName)
rollupConfig.HoloceneTime = &holocene
}
} }
func NewSyncConfig(ctx *cli.Context, log log.Logger) (*sync.Config, error) { func NewSyncConfig(ctx *cli.Context, log log.Logger) (*sync.Config, error) {
......
...@@ -11,12 +11,14 @@ import ( ...@@ -11,12 +11,14 @@ import (
) )
const ( const (
RollupConfigFlagName = "rollup.config" RollupConfigFlagName = "rollup.config"
NetworkFlagName = "network" NetworkFlagName = "network"
CanyonOverrideFlagName = "override.canyon" CanyonOverrideFlagName = "override.canyon"
DeltaOverrideFlagName = "override.delta" DeltaOverrideFlagName = "override.delta"
EcotoneOverrideFlagName = "override.ecotone" EcotoneOverrideFlagName = "override.ecotone"
FjordOverrideFlagName = "override.fjord" FjordOverrideFlagName = "override.fjord"
GraniteOverrideFlagName = "override.granite"
HoloceneOverrideFlagName = "override.holocene"
) )
func CLIFlags(envPrefix string, category string) []cli.Flag { func CLIFlags(envPrefix string, category string) []cli.Flag {
...@@ -49,6 +51,20 @@ func CLIFlags(envPrefix string, category string) []cli.Flag { ...@@ -49,6 +51,20 @@ func CLIFlags(envPrefix string, category string) []cli.Flag {
Hidden: false, Hidden: false,
Category: category, Category: category,
}, },
&cli.Uint64Flag{
Name: GraniteOverrideFlagName,
Usage: "Manually specify the Granite fork timestamp, overriding the bundled setting",
EnvVars: opservice.PrefixEnvVar(envPrefix, "OVERRIDE_GRANITE"),
Hidden: false,
Category: category,
},
&cli.Uint64Flag{
Name: HoloceneOverrideFlagName,
Usage: "Manually specify the Holocene fork timestamp, overriding the bundled setting",
EnvVars: opservice.PrefixEnvVar(envPrefix, "OVERRIDE_HOLOCENE"),
Hidden: false,
Category: category,
},
CLINetworkFlag(envPrefix, category), CLINetworkFlag(envPrefix, category),
CLIRollupConfigFlag(envPrefix, category), CLIRollupConfigFlag(envPrefix, category),
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment