Commit a4d81ba5 authored by Michael Amadi's avatar Michael Amadi Committed by GitHub

use interfaces in opcm contracts (#12217)

* use interfaces in opcm contracts

* fix change

* fix encodeConstructor omission

* fix wrong interface usage

* fix change

* fix change

* remove commented fn

* fix semver conflict issue
parent d8cde654
...@@ -16,31 +16,24 @@ import { Constants } from "src/libraries/Constants.sol"; ...@@ -16,31 +16,24 @@ import { Constants } from "src/libraries/Constants.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { Bytes } from "src/libraries/Bytes.sol"; import { Bytes } from "src/libraries/Bytes.sol";
import { ProxyAdmin } from "src/universal/ProxyAdmin.sol"; import { IProxy } from "src/universal/interfaces/IProxy.sol";
import { Proxy } from "src/universal/Proxy.sol";
import { L1ChugSplashProxy } from "src/legacy/L1ChugSplashProxy.sol"; import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol";
import { ResolvedDelegateProxy } from "src/legacy/ResolvedDelegateProxy.sol";
import { AddressManager } from "src/legacy/AddressManager.sol";
import { DelayedWETH } from "src/dispute/DelayedWETH.sol";
import { PreimageOracle } from "src/cannon/PreimageOracle.sol";
import { IPreimageOracle } from "src/cannon/interfaces/IPreimageOracle.sol"; import { IPreimageOracle } from "src/cannon/interfaces/IPreimageOracle.sol";
import { MIPS } from "src/cannon/MIPS.sol"; import { IMIPS } from "src/cannon/interfaces/IMIPS.sol";
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol"; import { IDisputeGameFactory } from "src/dispute/interfaces/IDisputeGameFactory.sol";
import { AnchorStateRegistry } from "src/dispute/AnchorStateRegistry.sol";
import { PermissionedDisputeGame } from "src/dispute/PermissionedDisputeGame.sol";
import { OPContractsManager } from "src/L1/OPContractsManager.sol"; import { OPContractsManager } from "src/L1/OPContractsManager.sol";
import { OptimismPortal2 } from "src/L1/OptimismPortal2.sol"; import { IOptimismPortal2 } from "src/L1/interfaces/IOptimismPortal2.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol"; import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { L1CrossDomainMessenger } from "src/L1/L1CrossDomainMessenger.sol"; import { IL1CrossDomainMessenger } from "src/L1/interfaces/IL1CrossDomainMessenger.sol";
import { L1ERC721Bridge } from "src/L1/L1ERC721Bridge.sol"; import { IL1ERC721Bridge } from "src/L1/interfaces/IL1ERC721Bridge.sol";
import { L1StandardBridge } from "src/L1/L1StandardBridge.sol"; import { IL1StandardBridge } from "src/L1/interfaces/IL1StandardBridge.sol";
import { OptimismMintableERC20Factory } from "src/universal/OptimismMintableERC20Factory.sol"; import { IOptimismMintableERC20Factory } from "src/universal/interfaces/IOptimismMintableERC20Factory.sol";
import { OPContractsManagerInterop } from "src/L1/OPContractsManagerInterop.sol"; import { OPContractsManagerInterop } from "src/L1/OPContractsManagerInterop.sol";
import { OptimismPortalInterop } from "src/L1/OptimismPortalInterop.sol"; import { IOptimismPortalInterop } from "src/L1/interfaces/IOptimismPortalInterop.sol";
import { SystemConfigInterop } from "src/L1/SystemConfigInterop.sol"; import { ISystemConfigInterop } from "src/L1/interfaces/ISystemConfigInterop.sol";
import { Blueprint } from "src/libraries/Blueprint.sol"; import { Blueprint } from "src/libraries/Blueprint.sol";
...@@ -169,16 +162,16 @@ contract DeployImplementationsInput is BaseDeployIO { ...@@ -169,16 +162,16 @@ contract DeployImplementationsInput is BaseDeployIO {
contract DeployImplementationsOutput is BaseDeployIO { contract DeployImplementationsOutput is BaseDeployIO {
OPContractsManager internal _opcmProxy; OPContractsManager internal _opcmProxy;
OPContractsManager internal _opcmImpl; OPContractsManager internal _opcmImpl;
DelayedWETH internal _delayedWETHImpl; IDelayedWETH internal _delayedWETHImpl;
OptimismPortal2 internal _optimismPortalImpl; IOptimismPortal2 internal _optimismPortalImpl;
PreimageOracle internal _preimageOracleSingleton; IPreimageOracle internal _preimageOracleSingleton;
MIPS internal _mipsSingleton; IMIPS internal _mipsSingleton;
SystemConfig internal _systemConfigImpl; ISystemConfig internal _systemConfigImpl;
L1CrossDomainMessenger internal _l1CrossDomainMessengerImpl; IL1CrossDomainMessenger internal _l1CrossDomainMessengerImpl;
L1ERC721Bridge internal _l1ERC721BridgeImpl; IL1ERC721Bridge internal _l1ERC721BridgeImpl;
L1StandardBridge internal _l1StandardBridgeImpl; IL1StandardBridge internal _l1StandardBridgeImpl;
OptimismMintableERC20Factory internal _optimismMintableERC20FactoryImpl; IOptimismMintableERC20Factory internal _optimismMintableERC20FactoryImpl;
DisputeGameFactory internal _disputeGameFactoryImpl; IDisputeGameFactory internal _disputeGameFactoryImpl;
function set(bytes4 _sel, address _addr) public { function set(bytes4 _sel, address _addr) public {
require(_addr != address(0), "DeployImplementationsOutput: cannot set zero address"); require(_addr != address(0), "DeployImplementationsOutput: cannot set zero address");
...@@ -186,16 +179,16 @@ contract DeployImplementationsOutput is BaseDeployIO { ...@@ -186,16 +179,16 @@ contract DeployImplementationsOutput is BaseDeployIO {
// forgefmt: disable-start // forgefmt: disable-start
if (_sel == this.opcmProxy.selector) _opcmProxy = OPContractsManager(payable(_addr)); if (_sel == this.opcmProxy.selector) _opcmProxy = OPContractsManager(payable(_addr));
else if (_sel == this.opcmImpl.selector) _opcmImpl = OPContractsManager(payable(_addr)); else if (_sel == this.opcmImpl.selector) _opcmImpl = OPContractsManager(payable(_addr));
else if (_sel == this.optimismPortalImpl.selector) _optimismPortalImpl = OptimismPortal2(payable(_addr)); else if (_sel == this.optimismPortalImpl.selector) _optimismPortalImpl = IOptimismPortal2(payable(_addr));
else if (_sel == this.delayedWETHImpl.selector) _delayedWETHImpl = DelayedWETH(payable(_addr)); else if (_sel == this.delayedWETHImpl.selector) _delayedWETHImpl = IDelayedWETH(payable(_addr));
else if (_sel == this.preimageOracleSingleton.selector) _preimageOracleSingleton = PreimageOracle(_addr); else if (_sel == this.preimageOracleSingleton.selector) _preimageOracleSingleton = IPreimageOracle(_addr);
else if (_sel == this.mipsSingleton.selector) _mipsSingleton = MIPS(_addr); else if (_sel == this.mipsSingleton.selector) _mipsSingleton = IMIPS(_addr);
else if (_sel == this.systemConfigImpl.selector) _systemConfigImpl = SystemConfig(_addr); else if (_sel == this.systemConfigImpl.selector) _systemConfigImpl = ISystemConfig(_addr);
else if (_sel == this.l1CrossDomainMessengerImpl.selector) _l1CrossDomainMessengerImpl = L1CrossDomainMessenger(_addr); else if (_sel == this.l1CrossDomainMessengerImpl.selector) _l1CrossDomainMessengerImpl = IL1CrossDomainMessenger(_addr);
else if (_sel == this.l1ERC721BridgeImpl.selector) _l1ERC721BridgeImpl = L1ERC721Bridge(_addr); else if (_sel == this.l1ERC721BridgeImpl.selector) _l1ERC721BridgeImpl = IL1ERC721Bridge(_addr);
else if (_sel == this.l1StandardBridgeImpl.selector) _l1StandardBridgeImpl = L1StandardBridge(payable(_addr)); else if (_sel == this.l1StandardBridgeImpl.selector) _l1StandardBridgeImpl = IL1StandardBridge(payable(_addr));
else if (_sel == this.optimismMintableERC20FactoryImpl.selector) _optimismMintableERC20FactoryImpl = OptimismMintableERC20Factory(_addr); else if (_sel == this.optimismMintableERC20FactoryImpl.selector) _optimismMintableERC20FactoryImpl = IOptimismMintableERC20Factory(_addr);
else if (_sel == this.disputeGameFactoryImpl.selector) _disputeGameFactoryImpl = DisputeGameFactory(_addr); else if (_sel == this.disputeGameFactoryImpl.selector) _disputeGameFactoryImpl = IDisputeGameFactory(_addr);
else revert("DeployImplementationsOutput: unknown selector"); else revert("DeployImplementationsOutput: unknown selector");
// forgefmt: disable-end // forgefmt: disable-end
} }
...@@ -237,52 +230,52 @@ contract DeployImplementationsOutput is BaseDeployIO { ...@@ -237,52 +230,52 @@ contract DeployImplementationsOutput is BaseDeployIO {
return _opcmImpl; return _opcmImpl;
} }
function optimismPortalImpl() public view returns (OptimismPortal2) { function optimismPortalImpl() public view returns (IOptimismPortal2) {
DeployUtils.assertValidContractAddress(address(_optimismPortalImpl)); DeployUtils.assertValidContractAddress(address(_optimismPortalImpl));
return _optimismPortalImpl; return _optimismPortalImpl;
} }
function delayedWETHImpl() public view returns (DelayedWETH) { function delayedWETHImpl() public view returns (IDelayedWETH) {
DeployUtils.assertValidContractAddress(address(_delayedWETHImpl)); DeployUtils.assertValidContractAddress(address(_delayedWETHImpl));
return _delayedWETHImpl; return _delayedWETHImpl;
} }
function preimageOracleSingleton() public view returns (PreimageOracle) { function preimageOracleSingleton() public view returns (IPreimageOracle) {
DeployUtils.assertValidContractAddress(address(_preimageOracleSingleton)); DeployUtils.assertValidContractAddress(address(_preimageOracleSingleton));
return _preimageOracleSingleton; return _preimageOracleSingleton;
} }
function mipsSingleton() public view returns (MIPS) { function mipsSingleton() public view returns (IMIPS) {
DeployUtils.assertValidContractAddress(address(_mipsSingleton)); DeployUtils.assertValidContractAddress(address(_mipsSingleton));
return _mipsSingleton; return _mipsSingleton;
} }
function systemConfigImpl() public view returns (SystemConfig) { function systemConfigImpl() public view returns (ISystemConfig) {
DeployUtils.assertValidContractAddress(address(_systemConfigImpl)); DeployUtils.assertValidContractAddress(address(_systemConfigImpl));
return _systemConfigImpl; return _systemConfigImpl;
} }
function l1CrossDomainMessengerImpl() public view returns (L1CrossDomainMessenger) { function l1CrossDomainMessengerImpl() public view returns (IL1CrossDomainMessenger) {
DeployUtils.assertValidContractAddress(address(_l1CrossDomainMessengerImpl)); DeployUtils.assertValidContractAddress(address(_l1CrossDomainMessengerImpl));
return _l1CrossDomainMessengerImpl; return _l1CrossDomainMessengerImpl;
} }
function l1ERC721BridgeImpl() public view returns (L1ERC721Bridge) { function l1ERC721BridgeImpl() public view returns (IL1ERC721Bridge) {
DeployUtils.assertValidContractAddress(address(_l1ERC721BridgeImpl)); DeployUtils.assertValidContractAddress(address(_l1ERC721BridgeImpl));
return _l1ERC721BridgeImpl; return _l1ERC721BridgeImpl;
} }
function l1StandardBridgeImpl() public view returns (L1StandardBridge) { function l1StandardBridgeImpl() public view returns (IL1StandardBridge) {
DeployUtils.assertValidContractAddress(address(_l1StandardBridgeImpl)); DeployUtils.assertValidContractAddress(address(_l1StandardBridgeImpl));
return _l1StandardBridgeImpl; return _l1StandardBridgeImpl;
} }
function optimismMintableERC20FactoryImpl() public view returns (OptimismMintableERC20Factory) { function optimismMintableERC20FactoryImpl() public view returns (IOptimismMintableERC20Factory) {
DeployUtils.assertValidContractAddress(address(_optimismMintableERC20FactoryImpl)); DeployUtils.assertValidContractAddress(address(_optimismMintableERC20FactoryImpl));
return _optimismMintableERC20FactoryImpl; return _optimismMintableERC20FactoryImpl;
} }
function disputeGameFactoryImpl() public view returns (DisputeGameFactory) { function disputeGameFactoryImpl() public view returns (IDisputeGameFactory) {
DeployUtils.assertValidContractAddress(address(_disputeGameFactoryImpl)); DeployUtils.assertValidContractAddress(address(_disputeGameFactoryImpl));
return _disputeGameFactoryImpl; return _disputeGameFactoryImpl;
} }
...@@ -305,7 +298,7 @@ contract DeployImplementationsOutput is BaseDeployIO { ...@@ -305,7 +298,7 @@ contract DeployImplementationsOutput is BaseDeployIO {
function assertValidOpcmProxy(DeployImplementationsInput _dii) internal { function assertValidOpcmProxy(DeployImplementationsInput _dii) internal {
// First we check the proxy as itself. // First we check the proxy as itself.
Proxy proxy = Proxy(payable(address(opcmProxy()))); IProxy proxy = IProxy(payable(address(opcmProxy())));
vm.prank(address(0)); vm.prank(address(0));
address admin = proxy.admin(); address admin = proxy.admin();
require(admin == address(_dii.opcmProxyOwner()), "OPCMP-10"); require(admin == address(_dii.opcmProxyOwner()), "OPCMP-10");
...@@ -318,7 +311,7 @@ contract DeployImplementationsOutput is BaseDeployIO { ...@@ -318,7 +311,7 @@ contract DeployImplementationsOutput is BaseDeployIO {
} }
function assertValidOpcmImpl(DeployImplementationsInput _dii) internal { function assertValidOpcmImpl(DeployImplementationsInput _dii) internal {
Proxy proxy = Proxy(payable(address(opcmProxy()))); IProxy proxy = IProxy(payable(address(opcmProxy())));
vm.prank(address(0)); vm.prank(address(0));
OPContractsManager impl = OPContractsManager(proxy.implementation()); OPContractsManager impl = OPContractsManager(proxy.implementation());
DeployUtils.assertInitialized({ _contractAddress: address(impl), _slot: 0, _offset: 0 }); DeployUtils.assertInitialized({ _contractAddress: address(impl), _slot: 0, _offset: 0 });
...@@ -327,7 +320,7 @@ contract DeployImplementationsOutput is BaseDeployIO { ...@@ -327,7 +320,7 @@ contract DeployImplementationsOutput is BaseDeployIO {
} }
function assertValidOptimismPortalImpl(DeployImplementationsInput) internal view { function assertValidOptimismPortalImpl(DeployImplementationsInput) internal view {
OptimismPortal2 portal = optimismPortalImpl(); IOptimismPortal2 portal = optimismPortalImpl();
DeployUtils.assertInitialized({ _contractAddress: address(portal), _slot: 0, _offset: 0 }); DeployUtils.assertInitialized({ _contractAddress: address(portal), _slot: 0, _offset: 0 });
...@@ -342,7 +335,7 @@ contract DeployImplementationsOutput is BaseDeployIO { ...@@ -342,7 +335,7 @@ contract DeployImplementationsOutput is BaseDeployIO {
} }
function assertValidDelayedWETHImpl(DeployImplementationsInput _dii) internal view { function assertValidDelayedWETHImpl(DeployImplementationsInput _dii) internal view {
DelayedWETH delayedWETH = delayedWETHImpl(); IDelayedWETH delayedWETH = delayedWETHImpl();
DeployUtils.assertInitialized({ _contractAddress: address(delayedWETH), _slot: 0, _offset: 0 }); DeployUtils.assertInitialized({ _contractAddress: address(delayedWETH), _slot: 0, _offset: 0 });
...@@ -352,20 +345,20 @@ contract DeployImplementationsOutput is BaseDeployIO { ...@@ -352,20 +345,20 @@ contract DeployImplementationsOutput is BaseDeployIO {
} }
function assertValidPreimageOracleSingleton(DeployImplementationsInput _dii) internal view { function assertValidPreimageOracleSingleton(DeployImplementationsInput _dii) internal view {
PreimageOracle oracle = preimageOracleSingleton(); IPreimageOracle oracle = preimageOracleSingleton();
require(oracle.minProposalSize() == _dii.minProposalSizeBytes(), "PO-10"); require(oracle.minProposalSize() == _dii.minProposalSizeBytes(), "PO-10");
require(oracle.challengePeriod() == _dii.challengePeriodSeconds(), "PO-20"); require(oracle.challengePeriod() == _dii.challengePeriodSeconds(), "PO-20");
} }
function assertValidMipsSingleton(DeployImplementationsInput) internal view { function assertValidMipsSingleton(DeployImplementationsInput) internal view {
MIPS mips = mipsSingleton(); IMIPS mips = mipsSingleton();
require(address(mips.oracle()) == address(preimageOracleSingleton()), "MIPS-10"); require(address(mips.oracle()) == address(preimageOracleSingleton()), "MIPS-10");
} }
function assertValidSystemConfigImpl(DeployImplementationsInput) internal view { function assertValidSystemConfigImpl(DeployImplementationsInput) internal view {
SystemConfig systemConfig = systemConfigImpl(); ISystemConfig systemConfig = systemConfigImpl();
DeployUtils.assertInitialized({ _contractAddress: address(systemConfig), _slot: 0, _offset: 0 }); DeployUtils.assertInitialized({ _contractAddress: address(systemConfig), _slot: 0, _offset: 0 });
...@@ -397,7 +390,7 @@ contract DeployImplementationsOutput is BaseDeployIO { ...@@ -397,7 +390,7 @@ contract DeployImplementationsOutput is BaseDeployIO {
} }
function assertValidL1CrossDomainMessengerImpl(DeployImplementationsInput) internal view { function assertValidL1CrossDomainMessengerImpl(DeployImplementationsInput) internal view {
L1CrossDomainMessenger messenger = l1CrossDomainMessengerImpl(); IL1CrossDomainMessenger messenger = l1CrossDomainMessengerImpl();
DeployUtils.assertInitialized({ _contractAddress: address(messenger), _slot: 0, _offset: 20 }); DeployUtils.assertInitialized({ _contractAddress: address(messenger), _slot: 0, _offset: 20 });
...@@ -412,7 +405,7 @@ contract DeployImplementationsOutput is BaseDeployIO { ...@@ -412,7 +405,7 @@ contract DeployImplementationsOutput is BaseDeployIO {
} }
function assertValidL1ERC721BridgeImpl(DeployImplementationsInput) internal view { function assertValidL1ERC721BridgeImpl(DeployImplementationsInput) internal view {
L1ERC721Bridge bridge = l1ERC721BridgeImpl(); IL1ERC721Bridge bridge = l1ERC721BridgeImpl();
DeployUtils.assertInitialized({ _contractAddress: address(bridge), _slot: 0, _offset: 0 }); DeployUtils.assertInitialized({ _contractAddress: address(bridge), _slot: 0, _offset: 0 });
...@@ -424,7 +417,7 @@ contract DeployImplementationsOutput is BaseDeployIO { ...@@ -424,7 +417,7 @@ contract DeployImplementationsOutput is BaseDeployIO {
} }
function assertValidL1StandardBridgeImpl(DeployImplementationsInput) internal view { function assertValidL1StandardBridgeImpl(DeployImplementationsInput) internal view {
L1StandardBridge bridge = l1StandardBridgeImpl(); IL1StandardBridge bridge = l1StandardBridgeImpl();
DeployUtils.assertInitialized({ _contractAddress: address(bridge), _slot: 0, _offset: 0 }); DeployUtils.assertInitialized({ _contractAddress: address(bridge), _slot: 0, _offset: 0 });
...@@ -436,7 +429,7 @@ contract DeployImplementationsOutput is BaseDeployIO { ...@@ -436,7 +429,7 @@ contract DeployImplementationsOutput is BaseDeployIO {
} }
function assertValidOptimismMintableERC20FactoryImpl(DeployImplementationsInput) internal view { function assertValidOptimismMintableERC20FactoryImpl(DeployImplementationsInput) internal view {
OptimismMintableERC20Factory factory = optimismMintableERC20FactoryImpl(); IOptimismMintableERC20Factory factory = optimismMintableERC20FactoryImpl();
DeployUtils.assertInitialized({ _contractAddress: address(factory), _slot: 0, _offset: 0 }); DeployUtils.assertInitialized({ _contractAddress: address(factory), _slot: 0, _offset: 0 });
...@@ -445,7 +438,7 @@ contract DeployImplementationsOutput is BaseDeployIO { ...@@ -445,7 +438,7 @@ contract DeployImplementationsOutput is BaseDeployIO {
} }
function assertValidDisputeGameFactoryImpl(DeployImplementationsInput) internal view { function assertValidDisputeGameFactoryImpl(DeployImplementationsInput) internal view {
DisputeGameFactory factory = disputeGameFactoryImpl(); IDisputeGameFactory factory = disputeGameFactoryImpl();
DeployUtils.assertInitialized({ _contractAddress: address(factory), _slot: 0, _offset: 0 }); DeployUtils.assertInitialized({ _contractAddress: address(factory), _slot: 0, _offset: 0 });
...@@ -497,7 +490,7 @@ contract DeployImplementations is Script { ...@@ -497,7 +490,7 @@ contract DeployImplementations is Script {
// is a function of the `release` passed in by the caller. // is a function of the `release` passed in by the caller.
bytes4 selector = LibString.eq(_dii.release(), "op-contracts/v1.6.0") bytes4 selector = LibString.eq(_dii.release(), "op-contracts/v1.6.0")
? ISystemConfigV160.initialize.selector ? ISystemConfigV160.initialize.selector
: SystemConfig.initialize.selector; : ISystemConfig.initialize.selector;
return OPContractsManager.ImplementationSetter({ return OPContractsManager.ImplementationSetter({
name: "SystemConfig", name: "SystemConfig",
info: OPContractsManager.Implementation(address(_dio.systemConfigImpl()), selector) info: OPContractsManager.Implementation(address(_dio.systemConfigImpl()), selector)
...@@ -515,7 +508,7 @@ contract DeployImplementations is Script { ...@@ -515,7 +508,7 @@ contract DeployImplementations is Script {
{ {
bytes4 selector = LibString.eq(_dii.release(), "op-contracts/v1.6.0") bytes4 selector = LibString.eq(_dii.release(), "op-contracts/v1.6.0")
? IL1CrossDomainMessengerV160.initialize.selector ? IL1CrossDomainMessengerV160.initialize.selector
: L1CrossDomainMessenger.initialize.selector; : IL1CrossDomainMessenger.initialize.selector;
return OPContractsManager.ImplementationSetter({ return OPContractsManager.ImplementationSetter({
name: "L1CrossDomainMessenger", name: "L1CrossDomainMessenger",
info: OPContractsManager.Implementation(address(_dio.l1CrossDomainMessengerImpl()), selector) info: OPContractsManager.Implementation(address(_dio.l1CrossDomainMessengerImpl()), selector)
...@@ -533,7 +526,7 @@ contract DeployImplementations is Script { ...@@ -533,7 +526,7 @@ contract DeployImplementations is Script {
{ {
bytes4 selector = LibString.eq(_dii.release(), "op-contracts/v1.6.0") bytes4 selector = LibString.eq(_dii.release(), "op-contracts/v1.6.0")
? IL1StandardBridgeV160.initialize.selector ? IL1StandardBridgeV160.initialize.selector
: L1StandardBridge.initialize.selector; : IL1StandardBridge.initialize.selector;
return OPContractsManager.ImplementationSetter({ return OPContractsManager.ImplementationSetter({
name: "L1StandardBridge", name: "L1StandardBridge",
info: OPContractsManager.Implementation(address(_dio.l1StandardBridgeImpl()), selector) info: OPContractsManager.Implementation(address(_dio.l1StandardBridgeImpl()), selector)
...@@ -555,7 +548,12 @@ contract DeployImplementations is Script { ...@@ -555,7 +548,12 @@ contract DeployImplementations is Script {
address opcmProxyOwner = _dii.opcmProxyOwner(); address opcmProxyOwner = _dii.opcmProxyOwner();
vm.broadcast(msg.sender); vm.broadcast(msg.sender);
Proxy proxy = new Proxy(address(msg.sender)); IProxy proxy = IProxy(
DeployUtils.create1({
_name: "Proxy",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IProxy.__constructor__, (msg.sender)))
})
);
deployOPContractsManagerImpl(_dii, _dio); deployOPContractsManagerImpl(_dii, _dio);
OPContractsManager opcmImpl = _dio.opcmImpl(); OPContractsManager opcmImpl = _dio.opcmImpl();
...@@ -589,30 +587,32 @@ contract DeployImplementations is Script { ...@@ -589,30 +587,32 @@ contract DeployImplementations is Script {
OPContractsManager.Blueprints memory blueprints; OPContractsManager.Blueprints memory blueprints;
vm.startBroadcast(msg.sender); vm.startBroadcast(msg.sender);
blueprints.addressManager = deployBytecode(Blueprint.blueprintDeployerBytecode(type(AddressManager).creationCode), salt); blueprints.addressManager = deployBytecode(Blueprint.blueprintDeployerBytecode(vm.getCode("AddressManager")), salt);
blueprints.proxy = deployBytecode(Blueprint.blueprintDeployerBytecode(type(Proxy).creationCode), salt); blueprints.proxy = deployBytecode(Blueprint.blueprintDeployerBytecode(vm.getCode("Proxy")), salt);
blueprints.proxyAdmin = deployBytecode(Blueprint.blueprintDeployerBytecode(type(ProxyAdmin).creationCode), salt); blueprints.proxyAdmin = deployBytecode(Blueprint.blueprintDeployerBytecode(vm.getCode("ProxyAdmin")), salt);
blueprints.l1ChugSplashProxy = deployBytecode(Blueprint.blueprintDeployerBytecode(type(L1ChugSplashProxy).creationCode), salt); blueprints.l1ChugSplashProxy = deployBytecode(Blueprint.blueprintDeployerBytecode(vm.getCode("L1ChugSplashProxy")), salt);
blueprints.resolvedDelegateProxy = deployBytecode(Blueprint.blueprintDeployerBytecode(type(ResolvedDelegateProxy).creationCode), salt); blueprints.resolvedDelegateProxy = deployBytecode(Blueprint.blueprintDeployerBytecode(vm.getCode("ResolvedDelegateProxy")), salt);
blueprints.anchorStateRegistry = deployBytecode(Blueprint.blueprintDeployerBytecode(type(AnchorStateRegistry).creationCode), salt); blueprints.anchorStateRegistry = deployBytecode(Blueprint.blueprintDeployerBytecode(vm.getCode("AnchorStateRegistry")), salt);
(blueprints.permissionedDisputeGame1, blueprints.permissionedDisputeGame2) = deployBigBytecode(type(PermissionedDisputeGame).creationCode, salt); (blueprints.permissionedDisputeGame1, blueprints.permissionedDisputeGame2) = deployBigBytecode(vm.getCode("PermissionedDisputeGame"), salt);
vm.stopBroadcast(); vm.stopBroadcast();
// forgefmt: disable-end // forgefmt: disable-end
OPContractsManager.ImplementationSetter[] memory setters = new OPContractsManager.ImplementationSetter[](9); OPContractsManager.ImplementationSetter[] memory setters = new OPContractsManager.ImplementationSetter[](9);
setters[0] = OPContractsManager.ImplementationSetter({ setters[0] = OPContractsManager.ImplementationSetter({
name: "L1ERC721Bridge", name: "L1ERC721Bridge",
info: OPContractsManager.Implementation(address(_dio.l1ERC721BridgeImpl()), L1ERC721Bridge.initialize.selector) info: OPContractsManager.Implementation(address(_dio.l1ERC721BridgeImpl()), IL1ERC721Bridge.initialize.selector)
}); });
setters[1] = OPContractsManager.ImplementationSetter({ setters[1] = OPContractsManager.ImplementationSetter({
name: "OptimismPortal", name: "OptimismPortal",
info: OPContractsManager.Implementation(address(_dio.optimismPortalImpl()), OptimismPortal2.initialize.selector) info: OPContractsManager.Implementation(
address(_dio.optimismPortalImpl()), IOptimismPortal2.initialize.selector
)
}); });
setters[2] = opcmSystemConfigSetter(_dii, _dio); setters[2] = opcmSystemConfigSetter(_dii, _dio);
setters[3] = OPContractsManager.ImplementationSetter({ setters[3] = OPContractsManager.ImplementationSetter({
name: "OptimismMintableERC20Factory", name: "OptimismMintableERC20Factory",
info: OPContractsManager.Implementation( info: OPContractsManager.Implementation(
address(_dio.optimismMintableERC20FactoryImpl()), OptimismMintableERC20Factory.initialize.selector address(_dio.optimismMintableERC20FactoryImpl()), IOptimismMintableERC20Factory.initialize.selector
) )
}); });
setters[4] = l1CrossDomainMessengerConfigSetter(_dii, _dio); setters[4] = l1CrossDomainMessengerConfigSetter(_dii, _dio);
...@@ -620,12 +620,12 @@ contract DeployImplementations is Script { ...@@ -620,12 +620,12 @@ contract DeployImplementations is Script {
setters[6] = OPContractsManager.ImplementationSetter({ setters[6] = OPContractsManager.ImplementationSetter({
name: "DisputeGameFactory", name: "DisputeGameFactory",
info: OPContractsManager.Implementation( info: OPContractsManager.Implementation(
address(_dio.disputeGameFactoryImpl()), DisputeGameFactory.initialize.selector address(_dio.disputeGameFactoryImpl()), IDisputeGameFactory.initialize.selector
) )
}); });
setters[7] = OPContractsManager.ImplementationSetter({ setters[7] = OPContractsManager.ImplementationSetter({
name: "DelayedWETH", name: "DelayedWETH",
info: OPContractsManager.Implementation(address(_dio.delayedWETHImpl()), DelayedWETH.initialize.selector) info: OPContractsManager.Implementation(address(_dio.delayedWETHImpl()), IDelayedWETH.initialize.selector)
}); });
setters[8] = OPContractsManager.ImplementationSetter({ setters[8] = OPContractsManager.ImplementationSetter({
name: "MIPS", name: "MIPS",
...@@ -648,15 +648,20 @@ contract DeployImplementations is Script { ...@@ -648,15 +648,20 @@ contract DeployImplementations is Script {
string memory stdVerToml = _dii.standardVersionsToml(); string memory stdVerToml = _dii.standardVersionsToml();
// Using snake case for contract name to match the TOML file in superchain-registry. // Using snake case for contract name to match the TOML file in superchain-registry.
string memory contractName = "system_config"; string memory contractName = "system_config";
SystemConfig impl; ISystemConfig impl;
address existingImplementation = getReleaseAddress(release, contractName, stdVerToml); address existingImplementation = getReleaseAddress(release, contractName, stdVerToml);
if (existingImplementation != address(0)) { if (existingImplementation != address(0)) {
impl = SystemConfig(existingImplementation); impl = ISystemConfig(existingImplementation);
} else if (isDevelopRelease(release)) { } else if (isDevelopRelease(release)) {
// Deploy a new implementation for development builds. // Deploy a new implementation for development builds.
vm.broadcast(msg.sender); vm.broadcast(msg.sender);
impl = new SystemConfig(); impl = ISystemConfig(
DeployUtils.create1({
_name: "SystemConfig",
_args: DeployUtils.encodeConstructor(abi.encodeCall(ISystemConfig.__constructor__, ()))
})
);
} else { } else {
revert(string.concat("DeployImplementations: failed to deploy release ", release)); revert(string.concat("DeployImplementations: failed to deploy release ", release));
} }
...@@ -675,14 +680,19 @@ contract DeployImplementations is Script { ...@@ -675,14 +680,19 @@ contract DeployImplementations is Script {
string memory release = _dii.release(); string memory release = _dii.release();
string memory stdVerToml = _dii.standardVersionsToml(); string memory stdVerToml = _dii.standardVersionsToml();
string memory contractName = "l1_cross_domain_messenger"; string memory contractName = "l1_cross_domain_messenger";
L1CrossDomainMessenger impl; IL1CrossDomainMessenger impl;
address existingImplementation = getReleaseAddress(release, contractName, stdVerToml); address existingImplementation = getReleaseAddress(release, contractName, stdVerToml);
if (existingImplementation != address(0)) { if (existingImplementation != address(0)) {
impl = L1CrossDomainMessenger(existingImplementation); impl = IL1CrossDomainMessenger(existingImplementation);
} else if (isDevelopRelease(release)) { } else if (isDevelopRelease(release)) {
vm.broadcast(msg.sender); vm.broadcast(msg.sender);
impl = new L1CrossDomainMessenger(); impl = IL1CrossDomainMessenger(
DeployUtils.create1({
_name: "L1CrossDomainMessenger",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IL1CrossDomainMessenger.__constructor__, ()))
})
);
} else { } else {
revert(string.concat("DeployImplementations: failed to deploy release ", release)); revert(string.concat("DeployImplementations: failed to deploy release ", release));
} }
...@@ -701,14 +711,19 @@ contract DeployImplementations is Script { ...@@ -701,14 +711,19 @@ contract DeployImplementations is Script {
string memory release = _dii.release(); string memory release = _dii.release();
string memory stdVerToml = _dii.standardVersionsToml(); string memory stdVerToml = _dii.standardVersionsToml();
string memory contractName = "l1_erc721_bridge"; string memory contractName = "l1_erc721_bridge";
L1ERC721Bridge impl; IL1ERC721Bridge impl;
address existingImplementation = getReleaseAddress(release, contractName, stdVerToml); address existingImplementation = getReleaseAddress(release, contractName, stdVerToml);
if (existingImplementation != address(0)) { if (existingImplementation != address(0)) {
impl = L1ERC721Bridge(existingImplementation); impl = IL1ERC721Bridge(existingImplementation);
} else if (isDevelopRelease(release)) { } else if (isDevelopRelease(release)) {
vm.broadcast(msg.sender); vm.broadcast(msg.sender);
impl = new L1ERC721Bridge(); impl = IL1ERC721Bridge(
DeployUtils.create1({
_name: "L1ERC721Bridge",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IL1ERC721Bridge.__constructor__, ()))
})
);
} else { } else {
revert(string.concat("DeployImplementations: failed to deploy release ", release)); revert(string.concat("DeployImplementations: failed to deploy release ", release));
} }
...@@ -727,14 +742,19 @@ contract DeployImplementations is Script { ...@@ -727,14 +742,19 @@ contract DeployImplementations is Script {
string memory release = _dii.release(); string memory release = _dii.release();
string memory stdVerToml = _dii.standardVersionsToml(); string memory stdVerToml = _dii.standardVersionsToml();
string memory contractName = "l1_standard_bridge"; string memory contractName = "l1_standard_bridge";
L1StandardBridge impl; IL1StandardBridge impl;
address existingImplementation = getReleaseAddress(release, contractName, stdVerToml); address existingImplementation = getReleaseAddress(release, contractName, stdVerToml);
if (existingImplementation != address(0)) { if (existingImplementation != address(0)) {
impl = L1StandardBridge(payable(existingImplementation)); impl = IL1StandardBridge(payable(existingImplementation));
} else if (isDevelopRelease(release)) { } else if (isDevelopRelease(release)) {
vm.broadcast(msg.sender); vm.broadcast(msg.sender);
impl = new L1StandardBridge(); impl = IL1StandardBridge(
DeployUtils.create1({
_name: "L1StandardBridge",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IL1StandardBridge.__constructor__, ()))
})
);
} else { } else {
revert(string.concat("DeployImplementations: failed to deploy release ", release)); revert(string.concat("DeployImplementations: failed to deploy release ", release));
} }
...@@ -753,14 +773,19 @@ contract DeployImplementations is Script { ...@@ -753,14 +773,19 @@ contract DeployImplementations is Script {
string memory release = _dii.release(); string memory release = _dii.release();
string memory stdVerToml = _dii.standardVersionsToml(); string memory stdVerToml = _dii.standardVersionsToml();
string memory contractName = "optimism_mintable_erc20_factory"; string memory contractName = "optimism_mintable_erc20_factory";
OptimismMintableERC20Factory impl; IOptimismMintableERC20Factory impl;
address existingImplementation = getReleaseAddress(release, contractName, stdVerToml); address existingImplementation = getReleaseAddress(release, contractName, stdVerToml);
if (existingImplementation != address(0)) { if (existingImplementation != address(0)) {
impl = OptimismMintableERC20Factory(existingImplementation); impl = IOptimismMintableERC20Factory(existingImplementation);
} else if (isDevelopRelease(release)) { } else if (isDevelopRelease(release)) {
vm.broadcast(msg.sender); vm.broadcast(msg.sender);
impl = new OptimismMintableERC20Factory(); impl = IOptimismMintableERC20Factory(
DeployUtils.create1({
_name: "OptimismMintableERC20Factory",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IOptimismMintableERC20Factory.__constructor__, ()))
})
);
} else { } else {
revert(string.concat("DeployImplementations: failed to deploy release ", release)); revert(string.concat("DeployImplementations: failed to deploy release ", release));
} }
...@@ -834,16 +859,25 @@ contract DeployImplementations is Script { ...@@ -834,16 +859,25 @@ contract DeployImplementations is Script {
string memory release = _dii.release(); string memory release = _dii.release();
string memory stdVerToml = _dii.standardVersionsToml(); string memory stdVerToml = _dii.standardVersionsToml();
string memory contractName = "optimism_portal"; string memory contractName = "optimism_portal";
OptimismPortal2 impl; IOptimismPortal2 impl;
address existingImplementation = getReleaseAddress(release, contractName, stdVerToml); address existingImplementation = getReleaseAddress(release, contractName, stdVerToml);
if (existingImplementation != address(0)) { if (existingImplementation != address(0)) {
impl = OptimismPortal2(payable(existingImplementation)); impl = IOptimismPortal2(payable(existingImplementation));
} else if (isDevelopRelease(release)) { } else if (isDevelopRelease(release)) {
uint256 proofMaturityDelaySeconds = _dii.proofMaturityDelaySeconds(); uint256 proofMaturityDelaySeconds = _dii.proofMaturityDelaySeconds();
uint256 disputeGameFinalityDelaySeconds = _dii.disputeGameFinalityDelaySeconds(); uint256 disputeGameFinalityDelaySeconds = _dii.disputeGameFinalityDelaySeconds();
vm.broadcast(msg.sender); vm.broadcast(msg.sender);
impl = new OptimismPortal2(proofMaturityDelaySeconds, disputeGameFinalityDelaySeconds); impl = IOptimismPortal2(
DeployUtils.create1({
_name: "OptimismPortal2",
_args: DeployUtils.encodeConstructor(
abi.encodeCall(
IOptimismPortal2.__constructor__, (proofMaturityDelaySeconds, disputeGameFinalityDelaySeconds)
)
)
})
);
} else { } else {
revert(string.concat("DeployImplementations: failed to deploy release ", release)); revert(string.concat("DeployImplementations: failed to deploy release ", release));
} }
...@@ -856,15 +890,22 @@ contract DeployImplementations is Script { ...@@ -856,15 +890,22 @@ contract DeployImplementations is Script {
string memory release = _dii.release(); string memory release = _dii.release();
string memory stdVerToml = _dii.standardVersionsToml(); string memory stdVerToml = _dii.standardVersionsToml();
string memory contractName = "delayed_weth"; string memory contractName = "delayed_weth";
DelayedWETH impl; IDelayedWETH impl;
address existingImplementation = getReleaseAddress(release, contractName, stdVerToml); address existingImplementation = getReleaseAddress(release, contractName, stdVerToml);
if (existingImplementation != address(0)) { if (existingImplementation != address(0)) {
impl = DelayedWETH(payable(existingImplementation)); impl = IDelayedWETH(payable(existingImplementation));
} else if (isDevelopRelease(release)) { } else if (isDevelopRelease(release)) {
uint256 withdrawalDelaySeconds = _dii.withdrawalDelaySeconds(); uint256 withdrawalDelaySeconds = _dii.withdrawalDelaySeconds();
vm.broadcast(msg.sender); vm.broadcast(msg.sender);
impl = new DelayedWETH(withdrawalDelaySeconds); impl = IDelayedWETH(
DeployUtils.create1({
_name: "DelayedWETH",
_args: DeployUtils.encodeConstructor(
abi.encodeCall(IDelayedWETH.__constructor__, (withdrawalDelaySeconds))
)
})
);
} else { } else {
revert(string.concat("DeployImplementations: failed to deploy release ", release)); revert(string.concat("DeployImplementations: failed to deploy release ", release));
} }
...@@ -883,16 +924,23 @@ contract DeployImplementations is Script { ...@@ -883,16 +924,23 @@ contract DeployImplementations is Script {
string memory release = _dii.release(); string memory release = _dii.release();
string memory stdVerToml = _dii.standardVersionsToml(); string memory stdVerToml = _dii.standardVersionsToml();
string memory contractName = "preimage_oracle"; string memory contractName = "preimage_oracle";
PreimageOracle singleton; IPreimageOracle singleton;
address existingImplementation = getReleaseAddress(release, contractName, stdVerToml); address existingImplementation = getReleaseAddress(release, contractName, stdVerToml);
if (existingImplementation != address(0)) { if (existingImplementation != address(0)) {
singleton = PreimageOracle(payable(existingImplementation)); singleton = IPreimageOracle(payable(existingImplementation));
} else if (isDevelopRelease(release)) { } else if (isDevelopRelease(release)) {
uint256 minProposalSizeBytes = _dii.minProposalSizeBytes(); uint256 minProposalSizeBytes = _dii.minProposalSizeBytes();
uint256 challengePeriodSeconds = _dii.challengePeriodSeconds(); uint256 challengePeriodSeconds = _dii.challengePeriodSeconds();
vm.broadcast(msg.sender); vm.broadcast(msg.sender);
singleton = new PreimageOracle(minProposalSizeBytes, challengePeriodSeconds); singleton = IPreimageOracle(
DeployUtils.create1({
_name: "PreimageOracle",
_args: DeployUtils.encodeConstructor(
abi.encodeCall(IPreimageOracle.__constructor__, (minProposalSizeBytes, challengePeriodSeconds))
)
})
);
} else { } else {
revert(string.concat("DeployImplementations: failed to deploy release ", release)); revert(string.concat("DeployImplementations: failed to deploy release ", release));
} }
...@@ -905,15 +953,20 @@ contract DeployImplementations is Script { ...@@ -905,15 +953,20 @@ contract DeployImplementations is Script {
string memory release = _dii.release(); string memory release = _dii.release();
string memory stdVerToml = _dii.standardVersionsToml(); string memory stdVerToml = _dii.standardVersionsToml();
string memory contractName = "mips"; string memory contractName = "mips";
MIPS singleton; IMIPS singleton;
address existingImplementation = getReleaseAddress(release, contractName, stdVerToml); address existingImplementation = getReleaseAddress(release, contractName, stdVerToml);
if (existingImplementation != address(0)) { if (existingImplementation != address(0)) {
singleton = MIPS(payable(existingImplementation)); singleton = IMIPS(payable(existingImplementation));
} else if (isDevelopRelease(release)) { } else if (isDevelopRelease(release)) {
IPreimageOracle preimageOracle = IPreimageOracle(address(_dio.preimageOracleSingleton())); IPreimageOracle preimageOracle = IPreimageOracle(address(_dio.preimageOracleSingleton()));
vm.broadcast(msg.sender); vm.broadcast(msg.sender);
singleton = new MIPS(preimageOracle); singleton = IMIPS(
DeployUtils.create1({
_name: "MIPS",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IMIPS.__constructor__, (preimageOracle)))
})
);
} else { } else {
revert(string.concat("DeployImplementations: failed to deploy release ", release)); revert(string.concat("DeployImplementations: failed to deploy release ", release));
} }
...@@ -932,14 +985,19 @@ contract DeployImplementations is Script { ...@@ -932,14 +985,19 @@ contract DeployImplementations is Script {
string memory release = _dii.release(); string memory release = _dii.release();
string memory stdVerToml = _dii.standardVersionsToml(); string memory stdVerToml = _dii.standardVersionsToml();
string memory contractName = "dispute_game_factory"; string memory contractName = "dispute_game_factory";
DisputeGameFactory impl; IDisputeGameFactory impl;
address existingImplementation = getReleaseAddress(release, contractName, stdVerToml); address existingImplementation = getReleaseAddress(release, contractName, stdVerToml);
if (existingImplementation != address(0)) { if (existingImplementation != address(0)) {
impl = DisputeGameFactory(payable(existingImplementation)); impl = IDisputeGameFactory(payable(existingImplementation));
} else if (isDevelopRelease(release)) { } else if (isDevelopRelease(release)) {
vm.broadcast(msg.sender); vm.broadcast(msg.sender);
impl = new DisputeGameFactory(); impl = IDisputeGameFactory(
DeployUtils.create1({
_name: "DisputeGameFactory",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IDisputeGameFactory.__constructor__, ()))
})
);
} else { } else {
revert(string.concat("DeployImplementations: failed to deploy release ", release)); revert(string.concat("DeployImplementations: failed to deploy release ", release));
} }
...@@ -1065,7 +1123,12 @@ contract DeployImplementationsInterop is DeployImplementations { ...@@ -1065,7 +1123,12 @@ contract DeployImplementationsInterop is DeployImplementations {
address opcmProxyOwner = _dii.opcmProxyOwner(); address opcmProxyOwner = _dii.opcmProxyOwner();
vm.broadcast(msg.sender); vm.broadcast(msg.sender);
Proxy proxy = new Proxy(address(msg.sender)); IProxy proxy = IProxy(
DeployUtils.create1({
_name: "Proxy",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IProxy.__constructor__, (msg.sender)))
})
);
deployOPContractsManagerImpl(_dii, _dio); // overriding function deployOPContractsManagerImpl(_dii, _dio); // overriding function
OPContractsManager opcmImpl = _dio.opcmImpl(); OPContractsManager opcmImpl = _dio.opcmImpl();
...@@ -1094,16 +1157,26 @@ contract DeployImplementationsInterop is DeployImplementations { ...@@ -1094,16 +1157,26 @@ contract DeployImplementationsInterop is DeployImplementations {
string memory release = _dii.release(); string memory release = _dii.release();
string memory stdVerToml = _dii.standardVersionsToml(); string memory stdVerToml = _dii.standardVersionsToml();
string memory contractName = "optimism_portal"; string memory contractName = "optimism_portal";
OptimismPortal2 impl; IOptimismPortalInterop impl;
address existingImplementation = getReleaseAddress(release, contractName, stdVerToml); address existingImplementation = getReleaseAddress(release, contractName, stdVerToml);
if (existingImplementation != address(0)) { if (existingImplementation != address(0)) {
impl = OptimismPortalInterop(payable(existingImplementation)); impl = IOptimismPortalInterop(payable(existingImplementation));
} else if (isDevelopRelease(release)) { } else if (isDevelopRelease(release)) {
uint256 proofMaturityDelaySeconds = _dii.proofMaturityDelaySeconds(); uint256 proofMaturityDelaySeconds = _dii.proofMaturityDelaySeconds();
uint256 disputeGameFinalityDelaySeconds = _dii.disputeGameFinalityDelaySeconds(); uint256 disputeGameFinalityDelaySeconds = _dii.disputeGameFinalityDelaySeconds();
vm.broadcast(msg.sender); vm.broadcast(msg.sender);
impl = new OptimismPortalInterop(proofMaturityDelaySeconds, disputeGameFinalityDelaySeconds); impl = IOptimismPortalInterop(
DeployUtils.create1({
_name: "OptimismPortalInterop",
_args: DeployUtils.encodeConstructor(
abi.encodeCall(
IOptimismPortalInterop.__constructor__,
(proofMaturityDelaySeconds, disputeGameFinalityDelaySeconds)
)
)
})
);
} else { } else {
revert(string.concat("DeployImplementations: failed to deploy release ", release)); revert(string.concat("DeployImplementations: failed to deploy release ", release));
} }
...@@ -1123,14 +1196,19 @@ contract DeployImplementationsInterop is DeployImplementations { ...@@ -1123,14 +1196,19 @@ contract DeployImplementationsInterop is DeployImplementations {
string memory stdVerToml = _dii.standardVersionsToml(); string memory stdVerToml = _dii.standardVersionsToml();
string memory contractName = "system_config"; string memory contractName = "system_config";
SystemConfig impl; ISystemConfigInterop impl;
address existingImplementation = getReleaseAddress(release, contractName, stdVerToml); address existingImplementation = getReleaseAddress(release, contractName, stdVerToml);
if (existingImplementation != address(0)) { if (existingImplementation != address(0)) {
impl = SystemConfigInterop(existingImplementation); impl = ISystemConfigInterop(existingImplementation);
} else if (isDevelopRelease(release)) { } else if (isDevelopRelease(release)) {
vm.broadcast(msg.sender); vm.broadcast(msg.sender);
impl = new SystemConfigInterop(); impl = ISystemConfigInterop(
DeployUtils.create1({
_name: "SystemConfigInterop",
_args: DeployUtils.encodeConstructor(abi.encodeCall(ISystemConfigInterop.__constructor__, ()))
})
);
} else { } else {
revert(string.concat("DeployImplementations: failed to deploy release ", release)); revert(string.concat("DeployImplementations: failed to deploy release ", release));
} }
...@@ -1169,7 +1247,7 @@ contract DeployImplementationsInterop is DeployImplementations { ...@@ -1169,7 +1247,7 @@ contract DeployImplementationsInterop is DeployImplementations {
return OPContractsManager.ImplementationSetter({ return OPContractsManager.ImplementationSetter({
name: "SystemConfig", name: "SystemConfig",
info: OPContractsManager.Implementation( info: OPContractsManager.Implementation(
address(_dio.systemConfigImpl()), SystemConfigInterop.initialize.selector address(_dio.systemConfigImpl()), ISystemConfigInterop.initialize.selector
) )
}); });
} }
......
...@@ -15,24 +15,24 @@ import { IBigStepper } from "src/dispute/interfaces/IBigStepper.sol"; ...@@ -15,24 +15,24 @@ import { IBigStepper } from "src/dispute/interfaces/IBigStepper.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { ProxyAdmin } from "src/universal/ProxyAdmin.sol"; import { IProxyAdmin } from "src/universal/interfaces/IProxyAdmin.sol";
import { Proxy } from "src/universal/Proxy.sol"; import { IProxy } from "src/universal/interfaces/IProxy.sol";
import { AddressManager } from "src/legacy/AddressManager.sol"; import { IAddressManager } from "src/legacy/interfaces/IAddressManager.sol";
import { DelayedWETH } from "src/dispute/DelayedWETH.sol"; import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol";
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol"; import { IDisputeGameFactory } from "src/dispute/interfaces/IDisputeGameFactory.sol";
import { AnchorStateRegistry } from "src/dispute/AnchorStateRegistry.sol"; import { IAnchorStateRegistry } from "src/dispute/interfaces/IAnchorStateRegistry.sol";
import { FaultDisputeGame } from "src/dispute/FaultDisputeGame.sol"; import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol";
import { PermissionedDisputeGame } from "src/dispute/PermissionedDisputeGame.sol"; import { IPermissionedDisputeGame } from "src/dispute/interfaces/IPermissionedDisputeGame.sol";
import { Claim, GameType, GameTypes, Hash, OutputRoot } from "src/dispute/lib/Types.sol"; import { Claim, GameType, GameTypes, Hash, OutputRoot } from "src/dispute/lib/Types.sol";
import { OPContractsManager } from "src/L1/OPContractsManager.sol"; import { OPContractsManager } from "src/L1/OPContractsManager.sol";
import { OptimismPortal2 } from "src/L1/OptimismPortal2.sol"; import { IOptimismPortal2 } from "src/L1/interfaces/IOptimismPortal2.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol"; import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { L1CrossDomainMessenger } from "src/L1/L1CrossDomainMessenger.sol"; import { IL1CrossDomainMessenger } from "src/L1/interfaces/IL1CrossDomainMessenger.sol";
import { L1ERC721Bridge } from "src/L1/L1ERC721Bridge.sol"; import { IL1ERC721Bridge } from "src/L1/interfaces/IL1ERC721Bridge.sol";
import { L1StandardBridge } from "src/L1/L1StandardBridge.sol"; import { IL1StandardBridge } from "src/L1/interfaces/IL1StandardBridge.sol";
import { OptimismMintableERC20Factory } from "src/universal/OptimismMintableERC20Factory.sol"; import { IOptimismMintableERC20Factory } from "src/universal/interfaces/IOptimismMintableERC20Factory.sol";
contract DeployOPChainInput is BaseDeployIO { contract DeployOPChainInput is BaseDeployIO {
address internal _opChainProxyAdminOwner; address internal _opChainProxyAdminOwner;
...@@ -140,9 +140,9 @@ contract DeployOPChainInput is BaseDeployIO { ...@@ -140,9 +140,9 @@ contract DeployOPChainInput is BaseDeployIO {
// //
// You can `console.logBytes(abi.encode(defaultStartingAnchorRoots))` to get the bytes that // You can `console.logBytes(abi.encode(defaultStartingAnchorRoots))` to get the bytes that
// are hardcoded into `op-chain-ops/deployer/opcm/opchain.go` // are hardcoded into `op-chain-ops/deployer/opcm/opchain.go`
AnchorStateRegistry.StartingAnchorRoot[] memory defaultStartingAnchorRoots = IAnchorStateRegistry.StartingAnchorRoot[] memory defaultStartingAnchorRoots =
new AnchorStateRegistry.StartingAnchorRoot[](1); new IAnchorStateRegistry.StartingAnchorRoot[](1);
defaultStartingAnchorRoots[0] = AnchorStateRegistry.StartingAnchorRoot({ defaultStartingAnchorRoots[0] = IAnchorStateRegistry.StartingAnchorRoot({
gameType: GameTypes.PERMISSIONED_CANNON, gameType: GameTypes.PERMISSIONED_CANNON,
outputRoot: OutputRoot({ root: Hash.wrap(bytes32(hex"dead")), l2BlockNumber: 0 }) outputRoot: OutputRoot({ root: Hash.wrap(bytes32(hex"dead")), l2BlockNumber: 0 })
}); });
...@@ -166,40 +166,40 @@ contract DeployOPChainInput is BaseDeployIO { ...@@ -166,40 +166,40 @@ contract DeployOPChainInput is BaseDeployIO {
} }
contract DeployOPChainOutput is BaseDeployIO { contract DeployOPChainOutput is BaseDeployIO {
ProxyAdmin internal _opChainProxyAdmin; IProxyAdmin internal _opChainProxyAdmin;
AddressManager internal _addressManager; IAddressManager internal _addressManager;
L1ERC721Bridge internal _l1ERC721BridgeProxy; IL1ERC721Bridge internal _l1ERC721BridgeProxy;
SystemConfig internal _systemConfigProxy; ISystemConfig internal _systemConfigProxy;
OptimismMintableERC20Factory internal _optimismMintableERC20FactoryProxy; IOptimismMintableERC20Factory internal _optimismMintableERC20FactoryProxy;
L1StandardBridge internal _l1StandardBridgeProxy; IL1StandardBridge internal _l1StandardBridgeProxy;
L1CrossDomainMessenger internal _l1CrossDomainMessengerProxy; IL1CrossDomainMessenger internal _l1CrossDomainMessengerProxy;
OptimismPortal2 internal _optimismPortalProxy; IOptimismPortal2 internal _optimismPortalProxy;
DisputeGameFactory internal _disputeGameFactoryProxy; IDisputeGameFactory internal _disputeGameFactoryProxy;
AnchorStateRegistry internal _anchorStateRegistryProxy; IAnchorStateRegistry internal _anchorStateRegistryProxy;
AnchorStateRegistry internal _anchorStateRegistryImpl; IAnchorStateRegistry internal _anchorStateRegistryImpl;
FaultDisputeGame internal _faultDisputeGame; IFaultDisputeGame internal _faultDisputeGame;
PermissionedDisputeGame internal _permissionedDisputeGame; IPermissionedDisputeGame internal _permissionedDisputeGame;
DelayedWETH internal _delayedWETHPermissionedGameProxy; IDelayedWETH internal _delayedWETHPermissionedGameProxy;
DelayedWETH internal _delayedWETHPermissionlessGameProxy; IDelayedWETH internal _delayedWETHPermissionlessGameProxy;
function set(bytes4 _sel, address _addr) public { function set(bytes4 _sel, address _addr) public {
require(_addr != address(0), "DeployOPChainOutput: cannot set zero address"); require(_addr != address(0), "DeployOPChainOutput: cannot set zero address");
// forgefmt: disable-start // forgefmt: disable-start
if (_sel == this.opChainProxyAdmin.selector) _opChainProxyAdmin = ProxyAdmin(_addr) ; if (_sel == this.opChainProxyAdmin.selector) _opChainProxyAdmin = IProxyAdmin(_addr) ;
else if (_sel == this.addressManager.selector) _addressManager = AddressManager(_addr) ; else if (_sel == this.addressManager.selector) _addressManager = IAddressManager(_addr) ;
else if (_sel == this.l1ERC721BridgeProxy.selector) _l1ERC721BridgeProxy = L1ERC721Bridge(_addr) ; else if (_sel == this.l1ERC721BridgeProxy.selector) _l1ERC721BridgeProxy = IL1ERC721Bridge(_addr) ;
else if (_sel == this.systemConfigProxy.selector) _systemConfigProxy = SystemConfig(_addr) ; else if (_sel == this.systemConfigProxy.selector) _systemConfigProxy = ISystemConfig(_addr) ;
else if (_sel == this.optimismMintableERC20FactoryProxy.selector) _optimismMintableERC20FactoryProxy = OptimismMintableERC20Factory(_addr) ; else if (_sel == this.optimismMintableERC20FactoryProxy.selector) _optimismMintableERC20FactoryProxy = IOptimismMintableERC20Factory(_addr) ;
else if (_sel == this.l1StandardBridgeProxy.selector) _l1StandardBridgeProxy = L1StandardBridge(payable(_addr)) ; else if (_sel == this.l1StandardBridgeProxy.selector) _l1StandardBridgeProxy = IL1StandardBridge(payable(_addr)) ;
else if (_sel == this.l1CrossDomainMessengerProxy.selector) _l1CrossDomainMessengerProxy = L1CrossDomainMessenger(_addr) ; else if (_sel == this.l1CrossDomainMessengerProxy.selector) _l1CrossDomainMessengerProxy = IL1CrossDomainMessenger(_addr) ;
else if (_sel == this.optimismPortalProxy.selector) _optimismPortalProxy = OptimismPortal2(payable(_addr)) ; else if (_sel == this.optimismPortalProxy.selector) _optimismPortalProxy = IOptimismPortal2(payable(_addr)) ;
else if (_sel == this.disputeGameFactoryProxy.selector) _disputeGameFactoryProxy = DisputeGameFactory(_addr) ; else if (_sel == this.disputeGameFactoryProxy.selector) _disputeGameFactoryProxy = IDisputeGameFactory(_addr) ;
else if (_sel == this.anchorStateRegistryProxy.selector) _anchorStateRegistryProxy = AnchorStateRegistry(_addr) ; else if (_sel == this.anchorStateRegistryProxy.selector) _anchorStateRegistryProxy = IAnchorStateRegistry(_addr) ;
else if (_sel == this.anchorStateRegistryImpl.selector) _anchorStateRegistryImpl = AnchorStateRegistry(_addr) ; else if (_sel == this.anchorStateRegistryImpl.selector) _anchorStateRegistryImpl = IAnchorStateRegistry(_addr) ;
else if (_sel == this.faultDisputeGame.selector) _faultDisputeGame = FaultDisputeGame(_addr) ; else if (_sel == this.faultDisputeGame.selector) _faultDisputeGame = IFaultDisputeGame(_addr) ;
else if (_sel == this.permissionedDisputeGame.selector) _permissionedDisputeGame = PermissionedDisputeGame(_addr) ; else if (_sel == this.permissionedDisputeGame.selector) _permissionedDisputeGame = IPermissionedDisputeGame(_addr) ;
else if (_sel == this.delayedWETHPermissionedGameProxy.selector) _delayedWETHPermissionedGameProxy = DelayedWETH(payable(_addr)) ; else if (_sel == this.delayedWETHPermissionedGameProxy.selector) _delayedWETHPermissionedGameProxy = IDelayedWETH(payable(_addr)) ;
else if (_sel == this.delayedWETHPermissionlessGameProxy.selector) _delayedWETHPermissionlessGameProxy = DelayedWETH(payable(_addr)) ; else if (_sel == this.delayedWETHPermissionlessGameProxy.selector) _delayedWETHPermissionlessGameProxy = IDelayedWETH(payable(_addr)) ;
else revert("DeployOPChainOutput: unknown selector"); else revert("DeployOPChainOutput: unknown selector");
// forgefmt: disable-end // forgefmt: disable-end
} }
...@@ -233,77 +233,77 @@ contract DeployOPChainOutput is BaseDeployIO { ...@@ -233,77 +233,77 @@ contract DeployOPChainOutput is BaseDeployIO {
assertValidDeploy(_doi); assertValidDeploy(_doi);
} }
function opChainProxyAdmin() public view returns (ProxyAdmin) { function opChainProxyAdmin() public view returns (IProxyAdmin) {
DeployUtils.assertValidContractAddress(address(_opChainProxyAdmin)); DeployUtils.assertValidContractAddress(address(_opChainProxyAdmin));
return _opChainProxyAdmin; return _opChainProxyAdmin;
} }
function addressManager() public view returns (AddressManager) { function addressManager() public view returns (IAddressManager) {
DeployUtils.assertValidContractAddress(address(_addressManager)); DeployUtils.assertValidContractAddress(address(_addressManager));
return _addressManager; return _addressManager;
} }
function l1ERC721BridgeProxy() public view returns (L1ERC721Bridge) { function l1ERC721BridgeProxy() public view returns (IL1ERC721Bridge) {
DeployUtils.assertValidContractAddress(address(_l1ERC721BridgeProxy)); DeployUtils.assertValidContractAddress(address(_l1ERC721BridgeProxy));
return _l1ERC721BridgeProxy; return _l1ERC721BridgeProxy;
} }
function systemConfigProxy() public view returns (SystemConfig) { function systemConfigProxy() public view returns (ISystemConfig) {
DeployUtils.assertValidContractAddress(address(_systemConfigProxy)); DeployUtils.assertValidContractAddress(address(_systemConfigProxy));
return _systemConfigProxy; return _systemConfigProxy;
} }
function optimismMintableERC20FactoryProxy() public view returns (OptimismMintableERC20Factory) { function optimismMintableERC20FactoryProxy() public view returns (IOptimismMintableERC20Factory) {
DeployUtils.assertValidContractAddress(address(_optimismMintableERC20FactoryProxy)); DeployUtils.assertValidContractAddress(address(_optimismMintableERC20FactoryProxy));
return _optimismMintableERC20FactoryProxy; return _optimismMintableERC20FactoryProxy;
} }
function l1StandardBridgeProxy() public view returns (L1StandardBridge) { function l1StandardBridgeProxy() public view returns (IL1StandardBridge) {
DeployUtils.assertValidContractAddress(address(_l1StandardBridgeProxy)); DeployUtils.assertValidContractAddress(address(_l1StandardBridgeProxy));
return _l1StandardBridgeProxy; return _l1StandardBridgeProxy;
} }
function l1CrossDomainMessengerProxy() public view returns (L1CrossDomainMessenger) { function l1CrossDomainMessengerProxy() public view returns (IL1CrossDomainMessenger) {
DeployUtils.assertValidContractAddress(address(_l1CrossDomainMessengerProxy)); DeployUtils.assertValidContractAddress(address(_l1CrossDomainMessengerProxy));
return _l1CrossDomainMessengerProxy; return _l1CrossDomainMessengerProxy;
} }
function optimismPortalProxy() public view returns (OptimismPortal2) { function optimismPortalProxy() public view returns (IOptimismPortal2) {
DeployUtils.assertValidContractAddress(address(_optimismPortalProxy)); DeployUtils.assertValidContractAddress(address(_optimismPortalProxy));
return _optimismPortalProxy; return _optimismPortalProxy;
} }
function disputeGameFactoryProxy() public view returns (DisputeGameFactory) { function disputeGameFactoryProxy() public view returns (IDisputeGameFactory) {
DeployUtils.assertValidContractAddress(address(_disputeGameFactoryProxy)); DeployUtils.assertValidContractAddress(address(_disputeGameFactoryProxy));
return _disputeGameFactoryProxy; return _disputeGameFactoryProxy;
} }
function anchorStateRegistryProxy() public view returns (AnchorStateRegistry) { function anchorStateRegistryProxy() public view returns (IAnchorStateRegistry) {
DeployUtils.assertValidContractAddress(address(_anchorStateRegistryProxy)); DeployUtils.assertValidContractAddress(address(_anchorStateRegistryProxy));
return _anchorStateRegistryProxy; return _anchorStateRegistryProxy;
} }
function anchorStateRegistryImpl() public view returns (AnchorStateRegistry) { function anchorStateRegistryImpl() public view returns (IAnchorStateRegistry) {
DeployUtils.assertValidContractAddress(address(_anchorStateRegistryImpl)); DeployUtils.assertValidContractAddress(address(_anchorStateRegistryImpl));
return _anchorStateRegistryImpl; return _anchorStateRegistryImpl;
} }
function faultDisputeGame() public view returns (FaultDisputeGame) { function faultDisputeGame() public view returns (IFaultDisputeGame) {
DeployUtils.assertValidContractAddress(address(_faultDisputeGame)); DeployUtils.assertValidContractAddress(address(_faultDisputeGame));
return _faultDisputeGame; return _faultDisputeGame;
} }
function permissionedDisputeGame() public view returns (PermissionedDisputeGame) { function permissionedDisputeGame() public view returns (IPermissionedDisputeGame) {
DeployUtils.assertValidContractAddress(address(_permissionedDisputeGame)); DeployUtils.assertValidContractAddress(address(_permissionedDisputeGame));
return _permissionedDisputeGame; return _permissionedDisputeGame;
} }
function delayedWETHPermissionedGameProxy() public view returns (DelayedWETH) { function delayedWETHPermissionedGameProxy() public view returns (IDelayedWETH) {
DeployUtils.assertValidContractAddress(address(_delayedWETHPermissionedGameProxy)); DeployUtils.assertValidContractAddress(address(_delayedWETHPermissionedGameProxy));
return _delayedWETHPermissionedGameProxy; return _delayedWETHPermissionedGameProxy;
} }
function delayedWETHPermissionlessGameProxy() public view returns (DelayedWETH) { function delayedWETHPermissionlessGameProxy() public view returns (IDelayedWETH) {
// TODO: Eventually switch from Permissioned to Permissionless. Add this check back in. // TODO: Eventually switch from Permissioned to Permissionless. Add this check back in.
// DeployUtils.assertValidContractAddress(address(_delayedWETHPermissionlessGameProxy)); // DeployUtils.assertValidContractAddress(address(_delayedWETHPermissionlessGameProxy));
return _delayedWETHPermissionlessGameProxy; return _delayedWETHPermissionlessGameProxy;
...@@ -326,7 +326,7 @@ contract DeployOPChainOutput is BaseDeployIO { ...@@ -326,7 +326,7 @@ contract DeployOPChainOutput is BaseDeployIO {
} }
function assertValidPermissionedDisputeGame(DeployOPChainInput _doi) internal { function assertValidPermissionedDisputeGame(DeployOPChainInput _doi) internal {
PermissionedDisputeGame game = permissionedDisputeGame(); IPermissionedDisputeGame game = permissionedDisputeGame();
require(GameType.unwrap(game.gameType()) == GameType.unwrap(GameTypes.PERMISSIONED_CANNON), "DPG-10"); require(GameType.unwrap(game.gameType()) == GameType.unwrap(GameTypes.PERMISSIONED_CANNON), "DPG-10");
// This hex string is the absolutePrestate of the latest op-program release, see where the // This hex string is the absolutePrestate of the latest op-program release, see where the
...@@ -348,7 +348,7 @@ contract DeployOPChainOutput is BaseDeployIO { ...@@ -348,7 +348,7 @@ contract DeployOPChainOutput is BaseDeployIO {
function assertValidAnchorStateRegistryProxy(DeployOPChainInput) internal { function assertValidAnchorStateRegistryProxy(DeployOPChainInput) internal {
// First we check the proxy as itself. // First we check the proxy as itself.
Proxy proxy = Proxy(payable(address(anchorStateRegistryProxy()))); IProxy proxy = IProxy(payable(address(anchorStateRegistryProxy())));
vm.prank(address(0)); vm.prank(address(0));
address admin = proxy.admin(); address admin = proxy.admin();
require(admin == address(opChainProxyAdmin()), "ANCHORP-10"); require(admin == address(opChainProxyAdmin()), "ANCHORP-10");
...@@ -365,7 +365,7 @@ contract DeployOPChainOutput is BaseDeployIO { ...@@ -365,7 +365,7 @@ contract DeployOPChainOutput is BaseDeployIO {
} }
function assertValidAnchorStateRegistryImpl(DeployOPChainInput) internal view { function assertValidAnchorStateRegistryImpl(DeployOPChainInput) internal view {
AnchorStateRegistry registry = anchorStateRegistryImpl(); IAnchorStateRegistry registry = anchorStateRegistryImpl();
DeployUtils.assertInitialized({ _contractAddress: address(registry), _slot: 0, _offset: 0 }); DeployUtils.assertInitialized({ _contractAddress: address(registry), _slot: 0, _offset: 0 });
...@@ -373,7 +373,7 @@ contract DeployOPChainOutput is BaseDeployIO { ...@@ -373,7 +373,7 @@ contract DeployOPChainOutput is BaseDeployIO {
} }
function assertValidSystemConfig(DeployOPChainInput _doi) internal { function assertValidSystemConfig(DeployOPChainInput _doi) internal {
SystemConfig systemConfig = systemConfigProxy(); ISystemConfig systemConfig = systemConfigProxy();
DeployUtils.assertInitialized({ _contractAddress: address(systemConfig), _slot: 0, _offset: 0 }); DeployUtils.assertInitialized({ _contractAddress: address(systemConfig), _slot: 0, _offset: 0 });
...@@ -412,7 +412,7 @@ contract DeployOPChainOutput is BaseDeployIO { ...@@ -412,7 +412,7 @@ contract DeployOPChainOutput is BaseDeployIO {
} }
function assertValidL1CrossDomainMessenger(DeployOPChainInput _doi) internal { function assertValidL1CrossDomainMessenger(DeployOPChainInput _doi) internal {
L1CrossDomainMessenger messenger = l1CrossDomainMessengerProxy(); IL1CrossDomainMessenger messenger = l1CrossDomainMessengerProxy();
DeployUtils.assertInitialized({ _contractAddress: address(messenger), _slot: 0, _offset: 20 }); DeployUtils.assertInitialized({ _contractAddress: address(messenger), _slot: 0, _offset: 20 });
...@@ -428,8 +428,8 @@ contract DeployOPChainOutput is BaseDeployIO { ...@@ -428,8 +428,8 @@ contract DeployOPChainOutput is BaseDeployIO {
} }
function assertValidL1StandardBridge(DeployOPChainInput _doi) internal { function assertValidL1StandardBridge(DeployOPChainInput _doi) internal {
L1StandardBridge bridge = l1StandardBridgeProxy(); IL1StandardBridge bridge = l1StandardBridgeProxy();
L1CrossDomainMessenger messenger = l1CrossDomainMessengerProxy(); IL1CrossDomainMessenger messenger = l1CrossDomainMessengerProxy();
DeployUtils.assertInitialized({ _contractAddress: address(bridge), _slot: 0, _offset: 0 }); DeployUtils.assertInitialized({ _contractAddress: address(bridge), _slot: 0, _offset: 0 });
...@@ -441,7 +441,7 @@ contract DeployOPChainOutput is BaseDeployIO { ...@@ -441,7 +441,7 @@ contract DeployOPChainOutput is BaseDeployIO {
} }
function assertValidOptimismMintableERC20Factory(DeployOPChainInput) internal view { function assertValidOptimismMintableERC20Factory(DeployOPChainInput) internal view {
OptimismMintableERC20Factory factory = optimismMintableERC20FactoryProxy(); IOptimismMintableERC20Factory factory = optimismMintableERC20FactoryProxy();
DeployUtils.assertInitialized({ _contractAddress: address(factory), _slot: 0, _offset: 0 }); DeployUtils.assertInitialized({ _contractAddress: address(factory), _slot: 0, _offset: 0 });
...@@ -450,7 +450,7 @@ contract DeployOPChainOutput is BaseDeployIO { ...@@ -450,7 +450,7 @@ contract DeployOPChainOutput is BaseDeployIO {
} }
function assertValidL1ERC721Bridge(DeployOPChainInput _doi) internal { function assertValidL1ERC721Bridge(DeployOPChainInput _doi) internal {
L1ERC721Bridge bridge = l1ERC721BridgeProxy(); IL1ERC721Bridge bridge = l1ERC721BridgeProxy();
DeployUtils.assertInitialized({ _contractAddress: address(bridge), _slot: 0, _offset: 0 }); DeployUtils.assertInitialized({ _contractAddress: address(bridge), _slot: 0, _offset: 0 });
...@@ -463,7 +463,7 @@ contract DeployOPChainOutput is BaseDeployIO { ...@@ -463,7 +463,7 @@ contract DeployOPChainOutput is BaseDeployIO {
} }
function assertValidOptimismPortal(DeployOPChainInput _doi) internal { function assertValidOptimismPortal(DeployOPChainInput _doi) internal {
OptimismPortal2 portal = optimismPortalProxy(); IOptimismPortal2 portal = optimismPortalProxy();
ISuperchainConfig superchainConfig = ISuperchainConfig(address(_doi.opcmProxy().superchainConfig())); ISuperchainConfig superchainConfig = ISuperchainConfig(address(_doi.opcmProxy().superchainConfig()));
require(address(portal.disputeGameFactory()) == address(disputeGameFactoryProxy()), "PORTAL-10"); require(address(portal.disputeGameFactory()) == address(disputeGameFactoryProxy()), "PORTAL-10");
...@@ -479,7 +479,7 @@ contract DeployOPChainOutput is BaseDeployIO { ...@@ -479,7 +479,7 @@ contract DeployOPChainOutput is BaseDeployIO {
} }
function assertValidDisputeGameFactory(DeployOPChainInput _doi) internal view { function assertValidDisputeGameFactory(DeployOPChainInput _doi) internal view {
DisputeGameFactory factory = disputeGameFactoryProxy(); IDisputeGameFactory factory = disputeGameFactoryProxy();
DeployUtils.assertInitialized({ _contractAddress: address(factory), _slot: 0, _offset: 0 }); DeployUtils.assertInitialized({ _contractAddress: address(factory), _slot: 0, _offset: 0 });
...@@ -490,11 +490,11 @@ contract DeployOPChainOutput is BaseDeployIO { ...@@ -490,11 +490,11 @@ contract DeployOPChainOutput is BaseDeployIO {
} }
function assertValidDelayedWETH(DeployOPChainInput _doi) internal { function assertValidDelayedWETH(DeployOPChainInput _doi) internal {
DelayedWETH permissioned = delayedWETHPermissionedGameProxy(); IDelayedWETH permissioned = delayedWETHPermissionedGameProxy();
require(permissioned.owner() == address(_doi.opChainProxyAdminOwner()), "DWETH-10"); require(permissioned.owner() == address(_doi.opChainProxyAdminOwner()), "DWETH-10");
Proxy proxy = Proxy(payable(address(permissioned))); IProxy proxy = IProxy(payable(address(permissioned)));
vm.prank(address(0)); vm.prank(address(0));
address admin = proxy.admin(); address admin = proxy.admin();
require(admin == address(opChainProxyAdmin()), "DWETH-20"); require(admin == address(opChainProxyAdmin()), "DWETH-20");
......
...@@ -4,10 +4,10 @@ pragma solidity 0.8.15; ...@@ -4,10 +4,10 @@ pragma solidity 0.8.15;
import { Script } from "forge-std/Script.sol"; import { Script } from "forge-std/Script.sol";
import { stdToml } from "forge-std/StdToml.sol"; import { stdToml } from "forge-std/StdToml.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol"; import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { ProtocolVersions, ProtocolVersion } from "src/L1/ProtocolVersions.sol"; import { IProtocolVersions, ProtocolVersion } from "src/L1/interfaces/IProtocolVersions.sol";
import { ProxyAdmin } from "src/universal/ProxyAdmin.sol"; import { IProxyAdmin } from "src/universal/interfaces/IProxyAdmin.sol";
import { Proxy } from "src/universal/Proxy.sol"; import { IProxy } from "src/universal/interfaces/IProxy.sol";
import { DeployUtils } from "scripts/libraries/DeployUtils.sol"; import { DeployUtils } from "scripts/libraries/DeployUtils.sol";
import { Solarray } from "scripts/libraries/Solarray.sol"; import { Solarray } from "scripts/libraries/Solarray.sol";
...@@ -156,21 +156,21 @@ contract DeploySuperchainInput is BaseDeployIO { ...@@ -156,21 +156,21 @@ contract DeploySuperchainInput is BaseDeployIO {
contract DeploySuperchainOutput is BaseDeployIO { contract DeploySuperchainOutput is BaseDeployIO {
// All outputs are stored in storage individually, with the same rationale as doing so for // All outputs are stored in storage individually, with the same rationale as doing so for
// inputs, and the same pattern is used below to expose the outputs. // inputs, and the same pattern is used below to expose the outputs.
ProtocolVersions internal _protocolVersionsImpl; IProtocolVersions internal _protocolVersionsImpl;
ProtocolVersions internal _protocolVersionsProxy; IProtocolVersions internal _protocolVersionsProxy;
SuperchainConfig internal _superchainConfigImpl; ISuperchainConfig internal _superchainConfigImpl;
SuperchainConfig internal _superchainConfigProxy; ISuperchainConfig internal _superchainConfigProxy;
ProxyAdmin internal _superchainProxyAdmin; IProxyAdmin internal _superchainProxyAdmin;
// This method lets each field be set individually. The selector of an output's getter method // This method lets each field be set individually. The selector of an output's getter method
// is used to determine which field to set. // is used to determine which field to set.
function set(bytes4 _sel, address _address) public { function set(bytes4 _sel, address _address) public {
require(_address != address(0), "DeploySuperchainOutput: cannot set zero address"); require(_address != address(0), "DeploySuperchainOutput: cannot set zero address");
if (_sel == this.superchainProxyAdmin.selector) _superchainProxyAdmin = ProxyAdmin(_address); if (_sel == this.superchainProxyAdmin.selector) _superchainProxyAdmin = IProxyAdmin(_address);
else if (_sel == this.superchainConfigImpl.selector) _superchainConfigImpl = SuperchainConfig(_address); else if (_sel == this.superchainConfigImpl.selector) _superchainConfigImpl = ISuperchainConfig(_address);
else if (_sel == this.superchainConfigProxy.selector) _superchainConfigProxy = SuperchainConfig(_address); else if (_sel == this.superchainConfigProxy.selector) _superchainConfigProxy = ISuperchainConfig(_address);
else if (_sel == this.protocolVersionsImpl.selector) _protocolVersionsImpl = ProtocolVersions(_address); else if (_sel == this.protocolVersionsImpl.selector) _protocolVersionsImpl = IProtocolVersions(_address);
else if (_sel == this.protocolVersionsProxy.selector) _protocolVersionsProxy = ProtocolVersions(_address); else if (_sel == this.protocolVersionsProxy.selector) _protocolVersionsProxy = IProtocolVersions(_address);
else revert("DeploySuperchainOutput: unknown selector"); else revert("DeploySuperchainOutput: unknown selector");
} }
...@@ -188,8 +188,8 @@ contract DeploySuperchainOutput is BaseDeployIO { ...@@ -188,8 +188,8 @@ contract DeploySuperchainOutput is BaseDeployIO {
// To read the implementations we prank as the zero address due to the proxyCallIfNotAdmin modifier. // To read the implementations we prank as the zero address due to the proxyCallIfNotAdmin modifier.
vm.startPrank(address(0)); vm.startPrank(address(0));
address actualSuperchainConfigImpl = Proxy(payable(address(_superchainConfigProxy))).implementation(); address actualSuperchainConfigImpl = IProxy(payable(address(_superchainConfigProxy))).implementation();
address actualProtocolVersionsImpl = Proxy(payable(address(_protocolVersionsProxy))).implementation(); address actualProtocolVersionsImpl = IProxy(payable(address(_protocolVersionsProxy))).implementation();
vm.stopPrank(); vm.stopPrank();
require(actualSuperchainConfigImpl == address(_superchainConfigImpl), "100"); require(actualSuperchainConfigImpl == address(_superchainConfigImpl), "100");
...@@ -198,27 +198,27 @@ contract DeploySuperchainOutput is BaseDeployIO { ...@@ -198,27 +198,27 @@ contract DeploySuperchainOutput is BaseDeployIO {
assertValidDeploy(_dsi); assertValidDeploy(_dsi);
} }
function superchainProxyAdmin() public view returns (ProxyAdmin) { function superchainProxyAdmin() public view returns (IProxyAdmin) {
// This does not have to be a contract address, it could be an EOA. // This does not have to be a contract address, it could be an EOA.
return _superchainProxyAdmin; return _superchainProxyAdmin;
} }
function superchainConfigImpl() public view returns (SuperchainConfig) { function superchainConfigImpl() public view returns (ISuperchainConfig) {
DeployUtils.assertValidContractAddress(address(_superchainConfigImpl)); DeployUtils.assertValidContractAddress(address(_superchainConfigImpl));
return _superchainConfigImpl; return _superchainConfigImpl;
} }
function superchainConfigProxy() public view returns (SuperchainConfig) { function superchainConfigProxy() public view returns (ISuperchainConfig) {
DeployUtils.assertValidContractAddress(address(_superchainConfigProxy)); DeployUtils.assertValidContractAddress(address(_superchainConfigProxy));
return _superchainConfigProxy; return _superchainConfigProxy;
} }
function protocolVersionsImpl() public view returns (ProtocolVersions) { function protocolVersionsImpl() public view returns (IProtocolVersions) {
DeployUtils.assertValidContractAddress(address(_protocolVersionsImpl)); DeployUtils.assertValidContractAddress(address(_protocolVersionsImpl));
return _protocolVersionsImpl; return _protocolVersionsImpl;
} }
function protocolVersionsProxy() public view returns (ProtocolVersions) { function protocolVersionsProxy() public view returns (IProtocolVersions) {
DeployUtils.assertValidContractAddress(address(_protocolVersionsProxy)); DeployUtils.assertValidContractAddress(address(_protocolVersionsProxy));
return _protocolVersionsProxy; return _protocolVersionsProxy;
} }
...@@ -236,16 +236,16 @@ contract DeploySuperchainOutput is BaseDeployIO { ...@@ -236,16 +236,16 @@ contract DeploySuperchainOutput is BaseDeployIO {
function assertValidSuperchainConfig(DeploySuperchainInput _dsi) internal { function assertValidSuperchainConfig(DeploySuperchainInput _dsi) internal {
// Proxy checks. // Proxy checks.
SuperchainConfig superchainConfig = superchainConfigProxy(); ISuperchainConfig superchainConfig = superchainConfigProxy();
DeployUtils.assertInitialized({ _contractAddress: address(superchainConfig), _slot: 0, _offset: 0 }); DeployUtils.assertInitialized({ _contractAddress: address(superchainConfig), _slot: 0, _offset: 0 });
require(superchainConfig.guardian() == _dsi.guardian(), "SUPCON-10"); require(superchainConfig.guardian() == _dsi.guardian(), "SUPCON-10");
require(superchainConfig.paused() == _dsi.paused(), "SUPCON-20"); require(superchainConfig.paused() == _dsi.paused(), "SUPCON-20");
vm.startPrank(address(0)); vm.startPrank(address(0));
require( require(
Proxy(payable(address(superchainConfig))).implementation() == address(superchainConfigImpl()), "SUPCON-30" IProxy(payable(address(superchainConfig))).implementation() == address(superchainConfigImpl()), "SUPCON-30"
); );
require(Proxy(payable(address(superchainConfig))).admin() == address(superchainProxyAdmin()), "SUPCON-40"); require(IProxy(payable(address(superchainConfig))).admin() == address(superchainProxyAdmin()), "SUPCON-40");
vm.stopPrank(); vm.stopPrank();
// Implementation checks // Implementation checks
...@@ -256,7 +256,7 @@ contract DeploySuperchainOutput is BaseDeployIO { ...@@ -256,7 +256,7 @@ contract DeploySuperchainOutput is BaseDeployIO {
function assertValidProtocolVersions(DeploySuperchainInput _dsi) internal { function assertValidProtocolVersions(DeploySuperchainInput _dsi) internal {
// Proxy checks. // Proxy checks.
ProtocolVersions pv = protocolVersionsProxy(); IProtocolVersions pv = protocolVersionsProxy();
DeployUtils.assertInitialized({ _contractAddress: address(pv), _slot: 0, _offset: 0 }); DeployUtils.assertInitialized({ _contractAddress: address(pv), _slot: 0, _offset: 0 });
require(pv.owner() == _dsi.protocolVersionsOwner(), "PV-10"); require(pv.owner() == _dsi.protocolVersionsOwner(), "PV-10");
require( require(
...@@ -268,8 +268,8 @@ contract DeploySuperchainOutput is BaseDeployIO { ...@@ -268,8 +268,8 @@ contract DeploySuperchainOutput is BaseDeployIO {
); );
vm.startPrank(address(0)); vm.startPrank(address(0));
require(Proxy(payable(address(pv))).implementation() == address(protocolVersionsImpl()), "PV-40"); require(IProxy(payable(address(pv))).implementation() == address(protocolVersionsImpl()), "PV-40");
require(Proxy(payable(address(pv))).admin() == address(superchainProxyAdmin()), "PV-50"); require(IProxy(payable(address(pv))).admin() == address(superchainProxyAdmin()), "PV-50");
vm.stopPrank(); vm.stopPrank();
// Implementation checks. // Implementation checks.
...@@ -320,7 +320,12 @@ contract DeploySuperchain is Script { ...@@ -320,7 +320,12 @@ contract DeploySuperchain is Script {
// contract. If we provide no argument, the foundry default sender would be the broadcaster during test, but the // contract. If we provide no argument, the foundry default sender would be the broadcaster during test, but the
// broadcaster needs to be the deployer since they are set to the initial proxy admin owner. // broadcaster needs to be the deployer since they are set to the initial proxy admin owner.
vm.broadcast(msg.sender); vm.broadcast(msg.sender);
ProxyAdmin superchainProxyAdmin = new ProxyAdmin(msg.sender); IProxyAdmin superchainProxyAdmin = IProxyAdmin(
DeployUtils.create1({
_name: "ProxyAdmin",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IProxyAdmin.__constructor__, (msg.sender)))
})
);
vm.label(address(superchainProxyAdmin), "SuperchainProxyAdmin"); vm.label(address(superchainProxyAdmin), "SuperchainProxyAdmin");
_dso.set(_dso.superchainProxyAdmin.selector, address(superchainProxyAdmin)); _dso.set(_dso.superchainProxyAdmin.selector, address(superchainProxyAdmin));
...@@ -329,8 +334,18 @@ contract DeploySuperchain is Script { ...@@ -329,8 +334,18 @@ contract DeploySuperchain is Script {
function deploySuperchainImplementationContracts(DeploySuperchainInput, DeploySuperchainOutput _dso) public { function deploySuperchainImplementationContracts(DeploySuperchainInput, DeploySuperchainOutput _dso) public {
// Deploy implementation contracts. // Deploy implementation contracts.
vm.startBroadcast(msg.sender); vm.startBroadcast(msg.sender);
SuperchainConfig superchainConfigImpl = new SuperchainConfig(); ISuperchainConfig superchainConfigImpl = ISuperchainConfig(
ProtocolVersions protocolVersionsImpl = new ProtocolVersions(); DeployUtils.create1({
_name: "SuperchainConfig",
_args: DeployUtils.encodeConstructor(abi.encodeCall(ISuperchainConfig.__constructor__, ()))
})
);
IProtocolVersions protocolVersionsImpl = IProtocolVersions(
DeployUtils.create1({
_name: "ProtocolVersions",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IProtocolVersions.__constructor__, ()))
})
);
vm.stopBroadcast(); vm.stopBroadcast();
vm.label(address(superchainConfigImpl), "SuperchainConfigImpl"); vm.label(address(superchainConfigImpl), "SuperchainConfigImpl");
...@@ -344,15 +359,22 @@ contract DeploySuperchain is Script { ...@@ -344,15 +359,22 @@ contract DeploySuperchain is Script {
address guardian = _dsi.guardian(); address guardian = _dsi.guardian();
bool paused = _dsi.paused(); bool paused = _dsi.paused();
ProxyAdmin superchainProxyAdmin = _dso.superchainProxyAdmin(); IProxyAdmin superchainProxyAdmin = _dso.superchainProxyAdmin();
SuperchainConfig superchainConfigImpl = _dso.superchainConfigImpl(); ISuperchainConfig superchainConfigImpl = _dso.superchainConfigImpl();
vm.startBroadcast(msg.sender); vm.startBroadcast(msg.sender);
SuperchainConfig superchainConfigProxy = SuperchainConfig(address(new Proxy(address(superchainProxyAdmin)))); ISuperchainConfig superchainConfigProxy = ISuperchainConfig(
DeployUtils.create1({
_name: "Proxy",
_args: DeployUtils.encodeConstructor(
abi.encodeCall(IProxy.__constructor__, (address(superchainProxyAdmin)))
)
})
);
superchainProxyAdmin.upgradeAndCall( superchainProxyAdmin.upgradeAndCall(
payable(address(superchainConfigProxy)), payable(address(superchainConfigProxy)),
address(superchainConfigImpl), address(superchainConfigImpl),
abi.encodeCall(SuperchainConfig.initialize, (guardian, paused)) abi.encodeCall(ISuperchainConfig.initialize, (guardian, paused))
); );
vm.stopBroadcast(); vm.stopBroadcast();
...@@ -365,16 +387,23 @@ contract DeploySuperchain is Script { ...@@ -365,16 +387,23 @@ contract DeploySuperchain is Script {
ProtocolVersion requiredProtocolVersion = _dsi.requiredProtocolVersion(); ProtocolVersion requiredProtocolVersion = _dsi.requiredProtocolVersion();
ProtocolVersion recommendedProtocolVersion = _dsi.recommendedProtocolVersion(); ProtocolVersion recommendedProtocolVersion = _dsi.recommendedProtocolVersion();
ProxyAdmin superchainProxyAdmin = _dso.superchainProxyAdmin(); IProxyAdmin superchainProxyAdmin = _dso.superchainProxyAdmin();
ProtocolVersions protocolVersionsImpl = _dso.protocolVersionsImpl(); IProtocolVersions protocolVersionsImpl = _dso.protocolVersionsImpl();
vm.startBroadcast(msg.sender); vm.startBroadcast(msg.sender);
ProtocolVersions protocolVersionsProxy = ProtocolVersions(address(new Proxy(address(superchainProxyAdmin)))); IProtocolVersions protocolVersionsProxy = IProtocolVersions(
DeployUtils.create1({
_name: "Proxy",
_args: DeployUtils.encodeConstructor(
abi.encodeCall(IProxy.__constructor__, (address(superchainProxyAdmin)))
)
})
);
superchainProxyAdmin.upgradeAndCall( superchainProxyAdmin.upgradeAndCall(
payable(address(protocolVersionsProxy)), payable(address(protocolVersionsProxy)),
address(protocolVersionsImpl), address(protocolVersionsImpl),
abi.encodeCall( abi.encodeCall(
ProtocolVersions.initialize, IProtocolVersions.initialize,
(protocolVersionsOwner, requiredProtocolVersion, recommendedProtocolVersion) (protocolVersionsOwner, requiredProtocolVersion, recommendedProtocolVersion)
) )
); );
...@@ -387,7 +416,7 @@ contract DeploySuperchain is Script { ...@@ -387,7 +416,7 @@ contract DeploySuperchain is Script {
function transferProxyAdminOwnership(DeploySuperchainInput _dsi, DeploySuperchainOutput _dso) public { function transferProxyAdminOwnership(DeploySuperchainInput _dsi, DeploySuperchainOutput _dso) public {
address superchainProxyAdminOwner = _dsi.superchainProxyAdminOwner(); address superchainProxyAdminOwner = _dsi.superchainProxyAdminOwner();
ProxyAdmin superchainProxyAdmin = _dso.superchainProxyAdmin(); IProxyAdmin superchainProxyAdmin = _dso.superchainProxyAdmin();
DeployUtils.assertValidContractAddress(address(superchainProxyAdmin)); DeployUtils.assertValidContractAddress(address(superchainProxyAdmin));
vm.broadcast(msg.sender); vm.broadcast(msg.sender);
......
...@@ -73,6 +73,7 @@ EXCLUDE_CONTRACTS=( ...@@ -73,6 +73,7 @@ EXCLUDE_CONTRACTS=(
"IDelayedWETH" "IDelayedWETH"
"IL2ToL2CrossDomainMessenger" "IL2ToL2CrossDomainMessenger"
"ICrossL2Inbox" "ICrossL2Inbox"
"ISystemConfigInterop"
# Solidity complains about receive but contract doens't have it. # Solidity complains about receive but contract doens't have it.
"IResolvedDelegateProxy" "IResolvedDelegateProxy"
......
...@@ -15,7 +15,6 @@ import { Chains } from "scripts/libraries/Chains.sol"; ...@@ -15,7 +15,6 @@ import { Chains } from "scripts/libraries/Chains.sol";
import { Config } from "scripts/libraries/Config.sol"; import { Config } from "scripts/libraries/Config.sol";
import { LibStateDiff } from "scripts/libraries/LibStateDiff.sol"; import { LibStateDiff } from "scripts/libraries/LibStateDiff.sol";
import { Process } from "scripts/libraries/Process.sol"; import { Process } from "scripts/libraries/Process.sol";
import { ForgeArtifacts } from "scripts/libraries/ForgeArtifacts.sol";
import { ChainAssertions } from "scripts/deploy/ChainAssertions.sol"; import { ChainAssertions } from "scripts/deploy/ChainAssertions.sol";
import { DeployUtils } from "scripts/libraries/DeployUtils.sol"; import { DeployUtils } from "scripts/libraries/DeployUtils.sol";
...@@ -25,9 +24,8 @@ import { StorageSetter } from "src/universal/StorageSetter.sol"; ...@@ -25,9 +24,8 @@ import { StorageSetter } from "src/universal/StorageSetter.sol";
// Libraries // Libraries
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
import { Predeploys } from "src/libraries/Predeploys.sol";
import { Types } from "scripts/libraries/Types.sol"; import { Types } from "scripts/libraries/Types.sol";
import { LibClaim, Duration } from "src/dispute/lib/LibUDT.sol"; import { Duration } from "src/dispute/lib/LibUDT.sol";
import "src/dispute/lib/Types.sol"; import "src/dispute/lib/Types.sol";
// Interfaces // Interfaces
...@@ -53,7 +51,6 @@ import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol" ...@@ -53,7 +51,6 @@ import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol"
import { IPermissionedDisputeGame } from "src/dispute/interfaces/IPermissionedDisputeGame.sol"; import { IPermissionedDisputeGame } from "src/dispute/interfaces/IPermissionedDisputeGame.sol";
import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol"; import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol";
import { IAnchorStateRegistry } from "src/dispute/interfaces/IAnchorStateRegistry.sol"; import { IAnchorStateRegistry } from "src/dispute/interfaces/IAnchorStateRegistry.sol";
import { IMIPS } from "src/cannon/interfaces/IMIPS.sol";
import { IMIPS2 } from "src/cannon/interfaces/IMIPS2.sol"; import { IMIPS2 } from "src/cannon/interfaces/IMIPS2.sol";
import { IPreimageOracle } from "src/cannon/interfaces/IPreimageOracle.sol"; import { IPreimageOracle } from "src/cannon/interfaces/IPreimageOracle.sol";
import { IOptimismMintableERC20Factory } from "src/universal/interfaces/IOptimismMintableERC20Factory.sol"; import { IOptimismMintableERC20Factory } from "src/universal/interfaces/IOptimismMintableERC20Factory.sol";
......
...@@ -10,7 +10,7 @@ import "src/dispute/lib/Types.sol"; ...@@ -10,7 +10,7 @@ import "src/dispute/lib/Types.sol";
// Interfaces // Interfaces
import { IProxy } from "src/universal/interfaces/IProxy.sol"; import { IProxy } from "src/universal/interfaces/IProxy.sol";
import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol"; import { IMIPS } from "src/cannon/interfaces/IMIPS.sol";
import { IAnchorStateRegistry } from "src/dispute/interfaces/IAnchorStateRegistry.sol"; import { IAnchorStateRegistry } from "src/dispute/interfaces/IAnchorStateRegistry.sol";
import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol"; import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol";
import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol"; import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol";
......
...@@ -10,7 +10,7 @@ import "src/dispute/lib/Types.sol"; ...@@ -10,7 +10,7 @@ import "src/dispute/lib/Types.sol";
// Interfaces // Interfaces
import { IProxy } from "src/universal/interfaces/IProxy.sol"; import { IProxy } from "src/universal/interfaces/IProxy.sol";
import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol"; import { IMIPS } from "src/cannon/interfaces/IMIPS.sol";
import { IAnchorStateRegistry } from "src/dispute/interfaces/IAnchorStateRegistry.sol"; import { IAnchorStateRegistry } from "src/dispute/interfaces/IAnchorStateRegistry.sol";
import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol"; import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol";
import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol"; import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol";
......
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
"sourceCodeHash": "0xde4df0f9633dc0cdb1c9f634003ea5b0f7c5c1aebc407bc1b2f44c0ecf938649" "sourceCodeHash": "0xde4df0f9633dc0cdb1c9f634003ea5b0f7c5c1aebc407bc1b2f44c0ecf938649"
}, },
"src/L1/OPContractsManager.sol": { "src/L1/OPContractsManager.sol": {
"initCodeHash": "0xfaab186a660764265a837fac689a6d8602454c6ca9f39b5244282768b8d86b3a", "initCodeHash": "0x44fa611dcacad2f61c8ca7ef970e580800b5070d10f9a2a4c04459d6cf4cd180",
"sourceCodeHash": "0x831b7268e1beb93050dbaae1e83e17635385bd101779146a95150084f69d2835" "sourceCodeHash": "0xe66886dd90cef90525f5ba2310c9e9d2d910c81c283f9b7cbfcd57c5091473c6"
}, },
"src/L1/OptimismPortal.sol": { "src/L1/OptimismPortal.sol": {
"initCodeHash": "0xbe2c0c81b3459014f287d8c89cdc0d27dde5d1f44e5d024fa1e4773ddc47c190", "initCodeHash": "0xbe2c0c81b3459014f287d8c89cdc0d27dde5d1f44e5d024fa1e4773ddc47c190",
......
...@@ -184,7 +184,7 @@ ...@@ -184,7 +184,7 @@
{ {
"components": [ "components": [
{ {
"internalType": "contract ProxyAdmin", "internalType": "contract IProxyAdmin",
"name": "opChainProxyAdmin", "name": "opChainProxyAdmin",
"type": "address" "type": "address"
}, },
...@@ -204,7 +204,7 @@ ...@@ -204,7 +204,7 @@
"type": "address" "type": "address"
}, },
{ {
"internalType": "contract OptimismMintableERC20Factory", "internalType": "contract IOptimismMintableERC20Factory",
"name": "optimismMintableERC20FactoryProxy", "name": "optimismMintableERC20FactoryProxy",
"type": "address" "type": "address"
}, },
......
...@@ -184,7 +184,7 @@ ...@@ -184,7 +184,7 @@
{ {
"components": [ "components": [
{ {
"internalType": "contract ProxyAdmin", "internalType": "contract IProxyAdmin",
"name": "opChainProxyAdmin", "name": "opChainProxyAdmin",
"type": "address" "type": "address"
}, },
...@@ -204,7 +204,7 @@ ...@@ -204,7 +204,7 @@
"type": "address" "type": "address"
}, },
{ {
"internalType": "contract OptimismMintableERC20Factory", "internalType": "contract IOptimismMintableERC20Factory",
"name": "optimismMintableERC20FactoryProxy", "name": "optimismMintableERC20FactoryProxy",
"type": "address" "type": "address"
}, },
......
...@@ -15,10 +15,7 @@ import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol"; ...@@ -15,10 +15,7 @@ import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol";
import { ISystemConfigV160 } from "src/L1/interfaces/ISystemConfigV160.sol"; import { ISystemConfigV160 } from "src/L1/interfaces/ISystemConfigV160.sol";
import { IAddressManager } from "src/legacy/interfaces/IAddressManager.sol"; import { IAddressManager } from "src/legacy/interfaces/IAddressManager.sol";
import { ProxyAdmin } from "src/universal/ProxyAdmin.sol"; import { IProxyAdmin } from "src/universal/interfaces/IProxyAdmin.sol";
import { L1ChugSplashProxy } from "src/legacy/L1ChugSplashProxy.sol";
import { ResolvedDelegateProxy } from "src/legacy/ResolvedDelegateProxy.sol";
import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol"; import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol";
import { IDisputeGameFactory } from "src/dispute/interfaces/IDisputeGameFactory.sol"; import { IDisputeGameFactory } from "src/dispute/interfaces/IDisputeGameFactory.sol";
...@@ -35,7 +32,7 @@ import { ISystemConfigV160 } from "src/L1/interfaces/ISystemConfigV160.sol"; ...@@ -35,7 +32,7 @@ import { ISystemConfigV160 } from "src/L1/interfaces/ISystemConfigV160.sol";
import { IL1CrossDomainMessenger } from "src/L1/interfaces/IL1CrossDomainMessenger.sol"; import { IL1CrossDomainMessenger } from "src/L1/interfaces/IL1CrossDomainMessenger.sol";
import { IL1ERC721Bridge } from "src/L1/interfaces/IL1ERC721Bridge.sol"; import { IL1ERC721Bridge } from "src/L1/interfaces/IL1ERC721Bridge.sol";
import { IL1StandardBridge } from "src/L1/interfaces/IL1StandardBridge.sol"; import { IL1StandardBridge } from "src/L1/interfaces/IL1StandardBridge.sol";
import { OptimismMintableERC20Factory } from "src/universal/OptimismMintableERC20Factory.sol"; import { IOptimismMintableERC20Factory } from "src/universal/interfaces/IOptimismMintableERC20Factory.sol";
/// @custom:proxied true /// @custom:proxied true
contract OPContractsManager is ISemver, Initializable { contract OPContractsManager is ISemver, Initializable {
...@@ -67,11 +64,11 @@ contract OPContractsManager is ISemver, Initializable { ...@@ -67,11 +64,11 @@ contract OPContractsManager is ISemver, Initializable {
/// @notice The full set of outputs from deploying a new OP Stack chain. /// @notice The full set of outputs from deploying a new OP Stack chain.
struct DeployOutput { struct DeployOutput {
ProxyAdmin opChainProxyAdmin; IProxyAdmin opChainProxyAdmin;
IAddressManager addressManager; IAddressManager addressManager;
IL1ERC721Bridge l1ERC721BridgeProxy; IL1ERC721Bridge l1ERC721BridgeProxy;
ISystemConfig systemConfigProxy; ISystemConfig systemConfigProxy;
OptimismMintableERC20Factory optimismMintableERC20FactoryProxy; IOptimismMintableERC20Factory optimismMintableERC20FactoryProxy;
IL1StandardBridge l1StandardBridgeProxy; IL1StandardBridge l1StandardBridgeProxy;
IL1CrossDomainMessenger l1CrossDomainMessengerProxy; IL1CrossDomainMessenger l1CrossDomainMessengerProxy;
// Fault proof contracts below. // Fault proof contracts below.
...@@ -125,8 +122,8 @@ contract OPContractsManager is ISemver, Initializable { ...@@ -125,8 +122,8 @@ contract OPContractsManager is ISemver, Initializable {
// -------- Constants and Variables -------- // -------- Constants and Variables --------
/// @custom:semver 1.0.0-beta.18 /// @custom:semver 1.0.0-beta.19
string public constant version = "1.0.0-beta.18"; string public constant version = "1.0.0-beta.19";
/// @notice Represents the interface version so consumers know how to decode the DeployOutput struct /// @notice Represents the interface version so consumers know how to decode the DeployOutput struct
/// that's emitted in the `Deployed` event. Whenever that struct changes, a new version should be used. /// that's emitted in the `Deployed` event. Whenever that struct changes, a new version should be used.
...@@ -237,7 +234,7 @@ contract OPContractsManager is ISemver, Initializable { ...@@ -237,7 +234,7 @@ contract OPContractsManager is ISemver, Initializable {
// due to it's usage of the legacy ResolvedDelegateProxy. // due to it's usage of the legacy ResolvedDelegateProxy.
output.addressManager = IAddressManager(Blueprint.deployFrom(blueprint.addressManager, salt)); output.addressManager = IAddressManager(Blueprint.deployFrom(blueprint.addressManager, salt));
output.opChainProxyAdmin = output.opChainProxyAdmin =
ProxyAdmin(Blueprint.deployFrom(blueprint.proxyAdmin, salt, abi.encode(address(this)))); IProxyAdmin(Blueprint.deployFrom(blueprint.proxyAdmin, salt, abi.encode(address(this))));
output.opChainProxyAdmin.setAddressManager(output.addressManager); output.opChainProxyAdmin.setAddressManager(output.addressManager);
// -------- Deploy Proxy Contracts -------- // -------- Deploy Proxy Contracts --------
...@@ -249,7 +246,7 @@ contract OPContractsManager is ISemver, Initializable { ...@@ -249,7 +246,7 @@ contract OPContractsManager is ISemver, Initializable {
IOptimismPortal2(payable(deployProxy(l2ChainId, output.opChainProxyAdmin, saltMixer, "OptimismPortal"))); IOptimismPortal2(payable(deployProxy(l2ChainId, output.opChainProxyAdmin, saltMixer, "OptimismPortal")));
output.systemConfigProxy = output.systemConfigProxy =
ISystemConfig(deployProxy(l2ChainId, output.opChainProxyAdmin, saltMixer, "SystemConfig")); ISystemConfig(deployProxy(l2ChainId, output.opChainProxyAdmin, saltMixer, "SystemConfig"));
output.optimismMintableERC20FactoryProxy = OptimismMintableERC20Factory( output.optimismMintableERC20FactoryProxy = IOptimismMintableERC20Factory(
deployProxy(l2ChainId, output.opChainProxyAdmin, saltMixer, "OptimismMintableERC20Factory") deployProxy(l2ChainId, output.opChainProxyAdmin, saltMixer, "OptimismMintableERC20Factory")
); );
output.disputeGameFactoryProxy = output.disputeGameFactoryProxy =
...@@ -261,14 +258,14 @@ contract OPContractsManager is ISemver, Initializable { ...@@ -261,14 +258,14 @@ contract OPContractsManager is ISemver, Initializable {
output.l1StandardBridgeProxy = IL1StandardBridge( output.l1StandardBridgeProxy = IL1StandardBridge(
payable(Blueprint.deployFrom(blueprint.l1ChugSplashProxy, salt, abi.encode(output.opChainProxyAdmin))) payable(Blueprint.deployFrom(blueprint.l1ChugSplashProxy, salt, abi.encode(output.opChainProxyAdmin)))
); );
output.opChainProxyAdmin.setProxyType(address(output.l1StandardBridgeProxy), ProxyAdmin.ProxyType.CHUGSPLASH); output.opChainProxyAdmin.setProxyType(address(output.l1StandardBridgeProxy), IProxyAdmin.ProxyType.CHUGSPLASH);
string memory contractName = "OVM_L1CrossDomainMessenger"; string memory contractName = "OVM_L1CrossDomainMessenger";
output.l1CrossDomainMessengerProxy = IL1CrossDomainMessenger( output.l1CrossDomainMessengerProxy = IL1CrossDomainMessenger(
Blueprint.deployFrom(blueprint.resolvedDelegateProxy, salt, abi.encode(output.addressManager, contractName)) Blueprint.deployFrom(blueprint.resolvedDelegateProxy, salt, abi.encode(output.addressManager, contractName))
); );
output.opChainProxyAdmin.setProxyType( output.opChainProxyAdmin.setProxyType(
address(output.l1CrossDomainMessengerProxy), ProxyAdmin.ProxyType.RESOLVED address(output.l1CrossDomainMessengerProxy), IProxyAdmin.ProxyType.RESOLVED
); );
output.opChainProxyAdmin.setImplementationName(address(output.l1CrossDomainMessengerProxy), contractName); output.opChainProxyAdmin.setImplementationName(address(output.l1CrossDomainMessengerProxy), contractName);
...@@ -387,7 +384,7 @@ contract OPContractsManager is ISemver, Initializable { ...@@ -387,7 +384,7 @@ contract OPContractsManager is ISemver, Initializable {
/// This is required because we deploy many identical proxies, so they each require a unique salt for determinism. /// This is required because we deploy many identical proxies, so they each require a unique salt for determinism.
function deployProxy( function deployProxy(
uint256 _l2ChainId, uint256 _l2ChainId,
ProxyAdmin _proxyAdmin, IProxyAdmin _proxyAdmin,
string memory _saltMixer, string memory _saltMixer,
string memory _contractName string memory _contractName
) )
...@@ -683,7 +680,7 @@ contract OPContractsManager is ISemver, Initializable { ...@@ -683,7 +680,7 @@ contract OPContractsManager is ISemver, Initializable {
/// @notice Makes an external call to the target to initialize the proxy with the specified data. /// @notice Makes an external call to the target to initialize the proxy with the specified data.
/// First performs safety checks to ensure the target, implementation, and proxy admin are valid. /// First performs safety checks to ensure the target, implementation, and proxy admin are valid.
function upgradeAndCall( function upgradeAndCall(
ProxyAdmin _proxyAdmin, IProxyAdmin _proxyAdmin,
address _target, address _target,
address _implementation, address _implementation,
bytes memory _data bytes memory _data
......
...@@ -6,7 +6,6 @@ import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol"; ...@@ -6,7 +6,6 @@ import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { IProtocolVersions } from "src/L1/interfaces/IProtocolVersions.sol"; import { IProtocolVersions } from "src/L1/interfaces/IProtocolVersions.sol";
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol"; import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol"; import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { ISystemConfigInterop } from "src/L1/interfaces/ISystemConfigInterop.sol";
/// @custom:proxied true /// @custom:proxied true
contract OPContractsManagerInterop is OPContractsManager { contract OPContractsManagerInterop is OPContractsManager {
......
...@@ -28,18 +28,6 @@ interface ISystemConfigInterop { ...@@ -28,18 +28,6 @@ interface ISystemConfigInterop {
function gasPayingToken() external view returns (address addr_, uint8 decimals_); function gasPayingToken() external view returns (address addr_, uint8 decimals_);
function gasPayingTokenName() external view returns (string memory name_); function gasPayingTokenName() external view returns (string memory name_);
function gasPayingTokenSymbol() external view returns (string memory symbol_); function gasPayingTokenSymbol() external view returns (string memory symbol_);
function initialize(
address _owner,
uint32 _basefeeScalar,
uint32 _blobbasefeeScalar,
bytes32 _batcherHash,
uint64 _gasLimit,
address _unsafeBlockSigner,
IResourceMetering.ResourceConfig memory _config,
address _batchInbox,
ISystemConfig.Addresses memory _addresses
)
external;
function isCustomGasToken() external view returns (bool); function isCustomGasToken() external view returns (bool);
function l1CrossDomainMessenger() external view returns (address addr_); function l1CrossDomainMessenger() external view returns (address addr_);
function l1ERC721Bridge() external view returns (address addr_); function l1ERC721Bridge() external view returns (address addr_);
......
...@@ -7,11 +7,8 @@ import { DeployOPChainInput } from "scripts/DeployOPChain.s.sol"; ...@@ -7,11 +7,8 @@ import { DeployOPChainInput } from "scripts/DeployOPChain.s.sol";
import { DeployOPChain_TestBase } from "test/opcm/DeployOPChain.t.sol"; import { DeployOPChain_TestBase } from "test/opcm/DeployOPChain.t.sol";
import { OPContractsManager } from "src/L1/OPContractsManager.sol"; import { OPContractsManager } from "src/L1/OPContractsManager.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { ProtocolVersions } from "src/L1/ProtocolVersions.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol"; import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { IProtocolVersions } from "src/L1/interfaces/IProtocolVersions.sol"; import { IProtocolVersions } from "src/L1/interfaces/IProtocolVersions.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol";
// Exposes internal functions for testing. // Exposes internal functions for testing.
contract OPContractsManager_Harness is OPContractsManager { contract OPContractsManager_Harness is OPContractsManager {
......
...@@ -2,23 +2,24 @@ ...@@ -2,23 +2,24 @@
pragma solidity 0.8.15; pragma solidity 0.8.15;
import { Test, stdStorage, StdStorage } from "forge-std/Test.sol"; import { Test, stdStorage, StdStorage } from "forge-std/Test.sol";
import { DeployUtils } from "scripts/libraries/DeployUtils.sol";
import { DelayedWETH } from "src/dispute/DelayedWETH.sol"; import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol";
import { PreimageOracle } from "src/cannon/PreimageOracle.sol"; import { IPreimageOracle } from "src/cannon/interfaces/IPreimageOracle.sol";
import { MIPS } from "src/cannon/MIPS.sol"; import { IMIPS } from "src/cannon/interfaces/IMIPS.sol";
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol"; import { IDisputeGameFactory } from "src/dispute/interfaces/IDisputeGameFactory.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol"; import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { ProtocolVersions } from "src/L1/ProtocolVersions.sol"; import { IProtocolVersions } from "src/L1/interfaces/IProtocolVersions.sol";
import { OPContractsManager } from "src/L1/OPContractsManager.sol"; import { OPContractsManager } from "src/L1/OPContractsManager.sol";
import { OptimismPortal2 } from "src/L1/OptimismPortal2.sol"; import { IOptimismPortal2 } from "src/L1/interfaces/IOptimismPortal2.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol"; import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { L1CrossDomainMessenger } from "src/L1/L1CrossDomainMessenger.sol"; import { IL1CrossDomainMessenger } from "src/L1/interfaces/IL1CrossDomainMessenger.sol";
import { L1ERC721Bridge } from "src/L1/L1ERC721Bridge.sol"; import { IL1ERC721Bridge } from "src/L1/interfaces/IL1ERC721Bridge.sol";
import { L1StandardBridge } from "src/L1/L1StandardBridge.sol"; import { IL1StandardBridge } from "src/L1/interfaces/IL1StandardBridge.sol";
import { OptimismMintableERC20Factory } from "src/universal/OptimismMintableERC20Factory.sol"; import { IOptimismMintableERC20Factory } from "src/universal/interfaces/IOptimismMintableERC20Factory.sol";
import { ProxyAdmin } from "src/universal/ProxyAdmin.sol"; import { IProxyAdmin } from "src/universal/interfaces/IProxyAdmin.sol";
import { Proxy } from "src/universal/Proxy.sol"; import { IProxy } from "src/universal/interfaces/IProxy.sol";
import { import {
DeployImplementationsInput, DeployImplementationsInput,
...@@ -36,8 +37,8 @@ contract DeployImplementationsInput_Test is Test { ...@@ -36,8 +37,8 @@ contract DeployImplementationsInput_Test is Test {
uint256 proofMaturityDelaySeconds = 400; uint256 proofMaturityDelaySeconds = 400;
uint256 disputeGameFinalityDelaySeconds = 500; uint256 disputeGameFinalityDelaySeconds = 500;
string release = "dev-release"; // this means implementation contracts will be deployed string release = "dev-release"; // this means implementation contracts will be deployed
SuperchainConfig superchainConfigProxy = SuperchainConfig(makeAddr("superchainConfigProxy")); ISuperchainConfig superchainConfigProxy = ISuperchainConfig(makeAddr("superchainConfigProxy"));
ProtocolVersions protocolVersionsProxy = ProtocolVersions(makeAddr("protocolVersionsProxy")); IProtocolVersions protocolVersionsProxy = IProtocolVersions(makeAddr("protocolVersionsProxy"));
function setUp() public { function setUp() public {
dii = new DeployImplementationsInput(); dii = new DeployImplementationsInput();
...@@ -95,24 +96,29 @@ contract DeployImplementationsOutput_Test is Test { ...@@ -95,24 +96,29 @@ contract DeployImplementationsOutput_Test is Test {
} }
function test_set_succeeds() public { function test_set_succeeds() public {
Proxy proxy = new Proxy(address(0)); IProxy proxy = IProxy(
DeployUtils.create1({
_name: "Proxy",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IProxy.__constructor__, (address(0))))
})
);
address opcmImpl = address(makeAddr("opcmImpl")); address opcmImpl = address(makeAddr("opcmImpl"));
vm.prank(address(0)); vm.prank(address(0));
proxy.upgradeTo(opcmImpl); proxy.upgradeTo(opcmImpl);
OPContractsManager opcmProxy = OPContractsManager(address(proxy)); OPContractsManager opcmProxy = OPContractsManager(address(proxy));
OptimismPortal2 optimismPortalImpl = OptimismPortal2(payable(makeAddr("optimismPortalImpl"))); IOptimismPortal2 optimismPortalImpl = IOptimismPortal2(payable(makeAddr("optimismPortalImpl")));
DelayedWETH delayedWETHImpl = DelayedWETH(payable(makeAddr("delayedWETHImpl"))); IDelayedWETH delayedWETHImpl = IDelayedWETH(payable(makeAddr("delayedWETHImpl")));
PreimageOracle preimageOracleSingleton = PreimageOracle(makeAddr("preimageOracleSingleton")); IPreimageOracle preimageOracleSingleton = IPreimageOracle(makeAddr("preimageOracleSingleton"));
MIPS mipsSingleton = MIPS(makeAddr("mipsSingleton")); IMIPS mipsSingleton = IMIPS(makeAddr("mipsSingleton"));
SystemConfig systemConfigImpl = SystemConfig(makeAddr("systemConfigImpl")); ISystemConfig systemConfigImpl = ISystemConfig(makeAddr("systemConfigImpl"));
L1CrossDomainMessenger l1CrossDomainMessengerImpl = IL1CrossDomainMessenger l1CrossDomainMessengerImpl =
L1CrossDomainMessenger(makeAddr("l1CrossDomainMessengerImpl")); IL1CrossDomainMessenger(makeAddr("l1CrossDomainMessengerImpl"));
L1ERC721Bridge l1ERC721BridgeImpl = L1ERC721Bridge(makeAddr("l1ERC721BridgeImpl")); IL1ERC721Bridge l1ERC721BridgeImpl = IL1ERC721Bridge(makeAddr("l1ERC721BridgeImpl"));
L1StandardBridge l1StandardBridgeImpl = L1StandardBridge(payable(makeAddr("l1StandardBridgeImpl"))); IL1StandardBridge l1StandardBridgeImpl = IL1StandardBridge(payable(makeAddr("l1StandardBridgeImpl")));
OptimismMintableERC20Factory optimismMintableERC20FactoryImpl = IOptimismMintableERC20Factory optimismMintableERC20FactoryImpl =
OptimismMintableERC20Factory(makeAddr("optimismMintableERC20FactoryImpl")); IOptimismMintableERC20Factory(makeAddr("optimismMintableERC20FactoryImpl"));
DisputeGameFactory disputeGameFactoryImpl = DisputeGameFactory(makeAddr("disputeGameFactoryImpl")); IDisputeGameFactory disputeGameFactoryImpl = IDisputeGameFactory(makeAddr("disputeGameFactoryImpl"));
vm.etch(address(opcmProxy), address(opcmProxy).code); vm.etch(address(opcmProxy), address(opcmProxy).code);
vm.etch(address(opcmImpl), hex"01"); vm.etch(address(opcmImpl), hex"01");
...@@ -240,8 +246,8 @@ contract DeployImplementations_Test is Test { ...@@ -240,8 +246,8 @@ contract DeployImplementations_Test is Test {
uint256 challengePeriodSeconds = 300; uint256 challengePeriodSeconds = 300;
uint256 proofMaturityDelaySeconds = 400; uint256 proofMaturityDelaySeconds = 400;
uint256 disputeGameFinalityDelaySeconds = 500; uint256 disputeGameFinalityDelaySeconds = 500;
SuperchainConfig superchainConfigProxy = SuperchainConfig(makeAddr("superchainConfigProxy")); ISuperchainConfig superchainConfigProxy = ISuperchainConfig(makeAddr("superchainConfigProxy"));
ProtocolVersions protocolVersionsProxy = ProtocolVersions(makeAddr("protocolVersionsProxy")); IProtocolVersions protocolVersionsProxy = IProtocolVersions(makeAddr("protocolVersionsProxy"));
function setUp() public virtual { function setUp() public virtual {
deployImplementations = new DeployImplementations(); deployImplementations = new DeployImplementations();
...@@ -401,15 +407,27 @@ contract DeployImplementations_Test is Test { ...@@ -401,15 +407,27 @@ contract DeployImplementations_Test is Test {
proofMaturityDelaySeconds = uint256(hash(_seed, 3)); proofMaturityDelaySeconds = uint256(hash(_seed, 3));
disputeGameFinalityDelaySeconds = uint256(hash(_seed, 4)); disputeGameFinalityDelaySeconds = uint256(hash(_seed, 4));
string memory release = string(bytes.concat(hash(_seed, 5))); string memory release = string(bytes.concat(hash(_seed, 5)));
protocolVersionsProxy = ProtocolVersions(address(uint160(uint256(hash(_seed, 7))))); protocolVersionsProxy = IProtocolVersions(address(uint160(uint256(hash(_seed, 7)))));
// Must configure the ProxyAdmin contract which is used to upgrade the OPCM's proxy contract. // Must configure the ProxyAdmin contract which is used to upgrade the OPCM's proxy contract.
ProxyAdmin superchainProxyAdmin = new ProxyAdmin(msg.sender); IProxyAdmin superchainProxyAdmin = IProxyAdmin(
superchainConfigProxy = SuperchainConfig(address(new Proxy(payable(address(superchainProxyAdmin))))); DeployUtils.create1({
_name: "ProxyAdmin",
SuperchainConfig superchainConfigImpl = SuperchainConfig(address(uint160(uint256(hash(_seed, 6))))); _args: DeployUtils.encodeConstructor(abi.encodeCall(IProxyAdmin.__constructor__, (msg.sender)))
})
);
superchainConfigProxy = ISuperchainConfig(
DeployUtils.create1({
_name: "Proxy",
_args: DeployUtils.encodeConstructor(
abi.encodeCall(IProxy.__constructor__, (address(superchainProxyAdmin)))
)
})
);
ISuperchainConfig superchainConfigImpl = ISuperchainConfig(address(uint160(uint256(hash(_seed, 6)))));
vm.prank(address(superchainProxyAdmin)); vm.prank(address(superchainProxyAdmin));
Proxy(payable(address(superchainConfigProxy))).upgradeTo(address(superchainConfigImpl)); IProxy(payable(address(superchainConfigProxy))).upgradeTo(address(superchainConfigImpl));
vm.etch(address(superchainProxyAdmin), address(superchainProxyAdmin).code); vm.etch(address(superchainProxyAdmin), address(superchainProxyAdmin).code);
vm.etch(address(superchainConfigProxy), address(superchainConfigProxy).code); vm.etch(address(superchainConfigProxy), address(superchainConfigProxy).code);
......
...@@ -11,26 +11,27 @@ import { ...@@ -11,26 +11,27 @@ import {
DeployImplementationsOutput DeployImplementationsOutput
} from "scripts/DeployImplementations.s.sol"; } from "scripts/DeployImplementations.s.sol";
import { DeployOPChainInput, DeployOPChain, DeployOPChainOutput } from "scripts/DeployOPChain.s.sol"; import { DeployOPChainInput, DeployOPChain, DeployOPChainOutput } from "scripts/DeployOPChain.s.sol";
import { DeployUtils } from "scripts/libraries/DeployUtils.sol";
import { ProxyAdmin } from "src/universal/ProxyAdmin.sol"; import { IProxyAdmin } from "src/universal/interfaces/IProxyAdmin.sol";
import { AddressManager } from "src/legacy/AddressManager.sol"; import { IAddressManager } from "src/legacy/interfaces/IAddressManager.sol";
import { DelayedWETH } from "src/dispute/DelayedWETH.sol"; import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol";
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol"; import { IDisputeGameFactory } from "src/dispute/interfaces/IDisputeGameFactory.sol";
import { AnchorStateRegistry } from "src/dispute/AnchorStateRegistry.sol"; import { IAnchorStateRegistry } from "src/dispute/interfaces/IAnchorStateRegistry.sol";
import { FaultDisputeGame } from "src/dispute/FaultDisputeGame.sol"; import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol";
import { PermissionedDisputeGame } from "src/dispute/PermissionedDisputeGame.sol"; import { IPermissionedDisputeGame } from "src/dispute/interfaces/IPermissionedDisputeGame.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol"; import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { ProtocolVersions, ProtocolVersion } from "src/L1/ProtocolVersions.sol"; import { IProtocolVersions, ProtocolVersion } from "src/L1/interfaces/IProtocolVersions.sol";
import { OPContractsManager } from "src/L1/OPContractsManager.sol"; import { OPContractsManager } from "src/L1/OPContractsManager.sol";
import { OptimismPortal2 } from "src/L1/OptimismPortal2.sol"; import { IOptimismPortal2 } from "src/L1/interfaces/IOptimismPortal2.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol"; import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { L1CrossDomainMessenger } from "src/L1/L1CrossDomainMessenger.sol"; import { IL1CrossDomainMessenger } from "src/L1/interfaces/IL1CrossDomainMessenger.sol";
import { L1ERC721Bridge } from "src/L1/L1ERC721Bridge.sol"; import { IL1ERC721Bridge } from "src/L1/interfaces/IL1ERC721Bridge.sol";
import { L1StandardBridge } from "src/L1/L1StandardBridge.sol"; import { IL1StandardBridge } from "src/L1/interfaces/IL1StandardBridge.sol";
import { OptimismMintableERC20Factory } from "src/universal/OptimismMintableERC20Factory.sol"; import { IOptimismMintableERC20Factory } from "src/universal/interfaces/IOptimismMintableERC20Factory.sol";
import { Proxy } from "src/universal/Proxy.sol"; import { IProxy } from "src/universal/interfaces/IProxy.sol";
import { GameType, GameTypes, Hash, OutputRoot } from "src/dispute/lib/Types.sol"; import { GameType, GameTypes, Hash, OutputRoot } from "src/dispute/lib/Types.sol";
...@@ -54,8 +55,13 @@ contract DeployOPChainInput_Test is Test { ...@@ -54,8 +55,13 @@ contract DeployOPChainInput_Test is Test {
doi = new DeployOPChainInput(); doi = new DeployOPChainInput();
} }
function buildOpcmProxy() public returns (Proxy opcmProxy) { function buildOpcmProxy() public returns (IProxy opcmProxy) {
opcmProxy = new Proxy(address(0)); opcmProxy = IProxy(
DeployUtils.create1({
_name: "Proxy",
_args: DeployUtils.encodeConstructor(abi.encodeCall(IProxy.__constructor__, (address(0))))
})
);
OPContractsManager opcmImpl = OPContractsManager(address(makeAddr("opcmImpl"))); OPContractsManager opcmImpl = OPContractsManager(address(makeAddr("opcmImpl")));
vm.prank(address(0)); vm.prank(address(0));
opcmProxy.upgradeTo(address(opcmImpl)); opcmProxy.upgradeTo(address(opcmImpl));
...@@ -74,7 +80,7 @@ contract DeployOPChainInput_Test is Test { ...@@ -74,7 +80,7 @@ contract DeployOPChainInput_Test is Test {
doi.set(doi.blobBaseFeeScalar.selector, blobBaseFeeScalar); doi.set(doi.blobBaseFeeScalar.selector, blobBaseFeeScalar);
doi.set(doi.l2ChainId.selector, l2ChainId); doi.set(doi.l2ChainId.selector, l2ChainId);
(Proxy opcmProxy) = buildOpcmProxy(); (IProxy opcmProxy) = buildOpcmProxy();
doi.set(doi.opcmProxy.selector, address(opcmProxy)); doi.set(doi.opcmProxy.selector, address(opcmProxy));
// Compare the default inputs to the getter methods. // Compare the default inputs to the getter methods.
...@@ -127,21 +133,22 @@ contract DeployOPChainOutput_Test is Test { ...@@ -127,21 +133,22 @@ contract DeployOPChainOutput_Test is Test {
// Define default outputs to set. // Define default outputs to set.
// We set these in storage because doing it locally in test_set_succeeds results in stack too deep. // We set these in storage because doing it locally in test_set_succeeds results in stack too deep.
ProxyAdmin opChainProxyAdmin = ProxyAdmin(makeAddr("optimismPortal2Impl")); IProxyAdmin opChainProxyAdmin = IProxyAdmin(makeAddr("optimismPortal2Impl"));
AddressManager addressManager = AddressManager(makeAddr("delayedWETHImpl")); IAddressManager addressManager = IAddressManager(makeAddr("delayedWETHImpl"));
L1ERC721Bridge l1ERC721BridgeProxy = L1ERC721Bridge(makeAddr("l1ERC721BridgeProxy")); IL1ERC721Bridge l1ERC721BridgeProxy = IL1ERC721Bridge(makeAddr("l1ERC721BridgeProxy"));
SystemConfig systemConfigProxy = SystemConfig(makeAddr("systemConfigProxy")); ISystemConfig systemConfigProxy = ISystemConfig(makeAddr("systemConfigProxy"));
OptimismMintableERC20Factory optimismMintableERC20FactoryProxy = IOptimismMintableERC20Factory optimismMintableERC20FactoryProxy =
OptimismMintableERC20Factory(makeAddr("optimismMintableERC20FactoryProxy")); IOptimismMintableERC20Factory(makeAddr("optimismMintableERC20FactoryProxy"));
L1StandardBridge l1StandardBridgeProxy = L1StandardBridge(payable(makeAddr("l1StandardBridgeProxy"))); IL1StandardBridge l1StandardBridgeProxy = IL1StandardBridge(payable(makeAddr("l1StandardBridgeProxy")));
L1CrossDomainMessenger l1CrossDomainMessengerProxy = L1CrossDomainMessenger(makeAddr("l1CrossDomainMessengerProxy")); IL1CrossDomainMessenger l1CrossDomainMessengerProxy =
OptimismPortal2 optimismPortalProxy = OptimismPortal2(payable(makeAddr("optimismPortalProxy"))); IL1CrossDomainMessenger(makeAddr("l1CrossDomainMessengerProxy"));
DisputeGameFactory disputeGameFactoryProxy = DisputeGameFactory(makeAddr("disputeGameFactoryProxy")); IOptimismPortal2 optimismPortalProxy = IOptimismPortal2(payable(makeAddr("optimismPortalProxy")));
AnchorStateRegistry anchorStateRegistryProxy = AnchorStateRegistry(makeAddr("anchorStateRegistryProxy")); IDisputeGameFactory disputeGameFactoryProxy = IDisputeGameFactory(makeAddr("disputeGameFactoryProxy"));
AnchorStateRegistry anchorStateRegistryImpl = AnchorStateRegistry(makeAddr("anchorStateRegistryImpl")); IAnchorStateRegistry anchorStateRegistryProxy = IAnchorStateRegistry(makeAddr("anchorStateRegistryProxy"));
FaultDisputeGame faultDisputeGame = FaultDisputeGame(makeAddr("faultDisputeGame")); IAnchorStateRegistry anchorStateRegistryImpl = IAnchorStateRegistry(makeAddr("anchorStateRegistryImpl"));
PermissionedDisputeGame permissionedDisputeGame = PermissionedDisputeGame(makeAddr("permissionedDisputeGame")); IFaultDisputeGame faultDisputeGame = IFaultDisputeGame(makeAddr("faultDisputeGame"));
DelayedWETH delayedWETHPermissionedGameProxy = DelayedWETH(payable(makeAddr("delayedWETHPermissionedGameProxy"))); IPermissionedDisputeGame permissionedDisputeGame = IPermissionedDisputeGame(makeAddr("permissionedDisputeGame"));
IDelayedWETH delayedWETHPermissionedGameProxy = IDelayedWETH(payable(makeAddr("delayedWETHPermissionedGameProxy")));
// TODO: Eventually switch from Permissioned to Permissionless. // TODO: Eventually switch from Permissioned to Permissionless.
// DelayedWETH delayedWETHPermissionlessGameProxy = // DelayedWETH delayedWETHPermissionlessGameProxy =
// DelayedWETH(payable(makeAddr("delayedWETHPermissionlessGameProxy"))); // DelayedWETH(payable(makeAddr("delayedWETHPermissionlessGameProxy")));
...@@ -345,8 +352,8 @@ contract DeployOPChain_TestBase is Test { ...@@ -345,8 +352,8 @@ contract DeployOPChain_TestBase is Test {
uint256 proofMaturityDelaySeconds = 400; uint256 proofMaturityDelaySeconds = 400;
uint256 disputeGameFinalityDelaySeconds = 500; uint256 disputeGameFinalityDelaySeconds = 500;
string release = "dev-release"; // this means implementation contracts will be deployed string release = "dev-release"; // this means implementation contracts will be deployed
SuperchainConfig superchainConfigProxy; ISuperchainConfig superchainConfigProxy;
ProtocolVersions protocolVersionsProxy; IProtocolVersions protocolVersionsProxy;
// Define default inputs for DeployOPChain. // Define default inputs for DeployOPChain.
// `opcm` is set during `setUp` since it is an output of the previous step. // `opcm` is set during `setUp` since it is an output of the previous step.
...@@ -359,7 +366,7 @@ contract DeployOPChain_TestBase is Test { ...@@ -359,7 +366,7 @@ contract DeployOPChain_TestBase is Test {
uint32 basefeeScalar = 100; uint32 basefeeScalar = 100;
uint32 blobBaseFeeScalar = 200; uint32 blobBaseFeeScalar = 200;
uint256 l2ChainId = 300; uint256 l2ChainId = 300;
AnchorStateRegistry.StartingAnchorRoot[] startingAnchorRoots; IAnchorStateRegistry.StartingAnchorRoot[] startingAnchorRoots;
OPContractsManager opcm = OPContractsManager(address(0)); OPContractsManager opcm = OPContractsManager(address(0));
string saltMixer = "defaultSaltMixer"; string saltMixer = "defaultSaltMixer";
uint64 gasLimit = 30_000_000; uint64 gasLimit = 30_000_000;
...@@ -369,13 +376,13 @@ contract DeployOPChain_TestBase is Test { ...@@ -369,13 +376,13 @@ contract DeployOPChain_TestBase is Test {
uint256 cannonBlock = 400; uint256 cannonBlock = 400;
uint256 permissionedBlock = 500; uint256 permissionedBlock = 500;
startingAnchorRoots.push( startingAnchorRoots.push(
AnchorStateRegistry.StartingAnchorRoot({ IAnchorStateRegistry.StartingAnchorRoot({
gameType: GameTypes.CANNON, gameType: GameTypes.CANNON,
outputRoot: OutputRoot({ root: Hash.wrap(keccak256("defaultOutputRootCannon")), l2BlockNumber: cannonBlock }) outputRoot: OutputRoot({ root: Hash.wrap(keccak256("defaultOutputRootCannon")), l2BlockNumber: cannonBlock })
}) })
); );
startingAnchorRoots.push( startingAnchorRoots.push(
AnchorStateRegistry.StartingAnchorRoot({ IAnchorStateRegistry.StartingAnchorRoot({
gameType: GameTypes.PERMISSIONED_CANNON, gameType: GameTypes.PERMISSIONED_CANNON,
outputRoot: OutputRoot({ outputRoot: OutputRoot({
root: Hash.wrap(keccak256("defaultOutputRootPermissioned")), root: Hash.wrap(keccak256("defaultOutputRootPermissioned")),
...@@ -456,13 +463,13 @@ contract DeployOPChain_Test is DeployOPChain_TestBase { ...@@ -456,13 +463,13 @@ contract DeployOPChain_Test is DeployOPChain_TestBase {
uint256 cannonBlock = uint256(hash(_seed, 9)); uint256 cannonBlock = uint256(hash(_seed, 9));
uint256 permissionedBlock = uint256(hash(_seed, 10)); uint256 permissionedBlock = uint256(hash(_seed, 10));
startingAnchorRoots.push( startingAnchorRoots.push(
AnchorStateRegistry.StartingAnchorRoot({ IAnchorStateRegistry.StartingAnchorRoot({
gameType: GameTypes.CANNON, gameType: GameTypes.CANNON,
outputRoot: OutputRoot({ root: Hash.wrap(keccak256(abi.encode(_seed, 11))), l2BlockNumber: cannonBlock }) outputRoot: OutputRoot({ root: Hash.wrap(keccak256(abi.encode(_seed, 11))), l2BlockNumber: cannonBlock })
}) })
); );
startingAnchorRoots.push( startingAnchorRoots.push(
AnchorStateRegistry.StartingAnchorRoot({ IAnchorStateRegistry.StartingAnchorRoot({
gameType: GameTypes.PERMISSIONED_CANNON, gameType: GameTypes.PERMISSIONED_CANNON,
outputRoot: OutputRoot({ outputRoot: OutputRoot({
root: Hash.wrap(keccak256(abi.encode(_seed, 12))), root: Hash.wrap(keccak256(abi.encode(_seed, 12))),
......
...@@ -7,7 +7,7 @@ import { stdToml } from "forge-std/StdToml.sol"; ...@@ -7,7 +7,7 @@ import { stdToml } from "forge-std/StdToml.sol";
import { ProxyAdmin } from "src/universal/ProxyAdmin.sol"; import { ProxyAdmin } from "src/universal/ProxyAdmin.sol";
import { Proxy } from "src/universal/Proxy.sol"; import { Proxy } from "src/universal/Proxy.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol"; import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { ProtocolVersions, ProtocolVersion } from "src/L1/ProtocolVersions.sol"; import { IProtocolVersions, ProtocolVersion } from "src/L1/interfaces/IProtocolVersions.sol";
import { DeploySuperchainInput, DeploySuperchain, DeploySuperchainOutput } from "scripts/DeploySuperchain.s.sol"; import { DeploySuperchainInput, DeploySuperchain, DeploySuperchainOutput } from "scripts/DeploySuperchain.s.sol";
contract DeploySuperchainInput_Test is Test { contract DeploySuperchainInput_Test is Test {
...@@ -58,8 +58,8 @@ contract DeploySuperchainOutput_Test is Test { ...@@ -58,8 +58,8 @@ contract DeploySuperchainOutput_Test is Test {
ProxyAdmin superchainProxyAdmin = ProxyAdmin(makeAddr("superchainProxyAdmin")); ProxyAdmin superchainProxyAdmin = ProxyAdmin(makeAddr("superchainProxyAdmin"));
SuperchainConfig superchainConfigImpl = SuperchainConfig(makeAddr("superchainConfigImpl")); SuperchainConfig superchainConfigImpl = SuperchainConfig(makeAddr("superchainConfigImpl"));
SuperchainConfig superchainConfigProxy = SuperchainConfig(makeAddr("superchainConfigProxy")); SuperchainConfig superchainConfigProxy = SuperchainConfig(makeAddr("superchainConfigProxy"));
ProtocolVersions protocolVersionsImpl = ProtocolVersions(makeAddr("protocolVersionsImpl")); IProtocolVersions protocolVersionsImpl = IProtocolVersions(makeAddr("protocolVersionsImpl"));
ProtocolVersions protocolVersionsProxy = ProtocolVersions(makeAddr("protocolVersionsProxy")); IProtocolVersions protocolVersionsProxy = IProtocolVersions(makeAddr("protocolVersionsProxy"));
// Ensure each address has code, since these are expected to be contracts. // Ensure each address has code, since these are expected to be contracts.
vm.etch(address(superchainProxyAdmin), hex"01"); vm.etch(address(superchainProxyAdmin), hex"01");
......
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