Commit fc3ed6fa authored by Maurelian's avatar Maurelian

contracts-bedrock: Set superchainConfig to zero in portal constructor

parent 86ce7216
......@@ -43,7 +43,7 @@ library ChainAssertions {
checkL2OutputOracle(_prox, _cfg, _l2OutputOracleStartingTimestamp, _l2OutputOracleStartingBlockNumber);
checkOptimismMintableERC20Factory(_prox);
checkL1ERC721Bridge(_prox);
checkOptimismPortal({ _contracts: _prox, _cfg: _cfg, _isPaused: false });
checkOptimismPortal({ _contracts: _prox, _cfg: _cfg, _isProxy: true });
checkProtocolVersions({ _contracts: _prox, _cfg: _cfg, _isProxy: true });
}
......@@ -135,29 +135,25 @@ library ChainAssertions {
}
/// @notice Asserts the OptimismPortal is setup correctly
function checkOptimismPortal(
Types.ContractSet memory _contracts,
DeployConfig _cfg,
bool _isPaused
)
internal
view
{
function checkOptimismPortal(Types.ContractSet memory _contracts, DeployConfig _cfg, bool _isProxy) internal view {
OptimismPortal portal = OptimismPortal(payable(_contracts.OptimismPortal));
address guardian = _cfg.superchainConfigGuardian();
if (guardian.code.length == 0) {
console.log("Portal guardian has no code: %s", guardian);
console.log("Guardian has no code: %s", guardian);
}
require(address(portal.L2_ORACLE()) == _contracts.L2OutputOracle);
require(address(portal.l2Oracle()) == _contracts.L2OutputOracle);
require(portal.GUARDIAN() == _cfg.superchainConfigGuardian());
require(portal.guardian() == _cfg.superchainConfigGuardian());
require(address(portal.SYSTEM_CONFIG()) == _contracts.SystemConfig);
require(address(portal.systemConfig()) == _contracts.SystemConfig);
require(address(portal.superchainConfig()) == address(_contracts.SuperchainConfig));
require(portal.paused() == _isPaused);
if (_isProxy) {
require(portal.GUARDIAN() == _cfg.superchainConfigGuardian());
require(portal.guardian() == _cfg.superchainConfigGuardian());
require(address(portal.superchainConfig()) == address(_contracts.SuperchainConfig));
require(portal.paused() == SuperchainConfig(_contracts.SuperchainConfig).paused());
}
}
/// @notice Asserts that the ProtocolVersions is setup correctly
......
......@@ -504,8 +504,7 @@ contract Deploy is Deployer {
OptimismPortal portal = new OptimismPortal{ salt: _implSalt() }({
_l2Oracle: l2OutputOracle,
_systemConfig: systemConfig,
_superchainConfig: superchainConfig
_systemConfig: systemConfig
});
save("OptimismPortal", address(portal));
......@@ -516,7 +515,7 @@ contract Deploy is Deployer {
// are always proxies.
Types.ContractSet memory contracts = _proxiesUnstrict();
contracts.OptimismPortal = address(portal);
ChainAssertions.checkOptimismPortal({ _contracts: contracts, _cfg: cfg, _isPaused: false });
ChainAssertions.checkOptimismPortal({ _contracts: contracts, _cfg: cfg, _isProxy: false });
require(loadInitializedSlot("OptimismPortal", false) == 1, "OptimismPortal is not initialized");
......@@ -943,7 +942,7 @@ contract Deploy is Deployer {
string memory version = portal.version();
console.log("OptimismPortal version: %s", version);
ChainAssertions.checkOptimismPortal({ _contracts: _proxies(), _cfg: cfg, _isPaused: false });
ChainAssertions.checkOptimismPortal({ _contracts: _proxies(), _cfg: cfg, _isProxy: true });
require(loadInitializedSlot("OptimismPortal", true) == 1, "OptimismPortalProxy is not initialized");
}
......
......@@ -107,11 +107,10 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver {
/// @notice Constructs the OptimismPortal contract.
/// @param _l2Oracle Address of the L2OutputOracle contract.
/// @param _systemConfig Address of the SystemConfig contract.
/// @param _superchainConfig Address of the SuperchainConfig contract.
constructor(L2OutputOracle _l2Oracle, SystemConfig _systemConfig, SuperchainConfig _superchainConfig) {
constructor(L2OutputOracle _l2Oracle, SystemConfig _systemConfig) {
L2_ORACLE = _l2Oracle;
SYSTEM_CONFIG = _systemConfig;
initialize(_superchainConfig);
initialize(SuperchainConfig(address(0)));
}
/// @notice Initializer.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment