Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

op-deployer: Backport deployer changes #13798

Merged
merged 3 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions op-deployer/pkg/deployer/opcm/l2genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ type L1Deployments struct {
}

type L2GenesisInput struct {
L1Deployments L1Deployments
L2Config genesis.L2InitializationConfig
L1Deployments L1Deployments
L2Config genesis.L2InitializationConfig
OverrideAllocsMode string
}

type L2GenesisScript struct {
Expand All @@ -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,
Expand Down
13 changes: 12 additions & 1 deletion op-deployer/pkg/deployer/pipeline/l2genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package pipeline

import (
"fmt"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/standard"

"github.com/ethereum-optimism/optimism/op-deployer/pkg/env"

Expand Down Expand Up @@ -48,13 +49,23 @@ 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,
L1StandardBridgeProxy: thisChainState.L1StandardBridgeProxyAddress,
L1ERC721BridgeProxy: thisChainState.L1ERC721BridgeProxyAddress,
},
L2Config: initCfg.L2InitializationConfig,
L2Config: initCfg.L2InitializationConfig,
OverrideAllocsMode: overrideAllocsMode,
}); err != nil {
return fmt.Errorf("failed to call L2Genesis script: %w", err)
}
Expand Down
3 changes: 2 additions & 1 deletion op-deployer/pkg/deployer/standard/standard.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const (
Eip1559Elasticity uint64 = 6

ContractsV160Tag = "op-contracts/v1.6.0"
ContractsV180Tag = "op-contracts/v1.8.0-rc.4"
ContractsV170Beta1L2Tag = "op-contracts/v1.7.0-beta.1+l2-contracts"
)

Expand All @@ -46,7 +47,7 @@ var L1VersionsSepolia L1Versions

var L1VersionsMainnet L1Versions

var DefaultL1ContractsTag = ContractsV160Tag
var DefaultL1ContractsTag = ContractsV180Tag

var DefaultL2ContractsTag = ContractsV170Beta1L2Tag

Expand Down
1 change: 1 addition & 0 deletions op-deployer/pkg/deployer/state/deploy_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func CombineDeployConfig(intent *Intent, chainIntent *ChainIntent, state *State,
L2GenesisEcotoneTimeOffset: op_service.U64UtilPtr(0),
L2GenesisFjordTimeOffset: op_service.U64UtilPtr(0),
L2GenesisGraniteTimeOffset: op_service.U64UtilPtr(0),
L2GenesisHoloceneTimeOffset: op_service.U64UtilPtr(0),
UseInterop: intent.UseInterop,
},
L2CoreDeployConfig: genesis.L2CoreDeployConfig{
Expand Down