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 { ...@@ -43,7 +43,7 @@ library ChainAssertions {
checkL2OutputOracle(_prox, _cfg, _l2OutputOracleStartingTimestamp, _l2OutputOracleStartingBlockNumber); checkL2OutputOracle(_prox, _cfg, _l2OutputOracleStartingTimestamp, _l2OutputOracleStartingBlockNumber);
checkOptimismMintableERC20Factory(_prox); checkOptimismMintableERC20Factory(_prox);
checkL1ERC721Bridge(_prox); checkL1ERC721Bridge(_prox);
checkOptimismPortal({ _contracts: _prox, _cfg: _cfg, _isPaused: false }); checkOptimismPortal({ _contracts: _prox, _cfg: _cfg, _isProxy: true });
checkProtocolVersions({ _contracts: _prox, _cfg: _cfg, _isProxy: true }); checkProtocolVersions({ _contracts: _prox, _cfg: _cfg, _isProxy: true });
} }
...@@ -135,29 +135,25 @@ library ChainAssertions { ...@@ -135,29 +135,25 @@ library ChainAssertions {
} }
/// @notice Asserts the OptimismPortal is setup correctly /// @notice Asserts the OptimismPortal is setup correctly
function checkOptimismPortal( function checkOptimismPortal(Types.ContractSet memory _contracts, DeployConfig _cfg, bool _isProxy) internal view {
Types.ContractSet memory _contracts,
DeployConfig _cfg,
bool _isPaused
)
internal
view
{
OptimismPortal portal = OptimismPortal(payable(_contracts.OptimismPortal)); OptimismPortal portal = OptimismPortal(payable(_contracts.OptimismPortal));
address guardian = _cfg.superchainConfigGuardian(); address guardian = _cfg.superchainConfigGuardian();
if (guardian.code.length == 0) { 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.L2_ORACLE()) == _contracts.L2OutputOracle);
require(address(portal.l2Oracle()) == _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.SYSTEM_CONFIG()) == _contracts.SystemConfig);
require(address(portal.systemConfig()) == _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 /// @notice Asserts that the ProtocolVersions is setup correctly
......
...@@ -504,8 +504,7 @@ contract Deploy is Deployer { ...@@ -504,8 +504,7 @@ contract Deploy is Deployer {
OptimismPortal portal = new OptimismPortal{ salt: _implSalt() }({ OptimismPortal portal = new OptimismPortal{ salt: _implSalt() }({
_l2Oracle: l2OutputOracle, _l2Oracle: l2OutputOracle,
_systemConfig: systemConfig, _systemConfig: systemConfig
_superchainConfig: superchainConfig
}); });
save("OptimismPortal", address(portal)); save("OptimismPortal", address(portal));
...@@ -516,7 +515,7 @@ contract Deploy is Deployer { ...@@ -516,7 +515,7 @@ contract Deploy is Deployer {
// are always proxies. // are always proxies.
Types.ContractSet memory contracts = _proxiesUnstrict(); Types.ContractSet memory contracts = _proxiesUnstrict();
contracts.OptimismPortal = address(portal); 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"); require(loadInitializedSlot("OptimismPortal", false) == 1, "OptimismPortal is not initialized");
...@@ -943,7 +942,7 @@ contract Deploy is Deployer { ...@@ -943,7 +942,7 @@ contract Deploy is Deployer {
string memory version = portal.version(); string memory version = portal.version();
console.log("OptimismPortal version: %s", 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"); require(loadInitializedSlot("OptimismPortal", true) == 1, "OptimismPortalProxy is not initialized");
} }
......
...@@ -107,11 +107,10 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver { ...@@ -107,11 +107,10 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver {
/// @notice Constructs the OptimismPortal contract. /// @notice Constructs the OptimismPortal contract.
/// @param _l2Oracle Address of the L2OutputOracle contract. /// @param _l2Oracle Address of the L2OutputOracle contract.
/// @param _systemConfig Address of the SystemConfig contract. /// @param _systemConfig Address of the SystemConfig contract.
/// @param _superchainConfig Address of the SuperchainConfig contract. constructor(L2OutputOracle _l2Oracle, SystemConfig _systemConfig) {
constructor(L2OutputOracle _l2Oracle, SystemConfig _systemConfig, SuperchainConfig _superchainConfig) {
L2_ORACLE = _l2Oracle; L2_ORACLE = _l2Oracle;
SYSTEM_CONFIG = _systemConfig; SYSTEM_CONFIG = _systemConfig;
initialize(_superchainConfig); initialize(SuperchainConfig(address(0)));
} }
/// @notice Initializer. /// @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