Commit 8e593108 authored by clabby's avatar clabby

comments + fmt

parent 095a07e8
...@@ -36,26 +36,14 @@ library ChainAssertions { ...@@ -36,26 +36,14 @@ library ChainAssertions {
ResourceMetering.ResourceConfig memory dflt = Constants.DEFAULT_RESOURCE_CONFIG(); ResourceMetering.ResourceConfig memory dflt = Constants.DEFAULT_RESOURCE_CONFIG();
require(keccak256(abi.encode(rcfg)) == keccak256(abi.encode(dflt))); require(keccak256(abi.encode(rcfg)) == keccak256(abi.encode(dflt)));
checkSystemConfig({ checkSystemConfig({ _contracts: _prox, _cfg: _cfg, _isProxy: true });
_contracts: _prox,
_cfg: _cfg,
_isProxy: true
});
checkL1CrossDomainMessenger(_prox, _vm); checkL1CrossDomainMessenger(_prox, _vm);
checkL1StandardBridge(_prox); checkL1StandardBridge(_prox);
checkL2OutputOracle(_prox, _cfg, _l2OutputOracleStartingTimestamp, _l2OutputOracleStartingBlockNumber); checkL2OutputOracle(_prox, _cfg, _l2OutputOracleStartingTimestamp, _l2OutputOracleStartingBlockNumber);
checkOptimismMintableERC20Factory(_prox); checkOptimismMintableERC20Factory(_prox);
checkL1ERC721Bridge(_prox); checkL1ERC721Bridge(_prox);
checkOptimismPortal({ checkOptimismPortal({ _contracts: _prox, _cfg: _cfg, _isPaused: false });
_contracts: _prox, checkProtocolVersions({ _contracts: _prox, _cfg: _cfg, _isProxy: true });
_cfg: _cfg,
_isPaused: false
});
checkProtocolVersions({
_contracts: _prox,
_cfg: _cfg,
_isProxy: true
});
} }
/// @notice Asserts that the SystemConfig is setup correctly /// @notice Asserts that the SystemConfig is setup correctly
...@@ -171,7 +159,14 @@ library ChainAssertions { ...@@ -171,7 +159,14 @@ library ChainAssertions {
} }
/// @notice Asserts that the ProtocolVersions is setup correctly /// @notice Asserts that the ProtocolVersions is setup correctly
function checkProtocolVersions(Types.ContractSet memory _contracts, DeployConfig _cfg, bool _isProxy) internal view { function checkProtocolVersions(
Types.ContractSet memory _contracts,
DeployConfig _cfg,
bool _isProxy
)
internal
view
{
ProtocolVersions versions = ProtocolVersions(_contracts.ProtocolVersions); ProtocolVersions versions = ProtocolVersions(_contracts.ProtocolVersions);
if (_isProxy) { if (_isProxy) {
require(versions.owner() == _cfg.finalSystemOwner()); require(versions.owner() == _cfg.finalSystemOwner());
......
...@@ -395,6 +395,9 @@ contract Deploy is Deployer { ...@@ -395,6 +395,9 @@ contract Deploy is Deployer {
save("L1CrossDomainMessenger", address(messenger)); save("L1CrossDomainMessenger", address(messenger));
console.log("L1CrossDomainMessenger deployed at %s", address(messenger)); console.log("L1CrossDomainMessenger deployed at %s", address(messenger));
// Override the `L1CrossDomainMessenger` contract to the deployed implementation. This is necessary
// to check the `L1CrossDomainMessenger` implementation alongside dependent contracts, which
// are always proxies.
Types.ContractSet memory contracts = _proxiesUnstrict(); Types.ContractSet memory contracts = _proxiesUnstrict();
contracts.L1CrossDomainMessenger = address(messenger); contracts.L1CrossDomainMessenger = address(messenger);
ChainAssertions.checkL1CrossDomainMessenger(contracts, vm); ChainAssertions.checkL1CrossDomainMessenger(contracts, vm);
...@@ -424,13 +427,12 @@ contract Deploy is Deployer { ...@@ -424,13 +427,12 @@ contract Deploy is Deployer {
save("OptimismPortal", address(portal)); save("OptimismPortal", address(portal));
console.log("OptimismPortal deployed at %s", address(portal)); console.log("OptimismPortal deployed at %s", address(portal));
// Override the `OptimismPortal` contract to the deployed implementation. This is necessary
// to check the `OptimismPortal` implementation alongside dependent contracts, which
// are always proxies.
Types.ContractSet memory contracts = _proxiesUnstrict(); Types.ContractSet memory contracts = _proxiesUnstrict();
contracts.OptimismPortal = address(portal); contracts.OptimismPortal = address(portal);
ChainAssertions.checkOptimismPortal({ ChainAssertions.checkOptimismPortal({ _contracts: contracts, _cfg: cfg, _isPaused: true });
_contracts: contracts,
_cfg: cfg,
_isPaused: true
});
require(loadInitializedSlot("OptimismPortal", false) == 1, "OptimismPortal is not initialized"); require(loadInitializedSlot("OptimismPortal", false) == 1, "OptimismPortal is not initialized");
...@@ -452,6 +454,9 @@ contract Deploy is Deployer { ...@@ -452,6 +454,9 @@ contract Deploy is Deployer {
save("L2OutputOracle", address(oracle)); save("L2OutputOracle", address(oracle));
console.log("L2OutputOracle deployed at %s", address(oracle)); console.log("L2OutputOracle deployed at %s", address(oracle));
// Override the `L2OutputOracle` contract to the deployed implementation. This is necessary
// to check the `L2OutputOracle` implementation alongside dependent contracts, which
// are always proxies.
Types.ContractSet memory contracts = _proxiesUnstrict(); Types.ContractSet memory contracts = _proxiesUnstrict();
contracts.L2OutputOracle = address(oracle); contracts.L2OutputOracle = address(oracle);
ChainAssertions.checkL2OutputOracle(contracts, cfg, 0, 0); ChainAssertions.checkL2OutputOracle(contracts, cfg, 0, 0);
...@@ -470,6 +475,9 @@ contract Deploy is Deployer { ...@@ -470,6 +475,9 @@ contract Deploy is Deployer {
save("OptimismMintableERC20Factory", address(factory)); save("OptimismMintableERC20Factory", address(factory));
console.log("OptimismMintableERC20Factory deployed at %s", address(factory)); console.log("OptimismMintableERC20Factory deployed at %s", address(factory));
// Override the `OptimismMintableERC20Factory` contract to the deployed implementation. This is necessary
// to check the `OptimismMintableERC20Factory` implementation alongside dependent contracts, which
// are always proxies.
Types.ContractSet memory contracts = _proxiesUnstrict(); Types.ContractSet memory contracts = _proxiesUnstrict();
contracts.OptimismMintableERC20Factory = address(factory); contracts.OptimismMintableERC20Factory = address(factory);
ChainAssertions.checkOptimismMintableERC20Factory(contracts); ChainAssertions.checkOptimismMintableERC20Factory(contracts);
...@@ -501,13 +509,12 @@ contract Deploy is Deployer { ...@@ -501,13 +509,12 @@ contract Deploy is Deployer {
save("ProtocolVersions", address(versions)); save("ProtocolVersions", address(versions));
console.log("ProtocolVersions deployed at %s", address(versions)); console.log("ProtocolVersions deployed at %s", address(versions));
// Override the `ProtocolVersions` contract to the deployed implementation. This is necessary
// to check the `ProtocolVersions` implementation alongside dependent contracts, which
// are always proxies.
Types.ContractSet memory contracts = _proxiesUnstrict(); Types.ContractSet memory contracts = _proxiesUnstrict();
contracts.ProtocolVersions = address(versions); contracts.ProtocolVersions = address(versions);
ChainAssertions.checkProtocolVersions({ ChainAssertions.checkProtocolVersions({ _contracts: contracts, _cfg: cfg, _isProxy: false });
_contracts: contracts,
_cfg: cfg,
_isProxy: false
});
require(loadInitializedSlot("ProtocolVersions", false) == 1, "ProtocolVersions is not initialized"); require(loadInitializedSlot("ProtocolVersions", false) == 1, "ProtocolVersions is not initialized");
...@@ -549,13 +556,12 @@ contract Deploy is Deployer { ...@@ -549,13 +556,12 @@ contract Deploy is Deployer {
save("SystemConfig", address(config)); save("SystemConfig", address(config));
console.log("SystemConfig deployed at %s", address(config)); console.log("SystemConfig deployed at %s", address(config));
// Override the `SystemConfig` contract to the deployed implementation. This is necessary
// to check the `SystemConfig` implementation alongside dependent contracts, which
// are always proxies.
Types.ContractSet memory contracts = _proxiesUnstrict(); Types.ContractSet memory contracts = _proxiesUnstrict();
contracts.SystemConfig = address(config); contracts.SystemConfig = address(config);
ChainAssertions.checkSystemConfig({ ChainAssertions.checkSystemConfig({ _contracts: contracts, _cfg: cfg, _isProxy: false });
_contracts: contracts,
_cfg: cfg,
_isProxy: false
});
require(loadInitializedSlot("SystemConfig", false) == 1, "SystemConfig is not initialized"); require(loadInitializedSlot("SystemConfig", false) == 1, "SystemConfig is not initialized");
...@@ -573,6 +579,9 @@ contract Deploy is Deployer { ...@@ -573,6 +579,9 @@ contract Deploy is Deployer {
save("L1StandardBridge", address(bridge)); save("L1StandardBridge", address(bridge));
console.log("L1StandardBridge deployed at %s", address(bridge)); console.log("L1StandardBridge deployed at %s", address(bridge));
// Override the `L1StandardBridge` contract to the deployed implementation. This is necessary
// to check the `L1StandardBridge` implementation alongside dependent contracts, which
// are always proxies.
Types.ContractSet memory contracts = _proxiesUnstrict(); Types.ContractSet memory contracts = _proxiesUnstrict();
contracts.L1StandardBridge = address(bridge); contracts.L1StandardBridge = address(bridge);
ChainAssertions.checkL1StandardBridge(contracts); ChainAssertions.checkL1StandardBridge(contracts);
...@@ -591,6 +600,9 @@ contract Deploy is Deployer { ...@@ -591,6 +600,9 @@ contract Deploy is Deployer {
save("L1ERC721Bridge", address(bridge)); save("L1ERC721Bridge", address(bridge));
console.log("L1ERC721Bridge deployed at %s", address(bridge)); console.log("L1ERC721Bridge deployed at %s", address(bridge));
// Override the `L1ERC721Bridge` contract to the deployed implementation. This is necessary
// to check the `L1ERC721Bridge` implementation alongside dependent contracts, which
// are always proxies.
Types.ContractSet memory contracts = _proxiesUnstrict(); Types.ContractSet memory contracts = _proxiesUnstrict();
contracts.L1ERC721Bridge = address(bridge); contracts.L1ERC721Bridge = address(bridge);
ChainAssertions.checkL1ERC721Bridge(contracts); ChainAssertions.checkL1ERC721Bridge(contracts);
...@@ -658,11 +670,7 @@ contract Deploy is Deployer { ...@@ -658,11 +670,7 @@ contract Deploy is Deployer {
string memory version = config.version(); string memory version = config.version();
console.log("SystemConfig version: %s", version); console.log("SystemConfig version: %s", version);
ChainAssertions.checkSystemConfig({ ChainAssertions.checkSystemConfig({ _contracts: _proxies(), _cfg: cfg, _isProxy: true });
_contracts: _proxies(),
_cfg: cfg,
_isProxy: true
});
require(loadInitializedSlot("SystemConfig", true) == 1, "SystemConfigProxy is not initialized"); require(loadInitializedSlot("SystemConfig", true) == 1, "SystemConfigProxy is not initialized");
} }
...@@ -815,11 +823,7 @@ contract Deploy is Deployer { ...@@ -815,11 +823,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({ ChainAssertions.checkOptimismPortal({ _contracts: _proxies(), _cfg: cfg, _isPaused: false });
_contracts: _proxies(),
_cfg: cfg,
_isPaused: false
});
require(loadInitializedSlot("OptimismPortal", true) == 1, "OptimismPortalProxy is not initialized"); require(loadInitializedSlot("OptimismPortal", true) == 1, "OptimismPortalProxy is not initialized");
} }
...@@ -849,11 +853,7 @@ contract Deploy is Deployer { ...@@ -849,11 +853,7 @@ contract Deploy is Deployer {
string memory version = versions.version(); string memory version = versions.version();
console.log("ProtocolVersions version: %s", version); console.log("ProtocolVersions version: %s", version);
ChainAssertions.checkProtocolVersions({ ChainAssertions.checkProtocolVersions({ _contracts: _proxies(), _cfg: cfg, _isProxy: true });
_contracts: _proxies(),
_cfg: cfg,
_isProxy: true
});
require(loadInitializedSlot("ProtocolVersions", true) == 1, "ProtocolVersionsProxy is not initialized"); require(loadInitializedSlot("ProtocolVersions", true) == 1, "ProtocolVersionsProxy is not initialized");
} }
......
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