Skip to content

Commit

Permalink
feat: Add OPCM to deployImplementations
Browse files Browse the repository at this point in the history
  • Loading branch information
maurelian committed Oct 3, 2024
1 parent f7174da commit 9aa3ee8
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
28 changes: 28 additions & 0 deletions packages/contracts-bedrock/scripts/deploy/ChainAssertions.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { IDisputeGameFactory } from "src/dispute/interfaces/IDisputeGameFactory.
import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol";
import { IOptimismMintableERC20Factory } from "src/universal/interfaces/IOptimismMintableERC20Factory.sol";
import { IPreimageOracle } from "src/cannon/interfaces/IPreimageOracle.sol";
import { OPContractsManager } from "src/L1/OPContractsManager.sol";

library ChainAssertions {
Vm internal constant vm = Vm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
Expand Down Expand Up @@ -557,4 +558,31 @@ library ChainAssertions {
"Storage value is not 1 at the given slot and offset"
);
}

/// @notice Asserts that the SuperchainConfig is setup correctly
function checkOPContractsManager(
Types.ContractSet memory _contracts,
DeployConfig _cfg,
bool _isProxy
)
internal
view
{
OPContractsManager opcm = OPContractsManager(_contracts.OPContractsManager);
console.log(
"Running chain assertions on the OPContractsManager %s at %s",
_isProxy ? "proxy" : "implementation",
address(opcm)
);
require(address(opcm) != address(0), "CHECK-OPCM-10");

// Check that the contract is initialized
assertSlotValueIsOne({ _contractAddress: address(opcm), _slot: 0, _offset: 0 });

// These values are immutable so are shared by the proxy and implementation
require(address(opcm.superchainConfig()) == address(_contracts.SuperchainConfig), "CHECK-OPCM-30");
require(address(opcm.protocolVersions()) == address(_contracts.ProtocolVersions), "CHECK-OPCM-40");

// TODO: Add assertions for blueprints and setters?
}
}
8 changes: 6 additions & 2 deletions packages/contracts-bedrock/scripts/deploy/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ contract Deploy is Deployer {
SystemConfig: getAddress("SystemConfigProxy"),
L1ERC721Bridge: getAddress("L1ERC721BridgeProxy"),
ProtocolVersions: getAddress("ProtocolVersionsProxy"),
SuperchainConfig: getAddress("SuperchainConfigProxy")
SuperchainConfig: getAddress("SuperchainConfigProxy"),
OPContractsManager: getAddress("OPContractsManagerProxy")
});
}

Expand All @@ -186,7 +187,8 @@ contract Deploy is Deployer {
SystemConfig: getAddress("SystemConfig"),
L1ERC721Bridge: getAddress("L1ERC721Bridge"),
ProtocolVersions: getAddress("ProtocolVersions"),
SuperchainConfig: getAddress("SuperchainConfig")
SuperchainConfig: getAddress("SuperchainConfig"),
OPContractsManager: getAddress("OPContractsManager")
});
}

Expand Down Expand Up @@ -391,6 +393,8 @@ contract Deploy is Deployer {
save("DelayedWETH", address(dio.delayedWETHImpl()));
save("PreimageOracle", address(dio.preimageOracleSingleton()));
save("Mips", address(dio.mipsSingleton()));
save("OPContractsManagerProxy", address(dio.opcmProxy()));
save("OPContractsManager", address(dio.opcmImpl()));

Types.ContractSet memory contracts = _impls();
ChainAssertions.checkL1CrossDomainMessenger({ _contracts: contracts, _vm: vm, _isProxy: false });
Expand Down
1 change: 1 addition & 0 deletions packages/contracts-bedrock/scripts/libraries/Types.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ library Types {
address L1ERC721Bridge;
address ProtocolVersions;
address SuperchainConfig;
address OPContractsManager;
}
}

0 comments on commit 9aa3ee8

Please sign in to comment.