Skip to content

Commit

Permalink
op-deployer: Backport deployer changes (#13798)
Browse files Browse the repository at this point in the history
* op-deployer: Holocene defaults (#13783)

* op-deployer: Default to holocene

* Add contracts v180 tag

* op-deployer: Fix holocene L2 genesis deployment

* Add comment
  • Loading branch information
mslipper committed Jan 15, 2025
1 parent 0d705b1 commit 6ce9caf
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
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
14 changes: 13 additions & 1 deletion op-deployer/pkg/deployer/pipeline/l2genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -48,13 +50,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

0 comments on commit 6ce9caf

Please sign in to comment.