Skip to content
Open
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
3 changes: 0 additions & 3 deletions op-chain-ops/addresses/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ type SuperchainContracts struct {
// - these contracts are shared by all OpChains that are members of the same superchain
// - these contracts are not upgradable, but can be replaced by new contract releases/deployments
type ImplementationsContracts struct {
OpcmGameTypeAdderImpl common.Address
OpcmDeployerImpl common.Address
OpcmUpgraderImpl common.Address
OpcmInteropMigratorImpl common.Address
OpcmStandardValidatorImpl common.Address
OpcmUtilsImpl common.Address
Expand Down
6 changes: 0 additions & 6 deletions op-chain-ops/interopgen/deployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ type L1Deployment struct {
}

type Implementations struct {
Opcm common.Address `json:"OPCM"`
OpcmContractsContainer common.Address `json:"OPCMContractsContainer"`
OpcmGameTypeAdder common.Address `json:"OPCMGameTypeAdder"`
OpcmDeployer common.Address `json:"OPCMDeployer"`
OpcmUpgrader common.Address `json:"OPCMUpgrader"`
OpcmInteropMigrator common.Address `json:"OPCMInteropMigrator"`
OpcmStandardValidator common.Address `json:"OPCMStandardValidator"`
OpcmUtils common.Address `json:"OPCMUtils"`
OpcmMigrator common.Address `json:"OPCMMigrator"`
Expand Down
40 changes: 3 additions & 37 deletions op-deployer/pkg/deployer/integration_test/apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,7 @@ func TestEndToEndBootstrapApplyWithUpgrade(t *testing.T) {
FaultGameClockExtension: standard.DisputeClockExtension,
FaultGameMaxClockDuration: standard.DisputeMaxClockDuration,
}
if deployer.IsDevFeatureEnabled(tt.devFeature, deployer.OPCMV2DevFlag) {
cfg.DevFeatureBitmap = deployer.OPCMV2DevFlag
}
cfg.DevFeatureBitmap = deployer.OPCMV2DevFlag

runEndToEndBootstrapAndApplyUpgradeTest(t, afactsFS, cfg)
})
Expand Down Expand Up @@ -435,9 +433,6 @@ func TestEndToEndApply(t *testing.T) {
require.Equal(t, deployer.OPCMV2DevFlag, intent.GlobalDeployOverrides["devFeatureBitmap"])

require.NotEqual(t, common.Address{}, st.ImplementationsDeployment.OpcmV2Impl, "OpcmV2Impl should be set")
require.Equal(t, common.Address{}, st.ImplementationsDeployment.OpcmGameTypeAdderImpl, "OPCM game type adder implementation should be zero")
require.Equal(t, common.Address{}, st.ImplementationsDeployment.OpcmDeployerImpl, "OPCM deployer implementation should be zero")
require.Equal(t, common.Address{}, st.ImplementationsDeployment.OpcmUpgraderImpl, "OPCM upgrader implementation should be zero")
})
}

Expand Down Expand Up @@ -863,10 +858,7 @@ func runEndToEndBootstrapAndApplyUpgradeTest(t *testing.T, afactsFS foundry.Stat
)
require.NoError(t, err)

opcmAddress := impls.Opcm
if deployer.IsDevFeatureEnabled(implementationsConfig.DevFeatureBitmap, deployer.OPCMV2DevFlag) {
opcmAddress = impls.OpcmV2
}
opcmAddress := impls.OpcmV2

// Only run the superchain config upgrade if the live superchain config is behind the freshly deployed
// implementation. Running the script when versions match will revert and panic the test harness.
Expand All @@ -891,34 +883,8 @@ func runEndToEndBootstrapAndApplyUpgradeTest(t *testing.T, afactsFS foundry.Stat
shared.RunPastUpgrades(t, host, 11155111, superchainProxyAdminOwner, deployer.DefaultSystemConfigProxySepolia)
})

// Then run the OPCM upgrade
t.Run("upgrade opcm", func(t *testing.T) {
if deployer.IsDevFeatureEnabled(implementationsConfig.DevFeatureBitmap, deployer.OPCMV2DevFlag) {
t.Skip("Skipping OPCM upgrade for OPCM V2")
return
}
upgradeConfig := embedded.UpgradeOPChainInput{
Prank: superchainProxyAdminOwner,
Opcm: impls.Opcm,
ChainConfigs: []embedded.OPChainConfig{
{
SystemConfigProxy: deployer.DefaultSystemConfigProxySepolia,
CannonPrestate: common.Hash{'C', 'A', 'N', 'N', 'O', 'N'},
CannonKonaPrestate: common.Hash{'K', 'O', 'N', 'A'},
},
},
}
// Test the upgrade
upgradeConfigBytes, err := json.Marshal(upgradeConfig)
require.NoError(t, err, "UpgradeOPChainInput should marshal to JSON")
err = embedded.DefaultUpgrader.Upgrade(host, upgradeConfigBytes)
require.NoError(t, err, "OPCM upgrade should succeed")
})
// Run the OPCM V2 upgrade
t.Run("upgrade opcm v2", func(t *testing.T) {
if !deployer.IsDevFeatureEnabled(implementationsConfig.DevFeatureBitmap, deployer.OPCMV2DevFlag) {
t.Skip("Skipping OPCM V2 upgrade for non-OPCM V2 dev feature")
return
}
require.NotEqual(t, common.Address{}, impls.OpcmV2, "OpcmV2 address should not be zero")
t.Logf("Using OpcmV2 at address: %s", impls.OpcmV2.Hex())
t.Logf("Using OpcmUtils at address: %s", impls.OpcmUtils.Hex())
Expand Down
222 changes: 0 additions & 222 deletions op-deployer/pkg/deployer/integration_test/cli/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,223 +88,6 @@ func TestCLIMigrateRequiredFlags(t *testing.T) {
})
}

// TestCLIMigrateV1 tests the migrate-v1 CLI command for OPCM v1.
// Skipped: OPCMv1 contract has been deleted. Remove this test in the Go cleanup PR.
func TestCLIMigrateV1(t *testing.T) {
t.Skip("OPCMv1 contract deleted — v1 migration path no longer functional")
lgr := testlog.Logger(t, slog.LevelDebug)

forkedL1, stopL1, err := devnet.NewForkedSepolia(lgr)
require.NoError(t, err)
t.Cleanup(func() {
require.NoError(t, stopL1())
})
l1RPC := forkedL1.RPCUrl()

testCacheDir := testutils.IsolatedTestDirWithAutoCleanup(t)

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
defer cancel()

pkHex, _, _ := shared.DefaultPrivkey(t)

privateKeyECDSA, err := crypto.HexToECDSA(strings.TrimPrefix(pkHex, "0x"))
require.NoError(t, err)
prank := crypto.PubkeyToAddress(privateKeyECDSA.PublicKey)

// Deploy superchain contracts first (required for OPCM deployment)
superchainProxyAdminOwner := prank
superchainOut, err := bootstrap.Superchain(ctx, bootstrap.SuperchainConfig{
L1RPCUrl: l1RPC,
PrivateKey: pkHex,
ArtifactsLocator: artifacts.EmbeddedLocator,
Logger: lgr,
SuperchainProxyAdminOwner: superchainProxyAdminOwner,
ProtocolVersionsOwner: common.Address{'P'},
Guardian: common.Address{'G'},
Paused: false,
RequiredProtocolVersion: params.ProtocolVersionV0{Major: 1}.Encode(),
RecommendedProtocolVersion: params.ProtocolVersionV0{Major: 2}.Encode(),
CacheDir: testCacheDir,
})
require.NoError(t, err, "Failed to deploy superchain contracts")

// Deploy OPCM V1 implementations (no OPCMV2DevFlag)
cfg := bootstrap.ImplementationsConfig{
L1RPCUrl: l1RPC,
PrivateKey: pkHex,
ArtifactsLocator: artifacts.EmbeddedLocator,
Logger: lgr,
MIPSVersion: int(standard.MIPSVersion),
WithdrawalDelaySeconds: standard.WithdrawalDelaySeconds,
MinProposalSizeBytes: standard.MinProposalSizeBytes,
ChallengePeriodSeconds: standard.ChallengePeriodSeconds,
ProofMaturityDelaySeconds: standard.ProofMaturityDelaySeconds,
DisputeGameFinalityDelaySeconds: standard.DisputeGameFinalityDelaySeconds,
DevFeatureBitmap: deployer.EnableDevFeature(common.Hash{}, deployer.OptimismPortalInteropDevFlag),
SuperchainConfigProxy: superchainOut.SuperchainConfigProxy,
ProtocolVersionsProxy: superchainOut.ProtocolVersionsProxy,
SuperchainProxyAdmin: superchainOut.SuperchainProxyAdmin,
L1ProxyAdminOwner: superchainProxyAdminOwner,
Challenger: common.Address{'C'},
CacheDir: testCacheDir,
FaultGameMaxGameDepth: standard.DisputeMaxGameDepth,
FaultGameSplitDepth: standard.DisputeSplitDepth,
FaultGameClockExtension: standard.DisputeClockExtension,
FaultGameMaxClockDuration: standard.DisputeMaxClockDuration,
}

impls, err := bootstrap.Implementations(ctx, cfg)
require.NoError(t, err, "Failed to deploy implementations")
require.NotEqual(t, common.Address{}, impls.OpcmV2, "OPCM V2 address should be set")
require.Equal(t, common.Address{}, impls.Opcm, "OPCM V1 address should be zero (v1 deleted)")

// Set up a test chain
l1ChainID := uint64(11155111) // Sepolia chain ID
l2ChainID := uint256.NewInt(1)

dk, err := devkeys.NewMnemonicDevKeys(devkeys.TestMnemonic)
require.NoError(t, err)

// Create a runner with network setup
runner := NewCLITestRunnerWithNetwork(t, WithL1RPC(l1RPC), WithPrivateKey(pkHex))
workDir := runner.GetWorkDir()

// Initialize intent and deploy chain
intent, _ := cliInitIntent(t, runner, l1ChainID, []common.Hash{l2ChainID.Bytes32()})

if intent.SuperchainRoles == nil {
intent.SuperchainRoles = &addresses.SuperchainRoles{}
}

l1ChainIDBig := big.NewInt(int64(l1ChainID))
intent.SuperchainRoles.SuperchainProxyAdminOwner = superchainProxyAdminOwner
intent.SuperchainRoles.SuperchainGuardian = shared.AddrFor(t, dk, devkeys.SuperchainConfigGuardianKey.Key(l1ChainIDBig))
intent.SuperchainRoles.ProtocolVersionsOwner = superchainProxyAdminOwner
intent.SuperchainRoles.Challenger = shared.AddrFor(t, dk, devkeys.ChallengerRole.Key(l1ChainIDBig))

for _, chain := range intent.Chains {
chain.Roles.L1ProxyAdminOwner = superchainProxyAdminOwner
chain.Roles.L2ProxyAdminOwner = shared.AddrFor(t, dk, devkeys.L2ProxyAdminOwnerRole.Key(l1ChainIDBig))
chain.Roles.SystemConfigOwner = superchainProxyAdminOwner
chain.Roles.UnsafeBlockSigner = shared.AddrFor(t, dk, devkeys.SequencerP2PRole.Key(l1ChainIDBig))
chain.Roles.Batcher = shared.AddrFor(t, dk, devkeys.BatcherRole.Key(l1ChainIDBig))
chain.Roles.Proposer = shared.AddrFor(t, dk, devkeys.ProposerRole.Key(l1ChainIDBig))
chain.Roles.Challenger = shared.AddrFor(t, dk, devkeys.ChallengerRole.Key(l1ChainIDBig))

chain.BaseFeeVaultRecipient = shared.AddrFor(t, dk, devkeys.BaseFeeVaultRecipientRole.Key(l1ChainIDBig))
chain.L1FeeVaultRecipient = shared.AddrFor(t, dk, devkeys.L1FeeVaultRecipientRole.Key(l1ChainIDBig))
chain.SequencerFeeVaultRecipient = shared.AddrFor(t, dk, devkeys.SequencerFeeVaultRecipientRole.Key(l1ChainIDBig))
chain.OperatorFeeVaultRecipient = shared.AddrFor(t, dk, devkeys.OperatorFeeVaultRecipientRole.Key(l1ChainIDBig))

chain.Eip1559DenominatorCanyon = standard.Eip1559DenominatorCanyon
chain.Eip1559Denominator = standard.Eip1559Denominator
chain.Eip1559Elasticity = standard.Eip1559Elasticity
}

// Populate the state with predeployed superchain and implementations
// so the pipeline knows about them
st, err := pipeline.ReadState(workDir)
require.NoError(t, err)

// Set superchain deployment addresses
if st.SuperchainDeployment == nil {
st.SuperchainDeployment = &addresses.SuperchainContracts{
SuperchainConfigProxy: superchainOut.SuperchainConfigProxy,
SuperchainConfigImpl: superchainOut.SuperchainConfigImpl,
ProtocolVersionsProxy: superchainOut.ProtocolVersionsProxy,
ProtocolVersionsImpl: superchainOut.ProtocolVersionsImpl,
SuperchainProxyAdminImpl: superchainOut.SuperchainProxyAdmin,
}
}

// Set implementations deployment addresses
if st.ImplementationsDeployment == nil {
st.ImplementationsDeployment = &addresses.ImplementationsContracts{
OpcmV2Impl: impls.OpcmV2,
OptimismPortalImpl: impls.OptimismPortalImpl,
DelayedWethImpl: impls.DelayedWETHImpl,
EthLockboxImpl: impls.ETHLockboxImpl,
SystemConfigImpl: impls.SystemConfigImpl,
L1CrossDomainMessengerImpl: impls.L1CrossDomainMessengerImpl,
L1Erc721BridgeImpl: impls.L1ERC721BridgeImpl,
L1StandardBridgeImpl: impls.L1StandardBridgeImpl,
OptimismMintableErc20FactoryImpl: impls.OptimismMintableERC20FactoryImpl,
DisputeGameFactoryImpl: impls.DisputeGameFactoryImpl,
AnchorStateRegistryImpl: impls.AnchorStateRegistryImpl,
PreimageOracleImpl: impls.PreimageOracleSingleton,
MipsImpl: impls.MipsSingleton,
}
}
require.NoError(t, pipeline.WriteState(workDir, st))

require.NoError(t, intent.WriteToFile(filepath.Join(workDir, "intent.toml")))

// Apply deployment
// Note: Validation will run automatically but may find expected errors for migration test deployments
// (e.g., custom dev features, non-standard configurations). We verify deployment succeeded despite validation errors.
applyCtx, applyCancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer applyCancel()
output, runErr := runner.RunWithNetwork(applyCtx, []string{
"apply",
"--deployment-target", "live",
"--workdir", workDir,
"--validate", "auto",
}, nil)

// Verify deployment succeeded regardless of validation errors
st, err = pipeline.ReadState(workDir)
require.NoError(t, err, "State should be readable after apply")
require.NotNil(t, st.AppliedIntent, "Applied intent should exist")
require.Len(t, st.Chains, 1, "Should have one chain deployed")

// If there was an error, it should be validation-related, not a deployment failure
if runErr != nil {
require.Contains(t, output, "validation", "Error should be validation-related, not deployment failure")
require.Contains(t, runErr.Error(), "validation", "Error should mention validation")
}

systemConfigProxy := st.Chains[0].SystemConfigProxy

// Run migrate command
migrateOutput := runner.ExpectSuccessWithNetwork(t, []string{
"manage",
"migrate",
"--l1-rpc-url", l1RPC,
"--private-key", pkHex,
"--l1-proxy-admin-owner-address", superchainProxyAdminOwner.Hex(),
"--opcm-impl-address", impls.Opcm.Hex(),
"--system-config-proxy-address", systemConfigProxy.Hex(),
"--permissionless",
"--proposer-address", common.Address{'P'}.Hex(),
"--challenger-address", common.Address{'C'}.Hex(),
"--starting-anchor-root", "0x0000000000000000000000000000000000000000000000000000000000000abc",
"--starting-anchor-l2-sequence-number", "1",
"--dispute-max-game-depth", "73",
"--dispute-split-depth", "30",
"--initial-bond", "1000000000000000000",
"--dispute-clock-extension", "10800",
"--dispute-max-clock-duration", "302400",
"--dispute-absolute-prestate-cannon", "0x0000000000000000000000000000000000000000000000000000000000000def",
"--dispute-absolute-prestate-cannon-kona", "0x0000000000000000000000000000000000000000000000000000000000000fed",
}, nil)

// Parse output to verify DisputeGameFactory was deployed
// Find the JSON output by looking for the opening brace
var migrationOutput manage.InteropMigrationOutput
jsonStart := strings.Index(migrateOutput, "{")
if jsonStart == -1 {
t.Logf("Full output length: %d", len(migrateOutput))
t.Logf("Full output: %q", migrateOutput)
t.Fatalf("No JSON output found in output")
}
// Find the end of the JSON object
jsonEnd := strings.Index(migrateOutput[jsonStart:], "}") + jsonStart + 1
jsonOutput := migrateOutput[jsonStart:jsonEnd]
err = json.Unmarshal([]byte(jsonOutput), &migrationOutput)
require.NoError(t, err, "Failed to parse migration output: %s", jsonOutput)
require.NotEqual(t, common.Address{}, migrationOutput.DisputeGameFactory, "DisputeGameFactory should be deployed")
}

// TestCLIMigrateV2 tests the migrate-v2 CLI command for OPCM v2
func TestCLIMigrateV2(t *testing.T) {
Expand Down Expand Up @@ -377,7 +160,6 @@ func TestCLIMigrateV2(t *testing.T) {
impls, err := bootstrap.Implementations(ctx, cfg)
require.NoError(t, err, "Failed to deploy implementations")
require.NotEqual(t, common.Address{}, impls.OpcmV2, "OPCM V2 address should be set")
require.Equal(t, common.Address{}, impls.Opcm, "OPCM V1 address should be zero when V2 is deployed")

// Set up a test chain
l1ChainID := uint64(11155111) // Sepolia chain ID
Expand Down Expand Up @@ -459,10 +241,6 @@ func TestCLIMigrateV2(t *testing.T) {
MipsImpl: impls.MipsSingleton,
FaultDisputeGameImpl: impls.FaultDisputeGameImpl,
PermissionedDisputeGameImpl: impls.PermissionedDisputeGameImpl,
OpcmDeployerImpl: impls.OpcmDeployer,
OpcmGameTypeAdderImpl: impls.OpcmGameTypeAdder,
OpcmUpgraderImpl: impls.OpcmUpgrader,
OpcmInteropMigratorImpl: impls.OpcmInteropMigrator,
OpcmStandardValidatorImpl: impls.OpcmStandardValidator,
}
}
Expand Down
14 changes: 0 additions & 14 deletions op-deployer/pkg/deployer/integration_test/shared/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,20 +230,6 @@ func runSingleOPCMUpgradeResolved(t *testing.T, host *script.Host, prank, system
func buildOPCMUpgradeConfig(t *testing.T, prank, opcmAddr, systemConfigProxy common.Address, version opcmregistry.Semver) *embedded.UpgradeOPChainInput {
t.Helper()

if version.IsV1OPCM() {
// V1 OPCM (6.x.x) - uses ChainConfigs with prestates
return &embedded.UpgradeOPChainInput{
Prank: prank,
Opcm: opcmAddr,
ChainConfigs: []embedded.OPChainConfig{{
SystemConfigProxy: systemConfigProxy,
CannonPrestate: opcmregistry.DummyCannonPrestate,
CannonKonaPrestate: opcmregistry.DummyCannonKonaPrestate,
}},
}
}

// V2 OPCM (7.x.x+) - uses UpgradeInputV2 with dispute game configs
cfg := buildV2OPCMUpgradeConfig(t, prank, opcmAddr, systemConfigProxy)
return &cfg
}
Expand Down
Loading
Loading