Skip to content

Commit

Permalink
Remove L2OutputOracle and legacy OptimismPortal (#13489)
Browse files Browse the repository at this point in the history
* attempt...

* fixes

* fix checks

* fix kontrol build

* update DeploymentSummaryFaultProofs kontrol hash

* fixes

* undo unnecessary change

* feat: Reduce diff and usage of OptimismPortal2

* semver

* fix: init test

---------

Co-authored-by: Maurelian <[email protected]>
  • Loading branch information
AmadiMichael and maurelian authored Dec 24, 2024
1 parent d356d92 commit f3b9f0c
Show file tree
Hide file tree
Showing 43 changed files with 167 additions and 5,917 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.0;

import { ICrossDomainMessenger } from "interfaces/universal/ICrossDomainMessenger.sol";
import { ISuperchainConfig } from "interfaces/L1/ISuperchainConfig.sol";
import { IOptimismPortal } from "interfaces/L1/IOptimismPortal.sol";
import { IOptimismPortal2 as IOptimismPortal } from "interfaces/L1/IOptimismPortal2.sol";
import { ISystemConfig } from "interfaces/L1/ISystemConfig.sol";

interface IL1CrossDomainMessenger is ICrossDomainMessenger {
Expand Down
55 changes: 0 additions & 55 deletions packages/contracts-bedrock/interfaces/L1/IL2OutputOracle.sol

This file was deleted.

87 changes: 0 additions & 87 deletions packages/contracts-bedrock/interfaces/L1/IOptimismPortal.sol

This file was deleted.

106 changes: 3 additions & 103 deletions packages/contracts-bedrock/scripts/deploy/ChainAssertions.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ import { OPContractsManager } from "src/L1/OPContractsManager.sol";
// Interfaces
import { IResourceMetering } from "interfaces/L1/IResourceMetering.sol";
import { ISystemConfig } from "interfaces/L1/ISystemConfig.sol";
import { IL2OutputOracle } from "interfaces/L1/IL2OutputOracle.sol";
import { ISuperchainConfig } from "interfaces/L1/ISuperchainConfig.sol";
import { IL1CrossDomainMessenger } from "interfaces/L1/IL1CrossDomainMessenger.sol";
import { IOptimismPortal } from "interfaces/L1/IOptimismPortal.sol";
import { IOptimismPortal2 } from "interfaces/L1/IOptimismPortal2.sol";
import { IL1ERC721Bridge } from "interfaces/L1/IL1ERC721Bridge.sol";
import { IL1StandardBridge } from "interfaces/L1/IL1StandardBridge.sol";
Expand All @@ -42,15 +40,7 @@ library ChainAssertions {

/// @notice Asserts the correctness of an L1 deployment. This function expects that all contracts
/// within the `prox` ContractSet are proxies that have been setup and initialized.
function postDeployAssertions(
Types.ContractSet memory _prox,
DeployConfig _cfg,
uint256 _l2OutputOracleStartingTimestamp,
Vm _vm
)
internal
view
{
function postDeployAssertions(Types.ContractSet memory _prox, DeployConfig _cfg, Vm _vm) internal view {
console.log("Running post-deploy assertions");
IResourceMetering.ResourceConfig memory rcfg = ISystemConfig(_prox.SystemConfig).resourceConfig();
IResourceMetering.ResourceConfig memory dflt = Constants.DEFAULT_RESOURCE_CONFIG();
Expand All @@ -59,15 +49,8 @@ library ChainAssertions {
checkSystemConfig({ _contracts: _prox, _cfg: _cfg, _isProxy: true });
checkL1CrossDomainMessenger({ _contracts: _prox, _vm: _vm, _isProxy: true });
checkL1StandardBridge({ _contracts: _prox, _isProxy: true });
checkL2OutputOracle({
_contracts: _prox,
_cfg: _cfg,
_l2OutputOracleStartingTimestamp: _l2OutputOracleStartingTimestamp,
_isProxy: true
});
checkOptimismMintableERC20Factory({ _contracts: _prox, _isProxy: true });
checkL1ERC721Bridge({ _contracts: _prox, _isProxy: true });
checkOptimismPortal({ _contracts: _prox, _cfg: _cfg, _isProxy: true });
checkOptimismPortal2({ _contracts: _prox, _cfg: _cfg, _isProxy: true });
checkProtocolVersions({ _contracts: _prox, _cfg: _cfg, _isProxy: true });
}
Expand Down Expand Up @@ -326,56 +309,6 @@ library ChainAssertions {
}
}

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

// Check that the contract is initialized
DeployUtils.assertInitialized({ _contractAddress: address(oracle), _isProxy: _isProxy, _slot: 0, _offset: 0 });

if (_isProxy) {
require(oracle.SUBMISSION_INTERVAL() == _cfg.l2OutputOracleSubmissionInterval(), "CHECK-L2OO-20");
require(oracle.submissionInterval() == _cfg.l2OutputOracleSubmissionInterval(), "CHECK-L2OO-30");
require(oracle.L2_BLOCK_TIME() == _cfg.l2BlockTime(), "CHECK-L2OO-40");
require(oracle.l2BlockTime() == _cfg.l2BlockTime(), "CHECK-L2OO-50");
require(oracle.PROPOSER() == _cfg.l2OutputOracleProposer(), "CHECK-L2OO-60");
require(oracle.proposer() == _cfg.l2OutputOracleProposer(), "CHECK-L2OO-70");
require(oracle.CHALLENGER() == _cfg.l2OutputOracleChallenger(), "CHECK-L2OO-80");
require(oracle.challenger() == _cfg.l2OutputOracleChallenger(), "CHECK-L2OO-90");
require(oracle.FINALIZATION_PERIOD_SECONDS() == _cfg.finalizationPeriodSeconds(), "CHECK-L2OO-100");
require(oracle.finalizationPeriodSeconds() == _cfg.finalizationPeriodSeconds(), "CHECK-L2OO-110");
require(oracle.startingBlockNumber() == _cfg.l2OutputOracleStartingBlockNumber(), "CHECK-L2OO-120");
require(oracle.startingTimestamp() == _l2OutputOracleStartingTimestamp, "CHECK-L2OO-130");
} else {
require(oracle.SUBMISSION_INTERVAL() == 0, "CHECK-L2OO-140");
require(oracle.submissionInterval() == 0, "CHECK-L2OO-150");
require(oracle.L2_BLOCK_TIME() == 0, "CHECK-L2OO-160");
require(oracle.l2BlockTime() == 0, "CHECK-L2OO-170");
require(oracle.PROPOSER() == address(0), "CHECK-L2OO-180");
require(oracle.proposer() == address(0), "CHECK-L2OO-190");
require(oracle.CHALLENGER() == address(0), "CHECK-L2OO-200");
require(oracle.challenger() == address(0), "CHECK-L2OO-210");
require(oracle.FINALIZATION_PERIOD_SECONDS() == 0, "CHECK-L2OO-220");
require(oracle.finalizationPeriodSeconds() == 0, "CHECK-L2OO-230");
require(oracle.startingBlockNumber() == 0, "CHECK-L2OO-240");
require(oracle.startingTimestamp() == 0, "CHECK-L2OO-250");
}
}

/// @notice Asserts that the OptimismMintableERC20Factory is setup correctly
function checkOptimismMintableERC20Factory(Types.ContractSet memory _contracts, bool _isProxy) internal view {
IOptimismMintableERC20Factory factory = IOptimismMintableERC20Factory(_contracts.OptimismMintableERC20Factory);
Expand Down Expand Up @@ -428,39 +361,6 @@ library ChainAssertions {
}

/// @notice Asserts the OptimismPortal is setup correctly
function checkOptimismPortal(Types.ContractSet memory _contracts, DeployConfig _cfg, bool _isProxy) internal view {
IOptimismPortal portal = IOptimismPortal(payable(_contracts.OptimismPortal));
console.log(
"Running chain assertions on the OptimismPortal %s at %s",
_isProxy ? "proxy" : "implementation",
address(portal)
);
require(address(portal) != address(0), "CHECK-OP-10");

// Check that the contract is initialized
DeployUtils.assertInitialized({ _contractAddress: address(portal), _isProxy: _isProxy, _slot: 0, _offset: 0 });

address guardian = _cfg.superchainConfigGuardian();
if (guardian.code.length == 0) {
console.log("Guardian has no code: %s", guardian);
}

if (_isProxy) {
require(address(portal.l2Oracle()) == _contracts.L2OutputOracle, "CHECK-OP-20");
require(address(portal.systemConfig()) == _contracts.SystemConfig, "CHECK-OP-30");
require(portal.guardian() == guardian, "CHECK-OP-40");
require(address(portal.superchainConfig()) == address(_contracts.SuperchainConfig), "CHECK-OP-50");
require(portal.paused() == ISuperchainConfig(_contracts.SuperchainConfig).paused(), "CHECK-OP-60");
require(portal.l2Sender() == Constants.DEFAULT_L2_SENDER, "CHECK-OP-70");
} else {
require(address(portal.l2Oracle()) == address(0), "CHECK-OP-80");
require(address(portal.systemConfig()) == address(0), "CHECK-OP-90");
require(address(portal.superchainConfig()) == address(0), "CHECK-OP-100");
require(portal.l2Sender() == address(0), "CHECK-OP-110");
}
}

/// @notice Asserts the OptimismPortal2 is setup correctly
function checkOptimismPortal2(
Types.ContractSet memory _contracts,
DeployConfig _cfg,
Expand All @@ -469,7 +369,7 @@ library ChainAssertions {
internal
view
{
IOptimismPortal2 portal = IOptimismPortal2(payable(_contracts.OptimismPortal2));
IOptimismPortal2 portal = IOptimismPortal2(payable(_contracts.OptimismPortal));
console.log(
"Running chain assertions on the OptimismPortal2 %s at %s",
_isProxy ? "proxy" : "implementation",
Expand Down Expand Up @@ -596,7 +496,7 @@ library ChainAssertions {
// Ensure that the OPCM impls are correctly saved
OPContractsManager.Implementations memory impls = _opcm.implementations();
require(impls.l1ERC721BridgeImpl == _contracts.L1ERC721Bridge, "CHECK-OPCM-50");
require(impls.optimismPortalImpl == _contracts.OptimismPortal2, "CHECK-OPCM-60");
require(impls.optimismPortalImpl == _contracts.OptimismPortal, "CHECK-OPCM-60");
require(impls.systemConfigImpl == _contracts.SystemConfig, "CHECK-OPCM-70");
require(impls.optimismMintableERC20FactoryImpl == _contracts.OptimismMintableERC20Factory, "CHECK-OPCM-80");
require(impls.l1CrossDomainMessengerImpl == _contracts.L1CrossDomainMessenger, "CHECK-OPCM-90");
Expand Down
Loading

0 comments on commit f3b9f0c

Please sign in to comment.