Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/contracts-bedrock/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ interface IOPContractsManager {

error InvalidDevFeatureAccess(bytes32 devFeature);

error OPContractsManager_V1Disabled();

// -------- Methods --------

function __constructor__(
Expand Down
32 changes: 26 additions & 6 deletions packages/contracts-bedrock/src/L1/OPContractsManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}

Expand All @@ -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));
Expand All @@ -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));
Expand All @@ -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));
Expand All @@ -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));
Expand All @@ -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));
Expand Down