diff --git a/op-acceptance-tests/tests/base/disputegame_v2/init_test.go b/op-acceptance-tests/tests/base/disputegame_v2/init_test.go deleted file mode 100644 index 2b3ef1852e9cc..0000000000000 --- a/op-acceptance-tests/tests/base/disputegame_v2/init_test.go +++ /dev/null @@ -1,11 +0,0 @@ -package disputegame_v2 - -import ( - "testing" - - "github.com/ethereum-optimism/optimism/op-devstack/presets" -) - -func TestMain(m *testing.M) { - presets.DoMain(m, presets.WithProofs(), presets.WithDisputeGameV2()) -} diff --git a/op-acceptance-tests/tests/proofs/cannon/init_test.go b/op-acceptance-tests/tests/proofs/cannon/init_test.go index de6c2bab33364..bdba42260d304 100644 --- a/op-acceptance-tests/tests/proofs/cannon/init_test.go +++ b/op-acceptance-tests/tests/proofs/cannon/init_test.go @@ -14,7 +14,6 @@ func TestMain(m *testing.M) { presets.WithProofs(), stack.MakeCommon(sysgo.WithDeployerOptions(sysgo.WithJovianAtGenesis)), presets.WithSafeDBEnabled(), - presets.WithCannonKona(), // Requires access to a challenger config which only sysgo provides // These tests would also be exceptionally slow on real L1s presets.WithCompatibleTypes(compat.SysGo), diff --git a/op-acceptance-tests/tests/base/disputegame_v2/smoke_test.go b/op-acceptance-tests/tests/proofs/cannon/smoke_test.go similarity index 98% rename from op-acceptance-tests/tests/base/disputegame_v2/smoke_test.go rename to op-acceptance-tests/tests/proofs/cannon/smoke_test.go index 8509a22a85f73..70ce6feaa7b12 100644 --- a/op-acceptance-tests/tests/base/disputegame_v2/smoke_test.go +++ b/op-acceptance-tests/tests/proofs/cannon/smoke_test.go @@ -1,4 +1,4 @@ -package disputegame_v2 +package cannon import ( "testing" diff --git a/op-deployer/pkg/deployer/bootstrap/implementations.go b/op-deployer/pkg/deployer/bootstrap/implementations.go index f876cef273d98..1432b4b282265 100644 --- a/op-deployer/pkg/deployer/bootstrap/implementations.go +++ b/op-deployer/pkg/deployer/bootstrap/implementations.go @@ -95,21 +95,17 @@ func (c *ImplementationsConfig) Check() error { if c.DisputeGameFinalityDelaySeconds == 0 { return errors.New("dispute game finality delay in seconds must be specified") } - // Check V2 fault game parameters only if V2 dispute games feature is enabled - deployV2Games := deployer.IsDevFeatureEnabled(c.DevFeatureBitmap, deployer.DeployV2DisputeGamesDevFlag) - if deployV2Games { - if c.FaultGameMaxGameDepth == 0 { - return errors.New("fault game max game depth must be specified when V2 dispute games feature is enabled") - } - if c.FaultGameSplitDepth == 0 { - return errors.New("fault game split depth must be specified when V2 dispute games feature is enabled") - } - if c.FaultGameClockExtension == 0 { - return errors.New("fault game clock extension must be specified when V2 dispute games feature is enabled") - } - if c.FaultGameMaxClockDuration == 0 { - return errors.New("fault game max clock duration must be specified when V2 dispute games feature is enabled") - } + if c.FaultGameMaxGameDepth == 0 { + return errors.New("fault game max game depth must be specified") + } + if c.FaultGameSplitDepth == 0 { + return errors.New("fault game split depth must be specified") + } + if c.FaultGameClockExtension == 0 { + return errors.New("fault game clock extension must be specified") + } + if c.FaultGameMaxClockDuration == 0 { + return errors.New("fault game max clock duration must be specified") } if c.SuperchainConfigProxy == (common.Address{}) { return errors.New("superchain config proxy must be specified") diff --git a/op-deployer/pkg/deployer/bootstrap/implementations_test.go b/op-deployer/pkg/deployer/bootstrap/implementations_test.go index c332553207d22..32359609f07c2 100644 --- a/op-deployer/pkg/deployer/bootstrap/implementations_test.go +++ b/op-deployer/pkg/deployer/bootstrap/implementations_test.go @@ -84,6 +84,10 @@ func testImplementations(t *testing.T, forkRPCURL string) { L1ProxyAdminOwner: proxyAdminOwner, Challenger: common.Address{'C'}, CacheDir: testCacheDir, + FaultGameMaxGameDepth: standard.DisputeMaxGameDepth, + FaultGameSplitDepth: standard.DisputeSplitDepth, + FaultGameClockExtension: standard.DisputeClockExtension, + FaultGameMaxClockDuration: standard.DisputeMaxClockDuration, }) require.NoError(t, err) return out diff --git a/op-deployer/pkg/deployer/integration_test/apply_test.go b/op-deployer/pkg/deployer/integration_test/apply_test.go index b028b09f82e53..b2ab4c514505c 100644 --- a/op-deployer/pkg/deployer/integration_test/apply_test.go +++ b/op-deployer/pkg/deployer/integration_test/apply_test.go @@ -121,6 +121,10 @@ func TestEndToEndBootstrapApply(t *testing.T) { CacheDir: testCacheDir, Logger: lgr, Challenger: common.Address{'C'}, + FaultGameMaxGameDepth: standard.DisputeMaxGameDepth, + FaultGameSplitDepth: standard.DisputeSplitDepth, + FaultGameClockExtension: standard.DisputeClockExtension, + FaultGameMaxClockDuration: standard.DisputeMaxClockDuration, }) require.NoError(t, err) @@ -165,65 +169,50 @@ func TestEndToEndBootstrapApply(t *testing.T) { func TestEndToEndBootstrapApplyWithUpgrade(t *testing.T) { op_e2e.InitParallel(t) - tests := []struct { - name string - devFeature common.Hash - }{ - {"default", common.Hash{}}, - {"deploy-v2-disputegames", deployer.DeployV2DisputeGamesDevFlag}, - {"cannon-kona", deployer.EnableDevFeature(deployer.DeployV2DisputeGamesDevFlag, deployer.CannonKonaDevFlag)}, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - op_e2e.InitParallel(t) - lgr := testlog.Logger(t, slog.LevelDebug) + lgr := testlog.Logger(t, slog.LevelDebug) - forkedL1, stopL1, err := devnet.NewForkedSepolia(lgr) - require.NoError(t, err) - pkHex, _, _ := shared.DefaultPrivkey(t) - t.Cleanup(func() { - require.NoError(t, stopL1()) - }) - loc, afactsFS := testutil.LocalArtifacts(t) - testCacheDir := testutils.IsolatedTestDirWithAutoCleanup(t) + forkedL1, stopL1, err := devnet.NewForkedSepolia(lgr) + require.NoError(t, err) + pkHex, _, _ := shared.DefaultPrivkey(t) + t.Cleanup(func() { + require.NoError(t, stopL1()) + }) + loc, afactsFS := testutil.LocalArtifacts(t) + testCacheDir := testutils.IsolatedTestDirWithAutoCleanup(t) - superchain, err := standard.SuperchainFor(11155111) - require.NoError(t, err) + superchain, err := standard.SuperchainFor(11155111) + require.NoError(t, err) - superchainProxyAdmin, err := standard.SuperchainProxyAdminAddrFor(11155111) - require.NoError(t, err) + superchainProxyAdmin, err := standard.SuperchainProxyAdminAddrFor(11155111) + require.NoError(t, err) - superchainProxyAdminOwner, err := standard.L1ProxyAdminOwner(11155111) - require.NoError(t, err) + superchainProxyAdminOwner, err := standard.L1ProxyAdminOwner(11155111) + require.NoError(t, err) - cfg := bootstrap.ImplementationsConfig{ - L1RPCUrl: forkedL1.RPCUrl(), - PrivateKey: pkHex, - ArtifactsLocator: loc, - MIPSVersion: int(standard.MIPSVersion), - WithdrawalDelaySeconds: standard.WithdrawalDelaySeconds, - MinProposalSizeBytes: standard.MinProposalSizeBytes, - ChallengePeriodSeconds: standard.ChallengePeriodSeconds, - ProofMaturityDelaySeconds: standard.ProofMaturityDelaySeconds, - DisputeGameFinalityDelaySeconds: standard.DisputeGameFinalityDelaySeconds, - DevFeatureBitmap: tt.devFeature, - SuperchainConfigProxy: superchain.SuperchainConfigAddr, - ProtocolVersionsProxy: superchain.ProtocolVersionsAddr, - L1ProxyAdminOwner: superchainProxyAdminOwner, - SuperchainProxyAdmin: superchainProxyAdmin, - CacheDir: testCacheDir, - Logger: lgr, - Challenger: common.Address{'C'}, - } - if deployer.IsDevFeatureEnabled(tt.devFeature, deployer.DeployV2DisputeGamesDevFlag) { - cfg.FaultGameMaxGameDepth = standard.DisputeMaxGameDepth - cfg.FaultGameSplitDepth = standard.DisputeSplitDepth - cfg.FaultGameClockExtension = standard.DisputeClockExtension - cfg.FaultGameMaxClockDuration = standard.DisputeMaxClockDuration - } - runEndToEndBootstrapAndApplyUpgradeTest(t, afactsFS, cfg) - }) + cfg := bootstrap.ImplementationsConfig{ + L1RPCUrl: forkedL1.RPCUrl(), + PrivateKey: pkHex, + ArtifactsLocator: loc, + MIPSVersion: int(standard.MIPSVersion), + WithdrawalDelaySeconds: standard.WithdrawalDelaySeconds, + MinProposalSizeBytes: standard.MinProposalSizeBytes, + ChallengePeriodSeconds: standard.ChallengePeriodSeconds, + ProofMaturityDelaySeconds: standard.ProofMaturityDelaySeconds, + DisputeGameFinalityDelaySeconds: standard.DisputeGameFinalityDelaySeconds, + DevFeatureBitmap: common.Hash{}, + SuperchainConfigProxy: superchain.SuperchainConfigAddr, + ProtocolVersionsProxy: superchain.ProtocolVersionsAddr, + L1ProxyAdminOwner: superchainProxyAdminOwner, + SuperchainProxyAdmin: superchainProxyAdmin, + CacheDir: testCacheDir, + Logger: lgr, + Challenger: common.Address{'C'}, + FaultGameMaxGameDepth: standard.DisputeMaxGameDepth, + FaultGameSplitDepth: standard.DisputeSplitDepth, + FaultGameClockExtension: standard.DisputeClockExtension, + FaultGameMaxClockDuration: standard.DisputeMaxClockDuration, } + runEndToEndBootstrapAndApplyUpgradeTest(t, afactsFS, cfg) } func TestEndToEndApply(t *testing.T) { @@ -454,114 +443,91 @@ func TestApplyGenesisStrategy(t *testing.T) { func TestProofParamOverrides(t *testing.T) { op_e2e.InitParallel(t) - for _, useV2 := range []bool{true, false} { - t.Run(fmt.Sprintf("useV2=%v", useV2), func(t *testing.T) { - op_e2e.InitParallel(t) - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() - opts, intent, st := setupGenesisChain(t, devnet.DefaultChainID) - devFeatureBitmap := common.Hash{} - if useV2 { - devFeatureBitmap = deployer.DeployV2DisputeGamesDevFlag - } - intent.GlobalDeployOverrides = map[string]any{ - "faultGameWithdrawalDelay": standard.WithdrawalDelaySeconds + 1, - "preimageOracleMinProposalSize": standard.MinProposalSizeBytes + 1, - "preimageOracleChallengePeriod": standard.ChallengePeriodSeconds + 1, - "proofMaturityDelaySeconds": standard.ProofMaturityDelaySeconds + 1, - "disputeGameFinalityDelaySeconds": standard.DisputeGameFinalityDelaySeconds + 1, - "mipsVersion": standard.MIPSVersion, // Contract enforces a valid value be used - "respectedGameType": standard.DisputeGameType, // This must be set to the permissioned game - "faultGameAbsolutePrestate": common.Hash{'A', 'B', 'S', 'O', 'L', 'U', 'T', 'E'}, - "faultGameMaxDepth": standard.DisputeMaxGameDepth + 1, - "faultGameSplitDepth": standard.DisputeSplitDepth + 1, - "faultGameClockExtension": standard.DisputeClockExtension + 1, - "faultGameMaxClockDuration": standard.DisputeMaxClockDuration + 1, - "dangerouslyAllowCustomDisputeParameters": true, - "devFeatureBitmap": devFeatureBitmap, - } + opts, intent, st := setupGenesisChain(t, devnet.DefaultChainID) + intent.GlobalDeployOverrides = map[string]any{ + "faultGameWithdrawalDelay": standard.WithdrawalDelaySeconds + 1, + "preimageOracleMinProposalSize": standard.MinProposalSizeBytes + 1, + "preimageOracleChallengePeriod": standard.ChallengePeriodSeconds + 1, + "proofMaturityDelaySeconds": standard.ProofMaturityDelaySeconds + 1, + "disputeGameFinalityDelaySeconds": standard.DisputeGameFinalityDelaySeconds + 1, + "mipsVersion": standard.MIPSVersion, // Contract enforces a valid value be used + "respectedGameType": standard.DisputeGameType, // This must be set to the permissioned game + "faultGameAbsolutePrestate": common.Hash{'A', 'B', 'S', 'O', 'L', 'U', 'T', 'E'}, + "faultGameMaxDepth": standard.DisputeMaxGameDepth + 1, + "faultGameSplitDepth": standard.DisputeSplitDepth + 1, + "faultGameClockExtension": standard.DisputeClockExtension + 1, + "faultGameMaxClockDuration": standard.DisputeMaxClockDuration + 1, + "dangerouslyAllowCustomDisputeParameters": true, + "devFeatureBitmap": common.Hash{}, + } - require.NoError(t, deployer.ApplyPipeline(ctx, opts)) + require.NoError(t, deployer.ApplyPipeline(ctx, opts)) - allocs := st.L1StateDump.Data.Accounts - chainState := st.Chains[0] + allocs := st.L1StateDump.Data.Accounts - uint64Caster := func(t *testing.T, val any) common.Hash { - return common.BigToHash(new(big.Int).SetUint64(val.(uint64))) - } + uint64Caster := func(t *testing.T, val any) common.Hash { + return common.BigToHash(new(big.Int).SetUint64(val.(uint64))) + } - pdgImpl := chainState.PermissionedDisputeGameImpl - if useV2 { - pdgImpl = st.ImplementationsDeployment.PermissionedDisputeGameV2Impl - } - tests := []struct { - name string - caster func(t *testing.T, val any) common.Hash - address common.Address - }{ - { - "faultGameWithdrawalDelay", - uint64Caster, - st.ImplementationsDeployment.DelayedWethImpl, - }, - { - "preimageOracleMinProposalSize", - uint64Caster, - st.ImplementationsDeployment.PreimageOracleImpl, - }, - { - "preimageOracleChallengePeriod", - uint64Caster, - st.ImplementationsDeployment.PreimageOracleImpl, - }, - { - "proofMaturityDelaySeconds", - uint64Caster, - st.ImplementationsDeployment.OptimismPortalImpl, - }, - { - "disputeGameFinalityDelaySeconds", - uint64Caster, - st.ImplementationsDeployment.AnchorStateRegistryImpl, - }, - { - "faultGameMaxDepth", - uint64Caster, - pdgImpl, - }, - { - "faultGameSplitDepth", - uint64Caster, - pdgImpl, - }, - { - "faultGameClockExtension", - uint64Caster, - pdgImpl, - }, - { - "faultGameMaxClockDuration", - uint64Caster, - pdgImpl, - }, - { - "faultGameAbsolutePrestate", - func(t *testing.T, val any) common.Hash { - return val.(common.Hash) - }, - pdgImpl, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if useV2 && tt.name == "faultGameAbsolutePrestate" { - t.Skip("absolute prestate is not an immutable in V2 contracts") - } - checkImmutable(t, allocs, tt.address, tt.caster(t, intent.GlobalDeployOverrides[tt.name])) - }) - } + pdgImpl := st.ImplementationsDeployment.PermissionedDisputeGameV2Impl + tests := []struct { + name string + caster func(t *testing.T, val any) common.Hash + address common.Address + }{ + { + "faultGameWithdrawalDelay", + uint64Caster, + st.ImplementationsDeployment.DelayedWethImpl, + }, + { + "preimageOracleMinProposalSize", + uint64Caster, + st.ImplementationsDeployment.PreimageOracleImpl, + }, + { + "preimageOracleChallengePeriod", + uint64Caster, + st.ImplementationsDeployment.PreimageOracleImpl, + }, + { + "proofMaturityDelaySeconds", + uint64Caster, + st.ImplementationsDeployment.OptimismPortalImpl, + }, + { + "disputeGameFinalityDelaySeconds", + uint64Caster, + st.ImplementationsDeployment.AnchorStateRegistryImpl, + }, + { + "faultGameMaxDepth", + uint64Caster, + pdgImpl, + }, + { + "faultGameSplitDepth", + uint64Caster, + pdgImpl, + }, + { + "faultGameClockExtension", + uint64Caster, + pdgImpl, + }, + { + "faultGameMaxClockDuration", + uint64Caster, + pdgImpl, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + checkImmutable(t, allocs, tt.address, tt.caster(t, intent.GlobalDeployOverrides[tt.name])) }) } } @@ -822,10 +788,6 @@ func runEndToEndBootstrapAndApplyUpgradeTest(t *testing.T, afactsFS foundry.Stat } // Then run the OPCM upgrade - var cannonKonaPrestate common.Hash - if deployer.IsDevFeatureEnabled(implementationsConfig.DevFeatureBitmap, deployer.CannonKonaDevFlag) { - cannonKonaPrestate = common.Hash{'K', 'O', 'N', 'A'} - } t.Run("upgrade opcm", func(t *testing.T) { upgradeConfig := embedded.UpgradeOPChainInput{ Prank: superchainProxyAdminOwner, @@ -834,7 +796,7 @@ func runEndToEndBootstrapAndApplyUpgradeTest(t *testing.T, afactsFS foundry.Stat { SystemConfigProxy: common.HexToAddress("034edD2A225f7f429A63E0f1D2084B9E0A93b538"), CannonPrestate: common.Hash{'C', 'A', 'N', 'N', 'O', 'N'}, - CannonKonaPrestate: cannonKonaPrestate, + CannonKonaPrestate: common.Hash{'K', 'O', 'N', 'A'}, }, }, } diff --git a/op-deployer/pkg/deployer/manage/add_game_type_test.go b/op-deployer/pkg/deployer/manage/add_game_type_test.go index 0f7aa80435abf..7349f0d669f04 100644 --- a/op-deployer/pkg/deployer/manage/add_game_type_test.go +++ b/op-deployer/pkg/deployer/manage/add_game_type_test.go @@ -66,6 +66,10 @@ func TestAddGameType(t *testing.T) { CacheDir: testCacheDir, Logger: lgr, Challenger: common.Address{'C'}, + FaultGameMaxGameDepth: standard.DisputeMaxGameDepth, + FaultGameSplitDepth: standard.DisputeSplitDepth, + FaultGameClockExtension: standard.DisputeClockExtension, + FaultGameMaxClockDuration: standard.DisputeMaxClockDuration, }) require.NoError(t, err) diff --git a/op-deployer/pkg/deployer/opcm/dispute_game.go b/op-deployer/pkg/deployer/opcm/dispute_game.go index 4346fea42a1a7..8ec4fd67137d0 100644 --- a/op-deployer/pkg/deployer/opcm/dispute_game.go +++ b/op-deployer/pkg/deployer/opcm/dispute_game.go @@ -10,7 +10,6 @@ import ( type DeployDisputeGameInput struct { Release string - UseV2 bool GameKind string GameType uint32 AbsolutePrestate common.Hash diff --git a/op-deployer/pkg/deployer/opcm/dispute_game_factory.go b/op-deployer/pkg/deployer/opcm/dispute_game_factory.go index a7138ca95e6f4..6fe4839abaabb 100644 --- a/op-deployer/pkg/deployer/opcm/dispute_game_factory.go +++ b/op-deployer/pkg/deployer/opcm/dispute_game_factory.go @@ -11,7 +11,6 @@ type SetDisputeGameImplInput struct { AnchorStateRegistry common.Address GameType uint32 GameArgs []byte - UseV2 bool } func SetDisputeGameImpl( diff --git a/op-deployer/pkg/deployer/opcm/dispute_game_factory_test.go b/op-deployer/pkg/deployer/opcm/dispute_game_factory_test.go index 8765d971b4582..c4b5047e49c23 100644 --- a/op-deployer/pkg/deployer/opcm/dispute_game_factory_test.go +++ b/op-deployer/pkg/deployer/opcm/dispute_game_factory_test.go @@ -60,7 +60,6 @@ func TestSetDisputeGameImpl(t *testing.T) { input := SetDisputeGameImplInput{ Factory: factoryAddr, - UseV2: len(gameArgs) > 0, Impl: common.Address{'I'}, GameType: 999, AnchorStateRegistry: common.Address{}, // Do not set as respected game type as we aren't authorized diff --git a/op-deployer/pkg/deployer/opcm/dispute_game_test.go b/op-deployer/pkg/deployer/opcm/dispute_game_test.go index 235ccbf42e07d..0c51c89c0e66a 100644 --- a/op-deployer/pkg/deployer/opcm/dispute_game_test.go +++ b/op-deployer/pkg/deployer/opcm/dispute_game_test.go @@ -1,7 +1,6 @@ package opcm import ( - "fmt" "math/big" "testing" @@ -32,36 +31,31 @@ func TestDeployDisputeGame(t *testing.T) { vmAddr := deployDisputeGameScriptVM(t, host) - for _, useV2 := range []bool{false, true} { - t.Run(fmt.Sprintf("useV2=%v", useV2), func(t *testing.T) { - input := DeployDisputeGameInput{ - Release: "dev", - UseV2: useV2, - VmAddress: vmAddr, - GameKind: "PermissionedDisputeGame", - GameType: 1, - AbsolutePrestate: common.Hash{'A'}, - MaxGameDepth: big.NewInt(int64(standard.DisputeMaxGameDepth)), - SplitDepth: big.NewInt(int64(standard.DisputeSplitDepth)), - ClockExtension: standard.DisputeClockExtension, - MaxClockDuration: standard.DisputeMaxClockDuration, - DelayedWethProxy: common.Address{'D'}, - AnchorStateRegistryProxy: common.Address{'A'}, - L2ChainId: big.NewInt(69), - Proposer: common.Address{'P'}, - Challenger: common.Address{'C'}, - } - - script, err := NewDeployDisputeGameScript(host) - require.NoError(t, err) - - output, err := script.Run(input) - require.NoError(t, err) - - require.NotEmpty(t, output.DisputeGameImpl) - require.NotEmpty(t, host.GetCode(output.DisputeGameImpl)) - }) + input := DeployDisputeGameInput{ + Release: "dev", + VmAddress: vmAddr, + GameKind: "PermissionedDisputeGame", + GameType: 1, + AbsolutePrestate: common.Hash{'A'}, + MaxGameDepth: big.NewInt(int64(standard.DisputeMaxGameDepth)), + SplitDepth: big.NewInt(int64(standard.DisputeSplitDepth)), + ClockExtension: standard.DisputeClockExtension, + MaxClockDuration: standard.DisputeMaxClockDuration, + DelayedWethProxy: common.Address{'D'}, + AnchorStateRegistryProxy: common.Address{'A'}, + L2ChainId: big.NewInt(69), + Proposer: common.Address{'P'}, + Challenger: common.Address{'C'}, } + + script, err := NewDeployDisputeGameScript(host) + require.NoError(t, err) + + output, err := script.Run(input) + require.NoError(t, err) + + require.NotEmpty(t, output.DisputeGameImpl) + require.NotEmpty(t, host.GetCode(output.DisputeGameImpl)) } func deployDisputeGameScriptVM(t *testing.T, host *script.Host) common.Address { diff --git a/op-deployer/pkg/deployer/pipeline/dispute_games.go b/op-deployer/pkg/deployer/pipeline/dispute_games.go index 2a0c2ecd4aaa3..c2d607eebc58a 100644 --- a/op-deployer/pkg/deployer/pipeline/dispute_games.go +++ b/op-deployer/pkg/deployer/pipeline/dispute_games.go @@ -5,7 +5,7 @@ import ( "math/big" "github.com/ethereum-optimism/optimism/op-challenger/game/fault/contracts/gameargs" - "github.com/ethereum-optimism/optimism/op-challenger/game/fault/types" + gameTypes "github.com/ethereum-optimism/optimism/op-challenger/game/fault/types" "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/opcm" "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/state" "github.com/ethereum-optimism/optimism/op-service/eth" @@ -88,24 +88,20 @@ func deployDisputeGame( } lgr.Info("vm deployed", "vmAddr", vmAddr) - useV2 := st.ImplementationsDeployment.PermissionedDisputeGameV2Impl != (common.Address{}) - var gameArgs []byte - if useV2 { // Only set game args if V2 contracts are used. - args := gameargs.GameArgs{ - AbsolutePrestate: game.DisputeAbsolutePrestate, - Vm: vmAddr, - AnchorStateRegistry: thisState.OpChainContracts.AnchorStateRegistryProxy, - Weth: thisState.OpChainContracts.DelayedWethPermissionedGameProxy, - L2ChainID: eth.ChainIDFromBytes32(thisIntent.ID), - Proposer: thisIntent.Roles.Proposer, - Challenger: thisIntent.Roles.Challenger, - } - if game.DisputeGameType == uint32(types.PermissionedGameType) { - gameArgs = args.PackPermissioned() - } else { - gameArgs = args.PackPermissionless() - } + args := gameargs.GameArgs{ + AbsolutePrestate: game.DisputeAbsolutePrestate, + Vm: vmAddr, + AnchorStateRegistry: thisState.OpChainContracts.AnchorStateRegistryProxy, + Weth: thisState.OpChainContracts.DelayedWethPermissionedGameProxy, + L2ChainID: eth.ChainIDFromBytes32(thisIntent.ID), + Proposer: thisIntent.Roles.Proposer, + Challenger: thisIntent.Roles.Challenger, + } + if game.DisputeGameType == uint32(gameTypes.PermissionedGameType) { + gameArgs = args.PackPermissioned() + } else { + gameArgs = args.PackPermissionless() } lgr.Info("deploying dispute game") @@ -113,7 +109,6 @@ func deployDisputeGame( out, err := env.Scripts.DeployDisputeGame.Run( opcm.DeployDisputeGameInput{ Release: "dev", - UseV2: useV2, VmAddress: vmAddr, GameKind: "FaultDisputeGame", GameType: game.DisputeGameType, @@ -136,7 +131,6 @@ func deployDisputeGame( lgr.Info("setting dispute game impl on factory", "respected", game.MakeRespected) sdgiInput := opcm.SetDisputeGameImplInput{ - UseV2: useV2, Factory: thisState.OpChainContracts.DisputeGameFactoryProxy, Impl: out.DisputeGameImpl, GameType: game.DisputeGameType, diff --git a/op-devstack/presets/disputegame_v2.go b/op-devstack/presets/disputegame_v2.go deleted file mode 100644 index 51bd175519ded..0000000000000 --- a/op-devstack/presets/disputegame_v2.go +++ /dev/null @@ -1,23 +0,0 @@ -package presets - -import ( - "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer" - "github.com/ethereum-optimism/optimism/op-devstack/stack" - "github.com/ethereum-optimism/optimism/op-devstack/sysgo" -) - -func WithDisputeGameV2() stack.CommonOption { - return stack.MakeCommon(sysgo.WithDeployerOptions(sysgo.WithDevFeatureEnabled(deployer.DeployV2DisputeGamesDevFlag))) -} - -func WithCannonKona() stack.CommonOption { - return stack.Combine( - // Enable dev features required - stack.MakeCommon(sysgo.WithDeployerOptions( - sysgo.WithDevFeatureEnabled(deployer.DeployV2DisputeGamesDevFlag), // Required for cannon kona - sysgo.WithDevFeatureEnabled(deployer.CannonKonaDevFlag), - )), - // Add cannon-kona game type - stack.MakeCommon(sysgo.WithCannonKonaGameTypeAdded()), - ) -} diff --git a/op-devstack/sysgo/system.go b/op-devstack/sysgo/system.go index 1fa516fe3813a..c1a3baf03e012 100644 --- a/op-devstack/sysgo/system.go +++ b/op-devstack/sysgo/system.go @@ -572,5 +572,6 @@ func ProofSystem(dest *DefaultMinimalSystemIDs) stack.Option[*Orchestrator] { ids := NewDefaultMinimalSystemIDs(DefaultL1ID, DefaultL2AID) opt := defaultMinimalSystemOpts(&ids, dest) opt.Add(WithCannonGameTypeAdded(ids.L1EL, ids.L2.ChainID())) + opt.Add(WithCannonKonaGameTypeAdded()) return opt } diff --git a/packages/contracts-bedrock/interfaces/L1/IOPContractsManager.sol b/packages/contracts-bedrock/interfaces/L1/IOPContractsManager.sol index f042cffa5796d..48c7ab9c6b58e 100644 --- a/packages/contracts-bedrock/interfaces/L1/IOPContractsManager.sol +++ b/packages/contracts-bedrock/interfaces/L1/IOPContractsManager.sol @@ -192,10 +192,6 @@ interface IOPContractsManager { address proxyAdmin; address l1ChugSplashProxy; address resolvedDelegateProxy; - address permissionedDisputeGame1; - address permissionedDisputeGame2; - address permissionlessDisputeGame1; - address permissionlessDisputeGame2; } /// @notice The latest implementation contracts for the OP Stack. diff --git a/packages/contracts-bedrock/interfaces/L1/IOPContractsManagerStandardValidator.sol b/packages/contracts-bedrock/interfaces/L1/IOPContractsManagerStandardValidator.sol index 71f54bc521360..0606ea93ef279 100644 --- a/packages/contracts-bedrock/interfaces/L1/IOPContractsManagerStandardValidator.sol +++ b/packages/contracts-bedrock/interfaces/L1/IOPContractsManagerStandardValidator.sol @@ -19,6 +19,8 @@ interface IOPContractsManagerStandardValidator { address anchorStateRegistryImpl; address delayedWETHImpl; address mipsImpl; + address faultDisputeGameImpl; + address permissionedDisputeGameImpl; } struct ValidationInput { @@ -54,11 +56,12 @@ interface IOPContractsManagerStandardValidator { function l1PAOMultisig() external view returns (address); function l1StandardBridgeImpl() external view returns (address); function mipsImpl() external view returns (address); + function faultDisputeGameImpl() external view returns (address); + function permissionedDisputeGameImpl() external view returns (address); function optimismMintableERC20FactoryImpl() external view returns (address); function optimismPortalImpl() external view returns (address); function optimismPortalInteropImpl() external view returns (address); function ethLockboxImpl() external view returns (address); - function permissionedDisputeGameVersion() external pure returns (string memory); function preimageOracleVersion() external pure returns (string memory); function superchainConfig() external view returns (ISuperchainConfig); function systemConfigImpl() external view returns (address); diff --git a/packages/contracts-bedrock/justfile b/packages/contracts-bedrock/justfile index fe4e0e0d1575c..45fd3ac79ac13 100644 --- a/packages/contracts-bedrock/justfile +++ b/packages/contracts-bedrock/justfile @@ -60,7 +60,7 @@ build-dev *ARGS: lint-fix-no-fail # Builds the go-ffi tool for contract tests. build-go-ffi: - cd ./scripts/go-ffi && go build + cd ./scripts/go-ffi && go build -buildvcs=false # Cleans build artifacts and deployments. clean: diff --git a/packages/contracts-bedrock/scripts/deploy/ChainAssertions.sol b/packages/contracts-bedrock/scripts/deploy/ChainAssertions.sol index 3661c7602ff22..0ac35465ff89f 100644 --- a/packages/contracts-bedrock/scripts/deploy/ChainAssertions.sol +++ b/packages/contracts-bedrock/scripts/deploy/ChainAssertions.sol @@ -16,7 +16,6 @@ import { Types } from "scripts/libraries/Types.sol"; import { Blueprint } from "src/libraries/Blueprint.sol"; import { GameTypes } from "src/dispute/lib/Types.sol"; import { Hash } from "src/dispute/lib/Types.sol"; -import { DevFeatures } from "src/libraries/DevFeatures.sol"; // Interfaces import { IOPContractsManager } from "interfaces/L1/IOPContractsManager.sol"; @@ -426,26 +425,6 @@ library ChainAssertions { Blueprint.Preamble memory rdProxyPreamble = Blueprint.parseBlueprintPreamble(address(blueprints.resolvedDelegateProxy).code); require(keccak256(rdProxyPreamble.initcode) == keccak256(vm.getCode("ResolvedDelegateProxy")), "CHECK-OPCM-200"); - - if (!_opcm.isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - Blueprint.Preamble memory pdg1Preamble = - Blueprint.parseBlueprintPreamble(address(blueprints.permissionedDisputeGame1).code); - Blueprint.Preamble memory pdg2Preamble = - Blueprint.parseBlueprintPreamble(address(blueprints.permissionedDisputeGame2).code); - // combine pdg1 and pdg2 initcodes - bytes memory fullPermissionedDisputeGameInitcode = - abi.encodePacked(pdg1Preamble.initcode, pdg2Preamble.initcode); - require( - keccak256(fullPermissionedDisputeGameInitcode) == keccak256(vm.getCode("PermissionedDisputeGame")), - "CHECK-OPCM-210" - ); - } else { - // Should not deploy V1 blueprints when using V2 dispute games - require(address(blueprints.permissionedDisputeGame1).code.length == 0, "CHECK-OPCM-220"); - require(address(blueprints.permissionedDisputeGame2).code.length == 0, "CHECK-OPCM-230"); - require(address(blueprints.permissionlessDisputeGame1).code.length == 0, "CHECK-OPCM-240"); - require(address(blueprints.permissionlessDisputeGame2).code.length == 0, "CHECK-OPCM-250"); - } } function checkAnchorStateRegistryProxy(IAnchorStateRegistry _anchorStateRegistryProxy, bool _isProxy) internal { diff --git a/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol b/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol index e6cc1e80dd8de..63c882f43f424 100644 --- a/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol +++ b/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol @@ -22,7 +22,6 @@ import { StandardConstants } from "scripts/deploy/StandardConstants.sol"; // Libraries import { Types } from "scripts/libraries/Types.sol"; import { Duration } from "src/dispute/lib/LibUDT.sol"; -import { DevFeatures } from "src/libraries/DevFeatures.sol"; import { GameType, Claim, GameTypes, Proposal, Hash } from "src/dispute/lib/Types.sol"; // Interfaces @@ -298,9 +297,7 @@ contract Deploy is Deployer { artifacts.save("OPContractsManager", address(dio.opcm)); artifacts.save("DelayedWETHImpl", address(dio.delayedWETHImpl)); artifacts.save("PreimageOracle", address(dio.preimageOracleSingleton)); - if (DevFeatures.isDevFeatureEnabled(dio.opcm.devFeatureBitmap(), DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - artifacts.save("PermissionedDisputeGame", address(dio.permissionedDisputeGameV2Impl)); - } + artifacts.save("PermissionedDisputeGame", address(dio.permissionedDisputeGameV2Impl)); // Get a contract set from the implementation addresses which were just deployed. Types.ContractSet memory impls = ChainAssertions.dioToContractSet(dio); @@ -368,9 +365,6 @@ contract Deploy is Deployer { artifacts.save("AnchorStateRegistryProxy", address(deployOutput.anchorStateRegistryProxy)); artifacts.save("OptimismPortalProxy", address(deployOutput.optimismPortalProxy)); artifacts.save("OptimismPortal2Proxy", address(deployOutput.optimismPortalProxy)); - if (!DevFeatures.isDevFeatureEnabled(opcm.devFeatureBitmap(), DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - artifacts.save("PermissionedDisputeGame", address(deployOutput.permissionedDisputeGame)); - } // Check if the permissionless game implementation is already set IDisputeGameFactory factory = IDisputeGameFactory(artifacts.mustGetAddress("DisputeGameFactoryProxy")); diff --git a/packages/contracts-bedrock/scripts/deploy/DeployDisputeGame.s.sol b/packages/contracts-bedrock/scripts/deploy/DeployDisputeGame.s.sol index 7ea2eb4cbcec6..5096d78f3a72c 100644 --- a/packages/contracts-bedrock/scripts/deploy/DeployDisputeGame.s.sol +++ b/packages/contracts-bedrock/scripts/deploy/DeployDisputeGame.s.sol @@ -26,7 +26,6 @@ contract DeployDisputeGame is Script { struct Input { // Common inputs. string release; - bool useV2; // Specify which game kind is being deployed here. string gameKind; // All inputs required to deploy FaultDisputeGame. @@ -52,11 +51,7 @@ contract DeployDisputeGame is Script { function run(Input memory _input) public returns (Output memory output_) { assertValidInput(_input); - if (_input.useV2) { - deployDisputeGameImplV2(_input, output_); - } else { - deployDisputeGameImplV1(_input, output_); - } + deployDisputeGameImplV2(_input, output_); assertValidOutput(_input, output_); } @@ -171,24 +166,9 @@ contract DeployDisputeGame is Script { DeployUtils.assertValidContractAddress(address(game)); - if (!_input.useV2) { - require(GameType.unwrap(game.gameType()) == GameType.unwrap(_input.gameType), "DG-10"); - } require(game.maxGameDepth() == _input.maxGameDepth, "DG-20"); require(game.splitDepth() == _input.splitDepth, "DG-30"); require(game.clockExtension().raw() == uint64(_input.clockExtension), "DG-40"); require(game.maxClockDuration().raw() == uint64(_input.maxClockDuration), "DG-50"); - - if (!_input.useV2) { - require(game.vm() == _input.vmAddress, "DG-60"); - require(game.weth() == _input.delayedWethProxy, "DG-70"); - require(game.anchorStateRegistry() == _input.anchorStateRegistryProxy, "DG-80"); - require(game.l2ChainId() == _input.l2ChainId, "DG-90"); - - if (LibString.eq(_input.gameKind, "PermissionedDisputeGame")) { - require(game.proposer() == _input.proposer, "DG-100"); - require(game.challenger() == _input.challenger, "DG-110"); - } - } } } diff --git a/packages/contracts-bedrock/scripts/deploy/DeployImplementations.s.sol b/packages/contracts-bedrock/scripts/deploy/DeployImplementations.s.sol index 3033e7e8bc4c9..7dde28ab2b7b9 100644 --- a/packages/contracts-bedrock/scripts/deploy/DeployImplementations.s.sol +++ b/packages/contracts-bedrock/scripts/deploy/DeployImplementations.s.sol @@ -124,10 +124,8 @@ contract DeployImplementations is Script { deployMipsSingleton(_input, output_); deployDisputeGameFactoryImpl(output_); deployAnchorStateRegistryImpl(_input, output_); - if (DevFeatures.isDevFeatureEnabled(_input.devFeatureBitmap, DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - deployFaultDisputeGameV2Impl(_input, output_); - deployPermissionedDisputeGameV2Impl(_input, output_); - } + deployFaultDisputeGameV2Impl(_input, output_); + deployPermissionedDisputeGameV2Impl(_input, output_); if (DevFeatures.isDevFeatureEnabled(_input.devFeatureBitmap, DevFeatures.OPTIMISM_PORTAL_INTEROP)) { deploySuperFaultDisputeGameImpl(_input, output_); deploySuperPermissionedDisputeGameImpl(_input, output_); @@ -238,12 +236,6 @@ contract DeployImplementations is Script { require(checkAddress == address(0), "OPCM-40"); (blueprints.resolvedDelegateProxy, checkAddress) = DeployUtils.createDeterministicBlueprint(vm.getCode("ResolvedDelegateProxy"), _salt); require(checkAddress == address(0), "OPCM-50"); - // The max initcode/runtimecode size is 48KB/24KB. - // But for Blueprint, the initcode is stored as runtime code, that's why it's necessary to split into 2 parts. - if (!DevFeatures.isDevFeatureEnabled(_input.devFeatureBitmap, DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - (blueprints.permissionedDisputeGame1, blueprints.permissionedDisputeGame2) = DeployUtils.createDeterministicBlueprint(vm.getCode("PermissionedDisputeGame"), _salt); - (blueprints.permissionlessDisputeGame1, blueprints.permissionlessDisputeGame2) = DeployUtils.createDeterministicBlueprint(vm.getCode("FaultDisputeGame"), _salt); - } // forgefmt: disable-end vm.stopBroadcast(); @@ -669,6 +661,8 @@ contract DeployImplementations is Script { opcmImplementations.anchorStateRegistryImpl = _implementations.anchorStateRegistryImpl; opcmImplementations.delayedWETHImpl = _implementations.delayedWETHImpl; opcmImplementations.mipsImpl = _implementations.mipsImpl; + opcmImplementations.faultDisputeGameImpl = _implementations.faultDisputeGameV2Impl; + opcmImplementations.permissionedDisputeGameImpl = _implementations.permissionedDisputeGameV2Impl; IOPContractsManagerStandardValidator impl = IOPContractsManagerStandardValidator( DeployUtils.createDeterministic({ @@ -694,35 +688,31 @@ contract DeployImplementations is Script { } function assertValidInput(Input memory _input) private pure { - if (DevFeatures.isDevFeatureEnabled(_input.devFeatureBitmap, DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - // Validate V2 game depth parameters are sensible - require( - _input.faultGameV2MaxGameDepth > 0 && _input.faultGameV2MaxGameDepth <= 125, - "DeployImplementations: faultGameV2MaxGameDepth out of valid range (1-125)" - ); - // V2 contract requires splitDepth >= 2 and splitDepth + 1 < maxGameDepth - require( - _input.faultGameV2SplitDepth >= 2 && _input.faultGameV2SplitDepth + 1 < _input.faultGameV2MaxGameDepth, - "DeployImplementations: faultGameV2SplitDepth must be >= 2 and splitDepth + 1 < maxGameDepth" - ); + // Validate V2 game depth parameters are sensible + require( + _input.faultGameV2MaxGameDepth > 0 && _input.faultGameV2MaxGameDepth <= 125, + "DeployImplementations: faultGameV2MaxGameDepth out of valid range (1-125)" + ); + // V2 contract requires splitDepth >= 2 and splitDepth + 1 < maxGameDepth + require( + _input.faultGameV2SplitDepth >= 2 && _input.faultGameV2SplitDepth + 1 < _input.faultGameV2MaxGameDepth, + "DeployImplementations: faultGameV2SplitDepth must be >= 2 and splitDepth + 1 < maxGameDepth" + ); - // Validate V2 clock parameters fit in uint64 before deployment - require( - _input.faultGameV2ClockExtension <= type(uint64).max, - "DeployImplementations: faultGameV2ClockExtension too large for uint64" - ); - require( - _input.faultGameV2MaxClockDuration <= type(uint64).max, - "DeployImplementations: faultGameV2MaxClockDuration too large for uint64" - ); - require( - _input.faultGameV2MaxClockDuration >= _input.faultGameV2ClockExtension, - "DeployImplementations: maxClockDuration must be >= clockExtension" - ); - require( - _input.faultGameV2ClockExtension > 0, "DeployImplementations: faultGameV2ClockExtension must be > 0" - ); - } + // Validate V2 clock parameters fit in uint64 before deployment + require( + _input.faultGameV2ClockExtension <= type(uint64).max, + "DeployImplementations: faultGameV2ClockExtension too large for uint64" + ); + require( + _input.faultGameV2MaxClockDuration <= type(uint64).max, + "DeployImplementations: faultGameV2MaxClockDuration too large for uint64" + ); + require( + _input.faultGameV2MaxClockDuration >= _input.faultGameV2ClockExtension, + "DeployImplementations: maxClockDuration must be >= clockExtension" + ); + require(_input.faultGameV2ClockExtension > 0, "DeployImplementations: faultGameV2ClockExtension must be > 0"); require(_input.withdrawalDelaySeconds != 0, "DeployImplementations: withdrawalDelaySeconds not set"); require(_input.minProposalSizeBytes != 0, "DeployImplementations: minProposalSizeBytes not set"); require(_input.challengePeriodSeconds != 0, "DeployImplementations: challengePeriodSeconds not set"); @@ -768,16 +758,11 @@ contract DeployImplementations is Script { address(_output.optimismMintableERC20FactoryImpl), address(_output.disputeGameFactoryImpl), address(_output.anchorStateRegistryImpl), - address(_output.ethLockboxImpl) + address(_output.ethLockboxImpl), + address(_output.faultDisputeGameV2Impl), + address(_output.permissionedDisputeGameV2Impl) ); - // Only include V2 contracts in validation if they were deployed - if (DevFeatures.isDevFeatureEnabled(_input.devFeatureBitmap, DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - address[] memory v2Addrs = Solarray.addresses( - address(_output.faultDisputeGameV2Impl), address(_output.permissionedDisputeGameV2Impl) - ); - addrs2 = Solarray.extend(addrs2, v2Addrs); - } if (DevFeatures.isDevFeatureEnabled(_input.devFeatureBitmap, DevFeatures.OPTIMISM_PORTAL_INTEROP)) { address[] memory superGameAddrs = Solarray.addresses( address(_output.superFaultDisputeGameImpl), address(_output.superPermissionedDisputeGameImpl) @@ -787,17 +772,6 @@ contract DeployImplementations is Script { DeployUtils.assertValidContractAddresses(Solarray.extend(addrs1, addrs2)); - // Validate V2 contracts not deployed when flag is disabled - if (!DevFeatures.isDevFeatureEnabled(_input.devFeatureBitmap, DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - require( - address(_output.faultDisputeGameV2Impl) == address(0), - "DeployImplementations: V2 flag disabled but FaultDisputeGameV2 was deployed" - ); - require( - address(_output.permissionedDisputeGameV2Impl) == address(0), - "DeployImplementations: V2 flag disabled but PermissionedDisputeGameV2 was deployed" - ); - } if (!DevFeatures.isDevFeatureEnabled(_input.devFeatureBitmap, DevFeatures.OPTIMISM_PORTAL_INTEROP)) { require( address(_output.superFaultDisputeGameImpl) == address(0), diff --git a/packages/contracts-bedrock/scripts/deploy/DeployOPChain.s.sol b/packages/contracts-bedrock/scripts/deploy/DeployOPChain.s.sol index 07683d3fca5de..2f5ff24e752da 100644 --- a/packages/contracts-bedrock/scripts/deploy/DeployOPChain.s.sol +++ b/packages/contracts-bedrock/scripts/deploy/DeployOPChain.s.sol @@ -3,7 +3,6 @@ pragma solidity 0.8.15; import { Script } from "forge-std/Script.sol"; -import { DevFeatures } from "src/libraries/DevFeatures.sol"; import { DeployUtils } from "scripts/libraries/DeployUtils.sol"; import { Solarray } from "scripts/libraries/Solarray.sol"; import { ChainAssertions } from "scripts/deploy/ChainAssertions.sol"; @@ -123,13 +122,6 @@ contract DeployOPChain is Script { checkOutput(_input, output_); } - // -------- Features -------- - - function isDevFeatureV2DisputeGamesEnabled(address _opcmAddr) internal view returns (bool) { - IOPContractsManager opcm = IOPContractsManager(_opcmAddr); - return DevFeatures.isDevFeatureEnabled(opcm.devFeatureBitmap(), DevFeatures.DEPLOY_V2_DISPUTE_GAMES); - } - // -------- Validations -------- function checkInput(Types.DeployOPChainInput memory _i) public view { @@ -176,16 +168,6 @@ contract DeployOPChain is Script { address(_o.ethLockboxProxy) ); - if (!isDevFeatureV2DisputeGamesEnabled(_i.opcm)) { - // Only check dispute game contracts if v2 dispute games are not enabled. - // When v2 contracts are enabled, we no longer deploy dispute games per chain - addrs2 = Solarray.extend(addrs2, Solarray.addresses(address(_o.permissionedDisputeGame))); - - // TODO: Eventually switch from Permissioned to Permissionless. Add these addresses back in. - // address(_o.delayedWETHPermissionlessGameProxy) - // address(_o.faultDisputeGame()), - } - DeployUtils.assertValidContractAddresses(Solarray.extend(addrs1, addrs2)); _assertValidDeploy(_i, _o); } @@ -209,11 +191,8 @@ contract DeployOPChain is Script { }); // Check dispute games - address expectedPDGImpl = address(_o.permissionedDisputeGame); - if (isDevFeatureV2DisputeGamesEnabled(_i.opcm)) { - // With v2 game contracts enabled, we use the predeployed pdg implementation - expectedPDGImpl = IOPContractsManager(_i.opcm).implementations().permissionedDisputeGameV2Impl; - } + // With v2 game contracts enabled, we use the predeployed pdg implementation + address expectedPDGImpl = IOPContractsManager(_i.opcm).implementations().permissionedDisputeGameV2Impl; ChainAssertions.checkDisputeGameFactory( _o.disputeGameFactoryProxy, _i.opChainProxyAdminOwner, expectedPDGImpl, true ); diff --git a/packages/contracts-bedrock/scripts/deploy/VerifyOPCM.s.sol b/packages/contracts-bedrock/scripts/deploy/VerifyOPCM.s.sol index 1c6c6237c2097..fd53f5c2ad8f3 100644 --- a/packages/contracts-bedrock/scripts/deploy/VerifyOPCM.s.sol +++ b/packages/contracts-bedrock/scripts/deploy/VerifyOPCM.s.sol @@ -413,29 +413,6 @@ contract VerifyOPCM is Script { string memory artifactPath = _buildArtifactPath(_target.name); console.log(string.concat(" Expected Runtime Artifact: ", artifactPath)); - // Check if this is a V1 dispute game that should be skipped - if (_isV1DisputeGameImplementation(_target.name) && _target.blueprint) { - if (_isV2DisputeGamesEnabled(_opcm)) { - console.log("[SKIP] Dispute game blueprint not deployed (dispute game v2 feature enabled)"); - return true; // Consider this "verified" when feature is on - } else if (_target.addr == address(0)) { - console.log("[FAIL] Dispute game blueprint not deployed (dispute game v2 feature disabled)"); - success = false; - } - } - // Check if this is a V2 dispute game that should be skipped - if (_isV2DisputeGameImplementation(_target.name)) { - if (!_isV2DisputeGamesEnabled(_opcm)) { - if (_target.addr == address(0)) { - console.log("[SKIP] V2 dispute game not deployed (feature disabled)"); - return true; // Consider this "verified" when feature is off - } else { - console.log("[FAIL] ERROR: V2 dispute game deployed but feature disabled"); - success = false; - } - } - // If feature is enabled, continue with normal verification - } // Check if this is a Super dispute game that should be skipped if (_isSuperDisputeGameImplementation(_target.name)) { if (!_isSuperDisputeGamesEnabled(_opcm)) { @@ -546,14 +523,6 @@ contract VerifyOPCM is Script { return success; } - /// @notice Checks if V2 dispute games feature is enabled in the dev feature bitmap. - /// @param _opcm The OPContractsManager to check. - /// @return True if V2 dispute games are enabled. - function _isV2DisputeGamesEnabled(IOPContractsManager _opcm) internal view returns (bool) { - bytes32 bitmap = _opcm.devFeatureBitmap(); - return DevFeatures.isDevFeatureEnabled(bitmap, DevFeatures.DEPLOY_V2_DISPUTE_GAMES); - } - /// @notice Checks if super dispute games feature is enabled in the dev feature bitmap. /// @param _opcm The OPContractsManager to check. /// @return True if super dispute games are enabled. @@ -562,13 +531,6 @@ contract VerifyOPCM is Script { return DevFeatures.isDevFeatureEnabled(bitmap, DevFeatures.OPTIMISM_PORTAL_INTEROP); } - /// @notice Checks if a contract is a V1 dispute game implementation. - /// @param _contractName The name to check. - /// @return True if this is a V1 dispute game. - function _isV1DisputeGameImplementation(string memory _contractName) internal pure returns (bool) { - return LibString.eq(_contractName, "FaultDisputeGame") || LibString.eq(_contractName, "PermissionedDisputeGame"); - } - /// @notice Checks if a contract is a V2 dispute game implementation. /// @param _contractName The name to check. /// @return True if this is a V2 dispute game. diff --git a/packages/contracts-bedrock/scripts/libraries/Config.sol b/packages/contracts-bedrock/scripts/libraries/Config.sol index 503c816ba4586..1e00ea2f31acd 100644 --- a/packages/contracts-bedrock/scripts/libraries/Config.sol +++ b/packages/contracts-bedrock/scripts/libraries/Config.sol @@ -241,16 +241,6 @@ library Config { return vm.envOr("DEV_FEATURE__OPTIMISM_PORTAL_INTEROP", false); } - /// @notice Returns true if the development feature cannon_kona is enabled. - function devFeatureCannonKona() internal view returns (bool) { - return vm.envOr("DEV_FEATURE__CANNON_KONA", false); - } - - /// @notice Returns true if the development feature deploy_v2_dispute_games is enabled. - function devFeatureDeployV2DisputeGames() internal view returns (bool) { - return vm.envOr("DEV_FEATURE__DEPLOY_V2_DISPUTE_GAMES", false); - } - /// @notice Returns true if the system feature custom_gas_token is enabled. function sysFeatureCustomGasToken() internal view returns (bool) { return vm.envOr("SYS_FEATURE__CUSTOM_GAS_TOKEN", false); diff --git a/packages/contracts-bedrock/scripts/ops/pull-artifacts.sh b/packages/contracts-bedrock/scripts/ops/pull-artifacts.sh index 7f79c46341b05..01e71fc5549bf 100755 --- a/packages/contracts-bedrock/scripts/ops/pull-artifacts.sh +++ b/packages/contracts-bedrock/scripts/ops/pull-artifacts.sh @@ -31,9 +31,9 @@ download_and_extract() { echoerr "> Extracting artifacts..." if [[ "$archive_name" == *.tar.zst ]]; then - zstd -dc "$archive_name" | tar -xf - --exclude='*..*' + zstd -dc "$archive_name" | tar -xf - --exclude='*..*' artifacts forge-artifacts cache else - tar -xzvf "$archive_name" --exclude='*..*' + tar -xzvf "$archive_name" --exclude='*..*' artifacts forge-artifacts cache fi echoerr "> Done." diff --git a/packages/contracts-bedrock/snapshots/abi/OPContractsManager.json b/packages/contracts-bedrock/snapshots/abi/OPContractsManager.json index 33f8880d27e8e..b5871765022c4 100644 --- a/packages/contracts-bedrock/snapshots/abi/OPContractsManager.json +++ b/packages/contracts-bedrock/snapshots/abi/OPContractsManager.json @@ -163,26 +163,6 @@ "internalType": "address", "name": "resolvedDelegateProxy", "type": "address" - }, - { - "internalType": "address", - "name": "permissionedDisputeGame1", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionedDisputeGame2", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionlessDisputeGame1", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionlessDisputeGame2", - "type": "address" } ], "internalType": "struct OPContractsManager.Blueprints", diff --git a/packages/contracts-bedrock/snapshots/abi/OPContractsManagerContractsContainer.json b/packages/contracts-bedrock/snapshots/abi/OPContractsManagerContractsContainer.json index a3dc49e896f89..0014bbfb7ce26 100644 --- a/packages/contracts-bedrock/snapshots/abi/OPContractsManagerContractsContainer.json +++ b/packages/contracts-bedrock/snapshots/abi/OPContractsManagerContractsContainer.json @@ -27,26 +27,6 @@ "internalType": "address", "name": "resolvedDelegateProxy", "type": "address" - }, - { - "internalType": "address", - "name": "permissionedDisputeGame1", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionedDisputeGame2", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionlessDisputeGame1", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionlessDisputeGame2", - "type": "address" } ], "internalType": "struct OPContractsManager.Blueprints", @@ -202,26 +182,6 @@ "internalType": "address", "name": "resolvedDelegateProxy", "type": "address" - }, - { - "internalType": "address", - "name": "permissionedDisputeGame1", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionedDisputeGame2", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionlessDisputeGame1", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionlessDisputeGame2", - "type": "address" } ], "internalType": "struct OPContractsManager.Blueprints", diff --git a/packages/contracts-bedrock/snapshots/abi/OPContractsManagerDeployer.json b/packages/contracts-bedrock/snapshots/abi/OPContractsManagerDeployer.json index a8798bdcb95e5..08c026dbfc7fc 100644 --- a/packages/contracts-bedrock/snapshots/abi/OPContractsManagerDeployer.json +++ b/packages/contracts-bedrock/snapshots/abi/OPContractsManagerDeployer.json @@ -53,26 +53,6 @@ "internalType": "address", "name": "resolvedDelegateProxy", "type": "address" - }, - { - "internalType": "address", - "name": "permissionedDisputeGame1", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionedDisputeGame2", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionlessDisputeGame1", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionlessDisputeGame2", - "type": "address" } ], "internalType": "struct OPContractsManager.Blueprints", @@ -523,17 +503,6 @@ "name": "InvalidChainId", "type": "error" }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "devFeature", - "type": "bytes32" - } - ], - "name": "InvalidDevFeatureAccess", - "type": "error" - }, { "inputs": [ { diff --git a/packages/contracts-bedrock/snapshots/abi/OPContractsManagerGameTypeAdder.json b/packages/contracts-bedrock/snapshots/abi/OPContractsManagerGameTypeAdder.json index 16debf40454f8..60a7aed15bbb3 100644 --- a/packages/contracts-bedrock/snapshots/abi/OPContractsManagerGameTypeAdder.json +++ b/packages/contracts-bedrock/snapshots/abi/OPContractsManagerGameTypeAdder.json @@ -146,26 +146,6 @@ "internalType": "address", "name": "resolvedDelegateProxy", "type": "address" - }, - { - "internalType": "address", - "name": "permissionedDisputeGame1", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionedDisputeGame2", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionlessDisputeGame1", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionlessDisputeGame2", - "type": "address" } ], "internalType": "struct OPContractsManager.Blueprints", @@ -437,17 +417,6 @@ "name": "IdentityPrecompileCallFailed", "type": "error" }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "devFeature", - "type": "bytes32" - } - ], - "name": "InvalidDevFeatureAccess", - "type": "error" - }, { "inputs": [], "name": "InvalidGameArgsLength", diff --git a/packages/contracts-bedrock/snapshots/abi/OPContractsManagerInteropMigrator.json b/packages/contracts-bedrock/snapshots/abi/OPContractsManagerInteropMigrator.json index 5644c7edb07da..3e06c679ab7b0 100644 --- a/packages/contracts-bedrock/snapshots/abi/OPContractsManagerInteropMigrator.json +++ b/packages/contracts-bedrock/snapshots/abi/OPContractsManagerInteropMigrator.json @@ -53,26 +53,6 @@ "internalType": "address", "name": "resolvedDelegateProxy", "type": "address" - }, - { - "internalType": "address", - "name": "permissionedDisputeGame1", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionedDisputeGame2", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionlessDisputeGame1", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionlessDisputeGame2", - "type": "address" } ], "internalType": "struct OPContractsManager.Blueprints", diff --git a/packages/contracts-bedrock/snapshots/abi/OPContractsManagerStandardValidator.json b/packages/contracts-bedrock/snapshots/abi/OPContractsManagerStandardValidator.json index 7d149dff61c7b..a6810ae759685 100644 --- a/packages/contracts-bedrock/snapshots/abi/OPContractsManagerStandardValidator.json +++ b/packages/contracts-bedrock/snapshots/abi/OPContractsManagerStandardValidator.json @@ -62,6 +62,16 @@ "internalType": "address", "name": "mipsImpl", "type": "address" + }, + { + "internalType": "address", + "name": "faultDisputeGameImpl", + "type": "address" + }, + { + "internalType": "address", + "name": "permissionedDisputeGameImpl", + "type": "address" } ], "internalType": "struct OPContractsManagerStandardValidator.Implementations", @@ -175,6 +185,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "faultDisputeGameImpl", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "l1CrossDomainMessengerImpl", @@ -281,12 +304,12 @@ }, { "inputs": [], - "name": "permissionedDisputeGameVersion", + "name": "permissionedDisputeGameImpl", "outputs": [ { - "internalType": "string", + "internalType": "address", "name": "", - "type": "string" + "type": "address" } ], "stateMutability": "view", diff --git a/packages/contracts-bedrock/snapshots/abi/OPContractsManagerUpgrader.json b/packages/contracts-bedrock/snapshots/abi/OPContractsManagerUpgrader.json index 2df9bcd824ae2..29f55b0bbc760 100644 --- a/packages/contracts-bedrock/snapshots/abi/OPContractsManagerUpgrader.json +++ b/packages/contracts-bedrock/snapshots/abi/OPContractsManagerUpgrader.json @@ -53,26 +53,6 @@ "internalType": "address", "name": "resolvedDelegateProxy", "type": "address" - }, - { - "internalType": "address", - "name": "permissionedDisputeGame1", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionedDisputeGame2", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionlessDisputeGame1", - "type": "address" - }, - { - "internalType": "address", - "name": "permissionlessDisputeGame2", - "type": "address" } ], "internalType": "struct OPContractsManager.Blueprints", @@ -351,17 +331,6 @@ "name": "IdentityPrecompileCallFailed", "type": "error" }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "devFeature", - "type": "bytes32" - } - ], - "name": "InvalidDevFeatureAccess", - "type": "error" - }, { "inputs": [], "name": "InvalidGameArgsLength", diff --git a/packages/contracts-bedrock/snapshots/semver-lock.json b/packages/contracts-bedrock/snapshots/semver-lock.json index 34b04976007d1..2b47ea63a6064 100644 --- a/packages/contracts-bedrock/snapshots/semver-lock.json +++ b/packages/contracts-bedrock/snapshots/semver-lock.json @@ -24,12 +24,12 @@ "sourceCodeHash": "0xfca613b5d055ffc4c3cbccb0773ddb9030abedc1aa6508c9e2e7727cc0cd617b" }, "src/L1/OPContractsManager.sol:OPContractsManager": { - "initCodeHash": "0x6fd82aaec43858b34bd093e29bbacb659a95817d506de948aebd3c84e6d2a00a", - "sourceCodeHash": "0x5f63555e12cb8e27ce5c1511e986550bf2f1b9769e314223a7324b8dcfa29523" + "initCodeHash": "0x51bb4fa1d01503ec16e8611ac1e2f042ea51280310f1cca2a15a4826acfc2db5", + "sourceCodeHash": "0xf96b2b362af0f9efd7068ab229c9205efe43872b46f0491ee6cf2f32c9578757" }, "src/L1/OPContractsManagerStandardValidator.sol:OPContractsManagerStandardValidator": { - "initCodeHash": "0x0c8b15453d0f0bc5d9af07f104505e0bbb2b358f0df418289822fb73a8652b30", - "sourceCodeHash": "0x8c156f9f46ae60d928dcc49355519281d019cafabb327103db3094f28ed03537" + "initCodeHash": "0xdec828fdb9f9bb7a35ca03d851b041fcd088681957642e949b5d320358d9b9a1", + "sourceCodeHash": "0x17231caf75773e159b91ad37d798c600ed9662b77c236143022456dc9eb83e47" }, "src/L1/OptimismPortal2.sol:OptimismPortal2": { "initCodeHash": "0x2c01bc6c0a55a1a27263224e05c1b28703ff85c61075bae7ab384b3043820ed2", diff --git a/packages/contracts-bedrock/snapshots/storageLayout/OPContractsManagerContractsContainer.json b/packages/contracts-bedrock/snapshots/storageLayout/OPContractsManagerContractsContainer.json index 9487d230af8ee..a6f0bb30b8c12 100644 --- a/packages/contracts-bedrock/snapshots/storageLayout/OPContractsManagerContractsContainer.json +++ b/packages/contracts-bedrock/snapshots/storageLayout/OPContractsManagerContractsContainer.json @@ -1,6 +1,6 @@ [ { - "bytes": "288", + "bytes": "160", "label": "blueprint", "offset": 0, "slot": "0", @@ -10,7 +10,7 @@ "bytes": "576", "label": "implementation", "offset": 0, - "slot": "9", + "slot": "5", "type": "struct OPContractsManager.Implementations" } ] \ No newline at end of file diff --git a/packages/contracts-bedrock/snapshots/storageLayout/OPContractsManagerStandardValidator.json b/packages/contracts-bedrock/snapshots/storageLayout/OPContractsManagerStandardValidator.json index 4b248cfef65d2..c9a280db30b00 100644 --- a/packages/contracts-bedrock/snapshots/storageLayout/OPContractsManagerStandardValidator.json +++ b/packages/contracts-bedrock/snapshots/storageLayout/OPContractsManagerStandardValidator.json @@ -111,11 +111,25 @@ "slot": "15", "type": "address" }, + { + "bytes": "20", + "label": "faultDisputeGameImpl", + "offset": 0, + "slot": "16", + "type": "address" + }, + { + "bytes": "20", + "label": "permissionedDisputeGameImpl", + "offset": 0, + "slot": "17", + "type": "address" + }, { "bytes": "32", "label": "devFeatureBitmap", "offset": 0, - "slot": "16", + "slot": "18", "type": "bytes32" } ] \ No newline at end of file diff --git a/packages/contracts-bedrock/src/L1/OPContractsManager.sol b/packages/contracts-bedrock/src/L1/OPContractsManager.sol index 31bfb0989e8c7..edea623b80f02 100644 --- a/packages/contracts-bedrock/src/L1/OPContractsManager.sol +++ b/packages/contracts-bedrock/src/L1/OPContractsManager.sol @@ -473,9 +473,6 @@ abstract contract OPContractsManagerBase { ) internal { - if (!isSuperGameVariant(_gameType) && !isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - revert OPContractsManager.InvalidDevFeatureAccess(DevFeatures.DEPLOY_V2_DISPUTE_GAMES); - } _dgf.setImplementation(_gameType, _newGame, _gameArgs); } @@ -602,142 +599,48 @@ contract OPContractsManagerGameTypeAdder is OPContractsManagerBase { IFaultDisputeGame existingGame = IFaultDisputeGame(address(getGameImplementation(dgf, gameConfig.disputeGameType))); - if ( - isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES) - || isSuperGameVariant(gameConfig.disputeGameType) - ) { - if ( - isCannonGameVariant(gameConfig.disputeGameType) - || (isDevFeatureEnabled(DevFeatures.CANNON_KONA) && isKonaGameVariant(gameConfig.disputeGameType)) - ) { - address impl = getDisputeGameImplementation(gameConfig.disputeGameType); - bytes memory gameArgs = LibGameArgs.encode( - LibGameArgs.GameArgs({ - absolutePrestate: gameConfig.disputeAbsolutePrestate.raw(), - vm: address(gameConfig.vm), - anchorStateRegistry: address(getAnchorStateRegistry(ISystemConfig(gameConfig.systemConfig))), - weth: address(outputs[i].delayedWETH), - // must be zero for SUPER game types - l2ChainId: isSuperGameVariant(gameConfig.disputeGameType) ? 0 : l2ChainId, - proposer: address(0), - challenger: address(0) - }) - ); - - setDGFImplementation(dgf, gameConfig.disputeGameType, IDisputeGame(impl), gameArgs); - outputs[i].faultDisputeGame = IFaultDisputeGame(impl); - } else if ( - gameConfig.disputeGameType.raw() == GameTypes.PERMISSIONED_CANNON.raw() - || gameConfig.disputeGameType.raw() == GameTypes.SUPER_PERMISSIONED_CANNON.raw() - ) { - address impl = getDisputeGameImplementation(gameConfig.disputeGameType); - bytes memory gameArgs = LibGameArgs.encode( - LibGameArgs.GameArgs({ - absolutePrestate: gameConfig.disputeAbsolutePrestate.raw(), - vm: address(gameConfig.vm), - anchorStateRegistry: address(getAnchorStateRegistry(ISystemConfig(gameConfig.systemConfig))), - weth: address(outputs[i].delayedWETH), - l2ChainId: gameConfig.disputeGameType.raw() == GameTypes.PERMISSIONED_CANNON.raw() - ? l2ChainId - : 0, // must be zero for SUPER gam types - proposer: getProposer( - dgf, IPermissionedDisputeGame(address(existingGame)), gameConfig.disputeGameType - ), - challenger: getChallenger( - dgf, IPermissionedDisputeGame(address(existingGame)), gameConfig.disputeGameType - ) - }) - ); - setDGFImplementation(dgf, gameConfig.disputeGameType, IDisputeGame(impl), gameArgs); - outputs[i].faultDisputeGame = IFaultDisputeGame(payable(impl)); - } else { - revert OPContractsManagerGameTypeAdder_UnsupportedGameType(); - } - } else { - // Determine the contract name and blueprints for the game type. - string memory gameContractName; - address blueprint1; - address blueprint2; - uint256 gameL2ChainId; - - // Separate context to avoid stack too deep. - { - // Grab the blueprints once since we'll need it multiple times below. - OPContractsManager.Blueprints memory bps = getBlueprints(); - - // Determine the contract name and blueprints for the game type. - if ( - gameConfig.disputeGameType.raw() == GameTypes.CANNON.raw() - || ( - isDevFeatureEnabled(DevFeatures.CANNON_KONA) - && gameConfig.disputeGameType.raw() == GameTypes.CANNON_KONA.raw() - ) - ) { - gameContractName = "FaultDisputeGame"; - blueprint1 = bps.permissionlessDisputeGame1; - blueprint2 = bps.permissionlessDisputeGame2; - gameL2ChainId = l2ChainId; - } else if (gameConfig.disputeGameType.raw() == GameTypes.PERMISSIONED_CANNON.raw()) { - gameContractName = "PermissionedDisputeGame"; - blueprint1 = bps.permissionedDisputeGame1; - blueprint2 = bps.permissionedDisputeGame2; - gameL2ChainId = l2ChainId; - } else { - revert OPContractsManagerGameTypeAdder_UnsupportedGameType(); - } - } + if (isCannonGameVariant(gameConfig.disputeGameType) || isKonaGameVariant(gameConfig.disputeGameType)) { + address impl = getDisputeGameImplementation(gameConfig.disputeGameType); + bytes memory gameArgs = LibGameArgs.encode( + LibGameArgs.GameArgs({ + absolutePrestate: gameConfig.disputeAbsolutePrestate.raw(), + vm: address(gameConfig.vm), + anchorStateRegistry: address(getAnchorStateRegistry(ISystemConfig(gameConfig.systemConfig))), + weth: address(outputs[i].delayedWETH), + // must be zero for SUPER game types + l2ChainId: isSuperGameVariant(gameConfig.disputeGameType) ? 0 : l2ChainId, + proposer: address(0), + challenger: address(0) + }) + ); - // Encode the constructor data for the game type. - bytes memory constructorData; - if (gameConfig.permissioned) { - constructorData = encodePermissionedFDGConstructor( - IFaultDisputeGame.GameConstructorParams( - gameConfig.disputeGameType, - gameConfig.disputeAbsolutePrestate, - gameConfig.disputeMaxGameDepth, - gameConfig.disputeSplitDepth, - gameConfig.disputeClockExtension, - gameConfig.disputeMaxClockDuration, - gameConfig.vm, - outputs[i].delayedWETH, - getAnchorStateRegistry(gameConfig.systemConfig), - gameL2ChainId + setDGFImplementation(dgf, gameConfig.disputeGameType, IDisputeGame(impl), gameArgs); + outputs[i].faultDisputeGame = IFaultDisputeGame(impl); + } else if ( + gameConfig.disputeGameType.raw() == GameTypes.PERMISSIONED_CANNON.raw() + || gameConfig.disputeGameType.raw() == GameTypes.SUPER_PERMISSIONED_CANNON.raw() + ) { + address impl = getDisputeGameImplementation(gameConfig.disputeGameType); + bytes memory gameArgs = LibGameArgs.encode( + LibGameArgs.GameArgs({ + absolutePrestate: gameConfig.disputeAbsolutePrestate.raw(), + vm: address(gameConfig.vm), + anchorStateRegistry: address(getAnchorStateRegistry(ISystemConfig(gameConfig.systemConfig))), + weth: address(outputs[i].delayedWETH), + l2ChainId: gameConfig.disputeGameType.raw() == GameTypes.PERMISSIONED_CANNON.raw() ? l2ChainId : 0, // must + // be zero for SUPER gam types + proposer: getProposer( + dgf, IPermissionedDisputeGame(address(existingGame)), gameConfig.disputeGameType ), - getProposer(dgf, IPermissionedDisputeGame(address(existingGame)), gameConfig.disputeGameType), - getChallenger(dgf, IPermissionedDisputeGame(address(existingGame)), gameConfig.disputeGameType) - ); - } else { - constructorData = encodePermissionlessFDGConstructor( - IFaultDisputeGame.GameConstructorParams( - gameConfig.disputeGameType, - gameConfig.disputeAbsolutePrestate, - gameConfig.disputeMaxGameDepth, - gameConfig.disputeSplitDepth, - gameConfig.disputeClockExtension, - gameConfig.disputeMaxClockDuration, - gameConfig.vm, - outputs[i].delayedWETH, - getAnchorStateRegistry(gameConfig.systemConfig), - gameL2ChainId + challenger: getChallenger( + dgf, IPermissionedDisputeGame(address(existingGame)), gameConfig.disputeGameType ) - ); - } - - // Deploy the new game type. - outputs[i].faultDisputeGame = IFaultDisputeGame( - Blueprint.deployFrom( - blueprint1, - blueprint2, - computeSalt(l2ChainId, gameConfig.saltMixer, gameContractName), - constructorData - ) - ); - - // As a last step, register the new game type with the DisputeGameFactory. If the game - // type already exists, then its implementation will be overwritten. - setDGFImplementation( - dgf, gameConfig.disputeGameType, IDisputeGame(address(outputs[i].faultDisputeGame)) + }) ); + setDGFImplementation(dgf, gameConfig.disputeGameType, IDisputeGame(impl), gameArgs); + outputs[i].faultDisputeGame = IFaultDisputeGame(payable(impl)); + } else { + revert OPContractsManagerGameTypeAdder_UnsupportedGameType(); } dgf.setInitBond(gameConfig.disputeGameType, gameConfig.initialBond); @@ -762,17 +665,14 @@ contract OPContractsManagerGameTypeAdder is OPContractsManagerBase { IDisputeGameFactory dgf = IDisputeGameFactory(_prestateUpdateInputs[i].systemConfigProxy.disputeGameFactory()); - uint256 numGameTypes = isDevFeatureEnabled(DevFeatures.CANNON_KONA) ? 6 : 4; // Create an array of all of the potential game types to update. - GameType[] memory gameTypes = new GameType[](numGameTypes); + GameType[] memory gameTypes = new GameType[](6); gameTypes[0] = GameTypes.CANNON; gameTypes[1] = GameTypes.PERMISSIONED_CANNON; gameTypes[2] = GameTypes.SUPER_CANNON; gameTypes[3] = GameTypes.SUPER_PERMISSIONED_CANNON; - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - gameTypes[4] = GameTypes.CANNON_KONA; - gameTypes[5] = GameTypes.SUPER_CANNON_KONA; - } + gameTypes[4] = GameTypes.CANNON_KONA; + gameTypes[5] = GameTypes.SUPER_CANNON_KONA; // Track if we have a legacy game, super game, or both. We will revert if this function // is ever called with a mix of legacy and super games. Should never happen in @@ -1004,86 +904,50 @@ contract OPContractsManagerUpgrader is OPContractsManagerBase { // All chains have the PermissionedDisputeGame, grab that. IDisputeGame permissionedDisputeGame = getGameImplementation(dgf, GameTypes.PERMISSIONED_CANNON); - if (!isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - // Update the PermissionedDisputeGame. - // We're reusing the same DelayedWETH and ASR contracts. - deployAndSetNewGameImplV1({ - _l2ChainId: _l2ChainId, - _disputeGame: permissionedDisputeGame, - _newDelayedWeth: getWETHV1(IFaultDisputeGame(address(permissionedDisputeGame))), - _newAnchorStateRegistryProxy: getAnchorStateRegistryV1(IFaultDisputeGame(address(permissionedDisputeGame))), - _gameType: GameTypes.PERMISSIONED_CANNON, - _opChainConfig: _opChainConfig - }); - - // Now retrieve the permissionless game. - IDisputeGame permissionlessDisputeGame = getGameImplementation(dgf, GameTypes.CANNON); + setNewPermissionedGameImplV2({ + _impls: _impls, + _l2ChainId: _l2ChainId, + _disputeGame: permissionedDisputeGame, + _newDelayedWeth: getWETH(dgf, permissionedDisputeGame, GameTypes.PERMISSIONED_CANNON), + _newAnchorStateRegistryProxy: getAnchorStateRegistry( + dgf, permissionedDisputeGame, GameTypes.PERMISSIONED_CANNON + ), + _opChainConfig: _opChainConfig + }); - // If it exists, replace its implementation. - // We're reusing the same DelayedWETH and ASR contracts. - if (address(permissionlessDisputeGame) != address(0)) { - deployAndSetNewGameImplV1({ - _l2ChainId: _l2ChainId, - _disputeGame: permissionlessDisputeGame, - _newDelayedWeth: getWETHV1(IFaultDisputeGame(address(permissionlessDisputeGame))), - _newAnchorStateRegistryProxy: getAnchorStateRegistryV1( - IFaultDisputeGame(address(permissionlessDisputeGame)) - ), - _gameType: GameTypes.CANNON, - _opChainConfig: _opChainConfig - }); - } - } else { - setNewPermissionedGameImplV2({ + IDisputeGame permissionlessDisputeGame = getGameImplementation(dgf, GameTypes.CANNON); + + // If it exists, replace its implementation. + // We're reusing the same DelayedWETH and ASR contracts. + if (address(permissionlessDisputeGame) != address(0)) { + IDisputeGameFactory disputeGameFactory = + IDisputeGameFactory(_opChainConfig.systemConfigProxy.disputeGameFactory()); + Claim cannonPrestate = _opChainConfig.cannonPrestate.raw() != bytes32(0) + ? _opChainConfig.cannonPrestate + : getAbsolutePrestate(disputeGameFactory, address(permissionlessDisputeGame), GameTypes.CANNON); + setNewPermissionlessGameImplV2({ _impls: _impls, _l2ChainId: _l2ChainId, - _disputeGame: permissionedDisputeGame, - _newDelayedWeth: getWETH(dgf, permissionedDisputeGame, GameTypes.PERMISSIONED_CANNON), - _newAnchorStateRegistryProxy: getAnchorStateRegistry( - dgf, permissionedDisputeGame, GameTypes.PERMISSIONED_CANNON - ), - _opChainConfig: _opChainConfig + _newAbsolutePrestate: cannonPrestate, + _newDelayedWeth: getWETH(dgf, permissionlessDisputeGame, GameTypes.CANNON), + _newAnchorStateRegistryProxy: getAnchorStateRegistry(dgf, permissionlessDisputeGame, GameTypes.CANNON), + _gameType: GameTypes.CANNON, + _disputeGameFactory: disputeGameFactory }); - IDisputeGame permissionlessDisputeGame = getGameImplementation(dgf, GameTypes.CANNON); - - // If it exists, replace its implementation. - // We're reusing the same DelayedWETH and ASR contracts. - if (address(permissionlessDisputeGame) != address(0)) { - IDisputeGameFactory disputeGameFactory = - IDisputeGameFactory(_opChainConfig.systemConfigProxy.disputeGameFactory()); - Claim cannonPrestate = _opChainConfig.cannonPrestate.raw() != bytes32(0) - ? _opChainConfig.cannonPrestate - : getAbsolutePrestate(disputeGameFactory, address(permissionlessDisputeGame), GameTypes.CANNON); + if (_opChainConfig.cannonKonaPrestate.raw() != bytes32(0)) { setNewPermissionlessGameImplV2({ _impls: _impls, _l2ChainId: _l2ChainId, - _newAbsolutePrestate: cannonPrestate, + _newAbsolutePrestate: _opChainConfig.cannonKonaPrestate, + // CANNON and CANNON_KONA use the same weth and asr proxy addresses _newDelayedWeth: getWETH(dgf, permissionlessDisputeGame, GameTypes.CANNON), _newAnchorStateRegistryProxy: getAnchorStateRegistry(dgf, permissionlessDisputeGame, GameTypes.CANNON), - _gameType: GameTypes.CANNON, + _gameType: GameTypes.CANNON_KONA, _disputeGameFactory: disputeGameFactory }); - - if ( - isDevFeatureEnabled(DevFeatures.CANNON_KONA) - && _opChainConfig.cannonKonaPrestate.raw() != bytes32(0) - ) { - setNewPermissionlessGameImplV2({ - _impls: _impls, - _l2ChainId: _l2ChainId, - _newAbsolutePrestate: _opChainConfig.cannonKonaPrestate, - // CANNON and CANNON_KONA use the same weth and asr proxy addresses - _newDelayedWeth: getWETH(dgf, permissionlessDisputeGame, GameTypes.CANNON), - _newAnchorStateRegistryProxy: getAnchorStateRegistry( - dgf, permissionlessDisputeGame, GameTypes.CANNON - ), - _gameType: GameTypes.CANNON_KONA, - _disputeGameFactory: disputeGameFactory - }); - uint256 initialCannonGameBond = disputeGameFactory.initBonds(GameTypes.CANNON); - disputeGameFactory.setInitBond(GameTypes.CANNON_KONA, initialCannonGameBond); - } + uint256 initialCannonGameBond = disputeGameFactory.initBonds(GameTypes.CANNON); + disputeGameFactory.setInitBond(GameTypes.CANNON_KONA, initialCannonGameBond); } } } @@ -1124,80 +988,6 @@ contract OPContractsManagerUpgrader is OPContractsManagerBase { assertValidContractAddress(address(_config.systemConfigProxy)); } - /// @notice Deploys and sets a new v1 dispute game implementation - /// @param _l2ChainId The L2 chain ID - /// @param _disputeGame The current dispute game implementation - /// @param _newDelayedWeth The new delayed WETH implementation - /// @param _newAnchorStateRegistryProxy The new anchor state registry proxy - /// @param _gameType The type of game to deploy - /// @param _opChainConfig The OP chain configuration - function deployAndSetNewGameImplV1( - uint256 _l2ChainId, - IDisputeGame _disputeGame, - IDelayedWETH _newDelayedWeth, - IAnchorStateRegistry _newAnchorStateRegistryProxy, - GameType _gameType, - OPContractsManager.OpChainConfig memory _opChainConfig - ) - internal - { - OPContractsManager.Blueprints memory bps = getBlueprints(); - OPContractsManager.Implementations memory impls = getImplementations(); - - // Get the constructor params for the game - IFaultDisputeGame.GameConstructorParams memory params = - getGameConstructorParams(IFaultDisputeGame(address(_disputeGame))); - - // Modify the params with the new vm values. - params.weth = _newDelayedWeth; - params.anchorStateRegistry = _newAnchorStateRegistryProxy; - params.vm = IBigStepper(impls.mipsImpl); - - // If the prestate is set in the config, use it. If not set, we'll try to use the prestate - // that already exists on the current dispute game. - if (Claim.unwrap(_opChainConfig.cannonPrestate) != bytes32(0)) { - params.absolutePrestate = _opChainConfig.cannonPrestate; - } - - // As a sanity check, if the prestate is zero here, revert. - if (params.absolutePrestate.raw() == bytes32(0)) { - revert OPContractsManager.PrestateNotSet(); - } - - IDisputeGame newGame; - if (GameType.unwrap(_gameType) == GameType.unwrap(GameTypes.PERMISSIONED_CANNON)) { - address proposer = getProposerV1(IPermissionedDisputeGame(address(_disputeGame))); - address challenger = getChallengerV1(IPermissionedDisputeGame(address(_disputeGame))); - newGame = IDisputeGame( - Blueprint.deployFrom( - bps.permissionedDisputeGame1, - bps.permissionedDisputeGame2, - computeSalt( - _l2ChainId, reusableSaltMixer(_opChainConfig.systemConfigProxy), "PermissionedDisputeGame" - ), - encodePermissionedFDGConstructor(params, proposer, challenger) - ) - ); - } else { - newGame = IDisputeGame( - Blueprint.deployFrom( - bps.permissionlessDisputeGame1, - bps.permissionlessDisputeGame2, - computeSalt( - _l2ChainId, reusableSaltMixer(_opChainConfig.systemConfigProxy), "PermissionlessDisputeGame" - ), - encodePermissionlessFDGConstructor(params) - ) - ); - } - - // Grab the DisputeGameFactory from the SystemConfig. - IDisputeGameFactory dgf = IDisputeGameFactory(_opChainConfig.systemConfigProxy.disputeGameFactory()); - - // Set the new implementation. - setDGFImplementation(dgf, _gameType, IDisputeGame(newGame)); - } - /// @notice Sets the latest permissioned dispute game v2 implementation /// @param _impls The container for the new dispute game implementations. /// @param _l2ChainId The L2 chain ID @@ -1418,32 +1208,6 @@ contract OPContractsManagerDeployer is OPContractsManagerBase { ) ); - if (!isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - output.permissionedDisputeGame = IPermissionedDisputeGame( - Blueprint.deployFrom( - blueprint.permissionedDisputeGame1, - blueprint.permissionedDisputeGame2, - computeSalt(_input.l2ChainId, _input.saltMixer, "PermissionedDisputeGame"), - encodePermissionedFDGConstructor( - IFaultDisputeGame.GameConstructorParams({ - gameType: GameTypes.PERMISSIONED_CANNON, - absolutePrestate: _input.disputeAbsolutePrestate, - maxGameDepth: _input.disputeMaxGameDepth, - splitDepth: _input.disputeSplitDepth, - clockExtension: _input.disputeClockExtension, - maxClockDuration: _input.disputeMaxClockDuration, - vm: IBigStepper(implementation.mipsImpl), - weth: IDelayedWETH(payable(address(output.delayedWETHPermissionedGameProxy))), - anchorStateRegistry: IAnchorStateRegistry(address(output.anchorStateRegistryProxy)), - l2ChainId: _input.l2ChainId - }), - _input.roles.proposer, - _input.roles.challenger - ) - ) - ); - } - // -------- Set and Initialize Proxy Implementations -------- bytes memory data; @@ -1534,18 +1298,8 @@ contract OPContractsManagerDeployer is OPContractsManagerBase { implementation.disputeGameFactoryImpl, data ); - // Register the appropriate dispute game implementation based on the feature flag - if (isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - // Extracted to helper function to avoid stack too deep error - _registerPermissionedGameV2(_input, implementation, output); - } else { - // Register v1 implementation for PERMISSIONED_CANNON game type - setDGFImplementation( - output.disputeGameFactoryProxy, - GameTypes.PERMISSIONED_CANNON, - IDisputeGame(address(output.permissionedDisputeGame)) - ); - } + // Extracted to helper function to avoid stack too deep error + _registerPermissionedGameV2(_input, implementation, output); transferOwnership(address(output.disputeGameFactoryProxy), address(_input.roles.opChainProxyAdminOwner)); @@ -1849,13 +1603,9 @@ contract OPContractsManagerInteropMigrator is OPContractsManagerBase { if (_input.opChainConfigs[i].cannonPrestate.raw() != _input.opChainConfigs[0].cannonPrestate.raw()) { revert OPContractsManagerInteropMigrator_AbsolutePrestateMismatch(); } - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - if ( - _input.opChainConfigs[i].cannonKonaPrestate.raw() - != _input.opChainConfigs[0].cannonKonaPrestate.raw() - ) { - revert OPContractsManagerInteropMigrator_AbsolutePrestateMismatch(); - } + if (_input.opChainConfigs[i].cannonKonaPrestate.raw() != _input.opChainConfigs[0].cannonKonaPrestate.raw()) + { + revert OPContractsManagerInteropMigrator_AbsolutePrestateMismatch(); } } @@ -1981,10 +1731,8 @@ contract OPContractsManagerInteropMigrator is OPContractsManagerBase { clearGameImplementation(oldDisputeGameFactory, GameTypes.SUPER_CANNON); clearGameImplementation(oldDisputeGameFactory, GameTypes.PERMISSIONED_CANNON); clearGameImplementation(oldDisputeGameFactory, GameTypes.SUPER_PERMISSIONED_CANNON); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - clearGameImplementation(oldDisputeGameFactory, GameTypes.CANNON_KONA); - clearGameImplementation(oldDisputeGameFactory, GameTypes.SUPER_CANNON_KONA); - } + clearGameImplementation(oldDisputeGameFactory, GameTypes.CANNON_KONA); + clearGameImplementation(oldDisputeGameFactory, GameTypes.SUPER_CANNON_KONA); // Migrate the portal to the new ETHLockbox and AnchorStateRegistry. portals[i].migrateToSuperRoots(newEthLockbox, newAnchorStateRegistry); @@ -2077,7 +1825,7 @@ contract OPContractsManagerInteropMigrator is OPContractsManagerBase { // If the cannon-kona game is being used, set that up too. bytes32 cannonKonaPrestate = _input.opChainConfigs[0].cannonKonaPrestate.raw(); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA) && cannonKonaPrestate != bytes32(0)) { + if (cannonKonaPrestate != bytes32(0)) { gameArgs = LibGameArgs.encode( LibGameArgs.GameArgs({ absolutePrestate: cannonKonaPrestate, @@ -2098,11 +1846,7 @@ contract OPContractsManagerInteropMigrator is OPContractsManagerBase { } function clearGameImplementation(IDisputeGameFactory _dgf, GameType _gameType) internal { - if (isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - _dgf.setImplementation(_gameType, IDisputeGame(address(0)), hex""); - } else { - _dgf.setImplementation(_gameType, IDisputeGame(address(0))); - } + _dgf.setImplementation(_gameType, IDisputeGame(address(0)), hex""); } } @@ -2172,10 +1916,6 @@ contract OPContractsManager is ISemver { address proxyAdmin; address l1ChugSplashProxy; address resolvedDelegateProxy; - address permissionedDisputeGame1; - address permissionedDisputeGame2; - address permissionlessDisputeGame1; - address permissionlessDisputeGame2; } /// @notice The latest implementation contracts for the OP Stack. @@ -2236,9 +1976,9 @@ contract OPContractsManager is ISemver { // -------- Constants and Variables -------- - /// @custom:semver 5.7.1 + /// @custom:semver 6.0.0 function version() public pure virtual returns (string memory) { - return "5.7.1"; + return "6.0.0"; } OPContractsManagerGameTypeAdder public immutable opcmGameTypeAdder; diff --git a/packages/contracts-bedrock/src/L1/OPContractsManagerStandardValidator.sol b/packages/contracts-bedrock/src/L1/OPContractsManagerStandardValidator.sol index d3f498bbb0640..7831f956fde39 100644 --- a/packages/contracts-bedrock/src/L1/OPContractsManagerStandardValidator.sol +++ b/packages/contracts-bedrock/src/L1/OPContractsManagerStandardValidator.sol @@ -40,8 +40,8 @@ import { IBigStepper } from "interfaces/dispute/IBigStepper.sol"; /// before and after an upgrade. contract OPContractsManagerStandardValidator is ISemver { /// @notice The semantic version of the OPContractsManagerStandardValidator contract. - /// @custom:semver 2.2.0 - string public constant version = "2.2.0"; + /// @custom:semver 2.3.0 + string public constant version = "2.3.0"; /// @notice The SuperchainConfig contract. ISuperchainConfig public superchainConfig; @@ -93,6 +93,12 @@ contract OPContractsManagerStandardValidator is ISemver { /// @notice The MIPS implementation address. address public mipsImpl; + /// @notice The FaultDisputeGame implementation address. + address public faultDisputeGameImpl; + + /// @notice The PermissionedFaultDisputeGame implementation address. + address public permissionedDisputeGameImpl; + /// @notice Bitmap of development features, verification may depend on these features. bytes32 public devFeatureBitmap; @@ -110,6 +116,8 @@ contract OPContractsManagerStandardValidator is ISemver { address anchorStateRegistryImpl; address delayedWETHImpl; address mipsImpl; + address faultDisputeGameImpl; + address permissionedDisputeGameImpl; } /// @notice Struct containing the input parameters for the validation process. @@ -183,6 +191,8 @@ contract OPContractsManagerStandardValidator is ISemver { anchorStateRegistryImpl = _implementations.anchorStateRegistryImpl; delayedWETHImpl = _implementations.delayedWETHImpl; mipsImpl = _implementations.mipsImpl; + faultDisputeGameImpl = _implementations.faultDisputeGameImpl; + permissionedDisputeGameImpl = _implementations.permissionedDisputeGameImpl; } /// @notice Returns a string representing the overrides that are set. @@ -217,15 +227,6 @@ contract OPContractsManagerStandardValidator is ISemver { return challenger; } - /// @notice Returns the expected PermissionedDisputeGame version. - function permissionedDisputeGameVersion() public view returns (string memory) { - if (DevFeatures.isDevFeatureEnabled(devFeatureBitmap, DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - return "2.2.0"; - } else { - return "1.8.0"; - } - } - /// @notice Returns the expected PreimageOracle version. function preimageOracleVersion() public pure returns (string memory) { return "1.1.4"; @@ -655,7 +656,12 @@ contract OPContractsManagerStandardValidator is ISemver { IDisputeGameFactory dgf = IDisputeGameFactory(_args.sysCfg.disputeGameFactory()); errors_ = internalRequire( - LibString.eq(getVersion(game.gameAddress), permissionedDisputeGameVersion()), + LibString.eq( + getVersion(game.gameAddress), + _args.gameType.raw() == GameTypes.PERMISSIONED_CANNON.raw() + ? getVersion(permissionedDisputeGameImpl) + : getVersion(faultDisputeGameImpl) + ), string.concat(errorPrefix, "-20"), errors_ ); @@ -887,18 +893,16 @@ contract OPContractsManagerStandardValidator is ISemver { _overrides, "PLDG" ); - if (DevFeatures.isDevFeatureEnabled(devFeatureBitmap, DevFeatures.CANNON_KONA)) { - _errors = assertValidPermissionlessDisputeGame( - _errors, - _input.sysCfg, - GameTypes.CANNON_KONA, - _input.cannonKonaPrestate, - _input.l2ChainID, - _proxyAdmin, - _overrides, - "CKDG" - ); - } + _errors = assertValidPermissionlessDisputeGame( + _errors, + _input.sysCfg, + GameTypes.CANNON_KONA, + _input.cannonKonaPrestate, + _input.l2ChainID, + _proxyAdmin, + _overrides, + "CKDG" + ); _errors = assertValidETHLockbox(_errors, _input.sysCfg, _proxyAdmin); @@ -942,22 +946,16 @@ contract OPContractsManagerStandardValidator is ISemver { string memory _errorPrefix ) internal - view + pure returns (string memory errors_, bool failed_) { _errorPrefix = string.concat(_errorPrefix, "-GARGS"); - if (DevFeatures.isDevFeatureEnabled(devFeatureBitmap, DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - if (_isPermissioned) { - bool ok = LibGameArgs.isValidPermissionedArgs(_gameArgsBytes); - _errors = internalRequire(ok, string.concat(_errorPrefix, "-10"), _errors); - return (_errors, !ok); - } else { - bool ok = LibGameArgs.isValidPermissionlessArgs(_gameArgsBytes); - _errors = internalRequire(ok, string.concat(_errorPrefix, "-10"), _errors); - return (_errors, !ok); - } + if (_isPermissioned) { + bool ok = LibGameArgs.isValidPermissionedArgs(_gameArgsBytes); + _errors = internalRequire(ok, string.concat(_errorPrefix, "-10"), _errors); + return (_errors, !ok); } else { - bool ok = _gameArgsBytes.length == 0; + bool ok = LibGameArgs.isValidPermissionlessArgs(_gameArgsBytes); _errors = internalRequire(ok, string.concat(_errorPrefix, "-10"), _errors); return (_errors, !ok); } @@ -974,23 +972,7 @@ contract OPContractsManagerStandardValidator is ISemver { view returns (DisputeGameImplementation memory gameImpl_) { - GameType gameType; - LibGameArgs.GameArgs memory gameArgs; - if (DevFeatures.isDevFeatureEnabled(devFeatureBitmap, DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - gameType = _gameType; - gameArgs = LibGameArgs.decode(_gameArgsBytes); - } else { - gameType = _game.gameType(); - gameArgs.absolutePrestate = Claim.unwrap(_game.absolutePrestate()); - gameArgs.vm = address(_game.vm()); - gameArgs.anchorStateRegistry = address(_game.anchorStateRegistry()); - gameArgs.weth = address(_game.weth()); - gameArgs.l2ChainId = _game.l2ChainId(); - if (_gameType.raw() == GameTypes.PERMISSIONED_CANNON.raw()) { - gameArgs.challenger = _game.challenger(); - gameArgs.proposer = _game.proposer(); - } - } + LibGameArgs.GameArgs memory gameArgs = LibGameArgs.decode(_gameArgsBytes); gameImpl_ = DisputeGameImplementation({ gameAddress: address(_game), @@ -998,7 +980,7 @@ contract OPContractsManagerStandardValidator is ISemver { splitDepth: _game.splitDepth(), maxClockDuration: _game.maxClockDuration(), clockExtension: _game.clockExtension(), - gameType: gameType, + gameType: _gameType, l2SequenceNumber: _game.l2SequenceNumber(), absolutePrestate: Claim.wrap(gameArgs.absolutePrestate), vm: IBigStepper(gameArgs.vm), diff --git a/packages/contracts-bedrock/src/libraries/DevFeatures.sol b/packages/contracts-bedrock/src/libraries/DevFeatures.sol index 5b7f8bd3cca69..22f3143b7f541 100644 --- a/packages/contracts-bedrock/src/libraries/DevFeatures.sol +++ b/packages/contracts-bedrock/src/libraries/DevFeatures.sol @@ -15,10 +15,13 @@ library DevFeatures { bytes32(0x0000000000000000000000000000000000000000000000000000000000000001); /// @notice The feature that enables deployment of the CANNON_KONA fault dispute game. - /// This feature depends on the DEPLOY_V2_DISPUTE_GAMES feature + /// @custom:legacy + /// This feature is no longer used, but is kept here for legacy reasons. bytes32 public constant CANNON_KONA = bytes32(0x0000000000000000000000000000000000000000000000000000000000000010); /// @notice The feature that enables deployment of V2 dispute game contracts. + /// @custom:legacy + /// This feature is no longer used, but is kept here for legacy reasons. bytes32 public constant DEPLOY_V2_DISPUTE_GAMES = bytes32(0x0000000000000000000000000000000000000000000000000000000000000100); diff --git a/packages/contracts-bedrock/test/L1/OPContractsManager.t.sol b/packages/contracts-bedrock/test/L1/OPContractsManager.t.sol index 877ab5e9781d5..3a063f11b15d4 100644 --- a/packages/contracts-bedrock/test/L1/OPContractsManager.t.sol +++ b/packages/contracts-bedrock/test/L1/OPContractsManager.t.sol @@ -294,9 +294,7 @@ contract OPContractsManager_Upgrade_Harness is CommonTest, DisputeGames { // checks. Easier to just expect the error in this case. // We add the prefix of OVERRIDES-L1PAOMULTISIG,OVERRIDES-CHALLENGER because we use validationOverrides. if (opChainConfigs[0].cannonPrestate.raw() == bytes32(0)) { - if ( - opChainConfigs[0].cannonKonaPrestate.raw() == bytes32(0) && isDevFeatureEnabled(DevFeatures.CANNON_KONA) - ) { + if (opChainConfigs[0].cannonKonaPrestate.raw() == bytes32(0)) { vm.expectRevert( "OPContractsManagerStandardValidator: OVERRIDES-L1PAOMULTISIG,OVERRIDES-CHALLENGER,PDDG-40,PLDG-40,CKDG-10" ); @@ -305,37 +303,22 @@ contract OPContractsManager_Upgrade_Harness is CommonTest, DisputeGames { "OPContractsManagerStandardValidator: OVERRIDES-L1PAOMULTISIG,OVERRIDES-CHALLENGER,PDDG-40,PLDG-40" ); } - } else if ( - opChainConfigs[0].cannonKonaPrestate.raw() == bytes32(0) && isDevFeatureEnabled(DevFeatures.CANNON_KONA) - ) { + } else if (opChainConfigs[0].cannonKonaPrestate.raw() == bytes32(0)) { vm.expectRevert("OPContractsManagerStandardValidator: OVERRIDES-L1PAOMULTISIG,OVERRIDES-CHALLENGER,CKDG-10"); } // Run the StandardValidator checks. - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - validator.validateWithOverrides( - IOPContractsManagerStandardValidator.ValidationInputDev({ - sysCfg: opChainConfigs[0].systemConfigProxy, - cannonPrestate: opChainConfigs[0].cannonPrestate.raw(), - cannonKonaPrestate: opChainConfigs[0].cannonKonaPrestate.raw(), - l2ChainID: l2ChainId, - proposer: initialProposer - }), - false, - validationOverrides - ); - } else { - validator.validateWithOverrides( - IOPContractsManagerStandardValidator.ValidationInput({ - sysCfg: opChainConfigs[0].systemConfigProxy, - absolutePrestate: opChainConfigs[0].cannonPrestate.raw(), - l2ChainID: l2ChainId, - proposer: initialProposer - }), - false, - validationOverrides - ); - } + validator.validateWithOverrides( + IOPContractsManagerStandardValidator.ValidationInputDev({ + sysCfg: opChainConfigs[0].systemConfigProxy, + cannonPrestate: opChainConfigs[0].cannonPrestate.raw(), + cannonKonaPrestate: opChainConfigs[0].cannonKonaPrestate.raw(), + l2ChainID: l2ChainId, + proposer: initialProposer + }), + false, + validationOverrides + ); _runPostUpgradeSmokeTests(_opcm, opChainConfigs[0], initialChallenger, initialProposer); } @@ -356,8 +339,7 @@ contract OPContractsManager_Upgrade_Harness is CommonTest, DisputeGames { (, uint256 rootBlockNumber) = optimismPortal2.anchorStateRegistry().getAnchorRoot(); uint256 l2BlockNumber = rootBlockNumber + 1; - bool expectCannonKonaGameSet = - isDevFeatureEnabled(DevFeatures.CANNON_KONA) && _opChainConfig.cannonKonaPrestate.raw() != bytes32(0); + bool expectCannonKonaGameSet = _opChainConfig.cannonKonaPrestate.raw() != bytes32(0); // Deploy live games and ensure they're configured correctly GameType[] memory gameTypes = new GameType[](expectCannonKonaGameSet ? 3 : 2); @@ -639,28 +621,26 @@ contract OPContractsManager_AddGameType_Test is OPContractsManager_TestInit { // L2 chain ID call should not revert because this is not a Super game. assertEq(newPDG.l2ChainId(), chain1L2ChainId, "l2ChainId should be set correctly"); - if (isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - // Get the v2 implementation address from OPCM - IOPContractsManager.Implementations memory impls = opcm.implementations(); + // Get the v2 implementation address from OPCM + IOPContractsManager.Implementations memory impls = opcm.implementations(); - // Verify v2 implementation is registered in DisputeGameFactory - address registeredImpl = - address(chainDeployOutput1.disputeGameFactoryProxy.gameImpls(GameTypes.PERMISSIONED_CANNON)); + // Verify v2 implementation is registered in DisputeGameFactory + address registeredImpl = + address(chainDeployOutput1.disputeGameFactoryProxy.gameImpls(GameTypes.PERMISSIONED_CANNON)); - // Verify implementation address matches permissionedDisputeGameV2Impl - assertEq( - registeredImpl, - address(impls.permissionedDisputeGameV2Impl), - "DisputeGameFactory should have v2 PermissionedDisputeGame implementation registered" - ); + // Verify implementation address matches permissionedDisputeGameV2Impl + assertEq( + registeredImpl, + address(impls.permissionedDisputeGameV2Impl), + "DisputeGameFactory should have v2 PermissionedDisputeGame implementation registered" + ); - // Verify that the returned fault dispute game is the v2 implementation - assertEq( - address(output.faultDisputeGame), - address(impls.permissionedDisputeGameV2Impl), - "addGameType should return v2 PermissionedDisputeGame implementation" - ); - } + // Verify that the returned fault dispute game is the v2 implementation + assertEq( + address(output.faultDisputeGame), + address(impls.permissionedDisputeGameV2Impl), + "addGameType should return v2 PermissionedDisputeGame implementation" + ); } /// @notice Tests that we can add a FaultDisputeGame implementation with addGameType. @@ -686,24 +666,22 @@ contract OPContractsManager_AddGameType_Test is OPContractsManager_TestInit { address registeredImpl = address(chainDeployOutput1.disputeGameFactoryProxy.gameImpls(input.disputeGameType)); assertNotEq(registeredImpl, address(0), "Implementation should have been set"); - if (isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - // Get the v2 implementation address from OPCM - IOPContractsManager.Implementations memory impls = opcm.implementations(); + // Get the v2 implementation address from OPCM + IOPContractsManager.Implementations memory impls = opcm.implementations(); - // Verify implementation address matches permissionedDisputeGameV2Impl - assertEq( - registeredImpl, - address(impls.faultDisputeGameV2Impl), - "DisputeGameFactory should have v2 FaultDisputeGame implementation registered" - ); + // Verify implementation address matches permissionedDisputeGameV2Impl + assertEq( + registeredImpl, + address(impls.faultDisputeGameV2Impl), + "DisputeGameFactory should have v2 FaultDisputeGame implementation registered" + ); - // Verify that the returned fault dispute game is the v2 implementation - assertEq( - address(output.faultDisputeGame), - address(impls.faultDisputeGameV2Impl), - "addGameType should return v2 FaultDisputeGame implementation" - ); - } + // Verify that the returned fault dispute game is the v2 implementation + assertEq( + address(output.faultDisputeGame), + address(impls.faultDisputeGameV2Impl), + "addGameType should return v2 FaultDisputeGame implementation" + ); } /// @notice Tests that we can add a SuperPermissionedDisputeGame implementation with addGameType. @@ -795,30 +773,6 @@ contract OPContractsManager_AddGameType_Test is OPContractsManager_TestInit { assertFalse(success, "addGameType should have failed"); } - /// @notice Tests that addGameType will revert if the game type is cannon-kona and the dev feature is not enabled - function test_addGameType_cannonKonaGameTypeDisabled_reverts() public { - skipIfDevFeatureEnabled(DevFeatures.CANNON_KONA); - IOPContractsManager.AddGameInput memory input = newGameInputFactory(GameTypes.CANNON_KONA); - - // Run the addGameType call, should revert. - IOPContractsManager.AddGameInput[] memory inputs = new IOPContractsManager.AddGameInput[](1); - inputs[0] = input; - (bool success,) = address(opcm).delegatecall(abi.encodeCall(IOPContractsManager.addGameType, (inputs))); - assertFalse(success, "addGameType should have failed"); - } - - /// @notice Tests that addGameType will revert if the game type is cannon-kona and the dev feature is not enabled - function test_addGameType_superCannonKonaGameTypeDisabled_reverts() public { - skipIfDevFeatureEnabled(DevFeatures.CANNON_KONA); - IOPContractsManager.AddGameInput memory input = newGameInputFactory(GameTypes.SUPER_CANNON_KONA); - - // Run the addGameType call, should revert. - IOPContractsManager.AddGameInput[] memory inputs = new IOPContractsManager.AddGameInput[](1); - inputs[0] = input; - (bool success,) = address(opcm).delegatecall(abi.encodeCall(IOPContractsManager.addGameType, (inputs))); - assertFalse(success, "addGameType should have failed"); - } - function test_addGameType_reusedDelayedWETH_succeeds() public { IDelayedWETH delayedWETH = IDelayedWETH( DeployUtils.create1({ @@ -933,7 +887,6 @@ contract OPContractsManager_AddGameType_Test is OPContractsManager_TestInit { /// @notice Tests that addGameType will revert if the game type is cannon-kona and the dev feature is not enabled function test_addGameType_cannonKonaGameType_succeeds() public { - skipIfDevFeatureDisabled(DevFeatures.CANNON_KONA); // Create the input for the cannon-kona game type. IOPContractsManager.AddGameInput memory input = newGameInputFactory(GameTypes.CANNON_KONA); @@ -955,7 +908,6 @@ contract OPContractsManager_AddGameType_Test is OPContractsManager_TestInit { /// @notice Tests that addGameType will revert if the game type is cannon-kona and the dev feature is not enabled function test_addGameType_superCannonKonaGameType_succeeds() public { skipIfDevFeatureDisabled(DevFeatures.OPTIMISM_PORTAL_INTEROP); - skipIfDevFeatureDisabled(DevFeatures.CANNON_KONA); // Create the input for the cannon-kona game type. IOPContractsManager.AddGameInput memory input = newGameInputFactory(GameTypes.SUPER_CANNON_KONA); @@ -1287,7 +1239,6 @@ contract OPContractsManager_UpdatePrestate_Test is OPContractsManager_TestInit { /// @notice Tests that we can update the prestate for both CANNON and CANNON_KONA game types. function test_updatePrestate_bothGamesAndCannonKonaWithValidInput_succeeds() public { - skipIfDevFeatureDisabled(DevFeatures.CANNON_KONA); // Add a FaultDisputeGame implementation via addGameType. IOPContractsManager.AddGameInput memory input = newGameInputFactory(GameTypes.CANNON); addGameType(input); @@ -1306,7 +1257,6 @@ contract OPContractsManager_UpdatePrestate_Test is OPContractsManager_TestInit { } function test_updatePrestate_cannonKonaWithSuperGame_succeeds() public { - skipIfDevFeatureDisabled(DevFeatures.CANNON_KONA); skipIfDevFeatureDisabled(DevFeatures.OPTIMISM_PORTAL_INTEROP); _mockSuperPermissionedGame(); @@ -1368,7 +1318,6 @@ contract OPContractsManager_UpdatePrestate_Test is OPContractsManager_TestInit { /// @notice Tests that we can update the prestate when both the PermissionedDisputeGame and /// FaultDisputeGame exist, and the FaultDisputeGame is of type CANNON_KONA. function test_updatePrestate_pdgAndCannonKonaOnly_succeeds() public { - skipIfDevFeatureDisabled(DevFeatures.CANNON_KONA); IOPContractsManager.AddGameInput memory input = newGameInputFactory(GameTypes.CANNON_KONA); addGameType(input); @@ -1385,7 +1334,6 @@ contract OPContractsManager_UpdatePrestate_Test is OPContractsManager_TestInit { /// mixed game types (i.e. CANNON and SUPER_CANNON_KONA). function test_updatePrestate_cannonKonaMixedGameTypes_reverts() public { skipIfDevFeatureDisabled(DevFeatures.OPTIMISM_PORTAL_INTEROP); - skipIfDevFeatureDisabled(DevFeatures.CANNON_KONA); // Add a SuperFaultDisputeGame implementation via addGameType. IOPContractsManager.AddGameInput memory input = newGameInputFactory(GameTypes.SUPER_CANNON_KONA); @@ -1409,7 +1357,6 @@ contract OPContractsManager_UpdatePrestate_Test is OPContractsManager_TestInit { function test_updatePrestate_presetCannonKonaWhenOnlyCannonPrestateIsZeroAndCannonGameTypeDisabled_reverts() public { - skipIfDevFeatureDisabled(DevFeatures.CANNON_KONA); IOPContractsManager.AddGameInput memory input = newGameInputFactory(GameTypes.CANNON_KONA); addGameType(input); @@ -1427,7 +1374,6 @@ contract OPContractsManager_UpdatePrestate_Test is OPContractsManager_TestInit { /// @notice Tests that the updatePrestate function will revert if the provided prestate is the /// zero hash. function test_updatePrestate_whenCannonKonaPrestateIsZero_reverts() public { - skipIfDevFeatureDisabled(DevFeatures.CANNON_KONA); IOPContractsManager.AddGameInput memory input = newGameInputFactory(GameTypes.CANNON_KONA); addGameType(input); @@ -1514,31 +1460,19 @@ contract OPContractsManager_Upgrade_Test is OPContractsManager_Upgrade_Harness { runCurrentUpgrade(upgrader); // Get the absolute prestate after the upgrade - Claim pdgPrestateAfter; - Claim fdgPrestateAfter; - if (isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - pdgPrestateAfter = getDisputeGameV2AbsolutePrestate(GameTypes.PERMISSIONED_CANNON); - fdgPrestateAfter = getDisputeGameV2AbsolutePrestate(GameTypes.CANNON); - } else { - pdgPrestateAfter = IPermissionedDisputeGame( - address(disputeGameFactory.gameImpls(GameTypes.PERMISSIONED_CANNON)) - ).absolutePrestate(); - fdgPrestateAfter = - IFaultDisputeGame(address(disputeGameFactory.gameImpls(GameTypes.CANNON))).absolutePrestate(); - } + Claim pdgPrestateAfter = getDisputeGameV2AbsolutePrestate(GameTypes.PERMISSIONED_CANNON); + Claim fdgPrestateAfter = getDisputeGameV2AbsolutePrestate(GameTypes.CANNON); // Assert that the absolute prestate is the non-zero value we set. assertEq(pdgPrestateAfter.raw(), bytes32(uint256(1))); assertEq(fdgPrestateAfter.raw(), bytes32(uint256(1))); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - LibGameArgs.GameArgs memory cannonArgs = LibGameArgs.decode(disputeGameFactory.gameArgs(GameTypes.CANNON)); - LibGameArgs.GameArgs memory cannonKonaArgs = - LibGameArgs.decode(disputeGameFactory.gameArgs(GameTypes.CANNON_KONA)); - assertEq(cannonKonaArgs.weth, cannonArgs.weth); - assertEq(cannonKonaArgs.anchorStateRegistry, cannonArgs.anchorStateRegistry); - assertEq(cannonKonaArgs.absolutePrestate, bytes32(uint256(2))); - } + LibGameArgs.GameArgs memory cannonArgs = LibGameArgs.decode(disputeGameFactory.gameArgs(GameTypes.CANNON)); + LibGameArgs.GameArgs memory cannonKonaArgs = + LibGameArgs.decode(disputeGameFactory.gameArgs(GameTypes.CANNON_KONA)); + assertEq(cannonKonaArgs.weth, cannonArgs.weth); + assertEq(cannonKonaArgs.anchorStateRegistry, cannonArgs.anchorStateRegistry); + assertEq(cannonKonaArgs.absolutePrestate, bytes32(uint256(2))); } /// @notice Tests that the old absolute prestate is used if the upgrade config does not set an @@ -1564,18 +1498,8 @@ contract OPContractsManager_Upgrade_Test is OPContractsManager_Upgrade_Harness { runCurrentUpgrade(upgrader); // Get the absolute prestate after the upgrade - Claim pdgPrestateAfter; - Claim fdgPrestateAfter; - if (isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - pdgPrestateAfter = getDisputeGameV2AbsolutePrestate(GameTypes.PERMISSIONED_CANNON); - fdgPrestateAfter = getDisputeGameV2AbsolutePrestate(GameTypes.CANNON); - } else { - pdgPrestateAfter = IPermissionedDisputeGame( - address(disputeGameFactory.gameImpls(GameTypes.PERMISSIONED_CANNON)) - ).absolutePrestate(); - fdgPrestateAfter = - IFaultDisputeGame(address(disputeGameFactory.gameImpls(GameTypes.CANNON))).absolutePrestate(); - } + Claim pdgPrestateAfter = getDisputeGameV2AbsolutePrestate(GameTypes.PERMISSIONED_CANNON); + Claim fdgPrestateAfter = getDisputeGameV2AbsolutePrestate(GameTypes.CANNON); // Assert that the absolute prestate is the same as before the upgrade. assertEq(pdgPrestateAfter.raw(), pdgPrestateBefore.raw()); @@ -1606,34 +1530,19 @@ contract OPContractsManager_Upgrade_Test is OPContractsManager_Upgrade_Harness { runCurrentUpgrade(upgrader); // Get the absolute prestate after the upgrade - Claim pdgPrestateAfter; - Claim fdgPrestateAfter; - if (isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - pdgPrestateAfter = getDisputeGameV2AbsolutePrestate(GameTypes.PERMISSIONED_CANNON); - fdgPrestateAfter = getDisputeGameV2AbsolutePrestate(GameTypes.CANNON); - } else { - pdgPrestateAfter = IPermissionedDisputeGame( - address(disputeGameFactory.gameImpls(GameTypes.PERMISSIONED_CANNON)) - ).absolutePrestate(); - fdgPrestateAfter = - IFaultDisputeGame(address(disputeGameFactory.gameImpls(GameTypes.CANNON))).absolutePrestate(); - } + Claim pdgPrestateAfter = getDisputeGameV2AbsolutePrestate(GameTypes.PERMISSIONED_CANNON); + Claim fdgPrestateAfter = getDisputeGameV2AbsolutePrestate(GameTypes.CANNON); // Assert that the absolute prestate is the same as before the upgrade. assertEq(pdgPrestateAfter.raw(), pdgPrestateBefore.raw()); assertEq(fdgPrestateAfter.raw(), fdgPrestateBefore.raw()); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - LibGameArgs.GameArgs memory cannonArgs = LibGameArgs.decode(disputeGameFactory.gameArgs(GameTypes.CANNON)); - LibGameArgs.GameArgs memory cannonKonaArgs = - LibGameArgs.decode(disputeGameFactory.gameArgs(GameTypes.CANNON_KONA)); - assertEq(cannonKonaArgs.weth, cannonArgs.weth); - assertEq(cannonKonaArgs.anchorStateRegistry, cannonArgs.anchorStateRegistry); - assertEq(cannonKonaArgs.absolutePrestate, cannonKonaPrestate.raw()); - } else { - assertEq(address(0), address(disputeGameFactory.gameImpls(GameTypes.CANNON_KONA))); - assertEq(0, disputeGameFactory.gameArgs(GameTypes.CANNON_KONA).length); - } + LibGameArgs.GameArgs memory cannonArgs = LibGameArgs.decode(disputeGameFactory.gameArgs(GameTypes.CANNON)); + LibGameArgs.GameArgs memory cannonKonaArgs = + LibGameArgs.decode(disputeGameFactory.gameArgs(GameTypes.CANNON_KONA)); + assertEq(cannonKonaArgs.weth, cannonArgs.weth); + assertEq(cannonKonaArgs.anchorStateRegistry, cannonArgs.anchorStateRegistry); + assertEq(cannonKonaArgs.absolutePrestate, cannonKonaPrestate.raw()); } /// @notice Tests that the cannon absolute prestate is updated even if the cannon kona prestate is not specified @@ -1657,18 +1566,8 @@ contract OPContractsManager_Upgrade_Test is OPContractsManager_Upgrade_Harness { runCurrentUpgrade(upgrader); // Get the absolute prestate after the upgrade - Claim pdgPrestateAfter; - Claim fdgPrestateAfter; - if (isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - pdgPrestateAfter = getDisputeGameV2AbsolutePrestate(GameTypes.PERMISSIONED_CANNON); - fdgPrestateAfter = getDisputeGameV2AbsolutePrestate(GameTypes.CANNON); - } else { - pdgPrestateAfter = IPermissionedDisputeGame( - address(disputeGameFactory.gameImpls(GameTypes.PERMISSIONED_CANNON)) - ).absolutePrestate(); - fdgPrestateAfter = - IFaultDisputeGame(address(disputeGameFactory.gameImpls(GameTypes.CANNON))).absolutePrestate(); - } + Claim pdgPrestateAfter = getDisputeGameV2AbsolutePrestate(GameTypes.PERMISSIONED_CANNON); + Claim fdgPrestateAfter = getDisputeGameV2AbsolutePrestate(GameTypes.CANNON); // Assert that the absolute prestate is the non-zero value we set. assertEq(pdgPrestateAfter.raw(), bytes32(uint256(1))); @@ -1887,11 +1786,9 @@ contract OPContractsManager_Migrate_Test is OPContractsManager_TestInit { _assertGameIsEmpty(_disputeGameFactory, GameTypes.SUPER_CANNON, "SUPER_CANNON"); _assertGameIsEmpty(_disputeGameFactory, GameTypes.PERMISSIONED_CANNON, "PERMISSIONED_CANNON"); _assertGameIsEmpty(_disputeGameFactory, GameTypes.SUPER_PERMISSIONED_CANNON, "SUPER_PERMISSIONED_CANNON"); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - // Only explicitly zeroed out if feature is enabled. Otherwise left unchanged (which may still be 0). - _assertGameIsEmpty(_disputeGameFactory, GameTypes.CANNON_KONA, "CANNON_KONA"); - _assertGameIsEmpty(_disputeGameFactory, GameTypes.SUPER_CANNON_KONA, "SUPER_CANNON_KONA"); - } + // Only explicitly zeroed out if feature is enabled. Otherwise left unchanged (which may still be 0). + _assertGameIsEmpty(_disputeGameFactory, GameTypes.CANNON_KONA, "CANNON_KONA"); + _assertGameIsEmpty(_disputeGameFactory, GameTypes.SUPER_CANNON_KONA, "SUPER_CANNON_KONA"); } function _assertGameIsEmpty(IDisputeGameFactory _dgf, GameType _gameType, string memory _label) internal view { @@ -1972,14 +1869,14 @@ contract OPContractsManager_Migrate_Test is OPContractsManager_TestInit { function _getPostMigrateExpectedGameTypes(IOPContractsManagerInteropMigrator.MigrateInput memory _input) internal - view + pure returns (GameType[] memory gameTypes_) { uint256 gameCount = 1; bytes32 cannonKonaPrestate = _input.opChainConfigs[0].cannonKonaPrestate.raw(); if (_input.usePermissionlessGame) { gameCount += 1; - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA) && cannonKonaPrestate != bytes32(0)) { + if (cannonKonaPrestate != bytes32(0)) { gameCount += 1; } } @@ -1988,7 +1885,7 @@ contract OPContractsManager_Migrate_Test is OPContractsManager_TestInit { gameTypes_[0] = GameTypes.SUPER_PERMISSIONED_CANNON; if (_input.usePermissionlessGame) { gameTypes_[1] = GameTypes.SUPER_CANNON; - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA) && cannonKonaPrestate != bytes32(0)) { + if (cannonKonaPrestate != bytes32(0)) { gameTypes_[2] = GameTypes.SUPER_CANNON_KONA; } } @@ -2012,26 +1909,16 @@ contract OPContractsManager_Migrate_Test is OPContractsManager_TestInit { input.gameParameters.initBond, "Super Permissioned Cannon init bond mismatch" ); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq( - dgf.initBonds(GameTypes.SUPER_CANNON_KONA), - input.gameParameters.initBond, - "Super CannonKona init bond mismatch" - ); - } else { - assertEq( - dgf.initBonds(GameTypes.SUPER_CANNON_KONA), uint256(0), "Super CannonKona init bond should be zero" - ); - } + assertEq( + dgf.initBonds(GameTypes.SUPER_CANNON_KONA), + input.gameParameters.initBond, + "Super CannonKona init bond mismatch" + ); // Check game configuration _validateSuperGameImplParams(input, dgf, GameTypes.SUPER_PERMISSIONED_CANNON, "SUPER_PERMISSIONED_CANNON"); _validateSuperGameImplParams(input, dgf, GameTypes.SUPER_CANNON, "SUPER_CANNON"); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - _validateSuperGameImplParams(input, dgf, GameTypes.SUPER_CANNON_KONA, "SUPER_CANNON_KONA"); - } else { - _assertGameIsEmpty(dgf, GameTypes.SUPER_CANNON_KONA, "SUPER_CANNON_KONA"); - } + _validateSuperGameImplParams(input, dgf, GameTypes.SUPER_CANNON_KONA, "SUPER_CANNON_KONA"); _runPostMigrateSmokeTests(input); } @@ -2263,16 +2150,10 @@ contract OPContractsManager_Migrate_Test is OPContractsManager_TestInit { input.opChainConfigs[1].cannonKonaPrestate = cannonKonaPrestate2; // Execute the migration. - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - // We should revert if there is a mismatch and cannonaKona is enabled - _doMigration( - input, - OPContractsManagerInteropMigrator.OPContractsManagerInteropMigrator_AbsolutePrestateMismatch.selector - ); - } else { - // Otherwise, migration should run without reverting - _doMigration(input); - } + // We should revert if there is a mismatch and cannonaKona is enabled + _doMigration( + input, OPContractsManagerInteropMigrator.OPContractsManagerInteropMigrator_AbsolutePrestateMismatch.selector + ); } /// @notice Tests that the migration function reverts when the SuperchainConfig addresses are @@ -2299,7 +2180,6 @@ contract OPContractsManager_Migrate_Test is OPContractsManager_TestInit { } function test_migrate_zerosOutCannonKonaGameTypes_succeeds() public { - skipIfDevFeatureDisabled(DevFeatures.CANNON_KONA); IOPContractsManagerInteropMigrator.MigrateInput memory input = _getDefaultInput(); // Grab the existing DisputeGameFactory for each chain. @@ -2389,29 +2269,21 @@ contract OPContractsManager_Deploy_Test is DeployOPChain_TestBase, DisputeGames /// @notice Test that deploy sets the permissioned dispute game implementation function test_deployPermissioned_succeeds() public { - bool isV2 = isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES); - // Sanity-check setup is consistent with devFeatures flag IOPContractsManager.Implementations memory impls = opcm.implementations(); address pdgImpl = address(impls.permissionedDisputeGameV2Impl); address fdgImpl = address(impls.faultDisputeGameV2Impl); - if (isV2) { - assertFalse(pdgImpl == address(0), "PDG implementation address should be non-zero"); - assertFalse(fdgImpl == address(0), "FDG implementation address should be non-zero"); - } else { - assertTrue(pdgImpl == address(0), "PDG implementation address should be zero"); - assertTrue(fdgImpl == address(0), "FDG implementation address should be zero"); - } + assertFalse(pdgImpl == address(0), "PDG implementation address should be non-zero"); + assertFalse(fdgImpl == address(0), "FDG implementation address should be non-zero"); // Run OPCM.deploy IOPContractsManager.DeployInput memory opcmInput = toOPCMDeployInput(deployOPChainInput); IOPContractsManager.DeployOutput memory opcmOutput = opcm.deploy(opcmInput); // Verify that the DisputeGameFactory has registered an implementation for the PERMISSIONED_CANNON game type - address expectedPDGAddress = isV2 ? pdgImpl : address(opcmOutput.permissionedDisputeGame); address actualPDGAddress = address(opcmOutput.disputeGameFactoryProxy.gameImpls(GameTypes.PERMISSIONED_CANNON)); assertNotEq(actualPDGAddress, address(0), "DisputeGameFactory should have a registered PERMISSIONED_CANNON"); - assertEq(actualPDGAddress, address(expectedPDGAddress), "PDG address should match"); + assertEq(actualPDGAddress, pdgImpl, "PDG address should match"); // Create a game proxy to test immutable fields Claim claim = Claim.wrap(bytes32(uint256(9876))); diff --git a/packages/contracts-bedrock/test/L1/OPContractsManagerContractsContainer.t.sol b/packages/contracts-bedrock/test/L1/OPContractsManagerContractsContainer.t.sol deleted file mode 100644 index 0028b6db8139d..0000000000000 --- a/packages/contracts-bedrock/test/L1/OPContractsManagerContractsContainer.t.sol +++ /dev/null @@ -1,90 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.15; - -// Testing -import { OPContractsManager_TestInit } from "test/L1/OPContractsManager.t.sol"; - -// Contracts -import { OPContractsManager, OPContractsManagerContractsContainer } from "src/L1/OPContractsManager.sol"; - -/// @title OPContractsManagerContractsContainer_Constructor_Test -/// @notice Tests the constructor of the `OPContractsManagerContractsContainer` contract. -contract OPContractsManagerContractsContainer_Constructor_Test is OPContractsManager_TestInit { - /// @notice Tests that the constructor succeeds when the devFeatureBitmap is in dev. - /// @param _devFeatureBitmap The devFeatureBitmap to use. - function testFuzz_constructor_devBitmapInDev_succeeds(bytes32 _devFeatureBitmap) public { - // Etch into the magic testing address. - vm.etch(address(0xbeefcafe), hex"01"); - - // Convert to proper OPCM type for construction. - OPContractsManager opcm2 = OPContractsManager(address(opcm)); - - // Should not revert. - OPContractsManagerContractsContainer container = new OPContractsManagerContractsContainer({ - _blueprints: opcm2.blueprints(), - _implementations: opcm2.implementations(), - _devFeatureBitmap: _devFeatureBitmap - }); - - // Should have the correct devFeatureBitmap. - assertEq(container.devFeatureBitmap(), _devFeatureBitmap); - } - - /// @notice Tests that the constructor reverts when the devFeatureBitmap is in prod. - /// @param _devFeatureBitmap The devFeatureBitmap to use. - function testFuzz_constructor_devBitmapInProd_reverts(bytes32 _devFeatureBitmap) public { - // Anything but zero! - _devFeatureBitmap = bytes32(bound(uint256(_devFeatureBitmap), 1, type(uint256).max)); - - // Make sure magic address has no code. - vm.etch(address(0xbeefcafe), bytes("")); - - // Convert to proper OPCM type for construction. - OPContractsManager opcm2 = OPContractsManager(address(opcm)); - - // Set the chain ID to 1. - vm.chainId(1); - - // Fetch ahead of time to avoid expectRevert applying to these functions by accident. - OPContractsManager.Blueprints memory blueprints = opcm2.blueprints(); - OPContractsManager.Implementations memory implementations = opcm2.implementations(); - - // Should revert. - vm.expectRevert( - OPContractsManagerContractsContainer.OPContractsManagerContractsContainer_DevFeatureInProd.selector - ); - OPContractsManagerContractsContainer container = new OPContractsManagerContractsContainer({ - _blueprints: blueprints, - _implementations: implementations, - _devFeatureBitmap: _devFeatureBitmap - }); - - // Constructor shouldn't have worked, foundry makes this return address(1). - assertEq(address(container), address(1)); - } - - /// @notice Tests that the constructor succeeds when the devFeatureBitmap is used on the - /// mainnet chain ID but this is actually a test environment as shown by the magic - /// address having code. - /// @param _devFeatureBitmap The devFeatureBitmap to use. - function test_constructor_devBitmapMainnetButTestEnv_succeeds(bytes32 _devFeatureBitmap) public { - // Make sure magic address has code. - vm.etch(address(0xbeefcafe), hex"01"); - - // Convert to proper OPCM type for construction. - OPContractsManager opcm2 = OPContractsManager(address(opcm)); - - // Set the chain ID to 1. - vm.chainId(1); - - // Should not revert. - OPContractsManagerContractsContainer container = new OPContractsManagerContractsContainer({ - _blueprints: opcm2.blueprints(), - _implementations: opcm2.implementations(), - _devFeatureBitmap: _devFeatureBitmap - }); - - // Should have the correct devFeatureBitmap. - assertEq(container.devFeatureBitmap(), _devFeatureBitmap); - } -} diff --git a/packages/contracts-bedrock/test/L1/OPContractsManagerStandardValidator.t.sol b/packages/contracts-bedrock/test/L1/OPContractsManagerStandardValidator.t.sol index 295a167c13d44..41fb36f0f0d70 100644 --- a/packages/contracts-bedrock/test/L1/OPContractsManagerStandardValidator.t.sol +++ b/packages/contracts-bedrock/test/L1/OPContractsManagerStandardValidator.t.sol @@ -11,7 +11,6 @@ import { GameType, Hash } from "src/dispute/lib/LibUDT.sol"; import { GameTypes, Duration, Claim } from "src/dispute/lib/Types.sol"; import { ForgeArtifacts } from "scripts/libraries/ForgeArtifacts.sol"; import { Features } from "src/libraries/Features.sol"; -import { DevFeatures } from "src/libraries/DevFeatures.sol"; // Interfaces import { IOPContractsManager } from "interfaces/L1/IOPContractsManager.sol"; @@ -82,6 +81,33 @@ contract BadDisputeGameFactoryReturner { } } +/// @title BadVersionReturner +contract BadVersionReturner { + /// @notice Address of the OPContractsManagerStandardValidator instance. + IOPContractsManagerStandardValidator public immutable validator; + + /// @notice Address of the versioned contract. + ISemver public immutable versioned; + + /// @notice The mock semver + string public mockVersion; + + constructor(IOPContractsManagerStandardValidator _validator, ISemver _versioned, string memory _mockVersion) { + validator = _validator; + versioned = _versioned; + mockVersion = _mockVersion; + } + + /// @notice Returns the real or fake semver + function version() external view returns (string memory) { + if (msg.sender == address(validator)) { + return mockVersion; + } else { + return versioned.version(); + } + } +} + /// @title OPContractsManagerStandardValidator_TestInit /// @notice Base contract for `OPContractsManagerStandardValidator` tests, handles common setup. abstract contract OPContractsManagerStandardValidator_TestInit is CommonTest, DisputeGames { @@ -186,9 +212,7 @@ abstract contract OPContractsManagerStandardValidator_TestInit is CommonTest, Di fdgImpl = output.faultDisputeGame; // Deploy cannon-kona - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - addGameType(GameTypes.CANNON_KONA, cannonKonaPrestate); - } + addGameType(GameTypes.CANNON_KONA, cannonKonaPrestate); } } @@ -196,28 +220,16 @@ abstract contract OPContractsManagerStandardValidator_TestInit is CommonTest, Di /// @param _allowFailure Whether to allow failure. /// @return The error message(s) from the validate function. function _validate(bool _allowFailure) internal view returns (string memory) { - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - return opcm.validate( - IOPContractsManagerStandardValidator.ValidationInputDev({ - sysCfg: systemConfig, - cannonPrestate: cannonPrestate.raw(), - cannonKonaPrestate: cannonKonaPrestate.raw(), - l2ChainID: l2ChainId, - proposer: proposer - }), - _allowFailure - ); - } else { - return opcm.validate( - IOPContractsManagerStandardValidator.ValidationInput({ - sysCfg: systemConfig, - absolutePrestate: cannonPrestate.raw(), - l2ChainID: l2ChainId, - proposer: proposer - }), - _allowFailure - ); - } + return opcm.validate( + IOPContractsManagerStandardValidator.ValidationInputDev({ + sysCfg: systemConfig, + cannonPrestate: cannonPrestate.raw(), + cannonKonaPrestate: cannonKonaPrestate.raw(), + l2ChainID: l2ChainId, + proposer: proposer + }), + _allowFailure + ); } /// @notice Runs the OPContractsManagerStandardValidator.validateWithOverrides function. @@ -231,30 +243,17 @@ abstract contract OPContractsManagerStandardValidator_TestInit is CommonTest, Di view returns (string memory) { - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - return opcm.validateWithOverrides( - IOPContractsManagerStandardValidator.ValidationInputDev({ - sysCfg: systemConfig, - cannonPrestate: cannonPrestate.raw(), - cannonKonaPrestate: cannonKonaPrestate.raw(), - l2ChainID: l2ChainId, - proposer: proposer - }), - _allowFailure, - _overrides - ); - } else { - return opcm.validateWithOverrides( - IOPContractsManagerStandardValidator.ValidationInput({ - sysCfg: systemConfig, - absolutePrestate: cannonPrestate.raw(), - l2ChainID: l2ChainId, - proposer: proposer - }), - _allowFailure, - _overrides - ); - } + return opcm.validateWithOverrides( + IOPContractsManagerStandardValidator.ValidationInputDev({ + sysCfg: systemConfig, + cannonPrestate: cannonPrestate.raw(), + cannonKonaPrestate: cannonKonaPrestate.raw(), + l2ChainID: l2ChainId, + proposer: proposer + }), + _allowFailure, + _overrides + ); } function _defaultValidationOverrides() @@ -351,17 +350,10 @@ contract OPContractsManagerStandardValidator_GeneralOverride_Test is OPContracts IOPContractsManagerStandardValidator.ValidationOverrides memory overrides = _defaultValidationOverrides(); overrides.l1PAOMultisig = address(0xace); overrides.challenger = address(0xbad); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq( - "OVERRIDES-L1PAOMULTISIG,OVERRIDES-CHALLENGER,PROXYA-10,DF-30,PDDG-DWETH-30,PDDG-130,PLDG-DWETH-30,CKDG-DWETH-30", - _validateWithOverrides(true, overrides) - ); - } else { - assertEq( - "OVERRIDES-L1PAOMULTISIG,OVERRIDES-CHALLENGER,PROXYA-10,DF-30,PDDG-DWETH-30,PDDG-130,PLDG-DWETH-30", - _validateWithOverrides(true, overrides) - ); - } + assertEq( + "OVERRIDES-L1PAOMULTISIG,OVERRIDES-CHALLENGER,PROXYA-10,DF-30,PDDG-DWETH-30,PDDG-130,PLDG-DWETH-30,CKDG-DWETH-30", + _validateWithOverrides(true, overrides) + ); } /// @notice Tests that the validate function (with the L1PAOMultisig and Challenger overridden) @@ -392,19 +384,11 @@ contract OPContractsManagerStandardValidator_GeneralOverride_Test is OPContracts IOPContractsManagerStandardValidator.ValidationOverrides memory overrides = IOPContractsManagerStandardValidator .ValidationOverrides({ l1PAOMultisig: address(0xbad), challenger: address(0xc0ffee) }); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - vm.expectRevert( - bytes( - "OPContractsManagerStandardValidator: OVERRIDES-L1PAOMULTISIG,OVERRIDES-CHALLENGER,PROXYA-10,DF-30,PDDG-DWETH-30,PDDG-130,PLDG-DWETH-30,CKDG-DWETH-30" - ) - ); - } else { - vm.expectRevert( - bytes( - "OPContractsManagerStandardValidator: OVERRIDES-L1PAOMULTISIG,OVERRIDES-CHALLENGER,PROXYA-10,DF-30,PDDG-DWETH-30,PDDG-130,PLDG-DWETH-30" - ) - ); - } + vm.expectRevert( + bytes( + "OPContractsManagerStandardValidator: OVERRIDES-L1PAOMULTISIG,OVERRIDES-CHALLENGER,PROXYA-10,DF-30,PDDG-DWETH-30,PDDG-130,PLDG-DWETH-30,CKDG-DWETH-30" + ) + ); _validateWithOverrides(false, overrides); } @@ -435,11 +419,7 @@ contract OPContractsManagerStandardValidator_ProxyAdmin_Test is OPContractsManag vm.mockCall( address(delayedWeth), abi.encodeCall(IProxyAdminOwnedBase.proxyAdminOwner, ()), abi.encode(address(0xbad)) ); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PROXYA-10,PDDG-DWETH-30,PLDG-DWETH-30,CKDG-DWETH-30", _validate(true)); - } else { - assertEq("PROXYA-10,PDDG-DWETH-30,PLDG-DWETH-30", _validate(true)); - } + assertEq("PROXYA-10,PDDG-DWETH-30,PLDG-DWETH-30,CKDG-DWETH-30", _validate(true)); } /// @notice Tests that the validate function successfully returns the right overrides error @@ -462,17 +442,10 @@ contract OPContractsManagerStandardValidator_ProxyAdmin_Test is OPContractsManag function test_validateOverrideL1PAOMultisig_invalidProxyAdminOwner_succeeds() public view { IOPContractsManagerStandardValidator.ValidationOverrides memory overrides = _defaultValidationOverrides(); overrides.l1PAOMultisig = address(0xbad); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq( - "OVERRIDES-L1PAOMULTISIG,PROXYA-10,DF-30,PDDG-DWETH-30,PLDG-DWETH-30,CKDG-DWETH-30", - _validateWithOverrides(true, overrides) - ); - } else { - assertEq( - "OVERRIDES-L1PAOMULTISIG,PROXYA-10,DF-30,PDDG-DWETH-30,PLDG-DWETH-30", - _validateWithOverrides(true, overrides) - ); - } + assertEq( + "OVERRIDES-L1PAOMULTISIG,PROXYA-10,DF-30,PDDG-DWETH-30,PLDG-DWETH-30,CKDG-DWETH-30", + _validateWithOverrides(true, overrides) + ); } } @@ -973,20 +946,14 @@ contract OPContractsManagerStandardValidator_PermissionedDisputeGame_Test is /// @notice Tests that the validate function successfully returns the right error when the /// PermissionedDisputeGame version is invalid. function test_validate_permissionedDisputeGameInvalidVersion_succeeds() public { - vm.mockCall(address(pdgImpl), abi.encodeCall(ISemver.version, ()), abi.encode("0.0.0")); + BadVersionReturner bad = + new BadVersionReturner(opcm.opcmStandardValidator(), ISemver(address(pdgImpl)), "0.0.0"); + bytes32 slot = + bytes32(ForgeArtifacts.getSlot("OPContractsManagerStandardValidator", "permissionedDisputeGameImpl").slot); + vm.store(address(opcm.opcmStandardValidator()), slot, bytes32(uint256(uint160(address(bad))))); assertEq("PDDG-20", _validate(true)); } - /// @notice Tests that the validate function successfully returns the right error when the - /// PermissionedDisputeGame game type is invalid. - function test_validate_permissionedDisputeGameInvalidGameType_succeeds() public { - // For v2 game contracts, we don't store the game type anywhere other than the DGF gameImpls and gameArgs maps - // So, there's not really an obvious way to return an invalid gameType - skipIfDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES); - vm.mockCall(address(pdgImpl), abi.encodeCall(IDisputeGame.gameType, ()), abi.encode(GameTypes.CANNON)); - assertEq("PDDG-30", _validate(true)); - } - /// @notice Tests that the validate function successfully returns the right error when the /// PermissionedDisputeGame game args are invalid. function test_validate_permissionedDisputeGameInvalidGameArgs_succeeds() public { @@ -1072,11 +1039,7 @@ contract OPContractsManagerStandardValidator_PermissionedDisputeGame_Test is /// PermissionedDisputeGame VM's state version is invalid. function test_validate_permissionedDisputeGameInvalidVMStateVersion_succeeds() public { vm.mockCall(address(mips), abi.encodeCall(IMIPS64.stateVersion, ()), abi.encode(6)); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PDDG-VM-30,PLDG-VM-30,CKDG-VM-30", _validate(true)); - } else { - assertEq("PDDG-VM-30,PLDG-VM-30", _validate(true)); - } + assertEq("PDDG-VM-30,PLDG-VM-30,CKDG-VM-30", _validate(true)); } /// @notice Tests that the validate function successfully returns the right error when the @@ -1138,11 +1101,7 @@ contract OPContractsManagerStandardValidator_PermissionedDisputeGame_Test is abi.encodeCall(IAnchorStateRegistry.getAnchorRoot, ()), abi.encode(bytes32(0), 1) ); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PDDG-120,PLDG-120,CKDG-120", _validate(true)); - } else { - assertEq("PDDG-120,PLDG-120", _validate(true)); - } + assertEq("PDDG-120,PLDG-120,CKDG-120", _validate(true)); } /// @notice Tests that the validate function successfully returns the right error when the @@ -1191,11 +1150,7 @@ contract OPContractsManagerStandardValidator_AnchorStateRegistry_Test is /// AnchorStateRegistry version is invalid. function test_validate_anchorStateRegistryInvalidVersion_succeeds() public { vm.mockCall(address(anchorStateRegistry), abi.encodeCall(ISemver.version, ()), abi.encode("0.0.1")); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PDDG-ANCHORP-10,PLDG-ANCHORP-10,CKDG-ANCHORP-10", _validate(true)); - } else { - assertEq("PDDG-ANCHORP-10,PLDG-ANCHORP-10", _validate(true)); - } + assertEq("PDDG-ANCHORP-10,PLDG-ANCHORP-10,CKDG-ANCHORP-10", _validate(true)); } /// @notice Tests that the validate function successfully returns the right error when the @@ -1206,11 +1161,7 @@ contract OPContractsManagerStandardValidator_AnchorStateRegistry_Test is abi.encodeCall(IProxyAdmin.getProxyImplementation, (address(anchorStateRegistry))), abi.encode(address(0xbad)) ); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PDDG-ANCHORP-20,PLDG-ANCHORP-20,CKDG-ANCHORP-20", _validate(true)); - } else { - assertEq("PDDG-ANCHORP-20,PLDG-ANCHORP-20", _validate(true)); - } + assertEq("PDDG-ANCHORP-20,PLDG-ANCHORP-20,CKDG-ANCHORP-20", _validate(true)); } /// @notice Tests that the validate function successfully returns the right error when the @@ -1221,11 +1172,7 @@ contract OPContractsManagerStandardValidator_AnchorStateRegistry_Test is address(badDisputeGameFactoryReturner), abi.encodeCall(IAnchorStateRegistry.disputeGameFactory, ()) ); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PDDG-ANCHORP-30,PLDG-ANCHORP-30,CKDG-ANCHORP-30", _validate(true)); - } else { - assertEq("PDDG-ANCHORP-30,PLDG-ANCHORP-30", _validate(true)); - } + assertEq("PDDG-ANCHORP-30,PLDG-ANCHORP-30,CKDG-ANCHORP-30", _validate(true)); } /// @notice Tests that the validate function successfully returns the right error when the @@ -1236,11 +1183,7 @@ contract OPContractsManagerStandardValidator_AnchorStateRegistry_Test is abi.encodeCall(IAnchorStateRegistry.systemConfig, ()), abi.encode(address(0xbad)) ); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PDDG-ANCHORP-40,PLDG-ANCHORP-40,CKDG-ANCHORP-40", _validate(true)); - } else { - assertEq("PDDG-ANCHORP-40,PLDG-ANCHORP-40", _validate(true)); - } + assertEq("PDDG-ANCHORP-40,PLDG-ANCHORP-40,CKDG-ANCHORP-40", _validate(true)); } /// @notice Tests that the validate function successfully returns the right error when the @@ -1251,11 +1194,7 @@ contract OPContractsManagerStandardValidator_AnchorStateRegistry_Test is abi.encodeCall(IProxyAdminOwnedBase.proxyAdmin, ()), abi.encode(address(0xbad)) ); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PDDG-ANCHORP-50,PLDG-ANCHORP-50,CKDG-ANCHORP-50", _validate(true)); - } else { - assertEq("PDDG-ANCHORP-50,PLDG-ANCHORP-50", _validate(true)); - } + assertEq("PDDG-ANCHORP-50,PLDG-ANCHORP-50,CKDG-ANCHORP-50", _validate(true)); } /// @notice Tests that the validate function successfully returns the right error when the @@ -1264,11 +1203,7 @@ contract OPContractsManagerStandardValidator_AnchorStateRegistry_Test is vm.mockCall( address(anchorStateRegistry), abi.encodeCall(IAnchorStateRegistry.retirementTimestamp, ()), abi.encode(0) ); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PDDG-ANCHORP-60,PLDG-ANCHORP-60,CKDG-ANCHORP-60", _validate(true)); - } else { - assertEq("PDDG-ANCHORP-60,PLDG-ANCHORP-60", _validate(true)); - } + assertEq("PDDG-ANCHORP-60,PLDG-ANCHORP-60,CKDG-ANCHORP-60", _validate(true)); } } @@ -1286,11 +1221,7 @@ contract OPContractsManagerStandardValidator_DelayedWETH_Test is OPContractsMana if (isForkTest()) { assertEq("PDDG-DWETH-10", _validate(true)); } else { - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PLDG-DWETH-10,CKDG-DWETH-10", _validate(true)); - } else { - assertEq("PLDG-DWETH-10", _validate(true)); - } + assertEq("PLDG-DWETH-10,CKDG-DWETH-10", _validate(true)); } } @@ -1306,11 +1237,7 @@ contract OPContractsManagerStandardValidator_DelayedWETH_Test is OPContractsMana if (isForkTest()) { assertEq("PDDG-DWETH-20", _validate(true)); } else { - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PLDG-DWETH-20,CKDG-DWETH-20", _validate(true)); - } else { - assertEq("PLDG-DWETH-20", _validate(true)); - } + assertEq("PLDG-DWETH-20,CKDG-DWETH-20", _validate(true)); } } @@ -1324,11 +1251,7 @@ contract OPContractsManagerStandardValidator_DelayedWETH_Test is OPContractsMana if (isForkTest()) { assertEq("PDDG-DWETH-30", _validate(true)); } else { - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PLDG-DWETH-30,CKDG-DWETH-30", _validate(true)); - } else { - assertEq("PLDG-DWETH-30", _validate(true)); - } + assertEq("PLDG-DWETH-30,CKDG-DWETH-30", _validate(true)); } } @@ -1340,11 +1263,7 @@ contract OPContractsManagerStandardValidator_DelayedWETH_Test is OPContractsMana if (isForkTest()) { assertEq("PDDG-DWETH-40", _validate(true)); } else { - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PLDG-DWETH-40,CKDG-DWETH-40", _validate(true)); - } else { - assertEq("PLDG-DWETH-40", _validate(true)); - } + assertEq("PLDG-DWETH-40,CKDG-DWETH-40", _validate(true)); } } @@ -1356,11 +1275,7 @@ contract OPContractsManagerStandardValidator_DelayedWETH_Test is OPContractsMana if (isForkTest()) { assertEq("PDDG-DWETH-50", _validate(true)); } else { - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PLDG-DWETH-50,CKDG-DWETH-50", _validate(true)); - } else { - assertEq("PLDG-DWETH-50", _validate(true)); - } + assertEq("PLDG-DWETH-50,CKDG-DWETH-50", _validate(true)); } } @@ -1374,11 +1289,7 @@ contract OPContractsManagerStandardValidator_DelayedWETH_Test is OPContractsMana if (isForkTest()) { assertEq("PDDG-DWETH-60", _validate(true)); } else { - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PLDG-DWETH-60,CKDG-DWETH-60", _validate(true)); - } else { - assertEq("PLDG-DWETH-60", _validate(true)); - } + assertEq("PLDG-DWETH-60,CKDG-DWETH-60", _validate(true)); } } } @@ -1390,33 +1301,21 @@ contract OPContractsManagerStandardValidator_PreimageOracle_Test is OPContractsM /// PreimageOracle version is invalid. function test_validate_preimageOracleInvalidVersion_succeeds() public { vm.mockCall(address(preimageOracle), abi.encodeCall(ISemver.version, ()), abi.encode("0.0.1")); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PDDG-PIMGO-10,PLDG-PIMGO-10,CKDG-PIMGO-10", _validate(true)); - } else { - assertEq("PDDG-PIMGO-10,PLDG-PIMGO-10", _validate(true)); - } + assertEq("PDDG-PIMGO-10,PLDG-PIMGO-10,CKDG-PIMGO-10", _validate(true)); } /// @notice Tests that the validate function successfully returns the right error when the /// PreimageOracle challengePeriod is invalid. function test_validate_preimageOracleInvalidChallengePeriod_succeeds() public { vm.mockCall(address(preimageOracle), abi.encodeCall(IPreimageOracle.challengePeriod, ()), abi.encode(1000)); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PDDG-PIMGO-20,PLDG-PIMGO-20,CKDG-PIMGO-20", _validate(true)); - } else { - assertEq("PDDG-PIMGO-20,PLDG-PIMGO-20", _validate(true)); - } + assertEq("PDDG-PIMGO-20,PLDG-PIMGO-20,CKDG-PIMGO-20", _validate(true)); } /// @notice Tests that the validate function successfully returns the right error when the /// PreimageOracle minProposalSize is invalid. function test_validate_preimageOracleInvalidMinProposalSize_succeeds() public { vm.mockCall(address(preimageOracle), abi.encodeCall(IPreimageOracle.minProposalSize, ()), abi.encode(1000)); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PDDG-PIMGO-30,PLDG-PIMGO-30,CKDG-PIMGO-30", _validate(true)); - } else { - assertEq("PDDG-PIMGO-30,PLDG-PIMGO-30", _validate(true)); - } + assertEq("PDDG-PIMGO-30,PLDG-PIMGO-30,CKDG-PIMGO-30", _validate(true)); } } @@ -1437,7 +1336,6 @@ contract OPContractsManagerStandardValidator_FaultDisputeGame_Test is OPContract /// @notice Tests that the validate function successfully returns the right error when the /// FaultDisputeGame (permissionless) CannonKona implementation is null. function test_validate_faultDisputeGameNullCannonKonaImplementation_succeeds() public { - skipIfDevFeatureDisabled(DevFeatures.CANNON_KONA); vm.mockCall( address(disputeGameFactory), abi.encodeCall(IDisputeGameFactory.gameImpls, (GameTypes.CANNON_KONA)), @@ -1449,24 +1347,12 @@ contract OPContractsManagerStandardValidator_FaultDisputeGame_Test is OPContract /// @notice Tests that the validate function successfully returns the right error when the /// FaultDisputeGame (permissionless) version is invalid. function test_validate_faultDisputeGameInvalidVersion_succeeds() public { - vm.mockCall(address(fdgImpl), abi.encodeCall(ISemver.version, ()), abi.encode("0.0.0")); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PLDG-20,CKDG-20", _validate(true)); - } else { - assertEq("PLDG-20", _validate(true)); - } - } - - /// @notice Tests that the validate function successfully returns the right error when the - /// FaultDisputeGame (permissionless) game type is invalid. - function test_validate_faultDisputeGameInvalidGameType_succeeds() public { - // For v2 game contracts, we don't store the game type anywhere other than the DGF gameImpls and gameArgs maps - // So, there's not really an obvious way to return an invalid gameType - skipIfDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES); - vm.mockCall( - address(fdgImpl), abi.encodeCall(IDisputeGame.gameType, ()), abi.encode(GameTypes.PERMISSIONED_CANNON) - ); - assertEq("PLDG-30", _validate(true)); + BadVersionReturner bad = + new BadVersionReturner(opcm.opcmStandardValidator(), ISemver(address(pdgImpl)), "0.0.0"); + bytes32 slot = + bytes32(ForgeArtifacts.getSlot("OPContractsManagerStandardValidator", "faultDisputeGameImpl").slot); + vm.store(address(opcm.opcmStandardValidator()), slot, bytes32(uint256(uint160(address(bad))))); + assertEq("PLDG-20,CKDG-20", _validate(true)); } /// @notice Tests that the validate function successfully returns the right error when the @@ -1482,7 +1368,6 @@ contract OPContractsManagerStandardValidator_FaultDisputeGame_Test is OPContract /// @notice Tests that the validate function successfully returns the right error when the /// FaultDisputeGame (permissionless) CannonKona game args are invalid. function test_validate_faultDisputeGameInvalidCannonKonaGameArgs_succeeds() public { - skipIfDevFeatureDisabled(DevFeatures.CANNON_KONA); bytes memory invalidGameArgs = hex"123456"; GameType gameType = GameTypes.CANNON_KONA; vm.mockCall(address(dgf), abi.encodeCall(IDisputeGameFactory.gameArgs, (gameType)), abi.encode(invalidGameArgs)); @@ -1502,7 +1387,6 @@ contract OPContractsManagerStandardValidator_FaultDisputeGame_Test is OPContract /// @notice Tests that the validate function successfully returns the right error when the /// FaultDisputeGame (permissionless) CannonKona absolute prestate is invalid. function test_validate_faultDisputeGameInvalidCannonKonaAbsolutePrestate_succeeds() public { - skipIfDevFeatureDisabled(DevFeatures.CANNON_KONA); bytes32 badPrestate = cannonPrestate.raw(); // Use the wrong prestate mockGameImplPrestate(dgf, GameTypes.CANNON_KONA, badPrestate); @@ -1523,7 +1407,6 @@ contract OPContractsManagerStandardValidator_FaultDisputeGame_Test is OPContract /// @notice Tests that the validate function successfully returns the right error when the /// FaultDisputeGame (permissionless) CannonKona VM address is invalid. function test_validate_faultDisputeGameInvalidCannonKonaVM_succeeds() public { - skipIfDevFeatureDisabled(DevFeatures.CANNON_KONA); address badVM = address(0xbad); mockGameImplVM(dgf, GameTypes.CANNON_KONA, badVM); vm.mockCall(badVM, abi.encodeCall(ISemver.version, ()), abi.encode("0.0.0")); @@ -1542,7 +1425,6 @@ contract OPContractsManagerStandardValidator_FaultDisputeGame_Test is OPContract /// @notice Tests that the validate function successfully returns the right error when the /// FaultDisputeGame (permissionless) CannonKona ASR address is invalid. function test_validate_faultDisputeGameInvalidCannonKonaASR_succeeds() public { - skipIfDevFeatureDisabled(DevFeatures.CANNON_KONA); _mockInvalidASR(GameTypes.CANNON_KONA); assertEq("CKDG-ANCHORP-10,CKDG-ANCHORP-20", _validate(true)); } @@ -1577,7 +1459,6 @@ contract OPContractsManagerStandardValidator_FaultDisputeGame_Test is OPContract /// @notice Tests that the validate function successfully returns the right error when the /// FaultDisputeGame (permissionless) CannonKona Weth address is invalid. function test_validate_faultDisputeGameInvalidCannonKonaWeth_succeeds() public { - skipIfDevFeatureDisabled(DevFeatures.CANNON_KONA); _mockInvalidWeth(GameTypes.CANNON_KONA); assertEq("CKDG-DWETH-10,CKDG-DWETH-20", _validate(true)); } @@ -1609,11 +1490,7 @@ contract OPContractsManagerStandardValidator_FaultDisputeGame_Test is OPContract /// FaultDisputeGame (permissionless) VM's state version is invalid. function test_validate_faultDisputeGameInvalidVMStateVersion_succeeds() public { vm.mockCall(address(mips), abi.encodeCall(IMIPS64.stateVersion, ()), abi.encode(6)); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PDDG-VM-30,PLDG-VM-30,CKDG-VM-30", _validate(true)); - } else { - assertEq("PDDG-VM-30,PLDG-VM-30", _validate(true)); - } + assertEq("PDDG-VM-30,PLDG-VM-30,CKDG-VM-30", _validate(true)); } /// @notice Tests that the validate function successfully returns the right error when the @@ -1628,7 +1505,6 @@ contract OPContractsManagerStandardValidator_FaultDisputeGame_Test is OPContract /// @notice Tests that the validate function successfully returns the right error when the /// FaultDisputeGame (permissionless) CannonKona L2 Chain ID is invalid. function test_validate_faultDisputeGameInvalidCannonKonaL2ChainId_succeeds() public { - skipIfDevFeatureDisabled(DevFeatures.CANNON_KONA); uint256 badChainId = l2ChainId + 1; mockGameImplL2ChainId(dgf, GameTypes.CANNON_KONA, badChainId); @@ -1639,11 +1515,7 @@ contract OPContractsManagerStandardValidator_FaultDisputeGame_Test is OPContract /// FaultDisputeGame (permissionless) L2 Sequence Number is invalid. function test_validate_faultDisputeGameInvalidL2SequenceNumber_succeeds() public { vm.mockCall(address(fdgImpl), abi.encodeCall(IDisputeGame.l2SequenceNumber, ()), abi.encode(123)); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PLDG-70,CKDG-70", _validate(true)); - } else { - assertEq("PLDG-70", _validate(true)); - } + assertEq("PLDG-70,CKDG-70", _validate(true)); } /// @notice Tests that the validate function successfully returns the right error when the @@ -1652,33 +1524,21 @@ contract OPContractsManagerStandardValidator_FaultDisputeGame_Test is OPContract vm.mockCall( address(fdgImpl), abi.encodeCall(IFaultDisputeGame.clockExtension, ()), abi.encode(Duration.wrap(1000)) ); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PLDG-80,CKDG-80", _validate(true)); - } else { - assertEq("PLDG-80", _validate(true)); - } + assertEq("PLDG-80,CKDG-80", _validate(true)); } /// @notice Tests that the validate function successfully returns the right error when the /// FaultDisputeGame (permissionless) splitDepth is invalid. function test_validate_faultDisputeGameInvalidSplitDepth_succeeds() public { vm.mockCall(address(fdgImpl), abi.encodeCall(IFaultDisputeGame.splitDepth, ()), abi.encode(20)); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PLDG-90,CKDG-90", _validate(true)); - } else { - assertEq("PLDG-90", _validate(true)); - } + assertEq("PLDG-90,CKDG-90", _validate(true)); } /// @notice Tests that the validate function successfully returns the right error when the /// FaultDisputeGame (permissionless) maxGameDepth is invalid. function test_validate_faultDisputeGameInvalidMaxGameDepth_succeeds() public { vm.mockCall(address(fdgImpl), abi.encodeCall(IFaultDisputeGame.maxGameDepth, ()), abi.encode(50)); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PLDG-100,CKDG-100", _validate(true)); - } else { - assertEq("PLDG-100", _validate(true)); - } + assertEq("PLDG-100,CKDG-100", _validate(true)); } /// @notice Tests that the validate function successfully returns the right error when the @@ -1687,11 +1547,7 @@ contract OPContractsManagerStandardValidator_FaultDisputeGame_Test is OPContract vm.mockCall( address(fdgImpl), abi.encodeCall(IFaultDisputeGame.maxClockDuration, ()), abi.encode(Duration.wrap(1000)) ); - if (isDevFeatureEnabled(DevFeatures.CANNON_KONA)) { - assertEq("PLDG-110,CKDG-110", _validate(true)); - } else { - assertEq("PLDG-110", _validate(true)); - } + assertEq("PLDG-110,CKDG-110", _validate(true)); } } @@ -1788,6 +1644,14 @@ contract OPContractsManagerStandardValidator_Versions_Test is OPContractsManager "l1StandardBridgeVersion empty" ); assertTrue(bytes(ISemver(opcm.opcmStandardValidator().mipsImpl()).version()).length > 0, "mipsVersion empty"); + assertTrue( + bytes(ISemver(opcm.opcmStandardValidator().faultDisputeGameImpl()).version()).length > 0, + "faultDisputeGameVersion empty" + ); + assertTrue( + bytes(ISemver(opcm.opcmStandardValidator().permissionedDisputeGameImpl()).version()).length > 0, + "permissionedDisputeGameVersion empty" + ); assertTrue( bytes(ISemver(opcm.opcmStandardValidator().optimismMintableERC20FactoryImpl()).version()).length > 0, "optimismMintableERC20FactoryVersion empty" @@ -1804,10 +1668,6 @@ contract OPContractsManagerStandardValidator_Versions_Test is OPContractsManager bytes(ISemver(opcm.opcmStandardValidator().delayedWETHImpl()).version()).length > 0, "delayedWETHVersion empty" ); - assertTrue( - bytes(opcm.opcmStandardValidator().permissionedDisputeGameVersion()).length > 0, - "permissionedDisputeGameVersion empty" - ); assertTrue( bytes(opcm.opcmStandardValidator().preimageOracleVersion()).length > 0, "preimageOracleVersion empty" ); diff --git a/packages/contracts-bedrock/test/dispute/DisputeGameFactory.t.sol b/packages/contracts-bedrock/test/dispute/DisputeGameFactory.t.sol index 5cc183833f63b..e17fde3c0a673 100644 --- a/packages/contracts-bedrock/test/dispute/DisputeGameFactory.t.sol +++ b/packages/contracts-bedrock/test/dispute/DisputeGameFactory.t.sol @@ -11,7 +11,6 @@ import { DeployUtils } from "scripts/libraries/DeployUtils.sol"; // Libraries import "src/dispute/lib/Types.sol"; import "src/dispute/lib/Errors.sol"; -import { DevFeatures } from "src/libraries/DevFeatures.sol"; // Interfaces import { IDisputeGameFactory } from "interfaces/dispute/IDisputeGameFactory.sol"; @@ -187,11 +186,7 @@ abstract contract DisputeGameFactory_TestInit is CommonTest { internal returns (address gameImpl_, AlphabetVM vm_, IPreimageOracle preimageOracle_) { - if (isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - return setupFaultDisputeGameV2(_absolutePrestate); - } else { - return setupFaultDisputeGameV1(_absolutePrestate); - } + return setupFaultDisputeGameV2(_absolutePrestate); } /// @notice Sets up a fault game implementation @@ -274,11 +269,7 @@ abstract contract DisputeGameFactory_TestInit is CommonTest { internal returns (address gameImpl_, AlphabetVM vm_, IPreimageOracle preimageOracle_) { - if (isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - return setupPermissionedDisputeGameV2(_absolutePrestate, _proposer, _challenger); - } else { - return setupPermissionedDisputeGameV1(_absolutePrestate, _proposer, _challenger); - } + return setupPermissionedDisputeGameV2(_absolutePrestate, _proposer, _challenger); } function setupPermissionedDisputeGameV1( @@ -456,7 +447,7 @@ contract DisputeGameFactory_Create_Test is DisputeGameFactory_TestInit { { // Ensure that the `gameType` is within the bounds of the `GameType` enum's possible // values. - uint32 maxGameType = isDevFeatureEnabled(DevFeatures.CANNON_KONA) ? 8 : 2; + uint32 maxGameType = 8; GameType gt = GameType.wrap(uint8(bound(gameType, 0, maxGameType))); // Ensure the rootClaim has a VMStatus that disagrees with the validity. rootClaim = changeClaimStatus(rootClaim, VMStatuses.INVALID); @@ -523,7 +514,7 @@ contract DisputeGameFactory_Create_Test is DisputeGameFactory_TestInit { // Ensure that the `gameType` is within the bounds of the `GameType` enum's possible // values. We skip over game type = 0, since the deploy script set the implementation for // that game type. - uint32 maxGameType = isDevFeatureEnabled(DevFeatures.CANNON_KONA) ? 8 : 2; + uint32 maxGameType = 8; GameType gt = GameType.wrap(uint32(bound(gameType, maxGameType + 1, type(uint32).max))); // Ensure the rootClaim has a VMStatus that disagrees with the validity. rootClaim = changeClaimStatus(rootClaim, VMStatuses.INVALID); @@ -537,7 +528,7 @@ contract DisputeGameFactory_Create_Test is DisputeGameFactory_TestInit { function testFuzz_create_sameUUID_reverts(uint32 gameType, Claim rootClaim, bytes calldata extraData) public { // Ensure that the `gameType` is within the bounds of the `GameType` enum's possible // values. - uint32 maxGameType = isDevFeatureEnabled(DevFeatures.CANNON_KONA) ? 8 : 2; + uint32 maxGameType = 8; GameType gt = GameType.wrap(uint8(bound(gameType, 0, maxGameType))); // Ensure the rootClaim has a VMStatus that disagrees with the validity. rootClaim = changeClaimStatus(rootClaim, VMStatuses.INVALID); diff --git a/packages/contracts-bedrock/test/dispute/FaultDisputeGame.t.sol b/packages/contracts-bedrock/test/dispute/FaultDisputeGame.t.sol index e4970e0ad76fd..3ad1f2a0b9e28 100644 --- a/packages/contracts-bedrock/test/dispute/FaultDisputeGame.t.sol +++ b/packages/contracts-bedrock/test/dispute/FaultDisputeGame.t.sol @@ -21,7 +21,6 @@ import { LibClock } from "src/dispute/lib/LibUDT.sol"; import { LibPosition } from "src/dispute/lib/LibPosition.sol"; import "src/dispute/lib/Types.sol"; import "src/dispute/lib/Errors.sol"; -import { DevFeatures } from "src/libraries/DevFeatures.sol"; // Interfaces import { IDisputeGame } from "interfaces/dispute/IDisputeGame.sol"; @@ -29,7 +28,6 @@ import { IPreimageOracle } from "interfaces/dispute/IBigStepper.sol"; import { IAnchorStateRegistry } from "interfaces/dispute/IAnchorStateRegistry.sol"; import { IFaultDisputeGame } from "interfaces/dispute/IFaultDisputeGame.sol"; import { IFaultDisputeGameV2 } from "interfaces/dispute/v2/IFaultDisputeGameV2.sol"; -import { IDelayedWETH } from "interfaces/dispute/IDelayedWETH.sol"; contract ClaimCreditReenter { Vm internal immutable vm; @@ -233,268 +231,11 @@ contract FaultDisputeGame_Version_Test is FaultDisputeGame_TestInit { } } -/// @title FaultDisputeGame_Constructor_Test -/// @notice Tests the constructor of the `FaultDisputeGame` contract. -contract FaultDisputeGame_Constructor_Test is FaultDisputeGame_TestInit { - function setUp() public virtual override { - super.setUp(); - skipIfDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES); - } - - /// @notice Tests that the constructor of the `FaultDisputeGame` reverts when the - /// `MAX_GAME_DEPTH` parameter is greater than `LibPosition.MAX_POSITION_BITLEN - 1`. - function testFuzz_constructor_maxDepthTooLarge_reverts(uint256 _maxGameDepth) public { - IPreimageOracle oracle = IPreimageOracle( - DeployUtils.create1({ - _name: "PreimageOracle", - _args: DeployUtils.encodeConstructor(abi.encodeCall(IPreimageOracle.__constructor__, (0, 0))) - }) - ); - AlphabetVM alphabetVM = new AlphabetVM(absolutePrestate, oracle); - - _maxGameDepth = bound(_maxGameDepth, LibPosition.MAX_POSITION_BITLEN, type(uint256).max - 1); - vm.expectRevert(MaxDepthTooLarge.selector); - DeployUtils.create1({ - _name: "FaultDisputeGame", - _args: DeployUtils.encodeConstructor( - abi.encodeCall( - IFaultDisputeGame.__constructor__, - ( - IFaultDisputeGame.GameConstructorParams({ - gameType: GAME_TYPE, - absolutePrestate: absolutePrestate, - maxGameDepth: _maxGameDepth, - splitDepth: _maxGameDepth + 1, - clockExtension: Duration.wrap(3 hours), - maxClockDuration: Duration.wrap(3.5 days), - vm: alphabetVM, - weth: IDelayedWETH(payable(address(0))), - anchorStateRegistry: IAnchorStateRegistry(address(0)), - l2ChainId: 10 - }) - ) - ) - ) - }); - } - - /// @notice Tests that the constructor of the `FaultDisputeGame` reverts when the challenge - /// period of the preimage oracle being used by the game's VM is too large. - /// @param _challengePeriod The challenge period of the preimage oracle. - function testFuzz_constructor_oracleChallengePeriodTooLarge_reverts(uint256 _challengePeriod) public { - _challengePeriod = bound(_challengePeriod, uint256(type(uint64).max) + 1, type(uint256).max); - - IPreimageOracle oracle = IPreimageOracle( - DeployUtils.create1({ - _name: "PreimageOracle", - _args: DeployUtils.encodeConstructor(abi.encodeCall(IPreimageOracle.__constructor__, (0, 0))) - }) - ); - AlphabetVM alphabetVM = new AlphabetVM(absolutePrestate, IPreimageOracle(address(oracle))); - - // PreimageOracle constructor will revert if the challenge period is too large, so we need - // to mock the call to pretend this is a bugged implementation where the challenge period - // is allowed to be too large. - vm.mockCall(address(oracle), abi.encodeCall(IPreimageOracle.challengePeriod, ()), abi.encode(_challengePeriod)); - - vm.expectRevert(InvalidChallengePeriod.selector); - DeployUtils.create1({ - _name: "FaultDisputeGame", - _args: DeployUtils.encodeConstructor( - abi.encodeCall( - IFaultDisputeGame.__constructor__, - ( - IFaultDisputeGame.GameConstructorParams({ - gameType: GAME_TYPE, - absolutePrestate: absolutePrestate, - maxGameDepth: 2 ** 3, - splitDepth: 2 ** 2, - clockExtension: Duration.wrap(3 hours), - maxClockDuration: Duration.wrap(3.5 days), - vm: alphabetVM, - weth: IDelayedWETH(payable(address(0))), - anchorStateRegistry: IAnchorStateRegistry(address(0)), - l2ChainId: 10 - }) - ) - ) - ) - }); - } - - /// @notice Tests that the constructor of the `FaultDisputeGame` reverts when the `_splitDepth` - /// parameter is greater than or equal to the `MAX_GAME_DEPTH` - function testFuzz_constructor_invalidSplitDepth_reverts(uint256 _splitDepth) public { - AlphabetVM alphabetVM = new AlphabetVM( - absolutePrestate, - IPreimageOracle( - DeployUtils.create1({ - _name: "PreimageOracle", - _args: DeployUtils.encodeConstructor(abi.encodeCall(IPreimageOracle.__constructor__, (0, 0))) - }) - ) - ); - - uint256 maxGameDepth = 2 ** 3; - _splitDepth = bound(_splitDepth, maxGameDepth - 1, type(uint256).max); - vm.expectRevert(InvalidSplitDepth.selector); - DeployUtils.create1({ - _name: "FaultDisputeGame", - _args: DeployUtils.encodeConstructor( - abi.encodeCall( - IFaultDisputeGame.__constructor__, - ( - IFaultDisputeGame.GameConstructorParams({ - gameType: GAME_TYPE, - absolutePrestate: absolutePrestate, - maxGameDepth: maxGameDepth, - splitDepth: _splitDepth, - clockExtension: Duration.wrap(3 hours), - maxClockDuration: Duration.wrap(3.5 days), - vm: alphabetVM, - weth: IDelayedWETH(payable(address(0))), - anchorStateRegistry: IAnchorStateRegistry(address(0)), - l2ChainId: 10 - }) - ) - ) - ) - }); - } - - /// @notice Tests that the constructor of the `FaultDisputeGame` reverts when the `_splitDepth` - /// parameter is less than the minimum split depth (currently 2). - function testFuzz_constructor_lowSplitDepth_reverts(uint256 _splitDepth) public { - AlphabetVM alphabetVM = new AlphabetVM( - absolutePrestate, - IPreimageOracle( - DeployUtils.create1({ - _name: "PreimageOracle", - _args: DeployUtils.encodeConstructor(abi.encodeCall(IPreimageOracle.__constructor__, (0, 0))) - }) - ) - ); - - uint256 minSplitDepth = 2; - _splitDepth = bound(_splitDepth, 0, minSplitDepth - 1); - vm.expectRevert(InvalidSplitDepth.selector); - DeployUtils.create1({ - _name: "FaultDisputeGame", - _args: DeployUtils.encodeConstructor( - abi.encodeCall( - IFaultDisputeGame.__constructor__, - ( - IFaultDisputeGame.GameConstructorParams({ - gameType: GAME_TYPE, - absolutePrestate: absolutePrestate, - maxGameDepth: 2 ** 3, - splitDepth: _splitDepth, - clockExtension: Duration.wrap(3 hours), - maxClockDuration: Duration.wrap(3.5 days), - vm: alphabetVM, - weth: IDelayedWETH(payable(address(0))), - anchorStateRegistry: IAnchorStateRegistry(address(0)), - l2ChainId: 10 - }) - ) - ) - ) - }); - } - - /// @notice Tests that the constructor of the `FaultDisputeGame` reverts when clock - /// extension * 2 is greater than the max clock duration. - function testFuzz_constructor_clockExtensionTooLong_reverts( - uint64 _maxClockDuration, - uint64 _clockExtension - ) - public - { - AlphabetVM alphabetVM = new AlphabetVM( - absolutePrestate, - IPreimageOracle( - DeployUtils.create1({ - _name: "PreimageOracle", - _args: DeployUtils.encodeConstructor(abi.encodeCall(IPreimageOracle.__constructor__, (0, 0))) - }) - ) - ); - - // Force the clock extension * 2 to be greater than the max clock duration, but keep things - // within bounds of the uint64 type. - _maxClockDuration = uint64(bound(_maxClockDuration, 0, type(uint64).max / 2 - 1)); - _clockExtension = uint64(bound(_clockExtension, _maxClockDuration / 2 + 1, type(uint64).max / 2)); - - vm.expectRevert(InvalidClockExtension.selector); - DeployUtils.create1({ - _name: "FaultDisputeGame", - _args: DeployUtils.encodeConstructor( - abi.encodeCall( - IFaultDisputeGame.__constructor__, - ( - IFaultDisputeGame.GameConstructorParams({ - gameType: GAME_TYPE, - absolutePrestate: absolutePrestate, - maxGameDepth: 16, - splitDepth: 8, - clockExtension: Duration.wrap(_clockExtension), - maxClockDuration: Duration.wrap(_maxClockDuration), - vm: alphabetVM, - weth: IDelayedWETH(payable(address(0))), - anchorStateRegistry: IAnchorStateRegistry(address(0)), - l2ChainId: 10 - }) - ) - ) - ) - }); - } - - /// @notice Tests that the constructor of the `FaultDisputeGame` reverts when the `_gameType` - /// parameter is set to the reserved `type(uint32).max` game type. - function test_constructor_reservedGameType_reverts() public { - AlphabetVM alphabetVM = new AlphabetVM( - absolutePrestate, - IPreimageOracle( - DeployUtils.create1({ - _name: "PreimageOracle", - _args: DeployUtils.encodeConstructor(abi.encodeCall(IPreimageOracle.__constructor__, (0, 0))) - }) - ) - ); - - vm.expectRevert(ReservedGameType.selector); - DeployUtils.create1({ - _name: "FaultDisputeGame", - _args: DeployUtils.encodeConstructor( - abi.encodeCall( - IFaultDisputeGame.__constructor__, - ( - IFaultDisputeGame.GameConstructorParams({ - gameType: GameType.wrap(type(uint32).max), - absolutePrestate: absolutePrestate, - maxGameDepth: 16, - splitDepth: 8, - clockExtension: Duration.wrap(3 hours), - maxClockDuration: Duration.wrap(3.5 days), - vm: alphabetVM, - weth: IDelayedWETH(payable(address(0))), - anchorStateRegistry: IAnchorStateRegistry(address(0)), - l2ChainId: 10 - }) - ) - ) - ) - }); - } -} - /// @title FaultDisputeGame_Constructor_Test /// @notice Tests the constructor of the `FaultDisputeGame` contract. contract FaultDisputeGameV2_Constructor_Test is FaultDisputeGame_TestInit { function setUp() public virtual override { super.setUp(); - skipIfDevFeatureDisabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES); } /// @notice Tests that the constructor of the `FaultDisputeGame` reverts when the @@ -668,7 +409,6 @@ contract FaultDisputeGame_Initialize_Test is FaultDisputeGame_TestInit { /// @notice Tests that the game cannot be initialized with incorrect CWIA calldata length /// caused by additional immutable args data function test_initialize_extraImmutableArgsBytes_reverts(uint256 _extraByteCount) public { - skipIfDevFeatureDisabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES); (bytes memory correctArgs,,) = getFaultDisputeGameV2ImmutableArgs(absolutePrestate); // We bound the upper end to 23.5KB to ensure that the minimal proxy never surpasses the @@ -694,7 +434,6 @@ contract FaultDisputeGame_Initialize_Test is FaultDisputeGame_TestInit { /// @notice Tests that the game cannot be initialized with incorrect CWIA calldata length /// caused by missing immutable args data function test_initialize_missingImmutableArgsBytes_reverts(uint256 _truncatedByteCount) public { - skipIfDevFeatureDisabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES); (bytes memory correctArgs,,) = getFaultDisputeGameV2ImmutableArgs(absolutePrestate); _truncatedByteCount = (_truncatedByteCount % correctArgs.length) + 1; @@ -2876,14 +2615,8 @@ contract FaultDisputeGame_Uncategorized_Test is FaultDisputeGame_TestInit { // Construct the expected CWIA data that the proxy will pass to the implementation, // alongside any extra calldata passed by the user. Hash l1Head = gameProxy.l1Head(); - bytes memory cwiaData; - if (isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - cwiaData = abi.encodePacked( - address(this), gameProxy.rootClaim(), l1Head, gameProxy.gameType(), gameProxy.extraData() - ); - } else { - cwiaData = abi.encodePacked(address(this), gameProxy.rootClaim(), l1Head, gameProxy.extraData()); - } + bytes memory cwiaData = + abi.encodePacked(address(this), gameProxy.rootClaim(), l1Head, gameProxy.gameType(), gameProxy.extraData()); // We expect a `ReceiveETH` event to be emitted when 0 bytes of calldata are sent; The // fallback is always reached *within the minimal proxy* in `LibClone`'s version of diff --git a/packages/contracts-bedrock/test/dispute/PermissionedDisputeGame.t.sol b/packages/contracts-bedrock/test/dispute/PermissionedDisputeGame.t.sol index f2876bc39daaf..e5f15c3424c74 100644 --- a/packages/contracts-bedrock/test/dispute/PermissionedDisputeGame.t.sol +++ b/packages/contracts-bedrock/test/dispute/PermissionedDisputeGame.t.sol @@ -8,7 +8,6 @@ import { AlphabetVM } from "test/mocks/AlphabetVM.sol"; // Libraries import "src/dispute/lib/Types.sol"; import "src/dispute/lib/Errors.sol"; -import { DevFeatures } from "src/libraries/DevFeatures.sol"; // Interfaces import { IFaultDisputeGame } from "interfaces/dispute/IFaultDisputeGame.sol"; @@ -286,7 +285,6 @@ contract PermissionedDisputeGame_Initialize_Test is PermissionedDisputeGame_Test /// @notice Tests that the game cannot be initialized with incorrect CWIA calldata length /// caused by additional immutable args data function test_initialize_extraImmutableArgsBytes_reverts(uint256 _extraByteCount) public { - skipIfDevFeatureDisabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES); (bytes memory correctArgs,,) = getPermissionedDisputeGameV2ImmutableArgs(absolutePrestate, PROPOSER, CHALLENGER); // We bound the upper end to 23.5KB to ensure that the minimal proxy never surpasses the @@ -313,7 +311,6 @@ contract PermissionedDisputeGame_Initialize_Test is PermissionedDisputeGame_Test /// @notice Tests that the game cannot be initialized with incorrect CWIA calldata length /// caused by missing immutable args data function test_initialize_missingImmutableArgsBytes_reverts(uint256 _truncatedByteCount) public { - skipIfDevFeatureDisabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES); (bytes memory correctArgs,,) = getPermissionedDisputeGameV2ImmutableArgs(absolutePrestate, PROPOSER, CHALLENGER); _truncatedByteCount = (_truncatedByteCount % correctArgs.length) + 1; diff --git a/packages/contracts-bedrock/test/opcm/DeployDisputeGame.t.sol b/packages/contracts-bedrock/test/opcm/DeployDisputeGame.t.sol index 1c429e245a98e..6931a6e13c22d 100644 --- a/packages/contracts-bedrock/test/opcm/DeployDisputeGame.t.sol +++ b/packages/contracts-bedrock/test/opcm/DeployDisputeGame.t.sol @@ -13,7 +13,6 @@ import { IPreimageOracle } from "interfaces/cannon/IPreimageOracle.sol"; import { LibPosition } from "src/dispute/lib/LibPosition.sol"; import { GameType } from "src/dispute/lib/Types.sol"; import { LibString } from "@solady/utils/LibString.sol"; -import { Config } from "scripts/libraries/Config.sol"; import { PreimageOracle } from "src/cannon/PreimageOracle.sol"; import { DeployDisputeGame } from "scripts/deploy/DeployDisputeGame.s.sol"; @@ -74,7 +73,6 @@ contract DeployDisputeGame_Test is Test { _input.maxGameDepth = _maxGameDepth; _input.splitDepth = bound(_splitDepth, 2, _maxGameDepth - 2); _input.vmAddress = bigStepper; - _input.useV2 = Config.devFeatureDeployV2DisputeGames(); // Run the deployment script. deployDisputeGame.run(_input); @@ -181,7 +179,6 @@ contract DeployDisputeGame_Test is Test { function defaultFaultDisputeGameInput() private view returns (DeployDisputeGame.Input memory input_) { input_ = DeployDisputeGame.Input({ release: "op-contracts", - useV2: Config.devFeatureDeployV2DisputeGames(), gameKind: "FaultDisputeGame", gameType: GameType.wrap(1), absolutePrestate: bytes32(uint256(1)), @@ -201,7 +198,6 @@ contract DeployDisputeGame_Test is Test { function defaultPermissionedDisputeGameInput() private view returns (DeployDisputeGame.Input memory input_) { input_ = DeployDisputeGame.Input({ release: "op-contracts", - useV2: Config.devFeatureDeployV2DisputeGames(), gameKind: "PermissionedDisputeGame", gameType: GameType.wrap(1), absolutePrestate: bytes32(uint256(1)), diff --git a/packages/contracts-bedrock/test/opcm/DeployImplementations.t.sol b/packages/contracts-bedrock/test/opcm/DeployImplementations.t.sol index e5f945dba2623..3136aaeb0c21a 100644 --- a/packages/contracts-bedrock/test/opcm/DeployImplementations.t.sol +++ b/packages/contracts-bedrock/test/opcm/DeployImplementations.t.sol @@ -51,83 +51,40 @@ contract DeployImplementations_Test is Test, FeatureFlags { assertNotEq(address(output.systemConfigImpl), address(0)); - if (isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - assertNotEq(address(output.faultDisputeGameV2Impl), address(0), "FaultDisputeGameV2 should be deployed"); - assertNotEq( - address(output.permissionedDisputeGameV2Impl), - address(0), - "PermissionedDisputeGameV2 should be deployed" - ); - - // Validate constructor args for FaultDisputeGameV2 - assertEq(output.faultDisputeGameV2Impl.maxGameDepth(), 73, "FaultDisputeGameV2 maxGameDepth incorrect"); - assertEq(output.faultDisputeGameV2Impl.splitDepth(), 30, "FaultDisputeGameV2 splitDepth incorrect"); - assertEq( - output.faultDisputeGameV2Impl.clockExtension().raw(), - 10800, - "FaultDisputeGameV2 clockExtension incorrect" - ); - assertEq( - output.faultDisputeGameV2Impl.maxClockDuration().raw(), - 302400, - "FaultDisputeGameV2 maxClockDuration incorrect" - ); - - // Validate constructor args for PermissionedDisputeGameV2 - assertEq( - output.permissionedDisputeGameV2Impl.maxGameDepth(), - 73, - "PermissionedDisputeGameV2 maxGameDepth incorrect" - ); - assertEq( - output.permissionedDisputeGameV2Impl.splitDepth(), 30, "PermissionedDisputeGameV2 splitDepth incorrect" - ); - assertEq( - output.permissionedDisputeGameV2Impl.clockExtension().raw(), - 10800, - "PermissionedDisputeGameV2 clockExtension incorrect" - ); - assertEq( - output.permissionedDisputeGameV2Impl.maxClockDuration().raw(), - 302400, - "PermissionedDisputeGameV2 maxClockDuration incorrect" - ); + assertNotEq(address(output.faultDisputeGameV2Impl), address(0), "FaultDisputeGameV2 should be deployed"); + assertNotEq( + address(output.permissionedDisputeGameV2Impl), address(0), "PermissionedDisputeGameV2 should be deployed" + ); - // Ensure legacy blueprints were not deployed - assertEq( - output.opcm.blueprints().permissionedDisputeGame1, - address(0), - "PermissionedDisputeGame1 blueprint should not be deployed" - ); - assertEq( - output.opcm.blueprints().permissionedDisputeGame2, - address(0), - "PermissionedDisputeGame2 blueprint should not be deployed" - ); - assertEq( - output.opcm.blueprints().permissionlessDisputeGame1, - address(0), - "PermissionlessDisputeGame1 blueprint should not be deployed" - ); - assertEq( - output.opcm.blueprints().permissionlessDisputeGame2, - address(0), - "PermissionlessDisputeGame2 blueprint should not be deployed" - ); - } else { - assertEq(address(output.faultDisputeGameV2Impl), address(0), "FaultDisputeGameV2 should not be deployed"); - assertEq( - address(output.permissionedDisputeGameV2Impl), - address(0), - "PermissionedDisputeGameV2 should not be deployed" - ); + // Validate constructor args for FaultDisputeGameV2 + assertEq(output.faultDisputeGameV2Impl.maxGameDepth(), 73, "FaultDisputeGameV2 maxGameDepth incorrect"); + assertEq(output.faultDisputeGameV2Impl.splitDepth(), 30, "FaultDisputeGameV2 splitDepth incorrect"); + assertEq( + output.faultDisputeGameV2Impl.clockExtension().raw(), 10800, "FaultDisputeGameV2 clockExtension incorrect" + ); + assertEq( + output.faultDisputeGameV2Impl.maxClockDuration().raw(), + 302400, + "FaultDisputeGameV2 maxClockDuration incorrect" + ); - // Ensure other contracts are still deployed - assertNotEq(address(output.systemConfigImpl), address(0), "SystemConfig should still be deployed"); - assertNotEq( - address(output.disputeGameFactoryImpl), address(0), "DisputeGameFactory should still be deployed" - ); - } + // Validate constructor args for PermissionedDisputeGameV2 + assertEq( + output.permissionedDisputeGameV2Impl.maxGameDepth(), 73, "PermissionedDisputeGameV2 maxGameDepth incorrect" + ); + assertEq( + output.permissionedDisputeGameV2Impl.splitDepth(), 30, "PermissionedDisputeGameV2 splitDepth incorrect" + ); + assertEq( + output.permissionedDisputeGameV2Impl.clockExtension().raw(), + 10800, + "PermissionedDisputeGameV2 clockExtension incorrect" + ); + assertEq( + output.permissionedDisputeGameV2Impl.maxClockDuration().raw(), + 302400, + "PermissionedDisputeGameV2 maxClockDuration incorrect" + ); // for the super DG implementation deployments if (isDevFeatureEnabled(DevFeatures.OPTIMISM_PORTAL_INTEROP)) { @@ -213,13 +170,8 @@ contract DeployImplementations_Test is Test, FeatureFlags { assertEq(address(output1.faultDisputeGameV2Impl), address(output2.faultDisputeGameV2Impl), "1400"); assertEq(address(output1.permissionedDisputeGameV2Impl), address(output2.permissionedDisputeGameV2Impl), "1500"); - if (isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - assertNotEq(address(output1.faultDisputeGameV2Impl), address(0), "V2 contracts should not be null"); - assertNotEq(address(output1.permissionedDisputeGameV2Impl), address(0), "V2 contracts should not be null"); - } else { - assertEq(address(output1.faultDisputeGameV2Impl), address(0), "V2 contracts should be null"); - assertEq(address(output1.permissionedDisputeGameV2Impl), address(0), "V2 contracts should be null"); - } + assertNotEq(address(output1.faultDisputeGameV2Impl), address(0), "V2 contracts should not be null"); + assertNotEq(address(output1.permissionedDisputeGameV2Impl), address(0), "V2 contracts should not be null"); } function testFuzz_run_memory_succeeds( @@ -272,18 +224,6 @@ contract DeployImplementations_Test is Test, FeatureFlags { _faultGameV2ClockExtension = bound(_faultGameV2ClockExtension, 1, 7 days); _faultGameV2MaxClockDuration = bound(_faultGameV2MaxClockDuration, _faultGameV2ClockExtension * 2, 30 days); - bool usesV2GameParameters = DevFeatures.isDevFeatureEnabled( - _devFeatureBitmap, DevFeatures.DEPLOY_V2_DISPUTE_GAMES - ) || DevFeatures.isDevFeatureEnabled(_devFeatureBitmap, DevFeatures.OPTIMISM_PORTAL_INTEROP); - // When V2 is not enabled, set V2 params to 0 to match script expectations - // Otherwise ensure they remain within bounds already set - if (!usesV2GameParameters) { - _faultGameV2MaxGameDepth = 0; - _faultGameV2SplitDepth = 0; - _faultGameV2ClockExtension = 0; - _faultGameV2MaxClockDuration = 0; - } - DeployImplementations.Input memory input = DeployImplementations.Input( _withdrawalDelaySeconds, _minProposalSizeBytes, @@ -319,44 +259,36 @@ contract DeployImplementations_Test is Test, FeatureFlags { assertNotEq(address(output.opcmDeployer), address(0), "1000"); assertNotEq(address(output.opcmGameTypeAdder), address(0), "1100"); - // Check V2 contracts based on feature flag - bool v2Enabled = DevFeatures.isDevFeatureEnabled(_devFeatureBitmap, DevFeatures.DEPLOY_V2_DISPUTE_GAMES); - if (v2Enabled) { - assertNotEq(address(output.faultDisputeGameV2Impl), address(0), "V2 should be deployed when enabled"); - assertNotEq(address(output.permissionedDisputeGameV2Impl), address(0), "V2 should be deployed when enabled"); + assertNotEq(address(output.faultDisputeGameV2Impl), address(0), "V2 should be deployed when enabled"); + assertNotEq(address(output.permissionedDisputeGameV2Impl), address(0), "V2 should be deployed when enabled"); - // Verify V2 constructor parameters match fuzz inputs - assertEq(output.faultDisputeGameV2Impl.maxGameDepth(), _faultGameV2MaxGameDepth, "FDGv2 maxGameDepth"); - assertEq(output.faultDisputeGameV2Impl.splitDepth(), _faultGameV2SplitDepth, "FDGv2 splitDepth"); - assertEq( - output.faultDisputeGameV2Impl.clockExtension().raw(), - uint64(_faultGameV2ClockExtension), - "FDGv2 clockExtension" - ); - assertEq( - output.faultDisputeGameV2Impl.maxClockDuration().raw(), - uint64(_faultGameV2MaxClockDuration), - "FDGv2 maxClockDuration" - ); + // Verify V2 constructor parameters match fuzz inputs + assertEq(output.faultDisputeGameV2Impl.maxGameDepth(), _faultGameV2MaxGameDepth, "FDGv2 maxGameDepth"); + assertEq(output.faultDisputeGameV2Impl.splitDepth(), _faultGameV2SplitDepth, "FDGv2 splitDepth"); + assertEq( + output.faultDisputeGameV2Impl.clockExtension().raw(), + uint64(_faultGameV2ClockExtension), + "FDGv2 clockExtension" + ); + assertEq( + output.faultDisputeGameV2Impl.maxClockDuration().raw(), + uint64(_faultGameV2MaxClockDuration), + "FDGv2 maxClockDuration" + ); + + assertEq(output.permissionedDisputeGameV2Impl.maxGameDepth(), _faultGameV2MaxGameDepth, "PDGv2 maxGameDepth"); + assertEq(output.permissionedDisputeGameV2Impl.splitDepth(), _faultGameV2SplitDepth, "PDGv2 splitDepth"); + assertEq( + output.permissionedDisputeGameV2Impl.clockExtension().raw(), + uint64(_faultGameV2ClockExtension), + "PDGv2 clockExtension" + ); + assertEq( + output.permissionedDisputeGameV2Impl.maxClockDuration().raw(), + uint64(_faultGameV2MaxClockDuration), + "PDGv2 maxClockDuration" + ); - assertEq( - output.permissionedDisputeGameV2Impl.maxGameDepth(), _faultGameV2MaxGameDepth, "PDGv2 maxGameDepth" - ); - assertEq(output.permissionedDisputeGameV2Impl.splitDepth(), _faultGameV2SplitDepth, "PDGv2 splitDepth"); - assertEq( - output.permissionedDisputeGameV2Impl.clockExtension().raw(), - uint64(_faultGameV2ClockExtension), - "PDGv2 clockExtension" - ); - assertEq( - output.permissionedDisputeGameV2Impl.maxClockDuration().raw(), - uint64(_faultGameV2MaxClockDuration), - "PDGv2 maxClockDuration" - ); - } else { - assertEq(address(output.faultDisputeGameV2Impl), address(0), "V2 should be null when disabled"); - assertEq(address(output.permissionedDisputeGameV2Impl), address(0), "V2 should be null when disabled"); - } bool superGamesEnabled = DevFeatures.isDevFeatureEnabled(_devFeatureBitmap, DevFeatures.OPTIMISM_PORTAL_INTEROP); if (superGamesEnabled) { assertNotEq( @@ -424,16 +356,8 @@ contract DeployImplementations_Test is Test, FeatureFlags { assertNotEq(address(output.opcmDeployer).code, empty, "2200"); assertNotEq(address(output.opcmGameTypeAdder).code, empty, "2300"); - // V2 contracts code existence based on feature flag - if (v2Enabled) { - assertNotEq(address(output.faultDisputeGameV2Impl).code, empty, "V2 FDG should have code when enabled"); - assertNotEq( - address(output.permissionedDisputeGameV2Impl).code, empty, "V2 PDG should have code when enabled" - ); - } else { - assertEq(address(output.faultDisputeGameV2Impl).code, empty, "V2 FDG should be empty when disabled"); - assertEq(address(output.permissionedDisputeGameV2Impl).code, empty, "V2 PDG should be empty when disabled"); - } + assertNotEq(address(output.faultDisputeGameV2Impl).code, empty, "V2 FDG should have code when enabled"); + assertNotEq(address(output.permissionedDisputeGameV2Impl).code, empty, "V2 PDG should have code when enabled"); if (superGamesEnabled) { assertNotEq(address(output.superFaultDisputeGameImpl).code, empty, "Super DG should have code when enabled"); assertNotEq( @@ -531,54 +455,7 @@ contract DeployImplementations_Test is Test, FeatureFlags { deployImplementations.run(input); } - function test_v2ParamsValidation_withFlagDisabled_succeeds() public { - // When V2 flag is disabled, V2 params should be 0 or within safe bounds - DeployImplementations.Input memory input = defaultInput(); - input.devFeatureBitmap = bytes32(0); // V2 disabled - - // Test that zero values are accepted - input.faultGameV2MaxGameDepth = 0; - input.faultGameV2SplitDepth = 0; - input.faultGameV2ClockExtension = 0; - input.faultGameV2MaxClockDuration = 0; - - DeployImplementations.Output memory output = deployImplementations.run(input); - assertEq(address(output.faultDisputeGameV2Impl), address(0), "V2 FDG should be null when disabled"); - assertEq(address(output.permissionedDisputeGameV2Impl), address(0), "V2 PDG should be null when disabled"); - } - - function test_invalidV2GameParams_withV2Disabled_succeeds() public { - skipIfDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES); - skipIfDevFeatureEnabled(DevFeatures.OPTIMISM_PORTAL_INTEROP); // for the Super DG - DeployImplementations.Input memory input; - - // When V2 flag is disabled, out-of-range values are ok - input = defaultInput(); - input.faultGameV2ClockExtension = type(uint256).max; - input.faultGameV2MaxClockDuration = type(uint256).max; - input.faultGameV2MaxGameDepth = 300; - input.faultGameV2SplitDepth = 1; // < 2 - input.faultGameV2ClockExtension = 0; - // Should not revert - deployImplementations.run(input); - - // Reset and test invalid split depth (too large, >= maxGameDepth) - input = defaultInput(); - input.faultGameV2MaxGameDepth = 50; - input.faultGameV2SplitDepth = 50; // splitDepth + 1 must be < maxGameDepth - // Should not revert - deployImplementations.run(input); - - // Reset and test maxClockDuration < clockExtension - input = defaultInput(); - input.faultGameV2ClockExtension = 1000; - input.faultGameV2MaxClockDuration = 500; // < clockExtension - // Should not revert - deployImplementations.run(input); - } - function test_invalidV2GameParams_withV2Enabled_reverts() public { - skipIfDevFeatureDisabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES); DeployImplementations.Input memory input; // Test that huge clock extension is rejected @@ -632,81 +509,6 @@ contract DeployImplementations_Test is Test, FeatureFlags { deployImplementations.run(input); } - function test_reuseImplementation_withV2Flags_succeeds() public { - DeployImplementations.Input memory inputEnabled = defaultInput(); - inputEnabled.devFeatureBitmap = DevFeatures.DEPLOY_V2_DISPUTE_GAMES; - DeployImplementations.Output memory output1 = deployImplementations.run(inputEnabled); - - DeployImplementations.Input memory inputDisabled = defaultInput(); - inputDisabled.devFeatureBitmap = bytes32(0); - DeployImplementations.Output memory output2 = deployImplementations.run(inputDisabled); - - // V2 contracts should be different between enabled and disabled - assertTrue( - address(output1.faultDisputeGameV2Impl) != address(output2.faultDisputeGameV2Impl), - "V2 addresses should differ between enabled/disabled" - ); - assertTrue( - address(output1.permissionedDisputeGameV2Impl) != address(output2.permissionedDisputeGameV2Impl), - "V2 addresses should differ between enabled/disabled" - ); - - // Validate constructor args for FaultDisputeGameV2 - assertEq(output1.faultDisputeGameV2Impl.maxGameDepth(), 73, "FaultDisputeGameV2 maxGameDepth incorrect"); - assertEq(output1.faultDisputeGameV2Impl.splitDepth(), 30, "FaultDisputeGameV2 splitDepth incorrect"); - assertEq( - output1.faultDisputeGameV2Impl.clockExtension().raw(), 10800, "FaultDisputeGameV2 clockExtension incorrect" - ); - assertEq( - output1.faultDisputeGameV2Impl.maxClockDuration().raw(), - 302400, - "FaultDisputeGameV2 maxClockDuration incorrect" - ); - - // Validate constructor args for PermissionedDisputeGameV2 - assertEq( - output1.permissionedDisputeGameV2Impl.maxGameDepth(), 73, "PermissionedDisputeGameV2 maxGameDepth incorrect" - ); - assertEq( - output1.permissionedDisputeGameV2Impl.splitDepth(), 30, "PermissionedDisputeGameV2 splitDepth incorrect" - ); - assertEq( - output1.permissionedDisputeGameV2Impl.clockExtension().raw(), - 10800, - "PermissionedDisputeGameV2 clockExtension incorrect" - ); - assertEq( - output1.permissionedDisputeGameV2Impl.maxClockDuration().raw(), - 302400, - "PermissionedDisputeGameV2 maxClockDuration incorrect" - ); - - // Other contracts should remain the same - assertEq( - address(output1.systemConfigImpl), - address(output2.systemConfigImpl), - "SystemConfig addresses should be the same" - ); - assertEq( - address(output1.disputeGameFactoryImpl), - address(output2.disputeGameFactoryImpl), - "DisputeGameFactory addresses should be the same" - ); - - // Running with same flags should produce same results - DeployImplementations.Output memory output3 = deployImplementations.run(inputEnabled); - assertEq( - address(output1.faultDisputeGameV2Impl), - address(output3.faultDisputeGameV2Impl), - "V2 enabled addresses should be deterministic" - ); - assertEq( - address(output1.permissionedDisputeGameV2Impl), - address(output3.permissionedDisputeGameV2Impl), - "V2 enabled addresses should be deterministic" - ); - } - function defaultInput() private view returns (DeployImplementations.Input memory input_) { input_ = DeployImplementations.Input( withdrawalDelaySeconds, diff --git a/packages/contracts-bedrock/test/opcm/DeployOPChain.t.sol b/packages/contracts-bedrock/test/opcm/DeployOPChain.t.sol index 3246d9de9b446..53defc933f152 100644 --- a/packages/contracts-bedrock/test/opcm/DeployOPChain.t.sol +++ b/packages/contracts-bedrock/test/opcm/DeployOPChain.t.sol @@ -3,7 +3,6 @@ pragma solidity 0.8.15; import { Test } from "forge-std/Test.sol"; import { FeatureFlags } from "test/setup/FeatureFlags.sol"; -import { DevFeatures } from "src/libraries/DevFeatures.sol"; import { Features } from "src/libraries/Features.sol"; import { DeploySuperchain } from "scripts/deploy/DeploySuperchain.s.sol"; @@ -151,18 +150,10 @@ contract DeployOPChain_Test is DeployOPChain_TestBase { Duration.unwrap(pdg.maxClockDuration()), Duration.unwrap(disputeMaxClockDuration), "PDG maxClockDuration" ); - if (isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - // For v2 contracts, some immutable args are passed in at game creation time from DGF.gameArgs - assertEq(address(pdg.proposer()), address(0), "PDG proposer"); - assertEq(address(pdg.challenger()), address(0), "PDG challenger"); - assertEq(Claim.unwrap(pdg.absolutePrestate()), bytes32(0), "PDG absolutePrestate"); - } else { - assertEq(address(pdg.proposer()), proposer, "PDG proposer"); - assertEq(address(pdg.challenger()), challenger, "PDG challenger"); - assertEq( - Claim.unwrap(pdg.absolutePrestate()), Claim.unwrap(disputeAbsolutePrestate), "PDG absolutePrestate" - ); - } + // For v2 contracts, some immutable args are passed in at game creation time from DGF.gameArgs + assertEq(address(pdg.proposer()), address(0), "PDG proposer"); + assertEq(address(pdg.challenger()), address(0), "PDG challenger"); + assertEq(Claim.unwrap(pdg.absolutePrestate()), bytes32(0), "PDG absolutePrestate"); // Custom gas token feature should reflect input assertEq(doo.systemConfigProxy.isCustomGasToken(), useCustomGasToken, "SystemConfig isCustomGasToken"); @@ -193,18 +184,15 @@ contract DeployOPChain_Test is DeployOPChain_TestBase { // Check dispute game deployments // Validate permissionedDisputeGame (PDG) address - bool isDeployV2Games = isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES); IOPContractsManager.Implementations memory impls = opcm.implementations(); - address expectedPDGAddress = - isDeployV2Games ? impls.permissionedDisputeGameV2Impl : address(doo.permissionedDisputeGame); + address expectedPDGAddress = impls.permissionedDisputeGameV2Impl; address actualPDGAddress = address(doo.disputeGameFactoryProxy.gameImpls(GameTypes.PERMISSIONED_CANNON)); assertNotEq(actualPDGAddress, address(0), "PDG address should be non-zero"); assertEq(actualPDGAddress, expectedPDGAddress, "PDG address should match expected address"); // Check PDG getters IPermissionedDisputeGame pdg = IPermissionedDisputeGame(actualPDGAddress); - bytes32 expectedPrestate = - isDeployV2Games ? bytes32(0) : bytes32(0x038512e02c4c3f7bdaec27d00edf55b7155e0905301e1a88083e4e0a6764d54c); + bytes32 expectedPrestate = bytes32(0); assertEq(pdg.l2BlockNumber(), 0, "3000"); assertEq(Claim.unwrap(pdg.absolutePrestate()), expectedPrestate, "3100"); assertEq(Duration.unwrap(pdg.clockExtension()), 10800, "3200"); @@ -237,18 +225,6 @@ contract DeployOPChain_Test is DeployOPChain_TestBase { ); } - function test_customDisputeGame_customEnabled_succeeds() public { - // For v2 games, these parameters have already been configured at OPCM deploy time - skipIfDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES); - - deployOPChainInput.allowCustomDisputeParameters = true; - deployOPChainInput.disputeSplitDepth = disputeSplitDepth + 1; - DeployOPChain.Output memory doo = deployOPChain.run(deployOPChainInput); - - IPermissionedDisputeGame pdg = getPermissionedDisputeGame(doo); - assertEq(pdg.splitDepth(), disputeSplitDepth + 1); - } - function getPermissionedDisputeGame(DeployOPChain.Output memory doo) internal view diff --git a/packages/contracts-bedrock/test/scripts/VerifyOPCM.t.sol b/packages/contracts-bedrock/test/scripts/VerifyOPCM.t.sol index a09475447d39b..903bfb32f9b8c 100644 --- a/packages/contracts-bedrock/test/scripts/VerifyOPCM.t.sol +++ b/packages/contracts-bedrock/test/scripts/VerifyOPCM.t.sol @@ -147,7 +147,6 @@ contract VerifyOPCM_Run_Test is VerifyOPCM_TestInit { // Check if V2 dispute games feature is enabled bytes32 bitmap = opcm.devFeatureBitmap(); - bool v2FeatureEnabled = DevFeatures.isDevFeatureEnabled(bitmap, DevFeatures.DEPLOY_V2_DISPUTE_GAMES); bool superGamesEnabled = DevFeatures.isDevFeatureEnabled(bitmap, DevFeatures.OPTIMISM_PORTAL_INTEROP); // Change 256 bytes at random. @@ -156,10 +155,6 @@ contract VerifyOPCM_Run_Test is VerifyOPCM_TestInit { uint256 randomImplIndex = vm.randomUint(0, refs.length - 1); VerifyOPCM.OpcmContractRef memory ref = refs[randomImplIndex]; - // Skip V2 dispute games when feature disabled - if (_isDisputeGameV2ContractRef(ref) && !v2FeatureEnabled) { - continue; - } // Skip super dispute games when feature disabled if (_isSuperDisputeGameContractRef(ref) && !superGamesEnabled) { continue; @@ -221,7 +216,6 @@ contract VerifyOPCM_Run_Test is VerifyOPCM_TestInit { // Check if V2 dispute games feature is enabled bytes32 bitmap = opcm.devFeatureBitmap(); - bool v2FeatureEnabled = DevFeatures.isDevFeatureEnabled(bitmap, DevFeatures.DEPLOY_V2_DISPUTE_GAMES); bool superGamesEnabled = DevFeatures.isDevFeatureEnabled(bitmap, DevFeatures.OPTIMISM_PORTAL_INTEROP); // Change 256 bytes at random. @@ -230,10 +224,6 @@ contract VerifyOPCM_Run_Test is VerifyOPCM_TestInit { uint256 randomImplIndex = vm.randomUint(0, refs.length - 1); VerifyOPCM.OpcmContractRef memory ref = refs[randomImplIndex]; - // Skip V2 dispute games when feature disabled - if (_isDisputeGameV2ContractRef(ref) && !v2FeatureEnabled) { - continue; - } // Skip super dispute games when feature disabled if (_isSuperDisputeGameContractRef(ref) && !superGamesEnabled) { continue; @@ -297,8 +287,7 @@ contract VerifyOPCM_Run_Test is VerifyOPCM_TestInit { address blueprint = ref.addr; bytes memory blueprintCode = blueprint.code; - // Skip the V2 dispute games blueprint when feature is enabled. - if (blueprintCode.length == 0 && isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { + if (blueprintCode.length == 0) { continue; } diff --git a/packages/contracts-bedrock/test/setup/DisputeGames.sol b/packages/contracts-bedrock/test/setup/DisputeGames.sol index 4ec7493c70d5f..a2179c293b671 100644 --- a/packages/contracts-bedrock/test/setup/DisputeGames.sol +++ b/packages/contracts-bedrock/test/setup/DisputeGames.sol @@ -10,13 +10,11 @@ import { console2 as console } from "forge-std/console2.sol"; // Libraries import { GameType, Claim } from "src/dispute/lib/LibUDT.sol"; import { GameTypes } from "src/dispute/lib/Types.sol"; -import { DevFeatures } from "src/libraries/DevFeatures.sol"; import { LibGameArgs } from "src/dispute/lib/LibGameArgs.sol"; // Interfaces import "../../interfaces/dispute/IDisputeGame.sol"; import "../../interfaces/dispute/IDisputeGameFactory.sol"; -import { IFaultDisputeGame } from "../../interfaces/dispute/IFaultDisputeGame.sol"; import { IPermissionedDisputeGame } from "../../interfaces/dispute/IPermissionedDisputeGame.sol"; contract DisputeGames is FeatureFlags { @@ -109,73 +107,38 @@ contract DisputeGames is FeatureFlags { } function mockGameImplPrestate(IDisputeGameFactory _dgf, GameType _gameType, bytes32 _prestate) internal { - if (isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - bytes memory value = abi.encodePacked(_prestate); - _mockGameArg(_dgf, _gameType, GameArg.PRESTATE, value); - } else { - address gameAddr = address(_dgf.gameImpls(_gameType)); - vm.mockCall(gameAddr, abi.encodeCall(IFaultDisputeGame.absolutePrestate, ()), abi.encode(_prestate)); - } + bytes memory value = abi.encodePacked(_prestate); + _mockGameArg(_dgf, _gameType, GameArg.PRESTATE, value); } function mockGameImplVM(IDisputeGameFactory _dgf, GameType _gameType, address _vm) internal { - if (isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - bytes memory value = abi.encodePacked(_vm); - _mockGameArg(_dgf, _gameType, GameArg.VM, value); - } else { - address gameAddr = address(_dgf.gameImpls(_gameType)); - vm.mockCall(gameAddr, abi.encodeCall(IFaultDisputeGame.vm, ()), abi.encode(_vm)); - } + bytes memory value = abi.encodePacked(_vm); + _mockGameArg(_dgf, _gameType, GameArg.VM, value); } function mockGameImplASR(IDisputeGameFactory _dgf, GameType _gameType, address _asr) internal { - if (isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - bytes memory value = abi.encodePacked(_asr); - _mockGameArg(_dgf, _gameType, GameArg.ASR, value); - } else { - address gameAddr = address(_dgf.gameImpls(_gameType)); - vm.mockCall(gameAddr, abi.encodeCall(IFaultDisputeGame.anchorStateRegistry, ()), abi.encode(_asr)); - } + bytes memory value = abi.encodePacked(_asr); + _mockGameArg(_dgf, _gameType, GameArg.ASR, value); } function mockGameImplWeth(IDisputeGameFactory _dgf, GameType _gameType, address _weth) internal { - if (isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - bytes memory value = abi.encodePacked(_weth); - _mockGameArg(_dgf, _gameType, GameArg.WETH, value); - } else { - address gameAddr = address(_dgf.gameImpls(_gameType)); - vm.mockCall(gameAddr, abi.encodeCall(IFaultDisputeGame.weth, ()), abi.encode(_weth)); - } + bytes memory value = abi.encodePacked(_weth); + _mockGameArg(_dgf, _gameType, GameArg.WETH, value); } function mockGameImplL2ChainId(IDisputeGameFactory _dgf, GameType _gameType, uint256 _chainId) internal { - if (isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - bytes memory value = abi.encodePacked(_chainId); - _mockGameArg(_dgf, _gameType, GameArg.L2_CHAIN_ID, value); - } else { - address gameAddr = address(_dgf.gameImpls(_gameType)); - vm.mockCall(gameAddr, abi.encodeCall(IFaultDisputeGame.l2ChainId, ()), abi.encode(_chainId)); - } + bytes memory value = abi.encodePacked(_chainId); + _mockGameArg(_dgf, _gameType, GameArg.L2_CHAIN_ID, value); } function mockGameImplProposer(IDisputeGameFactory _dgf, GameType _gameType, address _proposer) internal { - if (isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - bytes memory value = abi.encodePacked(_proposer); - _mockGameArg(_dgf, _gameType, GameArg.PROPOSER, value); - } else { - address gameAddr = address(_dgf.gameImpls(_gameType)); - vm.mockCall(gameAddr, abi.encodeCall(IPermissionedDisputeGame.proposer, ()), abi.encode(_proposer)); - } + bytes memory value = abi.encodePacked(_proposer); + _mockGameArg(_dgf, _gameType, GameArg.PROPOSER, value); } function mockGameImplChallenger(IDisputeGameFactory _dgf, GameType _gameType, address _challenger) internal { - if (isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - bytes memory value = abi.encodePacked(_challenger); - _mockGameArg(_dgf, _gameType, GameArg.CHALLENGER, value); - } else { - address gameAddr = address(_dgf.gameImpls(_gameType)); - vm.mockCall(gameAddr, abi.encodeCall(IPermissionedDisputeGame.challenger, ()), abi.encode(_challenger)); - } + bytes memory value = abi.encodePacked(_challenger); + _mockGameArg(_dgf, _gameType, GameArg.CHALLENGER, value); } function _getGameArgs( @@ -185,10 +148,6 @@ contract DisputeGames is FeatureFlags { private returns (bool gameArgsExist_, bytes memory gameArgs_) { - if (!isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - return (false, gameArgs_); - } - bytes memory gameArgsCallData = abi.encodeCall(IDisputeGameFactory.gameArgs, (_gameType)); (bool success, bytes memory gameArgs) = address(_dgf).call(gameArgsCallData); diff --git a/packages/contracts-bedrock/test/setup/FeatureFlags.sol b/packages/contracts-bedrock/test/setup/FeatureFlags.sol index 8a376473ec69b..2c7916231b379 100644 --- a/packages/contracts-bedrock/test/setup/FeatureFlags.sol +++ b/packages/contracts-bedrock/test/setup/FeatureFlags.sol @@ -36,14 +36,6 @@ abstract contract FeatureFlags { console.log("Setup: DEV_FEATURE__OPTIMISM_PORTAL_INTEROP is enabled"); devFeatureBitmap |= DevFeatures.OPTIMISM_PORTAL_INTEROP; } - if (Config.devFeatureCannonKona()) { - console.log("Setup: DEV_FEATURE__CANNON_KONA is enabled"); - devFeatureBitmap |= DevFeatures.CANNON_KONA; - } - if (Config.devFeatureDeployV2DisputeGames()) { - console.log("Setup: DEV_FEATURE__DEPLOY_V2_DISPUTE_GAMES is enabled"); - devFeatureBitmap |= DevFeatures.DEPLOY_V2_DISPUTE_GAMES; - } } /// @notice Enables a feature. diff --git a/packages/contracts-bedrock/test/setup/ForkLive.s.sol b/packages/contracts-bedrock/test/setup/ForkLive.s.sol index 2012966ef37d7..13a78abb9389f 100644 --- a/packages/contracts-bedrock/test/setup/ForkLive.s.sol +++ b/packages/contracts-bedrock/test/setup/ForkLive.s.sol @@ -15,7 +15,6 @@ import { Deploy } from "scripts/deploy/Deploy.s.sol"; import { Config } from "scripts/libraries/Config.sol"; // Libraries -import { DevFeatures } from "src/libraries/DevFeatures.sol"; import { GameTypes, Claim } from "src/dispute/lib/Types.sol"; import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol"; import { LibString } from "@solady/utils/LibString.sol"; @@ -24,7 +23,6 @@ import { LibGameArgs } from "src/dispute/lib/LibGameArgs.sol"; // Interfaces import { ISuperchainConfig } from "interfaces/L1/ISuperchainConfig.sol"; import { IFaultDisputeGame } from "interfaces/dispute/IFaultDisputeGame.sol"; -import { IPermissionedDisputeGame } from "interfaces/dispute/IPermissionedDisputeGame.sol"; import { IDisputeGameFactory } from "interfaces/dispute/IDisputeGameFactory.sol"; import { IDelayedWETH } from "interfaces/dispute/IDelayedWETH.sol"; import { IAddressManager } from "interfaces/legacy/IAddressManager.sol"; @@ -279,14 +277,9 @@ contract ForkLive is Deployer, StdAssertions, FeatureFlags { address permissionedDisputeGame = address(disputeGameFactory.gameImpls(GameTypes.PERMISSIONED_CANNON)); artifacts.save("PermissionedDisputeGame", permissionedDisputeGame); - IAnchorStateRegistry newAnchorStateRegistry; - if (isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - newAnchorStateRegistry = IAnchorStateRegistry( - LibGameArgs.decode(disputeGameFactory.gameArgs(GameTypes.PERMISSIONED_CANNON)).anchorStateRegistry - ); - } else { - newAnchorStateRegistry = IPermissionedDisputeGame(permissionedDisputeGame).anchorStateRegistry(); - } + IAnchorStateRegistry newAnchorStateRegistry = IAnchorStateRegistry( + LibGameArgs.decode(disputeGameFactory.gameArgs(GameTypes.PERMISSIONED_CANNON)).anchorStateRegistry + ); artifacts.save("AnchorStateRegistryProxy", address(newAnchorStateRegistry)); // Get the lockbox address from the portal, and save it @@ -295,14 +288,8 @@ contract ForkLive is Deployer, StdAssertions, FeatureFlags { artifacts.save("ETHLockboxProxy", lockboxAddress); // Get the new DelayedWETH address and save it (might be a new proxy). - IDelayedWETH newDelayedWeth; - if (isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) { - newDelayedWeth = IDelayedWETH( - payable(LibGameArgs.decode(disputeGameFactory.gameArgs(GameTypes.PERMISSIONED_CANNON)).weth) - ); - } else { - newDelayedWeth = IPermissionedDisputeGame(permissionedDisputeGame).weth(); - } + IDelayedWETH newDelayedWeth = + IDelayedWETH(payable(LibGameArgs.decode(disputeGameFactory.gameArgs(GameTypes.PERMISSIONED_CANNON)).weth)); artifacts.save("DelayedWETHProxy", address(newDelayedWeth)); artifacts.save("DelayedWETHImpl", EIP1967Helper.getImplementation(address(newDelayedWeth))); }