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,7 +304,7 @@ interface IOPContractsManager {

error InvalidDevFeatureAccess(bytes32 devFeature);

error OPContractsManager_V1Disabled();
error OPContractsManager_V2Enabled();

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@
},
{
"inputs": [],
"name": "OPContractsManager_V1Disabled",
"name": "OPContractsManager_V2Enabled",
"type": "error"
},
{
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts-bedrock/snapshots/semver-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"sourceCodeHash": "0xfca613b5d055ffc4c3cbccb0773ddb9030abedc1aa6508c9e2e7727cc0cd617b"
},
"src/L1/OPContractsManager.sol:OPContractsManager": {
"initCodeHash": "0xf8a73b2ed02a9c4c920bca1583491e51167eec6cf68e2e0226cff9c31063bfc6",
"sourceCodeHash": "0xd1a910a7ab12f96bc0a33c0aeb8e30321f5f0d644437a86d5b62ce9540ad21fb"
"initCodeHash": "0xaa7103e9b0a606264bfaa9da86a7f229e659267d6893c99518bfc8c03de5adb2",
"sourceCodeHash": "0x10b720f38a52713ac47d143d8e758fb89c3be503fb33b3b519a332a0e10ea363"
},
"src/L1/OPContractsManagerStandardValidator.sol:OPContractsManagerStandardValidator": {
"initCodeHash": "0x0c8b15453d0f0bc5d9af07f104505e0bbb2b358f0df418289822fb73a8652b30",
Expand Down
52 changes: 27 additions & 25 deletions packages/contracts-bedrock/src/L1/OPContractsManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2306,19 +2306,11 @@ 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();
/// @notice Thrown when OPCM v2 is enabled via dev feature flag.
error OPContractsManager_V2Enabled();

// -------- 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 @@ -2400,7 +2392,9 @@ 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 revertIfV2Enabled returns (DeployOutput memory) {
function deploy(DeployInput calldata _input) external virtual returns (DeployOutput memory) {
_assertV2NotEnabled();

return opcmDeployer.deploy(_input, superchainConfig, msg.sender);
}

Expand All @@ -2409,7 +2403,9 @@ 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 revertIfV2Enabled {
function upgrade(OpChainConfig[] memory _opChainConfigs) external virtual {
_assertV2NotEnabled();

if (address(this) == address(thisOPCM)) revert OnlyDelegatecall();

bytes memory data = abi.encodeCall(OPContractsManagerUpgrader.upgrade, (_opChainConfigs));
Expand All @@ -2420,7 +2416,9 @@ 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 revertIfV2Enabled {
function upgradeSuperchainConfig(ISuperchainConfig _superchainConfig) external {
_assertV2NotEnabled();

if (address(this) == address(thisOPCM)) revert OnlyDelegatecall();

bytes memory data = abi.encodeCall(OPContractsManagerUpgrader.upgradeSuperchainConfig, (_superchainConfig));
Expand All @@ -2429,12 +2427,9 @@ 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
revertIfV2Enabled
returns (AddGameOutput[] memory)
{
function addGameType(AddGameInput[] memory _gameConfigs) public virtual returns (AddGameOutput[] memory) {
_assertV2NotEnabled();

if (address(this) == address(thisOPCM)) revert OnlyDelegatecall();

bytes memory data = abi.encodeCall(OPContractsManagerGameTypeAdder.addGameType, (_gameConfigs));
Expand All @@ -2445,7 +2440,9 @@ 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 revertIfV2Enabled {
function updatePrestate(UpdatePrestateInput[] memory _prestateUpdateInputs) public {
_assertV2NotEnabled();

if (address(this) == address(thisOPCM)) revert OnlyDelegatecall();

bytes memory data = abi.encodeCall(OPContractsManagerGameTypeAdder.updatePrestate, (_prestateUpdateInputs));
Expand All @@ -2455,11 +2452,9 @@ 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
revertIfV2Enabled
{
function migrate(OPContractsManagerInteropMigrator.MigrateInput calldata _input) external virtual {
_assertV2NotEnabled();

if (address(this) == address(thisOPCM)) revert OnlyDelegatecall();

bytes memory data = abi.encodeCall(OPContractsManagerInteropMigrator.migrate, (_input));
Expand Down Expand Up @@ -2500,6 +2495,13 @@ contract OPContractsManager is ISemver {
return opcmDeployer.isDevFeatureEnabled(_feature);
}

/// @notice Reverts if the dev feature flag for OPCM v2 is enabled.
function _assertV2NotEnabled() internal view {
if (isDevFeatureEnabled(DevFeatures.OPCM_V2)) {
revert OPContractsManager_V2Enabled();
}
}

/// @notice Helper function to perform a delegatecall to a target contract
/// @param _target The target contract address
/// @param _data The calldata to send to the target
Expand Down