diff --git a/packages/contracts-bedrock/foundry.toml b/packages/contracts-bedrock/foundry.toml index b27dbe8207b..a3b29c4cf73 100644 --- a/packages/contracts-bedrock/foundry.toml +++ b/packages/contracts-bedrock/foundry.toml @@ -72,7 +72,7 @@ fs_permissions = [ # 5159 error code is selfdestruct error code ignored_error_codes = ["transient-storage", "code-size", "init-code-size", "too-many-warnings", 5159] -deny_warnings = true +# deny_warnings = true ffi = true # We set the gas limit to max int64 to avoid running out of gas during testing, since the default diff --git a/packages/contracts-bedrock/interfaces/L1/IOPContractsManager.sol b/packages/contracts-bedrock/interfaces/L1/IOPContractsManager.sol index f042cffa579..bade06c973b 100644 --- a/packages/contracts-bedrock/interfaces/L1/IOPContractsManager.sol +++ b/packages/contracts-bedrock/interfaces/L1/IOPContractsManager.sol @@ -304,6 +304,8 @@ interface IOPContractsManager { error InvalidDevFeatureAccess(bytes32 devFeature); + error OPContractsManager_V1Disabled(); + // -------- Methods -------- function __constructor__( diff --git a/packages/contracts-bedrock/src/L1/OPContractsManager.sol b/packages/contracts-bedrock/src/L1/OPContractsManager.sol index 31bfb0989e8..aaa29dcb9d1 100644 --- a/packages/contracts-bedrock/src/L1/OPContractsManager.sol +++ b/packages/contracts-bedrock/src/L1/OPContractsManager.sol @@ -2305,8 +2305,19 @@ contract OPContractsManager is ISemver { /// @notice Thrown if logic gated by a dev feature flag is incorrectly accessed. error InvalidDevFeatureAccess(bytes32 devFeature); + /// @notice Thrown when OPCM v1 is disabled via dev feature flag. + error OPContractsManager_V1Disabled(); + // -------- Methods -------- + /// @notice Modifier that reverts if OPCM v2 is enabled via dev feature flag. + modifier revertIfV2Enabled() { + if (isDevFeatureEnabled(DevFeatures.OPCM_V2)) { + revert OPContractsManager_V1Disabled(); + } + _; + } + constructor( OPContractsManagerGameTypeAdder _opcmGameTypeAdder, OPContractsManagerDeployer _opcmDeployer, @@ -2388,7 +2399,7 @@ contract OPContractsManager is ISemver { /// @notice Deploys a new OP Stack chain. /// @param _input The deploy input parameters for the deployment. /// @return The deploy output values of the deployment. - function deploy(DeployInput calldata _input) external virtual returns (DeployOutput memory) { + function deploy(DeployInput calldata _input) external virtual revertIfV2Enabled returns (DeployOutput memory) { return opcmDeployer.deploy(_input, superchainConfig, msg.sender); } @@ -2397,7 +2408,7 @@ contract OPContractsManager is ISemver { /// @dev This function is intended to be DELEGATECALLed by an address that is the common owner of every chain in /// `_opChainConfigs`'s ProxyAdmin. /// @dev This function requires that each chain's superchainConfig is already upgraded. - function upgrade(OpChainConfig[] memory _opChainConfigs) external virtual { + function upgrade(OpChainConfig[] memory _opChainConfigs) external virtual revertIfV2Enabled { if (address(this) == address(thisOPCM)) revert OnlyDelegatecall(); bytes memory data = abi.encodeCall(OPContractsManagerUpgrader.upgrade, (_opChainConfigs)); @@ -2408,7 +2419,7 @@ contract OPContractsManager is ISemver { /// @param _superchainConfig The SuperchainConfig contract to upgrade. /// @dev This function is intended to be DELEGATECALLed by the superchainConfig's ProxyAdminOwner. /// @dev This function will revert if the SuperchainConfig is already at or above the target version. - function upgradeSuperchainConfig(ISuperchainConfig _superchainConfig) external { + function upgradeSuperchainConfig(ISuperchainConfig _superchainConfig) external revertIfV2Enabled { if (address(this) == address(thisOPCM)) revert OnlyDelegatecall(); bytes memory data = abi.encodeCall(OPContractsManagerUpgrader.upgradeSuperchainConfig, (_superchainConfig)); @@ -2417,7 +2428,12 @@ contract OPContractsManager is ISemver { /// @notice addGameType deploys a new dispute game and links it to the DisputeGameFactory. The inputted _gameConfigs /// must be added in ascending GameType order. - function addGameType(AddGameInput[] memory _gameConfigs) public virtual returns (AddGameOutput[] memory) { + function addGameType(AddGameInput[] memory _gameConfigs) + public + virtual + revertIfV2Enabled + returns (AddGameOutput[] memory) + { if (address(this) == address(thisOPCM)) revert OnlyDelegatecall(); bytes memory data = abi.encodeCall(OPContractsManagerGameTypeAdder.addGameType, (_gameConfigs)); @@ -2428,7 +2444,7 @@ contract OPContractsManager is ISemver { /// @notice Updates the prestate hash for dispute games while keeping all other parameters the same /// @param _prestateUpdateInputs The new prestate hashes to use - function updatePrestate(UpdatePrestateInput[] memory _prestateUpdateInputs) public { + function updatePrestate(UpdatePrestateInput[] memory _prestateUpdateInputs) public revertIfV2Enabled { if (address(this) == address(thisOPCM)) revert OnlyDelegatecall(); bytes memory data = abi.encodeCall(OPContractsManagerGameTypeAdder.updatePrestate, (_prestateUpdateInputs)); @@ -2438,7 +2454,11 @@ contract OPContractsManager is ISemver { /// @notice Migrates the Optimism contracts to the latest version. /// @param _input Input parameters for the migration. - function migrate(OPContractsManagerInteropMigrator.MigrateInput calldata _input) external virtual { + function migrate(OPContractsManagerInteropMigrator.MigrateInput calldata _input) + external + virtual + revertIfV2Enabled + { if (address(this) == address(thisOPCM)) revert OnlyDelegatecall(); bytes memory data = abi.encodeCall(OPContractsManagerInteropMigrator.migrate, (_input));