Commit fc8c5749 authored by protolambda's avatar protolambda

go: delta/eclipse/fjord upgrade configuration

parent 28b8d6d3
...@@ -8,7 +8,7 @@ require ( ...@@ -8,7 +8,7 @@ require (
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.3 github.com/btcsuite/btcd/chaincfg/chainhash v1.0.3
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.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-20231030223232-e16eae11e492 github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20231130001649-9af4efaba30f
github.com/ethereum/go-ethereum v1.13.5 github.com/ethereum/go-ethereum v1.13.5
github.com/fsnotify/fsnotify v1.7.0 github.com/fsnotify/fsnotify v1.7.0
github.com/go-chi/chi/v5 v5.0.10 github.com/go-chi/chi/v5 v5.0.10
......
...@@ -151,8 +151,8 @@ github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3 h1:RWHKLhCrQThMfch+QJ1Z ...@@ -151,8 +151,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.101304.2-0.20231123211905-25fd986a27b2 h1:OMlKPzhepobr+KcdkxcfVwR9gKU+jeRrFweWtkzG7Xg= github.com/ethereum-optimism/op-geth v1.101304.2-0.20231123211905-25fd986a27b2 h1:OMlKPzhepobr+KcdkxcfVwR9gKU+jeRrFweWtkzG7Xg=
github.com/ethereum-optimism/op-geth v1.101304.2-0.20231123211905-25fd986a27b2/go.mod h1:KyXcYdAJTSm8tvOmd+KPeOygiA+FEE5VX3vs2WwjwQ4= github.com/ethereum-optimism/op-geth v1.101304.2-0.20231123211905-25fd986a27b2/go.mod h1:KyXcYdAJTSm8tvOmd+KPeOygiA+FEE5VX3vs2WwjwQ4=
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20231030223232-e16eae11e492 h1:FyzLzMLKMc9zcDYcSxbrLDglIRrGQJE9juFzIO35RmE= github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20231130001649-9af4efaba30f h1:ebY8ISCsP602IUGy0Av/N/vzs3vd+UBP35rHhqjk0dw=
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20231030223232-e16eae11e492/go.mod h1:/70H/KqrtKcvWvNGVj6S3rAcLC+kUPr3t2aDmYIS+Xk= github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20231130001649-9af4efaba30f/go.mod h1:/70H/KqrtKcvWvNGVj6S3rAcLC+kUPr3t2aDmYIS+Xk=
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 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
......
...@@ -115,6 +115,12 @@ type DeployConfig struct { ...@@ -115,6 +115,12 @@ type DeployConfig struct {
// L2GenesisDeltaTimeOffset is the number of seconds after genesis block that Delta hard fork activates. // L2GenesisDeltaTimeOffset is the number of seconds after genesis block that Delta hard fork activates.
// Set it to 0 to activate at genesis. Nil to disable Delta. // Set it to 0 to activate at genesis. Nil to disable Delta.
L2GenesisDeltaTimeOffset *hexutil.Uint64 `json:"l2GenesisDeltaTimeOffset,omitempty"` L2GenesisDeltaTimeOffset *hexutil.Uint64 `json:"l2GenesisDeltaTimeOffset,omitempty"`
// L2GenesisDeltaTimeOffset is the number of seconds after genesis block that Eclipse hard fork activates.
// Set it to 0 to activate at genesis. Nil to disable Delta.
L2GenesisEclipseTimeOffset *hexutil.Uint64 `json:"l2GenesisEclipseTimeOffset,omitempty"`
// L2GenesisDeltaTimeOffset is the number of seconds after genesis block that Fjord hard fork activates.
// Set it to 0 to activate at genesis. Nil to disable Delta.
L2GenesisFjordTimeOffset *hexutil.Uint64 `json:"l2GenesisFjordTimeOffset,omitempty"`
// L2GenesisInteropTimeOffset is the number of seconds after genesis block that the Interop hard fork activates. // L2GenesisInteropTimeOffset is the number of seconds after genesis block that the Interop hard fork activates.
// Set it to 0 to activate at genesis. Nil to disable Interop. // Set it to 0 to activate at genesis. Nil to disable Interop.
L2GenesisInteropTimeOffset *hexutil.Uint64 `json:"l2GenesisInteropTimeOffset,omitempty"` L2GenesisInteropTimeOffset *hexutil.Uint64 `json:"l2GenesisInteropTimeOffset,omitempty"`
...@@ -477,6 +483,28 @@ func (d *DeployConfig) DeltaTime(genesisTime uint64) *uint64 { ...@@ -477,6 +483,28 @@ func (d *DeployConfig) DeltaTime(genesisTime uint64) *uint64 {
return &v return &v
} }
func (d *DeployConfig) EclipseTime(genesisTime uint64) *uint64 {
if d.L2GenesisEclipseTimeOffset == nil {
return nil
}
v := uint64(0)
if offset := *d.L2GenesisEclipseTimeOffset; offset > 0 {
v = genesisTime + uint64(offset)
}
return &v
}
func (d *DeployConfig) FjordTime(genesisTime uint64) *uint64 {
if d.L2GenesisFjordTimeOffset == nil {
return nil
}
v := uint64(0)
if offset := *d.L2GenesisFjordTimeOffset; offset > 0 {
v = genesisTime + uint64(offset)
}
return &v
}
func (d *DeployConfig) InteropTime(genesisTime uint64) *uint64 { func (d *DeployConfig) InteropTime(genesisTime uint64) *uint64 {
if d.L2GenesisInteropTimeOffset == nil { if d.L2GenesisInteropTimeOffset == nil {
return nil return nil
...@@ -527,6 +555,8 @@ func (d *DeployConfig) RollupConfig(l1StartBlock *types.Block, l2GenesisBlockHas ...@@ -527,6 +555,8 @@ func (d *DeployConfig) RollupConfig(l1StartBlock *types.Block, l2GenesisBlockHas
RegolithTime: d.RegolithTime(l1StartBlock.Time()), RegolithTime: d.RegolithTime(l1StartBlock.Time()),
CanyonTime: d.CanyonTime(l1StartBlock.Time()), CanyonTime: d.CanyonTime(l1StartBlock.Time()),
DeltaTime: d.DeltaTime(l1StartBlock.Time()), DeltaTime: d.DeltaTime(l1StartBlock.Time()),
EclipseTime: d.EclipseTime(l1StartBlock.Time()),
FjordTime: d.FjordTime(l1StartBlock.Time()),
InteropTime: d.InteropTime(l1StartBlock.Time()), InteropTime: d.InteropTime(l1StartBlock.Time()),
}, nil }, nil
} }
......
...@@ -159,6 +159,8 @@ func Setup(t require.TestingT, deployParams *DeployParams, alloc *AllocParams) * ...@@ -159,6 +159,8 @@ func Setup(t require.TestingT, deployParams *DeployParams, alloc *AllocParams) *
RegolithTime: deployConf.RegolithTime(uint64(deployConf.L1GenesisBlockTimestamp)), RegolithTime: deployConf.RegolithTime(uint64(deployConf.L1GenesisBlockTimestamp)),
CanyonTime: deployConf.CanyonTime(uint64(deployConf.L1GenesisBlockTimestamp)), CanyonTime: deployConf.CanyonTime(uint64(deployConf.L1GenesisBlockTimestamp)),
DeltaTime: deployConf.DeltaTime(uint64(deployConf.L1GenesisBlockTimestamp)), DeltaTime: deployConf.DeltaTime(uint64(deployConf.L1GenesisBlockTimestamp)),
EclipseTime: deployConf.EclipseTime(uint64(deployConf.L1GenesisBlockTimestamp)),
FjordTime: deployConf.FjordTime(uint64(deployConf.L1GenesisBlockTimestamp)),
InteropTime: deployConf.InteropTime(uint64(deployConf.L1GenesisBlockTimestamp)), InteropTime: deployConf.InteropTime(uint64(deployConf.L1GenesisBlockTimestamp)),
} }
......
...@@ -434,6 +434,8 @@ func (cfg SystemConfig) Start(t *testing.T, _opts ...SystemConfigOption) (*Syste ...@@ -434,6 +434,8 @@ func (cfg SystemConfig) Start(t *testing.T, _opts ...SystemConfigOption) (*Syste
RegolithTime: cfg.DeployConfig.RegolithTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)), RegolithTime: cfg.DeployConfig.RegolithTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
CanyonTime: cfg.DeployConfig.CanyonTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)), CanyonTime: cfg.DeployConfig.CanyonTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
DeltaTime: cfg.DeployConfig.DeltaTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)), DeltaTime: cfg.DeployConfig.DeltaTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
EclipseTime: cfg.DeployConfig.EclipseTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
FjordTime: cfg.DeployConfig.FjordTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
InteropTime: cfg.DeployConfig.InteropTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)), InteropTime: cfg.DeployConfig.InteropTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
ProtocolVersionsAddress: cfg.L1Deployments.ProtocolVersionsProxy, ProtocolVersionsAddress: cfg.L1Deployments.ProtocolVersionsProxy,
} }
......
...@@ -99,6 +99,9 @@ func LoadOPStackRollupConfig(chainID uint64) (*Config, error) { ...@@ -99,6 +99,9 @@ func LoadOPStackRollupConfig(chainID uint64) (*Config, error) {
L2ChainID: new(big.Int).SetUint64(chConfig.ChainID), L2ChainID: new(big.Int).SetUint64(chConfig.ChainID),
RegolithTime: &regolithTime, RegolithTime: &regolithTime,
CanyonTime: superChain.Config.CanyonTime, CanyonTime: superChain.Config.CanyonTime,
DeltaTime: superChain.Config.DeltaTime,
EclipseTime: superChain.Config.EclipseTime,
FjordTime: superChain.Config.FjordTime,
BatchInboxAddress: common.Address(chConfig.BatchInboxAddr), BatchInboxAddress: common.Address(chConfig.BatchInboxAddr),
DepositContractAddress: depositContractAddress, DepositContractAddress: depositContractAddress,
L1SystemConfigAddress: common.Address(chConfig.SystemConfigAddr), L1SystemConfigAddress: common.Address(chConfig.SystemConfigAddr),
......
...@@ -75,14 +75,22 @@ type Config struct { ...@@ -75,14 +75,22 @@ type Config struct {
// Active if RegolithTime != nil && L2 block timestamp >= *RegolithTime, inactive otherwise. // Active if RegolithTime != nil && L2 block timestamp >= *RegolithTime, inactive otherwise.
RegolithTime *uint64 `json:"regolith_time,omitempty"` RegolithTime *uint64 `json:"regolith_time,omitempty"`
// CanyonTime sets the activation time of the next network upgrade. // CanyonTime sets the activation time of the Canyon network upgrade.
// Active if CanyonTime != nil && L2 block timestamp >= *CanyonTime, inactive otherwise. // Active if CanyonTime != nil && L2 block timestamp >= *CanyonTime, inactive otherwise.
CanyonTime *uint64 `json:"canyon_time,omitempty"` CanyonTime *uint64 `json:"canyon_time,omitempty"`
// DeltaTime sets the activation time of the next network upgrade. // DeltaTime sets the activation time of the Delta network upgrade.
// Active if DeltaTime != nil && L2 block timestamp >= *DeltaTime, inactive otherwise. // Active if DeltaTime != nil && L2 block timestamp >= *DeltaTime, inactive otherwise.
DeltaTime *uint64 `json:"delta_time,omitempty"` DeltaTime *uint64 `json:"delta_time,omitempty"`
// EclipseTime sets the activation time of the Eclipse network upgrade.
// Active if EclipseTime != nil && L2 block timestamp >= *EclipseTime, inactive otherwise.
EclipseTime *uint64 `json:"eclipse_time,omitempty"`
// FjordTime sets the activation time of the Fjord network upgrade.
// Active if FjordTime != nil && L2 block timestamp >= *FjordTime, inactive otherwise.
FjordTime *uint64 `json:"fjord_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"`
...@@ -285,6 +293,16 @@ func (c *Config) IsDelta(timestamp uint64) bool { ...@@ -285,6 +293,16 @@ func (c *Config) IsDelta(timestamp uint64) bool {
return c.DeltaTime != nil && timestamp >= *c.DeltaTime return c.DeltaTime != nil && timestamp >= *c.DeltaTime
} }
// IsEclipse returns true if the Eclipse hardfork is active at or past the given timestamp.
func (c *Config) IsEclipse(timestamp uint64) bool {
return c.EclipseTime != nil && timestamp >= *c.EclipseTime
}
// IsFjord returns true if the Fjord hardfork is active at or past the given timestamp.
func (c *Config) IsFjord(timestamp uint64) bool {
return c.FjordTime != nil && timestamp >= *c.FjordTime
}
// 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.
func (c *Config) IsInterop(timestamp uint64) bool { func (c *Config) IsInterop(timestamp uint64) bool {
return c.InteropTime != nil && timestamp >= *c.InteropTime return c.InteropTime != nil && timestamp >= *c.InteropTime
...@@ -319,6 +337,8 @@ func (c *Config) Description(l2Chains map[string]string) string { ...@@ -319,6 +337,8 @@ func (c *Config) Description(l2Chains map[string]string) string {
banner += fmt.Sprintf(" - Regolith: %s\n", fmtForkTimeOrUnset(c.RegolithTime)) banner += fmt.Sprintf(" - Regolith: %s\n", fmtForkTimeOrUnset(c.RegolithTime))
banner += fmt.Sprintf(" - Canyon: %s\n", fmtForkTimeOrUnset(c.CanyonTime)) banner += fmt.Sprintf(" - Canyon: %s\n", fmtForkTimeOrUnset(c.CanyonTime))
banner += fmt.Sprintf(" - Delta: %s\n", fmtForkTimeOrUnset(c.DeltaTime)) banner += fmt.Sprintf(" - Delta: %s\n", fmtForkTimeOrUnset(c.DeltaTime))
banner += fmt.Sprintf(" - Eclipse: %s\n", fmtForkTimeOrUnset(c.EclipseTime))
banner += fmt.Sprintf(" - Fjord: %s\n", fmtForkTimeOrUnset(c.FjordTime))
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)
...@@ -347,6 +367,8 @@ func (c *Config) LogDescription(log log.Logger, l2Chains map[string]string) { ...@@ -347,6 +367,8 @@ func (c *Config) LogDescription(log log.Logger, l2Chains map[string]string) {
"l1_block_number", c.Genesis.L1.Number, "regolith_time", fmtForkTimeOrUnset(c.RegolithTime), "l1_block_number", c.Genesis.L1.Number, "regolith_time", fmtForkTimeOrUnset(c.RegolithTime),
"canyon_time", fmtForkTimeOrUnset(c.CanyonTime), "canyon_time", fmtForkTimeOrUnset(c.CanyonTime),
"delta_time", fmtForkTimeOrUnset(c.DeltaTime), "delta_time", fmtForkTimeOrUnset(c.DeltaTime),
"eclipse_time", fmtForkTimeOrUnset(c.EclipseTime),
"fjord_time", fmtForkTimeOrUnset(c.FjordTime),
"interop_time", fmtForkTimeOrUnset(c.InteropTime), "interop_time", fmtForkTimeOrUnset(c.InteropTime),
) )
} }
......
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