Commit 3614064c authored by Matthew Slipper's avatar Matthew Slipper Committed by GitHub

op-deployer: Support Holocene genesis (#13843)

parent 704faf26
......@@ -23,6 +23,7 @@ type L1Deployments struct {
type L2GenesisInput struct {
L1Deployments L1Deployments
L2Config genesis.L2InitializationConfig
OverrideAllocsMode string
}
type L2GenesisScript struct {
......@@ -33,8 +34,15 @@ func L2Genesis(l2Host *script.Host, input *L2GenesisInput) error {
l2Host.SetEnvVar("L2GENESIS_L1CrossDomainMessengerProxy", input.L1Deployments.L1CrossDomainMessengerProxy.String())
l2Host.SetEnvVar("L2GENESIS_L1StandardBridgeProxy", input.L1Deployments.L1StandardBridgeProxy.String())
l2Host.SetEnvVar("L2GENESIS_L1ERC721BridgeProxy", input.L1Deployments.L1ERC721BridgeProxy.String())
allocsMode := input.L2Config.UpgradeScheduleDeployConfig.AllocMode(uint64(time.Now().Unix()))
l2Host.SetEnvVar("FORK", string(allocsMode))
var allocsMode string
if input.OverrideAllocsMode == "" {
allocsMode = string(input.L2Config.UpgradeScheduleDeployConfig.AllocMode(uint64(time.Now().Unix())))
} else {
allocsMode = input.OverrideAllocsMode
}
l2Host.SetEnvVar("FORK", allocsMode)
deployConfig := &genesis.DeployConfig{
L2InitializationConfig: input.L2Config,
......
......@@ -3,6 +3,8 @@ package pipeline
import (
"fmt"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/standard"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/env"
"github.com/ethereum-optimism/optimism/op-chain-ops/foundry"
......@@ -48,6 +50,15 @@ func GenerateL2Genesis(pEnv *Env, intent *state.Intent, bundle ArtifactsBundle,
return fmt.Errorf("failed to create L2 script host: %w", err)
}
// This is an ugly hack to support holocene. The v1.7.0 predeploy contracts do not support setting the allocs
// mode as Holocene, even though there are no predeploy changes in Holocene. The v1.7.0 changes are the "official"
// release of the predeploy contracts, so we need to set the allocs mode to "granite" to avoid having to backport
// Holocene support into the predeploy contracts.
var overrideAllocsMode string
if intent.L2ContractsLocator.IsTag() && intent.L2ContractsLocator.Tag == standard.ContractsV170Beta1L2Tag {
overrideAllocsMode = "granite"
}
if err := opcm.L2Genesis(host, &opcm.L2GenesisInput{
L1Deployments: opcm.L1Deployments{
L1CrossDomainMessengerProxy: thisChainState.L1CrossDomainMessengerProxyAddress,
......@@ -55,6 +66,7 @@ func GenerateL2Genesis(pEnv *Env, intent *state.Intent, bundle ArtifactsBundle,
L1ERC721BridgeProxy: thisChainState.L1ERC721BridgeProxyAddress,
},
L2Config: initCfg.L2InitializationConfig,
OverrideAllocsMode: overrideAllocsMode,
}); err != nil {
return fmt.Errorf("failed to call L2Genesis script: %w", err)
}
......
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