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