Commit 6cfa9b4e authored by Maurelian's avatar Maurelian Committed by GitHub

Deploy Cleanup: Make Artifacts stand alone and etch into global state (#13648)

* Make Artifacts stand alone and etch into global state

* fix the things

* Remove extra artifacts etch

* feat: label and allowCheatCodes on artifacts

feat: restore deploy config label

* fix typo

* fix import

* fix import
parent b9382028
...@@ -6,8 +6,7 @@ import { stdJson } from "forge-std/StdJson.sol"; ...@@ -6,8 +6,7 @@ import { stdJson } from "forge-std/StdJson.sol";
import { Vm } from "forge-std/Vm.sol"; import { Vm } from "forge-std/Vm.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { Config } from "scripts/libraries/Config.sol"; import { Config } from "scripts/libraries/Config.sol";
import { StorageSlot } from "scripts/libraries/ForgeArtifacts.sol"; import { ForgeArtifacts, StorageSlot } from "scripts/libraries/ForgeArtifacts.sol";
import { ForgeArtifacts } from "scripts/libraries/ForgeArtifacts.sol";
import { Process } from "scripts/libraries/Process.sol"; import { Process } from "scripts/libraries/Process.sol";
/// @notice Represents a deployment. Is serialized to JSON as a key/value /// @notice Represents a deployment. Is serialized to JSON as a key/value
...@@ -21,7 +20,7 @@ struct Deployment { ...@@ -21,7 +20,7 @@ struct Deployment {
/// @notice Useful for accessing deployment artifacts from within scripts. /// @notice Useful for accessing deployment artifacts from within scripts.
/// When a contract is deployed, call the `save` function to write its name and /// When a contract is deployed, call the `save` function to write its name and
/// contract address to disk. Inspired by `forge-deploy`. /// contract address to disk. Inspired by `forge-deploy`.
abstract contract Artifacts { contract Artifacts {
/// @notice Foundry cheatcode VM. /// @notice Foundry cheatcode VM.
Vm private constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code"))))); Vm private constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code")))));
......
...@@ -100,9 +100,9 @@ contract L2Genesis is Deployer { ...@@ -100,9 +100,9 @@ contract L2Genesis is Deployer {
function artifactDependencies() internal view returns (L1Dependencies memory l1Dependencies_) { function artifactDependencies() internal view returns (L1Dependencies memory l1Dependencies_) {
return L1Dependencies({ return L1Dependencies({
l1CrossDomainMessengerProxy: mustGetAddress("L1CrossDomainMessengerProxy"), l1CrossDomainMessengerProxy: artifacts.mustGetAddress("L1CrossDomainMessengerProxy"),
l1StandardBridgeProxy: mustGetAddress("L1StandardBridgeProxy"), l1StandardBridgeProxy: artifacts.mustGetAddress("L1StandardBridgeProxy"),
l1ERC721BridgeProxy: mustGetAddress("L1ERC721BridgeProxy") l1ERC721BridgeProxy: artifacts.mustGetAddress("L1ERC721BridgeProxy")
}); });
} }
......
...@@ -85,12 +85,12 @@ contract DeployOwnership is Deploy { ...@@ -85,12 +85,12 @@ contract DeployOwnership is Deploy {
/// @notice Returns a GuardianConfig similar to that of the Guardian Safe on Mainnet. /// @notice Returns a GuardianConfig similar to that of the Guardian Safe on Mainnet.
function _getExampleGuardianConfig() internal view returns (GuardianConfig memory guardianConfig_) { function _getExampleGuardianConfig() internal view returns (GuardianConfig memory guardianConfig_) {
address[] memory exampleGuardianOwners = new address[](1); address[] memory exampleGuardianOwners = new address[](1);
exampleGuardianOwners[0] = mustGetAddress("SecurityCouncilSafe"); exampleGuardianOwners[0] = artifacts.mustGetAddress("SecurityCouncilSafe");
guardianConfig_ = GuardianConfig({ guardianConfig_ = GuardianConfig({
safeConfig: SafeConfig({ threshold: 1, owners: exampleGuardianOwners }), safeConfig: SafeConfig({ threshold: 1, owners: exampleGuardianOwners }),
deputyGuardianModuleConfig: DeputyGuardianModuleConfig({ deputyGuardianModuleConfig: DeputyGuardianModuleConfig({
deputyGuardian: mustGetAddress("FoundationOperationsSafe"), deputyGuardian: artifacts.mustGetAddress("FoundationOperationsSafe"),
superchainConfig: ISuperchainConfig(mustGetAddress("SuperchainConfigImpl")) superchainConfig: ISuperchainConfig(artifacts.mustGetAddress("SuperchainConfigImpl"))
}) })
}); });
} }
...@@ -108,7 +108,7 @@ contract DeployOwnership is Deploy { ...@@ -108,7 +108,7 @@ contract DeployOwnership is Deploy {
livenessInterval: 14 weeks, livenessInterval: 14 weeks,
thresholdPercentage: 75, thresholdPercentage: 75,
minOwners: 8, minOwners: 8,
fallbackOwner: mustGetAddress("FoundationUpgradeSafe") fallbackOwner: artifacts.mustGetAddress("FoundationUpgradeSafe")
}) })
}); });
} }
...@@ -174,14 +174,14 @@ contract DeployOwnership is Deploy { ...@@ -174,14 +174,14 @@ contract DeployOwnership is Deploy {
); );
addr_ = address(safeProxyFactory.createProxyWithNonce(address(safeSingleton), initData, uint256(salt))); addr_ = address(safeProxyFactory.createProxyWithNonce(address(safeSingleton), initData, uint256(salt)));
save(_name, addr_); artifacts.save(_name, addr_);
console.log("New safe: %s deployed at %s\n Note that this safe is owned by the deployer key", _name, addr_); console.log("New safe: %s deployed at %s\n Note that this safe is owned by the deployer key", _name, addr_);
} }
/// @notice If the keepDeployer option was used with deploySafe(), this function can be used to remove the deployer. /// @notice If the keepDeployer option was used with deploySafe(), this function can be used to remove the deployer.
/// Note this function does not have the broadcast modifier. /// Note this function does not have the broadcast modifier.
function removeDeployerFromSafe(string memory _name, uint256 _newThreshold) public { function removeDeployerFromSafe(string memory _name, uint256 _newThreshold) public {
Safe safe = Safe(mustGetAddress(_name)); Safe safe = Safe(artifacts.mustGetAddress(_name));
// The sentinel address is used to mark the start and end of the linked list of owners in the Safe. // The sentinel address is used to mark the start and end of the linked list of owners in the Safe.
address sentinelOwners = address(0x1); address sentinelOwners = address(0x1);
...@@ -198,10 +198,10 @@ contract DeployOwnership is Deploy { ...@@ -198,10 +198,10 @@ contract DeployOwnership is Deploy {
/// @notice Gets the address of the SafeProxyFactory and Safe singleton for use in deploying a new GnosisSafe. /// @notice Gets the address of the SafeProxyFactory and Safe singleton for use in deploying a new GnosisSafe.
function _getSafeFactory() internal returns (SafeProxyFactory safeProxyFactory_, Safe safeSingleton_) { function _getSafeFactory() internal returns (SafeProxyFactory safeProxyFactory_, Safe safeSingleton_) {
if (getAddress("SafeProxyFactory") != address(0)) { if (artifacts.getAddress("SafeProxyFactory") != address(0)) {
// The SafeProxyFactory is already saved, we can just use it. // The SafeProxyFactory is already saved, we can just use it.
safeProxyFactory_ = SafeProxyFactory(getAddress("SafeProxyFactory")); safeProxyFactory_ = SafeProxyFactory(artifacts.getAddress("SafeProxyFactory"));
safeSingleton_ = Safe(getAddress("SafeSingleton")); safeSingleton_ = Safe(artifacts.getAddress("SafeSingleton"));
return (safeProxyFactory_, safeSingleton_); return (safeProxyFactory_, safeSingleton_);
} }
...@@ -216,8 +216,8 @@ contract DeployOwnership is Deploy { ...@@ -216,8 +216,8 @@ contract DeployOwnership is Deploy {
safeSingleton.code.length == 0 ? safeSingleton_ = new Safe() : safeSingleton_ = Safe(payable(safeSingleton)); safeSingleton.code.length == 0 ? safeSingleton_ = new Safe() : safeSingleton_ = Safe(payable(safeSingleton));
save("SafeProxyFactory", address(safeProxyFactory_)); artifacts.save("SafeProxyFactory", address(safeProxyFactory_));
save("SafeSingleton", address(safeSingleton_)); artifacts.save("SafeSingleton", address(safeSingleton_));
} }
/// @notice Deploys a Safe with a configuration similar to that of the Foundation Safe on Mainnet. /// @notice Deploys a Safe with a configuration similar to that of the Foundation Safe on Mainnet.
...@@ -245,18 +245,18 @@ contract DeployOwnership is Deploy { ...@@ -245,18 +245,18 @@ contract DeployOwnership is Deploy {
/// @notice Deploy a LivenessGuard for use on the Security Council Safe. /// @notice Deploy a LivenessGuard for use on the Security Council Safe.
/// Note this function does not have the broadcast modifier. /// Note this function does not have the broadcast modifier.
function deployLivenessGuard() public returns (address addr_) { function deployLivenessGuard() public returns (address addr_) {
Safe councilSafe = Safe(payable(mustGetAddress("SecurityCouncilSafe"))); Safe councilSafe = Safe(payable(artifacts.mustGetAddress("SecurityCouncilSafe")));
addr_ = address(new LivenessGuard(councilSafe)); addr_ = address(new LivenessGuard(councilSafe));
save("LivenessGuard", address(addr_)); artifacts.save("LivenessGuard", address(addr_));
console.log("New LivenessGuard deployed at %s", address(addr_)); console.log("New LivenessGuard deployed at %s", address(addr_));
} }
/// @notice Deploy a LivenessModule for use on the Security Council Safe /// @notice Deploy a LivenessModule for use on the Security Council Safe
/// Note this function does not have the broadcast modifier. /// Note this function does not have the broadcast modifier.
function deployLivenessModule() public returns (address addr_) { function deployLivenessModule() public returns (address addr_) {
Safe councilSafe = Safe(payable(mustGetAddress("SecurityCouncilSafe"))); Safe councilSafe = Safe(payable(artifacts.mustGetAddress("SecurityCouncilSafe")));
address guard = mustGetAddress("LivenessGuard"); address guard = artifacts.mustGetAddress("LivenessGuard");
LivenessModuleConfig memory livenessModuleConfig = _getExampleCouncilConfig().livenessModuleConfig; LivenessModuleConfig memory livenessModuleConfig = _getExampleCouncilConfig().livenessModuleConfig;
addr_ = address( addr_ = address(
...@@ -270,14 +270,14 @@ contract DeployOwnership is Deploy { ...@@ -270,14 +270,14 @@ contract DeployOwnership is Deploy {
}) })
); );
save("LivenessModule", address(addr_)); artifacts.save("LivenessModule", address(addr_));
console.log("New LivenessModule deployed at %s", address(addr_)); console.log("New LivenessModule deployed at %s", address(addr_));
} }
/// @notice Deploy a DeputyGuardianModule for use on the Security Council Safe. /// @notice Deploy a DeputyGuardianModule for use on the Security Council Safe.
/// Note this function does not have the broadcast modifier. /// Note this function does not have the broadcast modifier.
function deployDeputyGuardianModule() public returns (address addr_) { function deployDeputyGuardianModule() public returns (address addr_) {
Safe guardianSafe = Safe(payable(mustGetAddress("GuardianSafe"))); Safe guardianSafe = Safe(payable(artifacts.mustGetAddress("GuardianSafe")));
DeputyGuardianModuleConfig memory deputyGuardianModuleConfig = DeputyGuardianModuleConfig memory deputyGuardianModuleConfig =
_getExampleGuardianConfig().deputyGuardianModuleConfig; _getExampleGuardianConfig().deputyGuardianModuleConfig;
addr_ = address( addr_ = address(
...@@ -288,7 +288,7 @@ contract DeployOwnership is Deploy { ...@@ -288,7 +288,7 @@ contract DeployOwnership is Deploy {
}) })
); );
save("DeputyGuardianModule", addr_); artifacts.save("DeputyGuardianModule", addr_);
console.log("New DeputyGuardianModule deployed at %s", addr_); console.log("New DeputyGuardianModule deployed at %s", addr_);
} }
...@@ -310,7 +310,7 @@ contract DeployOwnership is Deploy { ...@@ -310,7 +310,7 @@ contract DeployOwnership is Deploy {
function deployGuardianSafe() public broadcast returns (address addr_) { function deployGuardianSafe() public broadcast returns (address addr_) {
// Config is hardcoded here as the Guardian Safe's configuration is inflexible. // Config is hardcoded here as the Guardian Safe's configuration is inflexible.
address[] memory owners = new address[](1); address[] memory owners = new address[](1);
owners[0] = mustGetAddress("SecurityCouncilSafe"); owners[0] = artifacts.mustGetAddress("SecurityCouncilSafe");
addr_ = deploySafe({ _name: "GuardianSafe", _owners: owners, _threshold: 1, _keepDeployer: true }); addr_ = deploySafe({ _name: "GuardianSafe", _owners: owners, _threshold: 1, _keepDeployer: true });
console.log("Deployed and configured the Guardian Safe!"); console.log("Deployed and configured the Guardian Safe!");
...@@ -320,7 +320,7 @@ contract DeployOwnership is Deploy { ...@@ -320,7 +320,7 @@ contract DeployOwnership is Deploy {
function deploySuperchainConfig() public broadcast { function deploySuperchainConfig() public broadcast {
ISuperchainConfig superchainConfig = ISuperchainConfig( ISuperchainConfig superchainConfig = ISuperchainConfig(
DeployUtils.create2AndSave({ DeployUtils.create2AndSave({
_save: this, _save: artifacts,
_salt: _implSalt(), _salt: _implSalt(),
_name: "SuperchainConfig", _name: "SuperchainConfig",
_nick: "SuperchainConfigImpl", _nick: "SuperchainConfigImpl",
...@@ -335,7 +335,7 @@ contract DeployOwnership is Deploy { ...@@ -335,7 +335,7 @@ contract DeployOwnership is Deploy {
/// @notice Configure the Guardian Safe with the DeputyGuardianModule. /// @notice Configure the Guardian Safe with the DeputyGuardianModule.
function configureGuardianSafe() public broadcast returns (address addr_) { function configureGuardianSafe() public broadcast returns (address addr_) {
addr_ = mustGetAddress("GuardianSafe"); addr_ = artifacts.mustGetAddress("GuardianSafe");
address deputyGuardianModule = deployDeputyGuardianModule(); address deputyGuardianModule = deployDeputyGuardianModule();
_callViaSafe({ _callViaSafe({
_safe: Safe(payable(addr_)), _safe: Safe(payable(addr_)),
...@@ -352,7 +352,7 @@ contract DeployOwnership is Deploy { ...@@ -352,7 +352,7 @@ contract DeployOwnership is Deploy {
function configureSecurityCouncilSafe() public broadcast returns (address addr_) { function configureSecurityCouncilSafe() public broadcast returns (address addr_) {
// Deploy and add the Deputy Guardian Module. // Deploy and add the Deputy Guardian Module.
SecurityCouncilConfig memory exampleCouncilConfig = _getExampleCouncilConfig(); SecurityCouncilConfig memory exampleCouncilConfig = _getExampleCouncilConfig();
Safe safe = Safe(mustGetAddress("SecurityCouncilSafe")); Safe safe = Safe(artifacts.mustGetAddress("SecurityCouncilSafe"));
// Deploy and add the Liveness Guard. // Deploy and add the Liveness Guard.
address guard = deployLivenessGuard(); address guard = deployLivenessGuard();
......
...@@ -11,13 +11,19 @@ import { Process } from "scripts/libraries/Process.sol"; ...@@ -11,13 +11,19 @@ import { Process } from "scripts/libraries/Process.sol";
/// @title Deployer /// @title Deployer
/// @author tynes /// @author tynes
/// @notice A contract that can make deploying and interacting with deployments easy. /// @notice A contract that can make deploying and interacting with deployments easy.
abstract contract Deployer is Script, Artifacts { abstract contract Deployer is Script {
DeployConfig public constant cfg = DeployConfig public constant cfg =
DeployConfig(address(uint160(uint256(keccak256(abi.encode("optimism.deployconfig")))))); DeployConfig(address(uint160(uint256(keccak256(abi.encode("optimism.deployconfig"))))));
Artifacts public constant artifacts =
Artifacts(address(uint160(uint256(keccak256(abi.encode("optimism.artifacts"))))));
/// @notice Sets up the artifacts contract. /// @notice Sets up the artifacts contract.
function setUp() public virtual override { function setUp() public virtual {
Artifacts.setUp(); vm.etch(address(artifacts), vm.getDeployedCode("Artifacts.s.sol:Artifacts"));
vm.label(address(cfg), "Artifacts");
vm.allowCheatcodes(address(artifacts));
artifacts.setUp();
console.log("Commit hash: %s", gitCommitHash()); console.log("Commit hash: %s", gitCommitHash());
......
...@@ -23,16 +23,21 @@ import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol"; ...@@ -23,16 +23,21 @@ import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol";
/// @title DeployPeriphery /// @title DeployPeriphery
/// @notice Script used to deploy periphery contracts. /// @notice Script used to deploy periphery contracts.
contract DeployPeriphery is Script, Artifacts { contract DeployPeriphery is Script {
/// @notice Error emitted when an address mismatch is detected. /// @notice Error emitted when an address mismatch is detected.
error AddressMismatch(string, address, address); error AddressMismatch(string, address, address);
/// @notice Deployment configuration. /// @notice Deployment configuration.
PeripheryDeployConfig cfg; PeripheryDeployConfig cfg;
Artifacts public constant artifacts =
Artifacts(address(uint160(uint256(keccak256(abi.encode("optimism.artifacts"))))));
/// @notice Sets up the deployment script. /// @notice Sets up the deployment script.
function setUp() public override { function setUp() public {
Artifacts.setUp(); vm.etch(address(artifacts), vm.getDeployedCode("Artifacts.s.sol:Artifacts"));
artifacts.setUp();
cfg = new PeripheryDeployConfig(Config.deployConfigPath()); cfg = new PeripheryDeployConfig(Config.deployConfigPath());
console.log("Config path: %s", Config.deployConfigPath()); console.log("Config path: %s", Config.deployConfigPath());
} }
...@@ -94,12 +99,12 @@ contract DeployPeriphery is Script, Artifacts { ...@@ -94,12 +99,12 @@ contract DeployPeriphery is Script, Artifacts {
addr_ = _deployCreate2({ addr_ = _deployCreate2({
_name: "FaucetProxy", _name: "FaucetProxy",
_creationCode: type(Proxy).creationCode, _creationCode: type(Proxy).creationCode,
_constructorParams: abi.encode(mustGetAddress("ProxyAdmin")) _constructorParams: abi.encode(artifacts.mustGetAddress("ProxyAdmin"))
}); });
Proxy proxy = Proxy(payable(addr_)); Proxy proxy = Proxy(payable(addr_));
require( require(
EIP1967Helper.getAdmin(address(proxy)) == mustGetAddress("ProxyAdmin"), EIP1967Helper.getAdmin(address(proxy)) == artifacts.mustGetAddress("ProxyAdmin"),
"DeployPeriphery: FaucetProxy admin mismatch" "DeployPeriphery: FaucetProxy admin mismatch"
); );
} }
...@@ -206,9 +211,9 @@ contract DeployPeriphery is Script, Artifacts { ...@@ -206,9 +211,9 @@ contract DeployPeriphery is Script, Artifacts {
/// @notice Initialize the Faucet. /// @notice Initialize the Faucet.
function initializeFaucet() public broadcast { function initializeFaucet() public broadcast {
ProxyAdmin proxyAdmin = ProxyAdmin(mustGetAddress("ProxyAdmin")); ProxyAdmin proxyAdmin = ProxyAdmin(artifacts.mustGetAddress("ProxyAdmin"));
address faucetProxy = mustGetAddress("FaucetProxy"); address faucetProxy = artifacts.mustGetAddress("FaucetProxy");
address faucet = mustGetAddress("Faucet"); address faucet = artifacts.mustGetAddress("Faucet");
address implementationAddress = proxyAdmin.getProxyImplementation(faucetProxy); address implementationAddress = proxyAdmin.getProxyImplementation(faucetProxy);
if (implementationAddress == faucet) { if (implementationAddress == faucet) {
console.log("Faucet proxy implementation already set"); console.log("Faucet proxy implementation already set");
...@@ -225,7 +230,7 @@ contract DeployPeriphery is Script, Artifacts { ...@@ -225,7 +230,7 @@ contract DeployPeriphery is Script, Artifacts {
/// @notice Installs the OnChain AuthModule on the Faucet contract. /// @notice Installs the OnChain AuthModule on the Faucet contract.
function installOnChainAuthModule() public broadcast { function installOnChainAuthModule() public broadcast {
_installAuthModule({ _installAuthModule({
_faucet: Faucet(mustGetAddress("FaucetProxy")), _faucet: Faucet(artifacts.mustGetAddress("FaucetProxy")),
_name: "OnChainAuthModule", _name: "OnChainAuthModule",
_config: Faucet.ModuleConfig({ _config: Faucet.ModuleConfig({
name: "OnChainAuthModule", name: "OnChainAuthModule",
...@@ -239,7 +244,7 @@ contract DeployPeriphery is Script, Artifacts { ...@@ -239,7 +244,7 @@ contract DeployPeriphery is Script, Artifacts {
/// @notice Installs the OffChain AuthModule on the Faucet contract. /// @notice Installs the OffChain AuthModule on the Faucet contract.
function installOffChainAuthModule() public broadcast { function installOffChainAuthModule() public broadcast {
_installAuthModule({ _installAuthModule({
_faucet: Faucet(mustGetAddress("FaucetProxy")), _faucet: Faucet(artifacts.mustGetAddress("FaucetProxy")),
_name: "OffChainAuthModule", _name: "OffChainAuthModule",
_config: Faucet.ModuleConfig({ _config: Faucet.ModuleConfig({
name: "OffChainAuthModule", name: "OffChainAuthModule",
...@@ -252,7 +257,7 @@ contract DeployPeriphery is Script, Artifacts { ...@@ -252,7 +257,7 @@ contract DeployPeriphery is Script, Artifacts {
/// @notice Installs all of the auth modules in the faucet contract. /// @notice Installs all of the auth modules in the faucet contract.
function installFaucetAuthModulesConfigs() public { function installFaucetAuthModulesConfigs() public {
Faucet faucet = Faucet(mustGetAddress("FaucetProxy")); Faucet faucet = Faucet(artifacts.mustGetAddress("FaucetProxy"));
console.log("Installing auth modules at %s", address(faucet)); console.log("Installing auth modules at %s", address(faucet));
installOnChainAuthModule(); installOnChainAuthModule();
installOffChainAuthModule(); installOffChainAuthModule();
...@@ -276,9 +281,9 @@ contract DeployPeriphery is Script, Artifacts { ...@@ -276,9 +281,9 @@ contract DeployPeriphery is Script, Artifacts {
address preComputedAddress = vm.computeCreate2Address(salt, keccak256(initCode)); address preComputedAddress = vm.computeCreate2Address(salt, keccak256(initCode));
if (preComputedAddress.code.length > 0) { if (preComputedAddress.code.length > 0) {
console.log("%s already deployed at %s", _name, preComputedAddress); console.log("%s already deployed at %s", _name, preComputedAddress);
address savedAddress = getAddress(_name); address savedAddress = artifacts.getAddress(_name);
if (savedAddress == address(0)) { if (savedAddress == address(0)) {
save(_name, preComputedAddress); artifacts.save(_name, preComputedAddress);
} else if (savedAddress != preComputedAddress) { } else if (savedAddress != preComputedAddress) {
revert AddressMismatch(_name, preComputedAddress, savedAddress); revert AddressMismatch(_name, preComputedAddress, savedAddress);
} }
...@@ -288,7 +293,7 @@ contract DeployPeriphery is Script, Artifacts { ...@@ -288,7 +293,7 @@ contract DeployPeriphery is Script, Artifacts {
addr_ := create2(0, add(initCode, 0x20), mload(initCode), salt) addr_ := create2(0, add(initCode, 0x20), mload(initCode), salt)
} }
require(addr_ != address(0), "DeployPeriphery: deployment failed"); require(addr_ != address(0), "DeployPeriphery: deployment failed");
save(_name, addr_); artifacts.save(_name, addr_);
console.log("%s deployed at %s", _name, addr_); console.log("%s deployed at %s", _name, addr_);
} }
} }
...@@ -298,7 +303,7 @@ contract DeployPeriphery is Script, Artifacts { ...@@ -298,7 +303,7 @@ contract DeployPeriphery is Script, Artifacts {
/// @param _name The name of the auth module. /// @param _name The name of the auth module.
/// @param _config The configuration of the auth module. /// @param _config The configuration of the auth module.
function _installAuthModule(Faucet _faucet, string memory _name, Faucet.ModuleConfig memory _config) internal { function _installAuthModule(Faucet _faucet, string memory _name, Faucet.ModuleConfig memory _config) internal {
AdminFaucetAuthModule module = AdminFaucetAuthModule(mustGetAddress(_name)); AdminFaucetAuthModule module = AdminFaucetAuthModule(artifacts.mustGetAddress(_name));
if (_faucet.isModuleEnabled(module)) { if (_faucet.isModuleEnabled(module)) {
console.log("%s already installed.", _name); console.log("%s already installed.", _name);
} else { } else {
......
GasBenchMark_L1BlockInterop_DepositsComplete:test_depositsComplete_benchmark() (gas: 7567) GasBenchMark_L1BlockInterop_DepositsComplete:test_depositsComplete_benchmark() (gas: 7567)
GasBenchMark_L1BlockInterop_DepositsComplete_Warm:test_depositsComplete_benchmark() (gas: 5567) GasBenchMark_L1BlockInterop_DepositsComplete_Warm:test_depositsComplete_benchmark() (gas: 5567)
GasBenchMark_L1BlockInterop_SetValuesInterop:test_setL1BlockValuesInterop_benchmark() (gas: 175677) GasBenchMark_L1BlockInterop_SetValuesInterop:test_setL1BlockValuesInterop_benchmark() (gas: 175722)
GasBenchMark_L1BlockInterop_SetValuesInterop_Warm:test_setL1BlockValuesInterop_benchmark() (gas: 5099) GasBenchMark_L1BlockInterop_SetValuesInterop_Warm:test_setL1BlockValuesInterop_benchmark() (gas: 5144)
GasBenchMark_L1Block_SetValuesEcotone:test_setL1BlockValuesEcotone_benchmark() (gas: 158531) GasBenchMark_L1Block_SetValuesEcotone:test_setL1BlockValuesEcotone_benchmark() (gas: 158531)
GasBenchMark_L1Block_SetValuesEcotone_Warm:test_setL1BlockValuesEcotone_benchmark() (gas: 7597) GasBenchMark_L1Block_SetValuesEcotone_Warm:test_setL1BlockValuesEcotone_benchmark() (gas: 7597)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 369309) GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 369264)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2967471) GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2967493)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 564458) GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 564413)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4076606) GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4076606)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 467070) GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 467092)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3512819) GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3512819)
GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 72667) GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 72667)
\ No newline at end of file
...@@ -57,7 +57,7 @@ contract DataAvailabilityChallengeTest is CommonTest { ...@@ -57,7 +57,7 @@ contract DataAvailabilityChallengeTest is CommonTest {
// EntryPoint will revert if using amount > type(uint112).max. // EntryPoint will revert if using amount > type(uint112).max.
vm.assume(sender != Preinstalls.EntryPoint_v060); vm.assume(sender != Preinstalls.EntryPoint_v060);
vm.assume(sender != address(dataAvailabilityChallenge)); vm.assume(sender != address(dataAvailabilityChallenge));
vm.assume(sender != deploy.mustGetAddress("DataAvailabilityChallengeImpl")); vm.assume(sender != artifacts.mustGetAddress("DataAvailabilityChallengeImpl"));
vm.deal(sender, amount); vm.deal(sender, amount);
vm.prank(sender); vm.prank(sender);
......
...@@ -29,7 +29,7 @@ contract L1CrossDomainMessenger_Test is CommonTest { ...@@ -29,7 +29,7 @@ contract L1CrossDomainMessenger_Test is CommonTest {
/// @notice Marked virtual to be overridden in /// @notice Marked virtual to be overridden in
/// test/kontrol/deployment/DeploymentSummary.t.sol /// test/kontrol/deployment/DeploymentSummary.t.sol
function test_constructor_succeeds() external virtual { function test_constructor_succeeds() external virtual {
IL1CrossDomainMessenger impl = IL1CrossDomainMessenger(deploy.mustGetAddress("L1CrossDomainMessengerImpl")); IL1CrossDomainMessenger impl = IL1CrossDomainMessenger(artifacts.mustGetAddress("L1CrossDomainMessengerImpl"));
assertEq(address(impl.superchainConfig()), address(0)); assertEq(address(impl.superchainConfig()), address(0));
assertEq(address(impl.PORTAL()), address(0)); assertEq(address(impl.PORTAL()), address(0));
assertEq(address(impl.portal()), address(0)); assertEq(address(impl.portal()), address(0));
......
...@@ -69,7 +69,7 @@ contract L1ERC721Bridge_Test is CommonTest { ...@@ -69,7 +69,7 @@ contract L1ERC721Bridge_Test is CommonTest {
/// @notice Marked virtual to be overridden in /// @notice Marked virtual to be overridden in
/// test/kontrol/deployment/DeploymentSummary.t.sol /// test/kontrol/deployment/DeploymentSummary.t.sol
function test_constructor_succeeds() public virtual { function test_constructor_succeeds() public virtual {
IL1ERC721Bridge impl = IL1ERC721Bridge(deploy.mustGetAddress("L1ERC721BridgeImpl")); IL1ERC721Bridge impl = IL1ERC721Bridge(artifacts.mustGetAddress("L1ERC721BridgeImpl"));
assertEq(address(impl.MESSENGER()), address(0)); assertEq(address(impl.MESSENGER()), address(0));
assertEq(address(impl.messenger()), address(0)); assertEq(address(impl.messenger()), address(0));
assertEq(address(impl.superchainConfig()), address(0)); assertEq(address(impl.superchainConfig()), address(0));
......
...@@ -38,7 +38,7 @@ contract L1StandardBridge_Initialize_Test is CommonTest { ...@@ -38,7 +38,7 @@ contract L1StandardBridge_Initialize_Test is CommonTest {
/// @notice Marked virtual to be overridden in /// @notice Marked virtual to be overridden in
/// test/kontrol/deployment/DeploymentSummary.t.sol /// test/kontrol/deployment/DeploymentSummary.t.sol
function test_constructor_succeeds() external virtual { function test_constructor_succeeds() external virtual {
IL1StandardBridge impl = IL1StandardBridge(deploy.mustGetAddress("L1StandardBridgeImpl")); IL1StandardBridge impl = IL1StandardBridge(artifacts.mustGetAddress("L1StandardBridgeImpl"));
assertEq(address(impl.superchainConfig()), address(0)); assertEq(address(impl.superchainConfig()), address(0));
// The constructor now uses _disableInitializers, whereas OP Mainnet has these values in storage // The constructor now uses _disableInitializers, whereas OP Mainnet has these values in storage
......
...@@ -42,7 +42,7 @@ contract OptimismPortal2_Test is CommonTest { ...@@ -42,7 +42,7 @@ contract OptimismPortal2_Test is CommonTest {
/// @notice Marked virtual to be overridden in /// @notice Marked virtual to be overridden in
/// test/kontrol/deployment/DeploymentSummary.t.sol /// test/kontrol/deployment/DeploymentSummary.t.sol
function test_constructor_succeeds() external virtual { function test_constructor_succeeds() external virtual {
IOptimismPortal2 opImpl = IOptimismPortal2(payable(deploy.mustGetAddress("OptimismPortal2Impl"))); IOptimismPortal2 opImpl = IOptimismPortal2(payable(artifacts.mustGetAddress("OptimismPortal2Impl")));
assertEq(address(opImpl.disputeGameFactory()), address(0)); assertEq(address(opImpl.disputeGameFactory()), address(0));
assertEq(address(opImpl.systemConfig()), address(0)); assertEq(address(opImpl.systemConfig()), address(0));
assertEq(address(opImpl.superchainConfig()), address(0)); assertEq(address(opImpl.superchainConfig()), address(0));
......
...@@ -28,7 +28,7 @@ contract ProtocolVersions_Initialize_Test is ProtocolVersions_Init { ...@@ -28,7 +28,7 @@ contract ProtocolVersions_Initialize_Test is ProtocolVersions_Init {
skipIfForkTest( skipIfForkTest(
"ProtocolVersions_Initialize_Test: cannot test initialization on forked network against hardhat config" "ProtocolVersions_Initialize_Test: cannot test initialization on forked network against hardhat config"
); );
IProtocolVersions protocolVersionsImpl = IProtocolVersions(deploy.mustGetAddress("ProtocolVersionsImpl")); IProtocolVersions protocolVersionsImpl = IProtocolVersions(artifacts.mustGetAddress("ProtocolVersionsImpl"));
address owner = deploy.cfg().finalSystemOwner(); address owner = deploy.cfg().finalSystemOwner();
assertEq(ProtocolVersion.unwrap(protocolVersions.required()), ProtocolVersion.unwrap(required)); assertEq(ProtocolVersion.unwrap(protocolVersions.required()), ProtocolVersion.unwrap(required));
...@@ -42,7 +42,7 @@ contract ProtocolVersions_Initialize_Test is ProtocolVersions_Init { ...@@ -42,7 +42,7 @@ contract ProtocolVersions_Initialize_Test is ProtocolVersions_Init {
/// @dev Ensures that the events are emitted during initialization. /// @dev Ensures that the events are emitted during initialization.
function test_initialize_events_succeeds() external { function test_initialize_events_succeeds() external {
IProtocolVersions protocolVersionsImpl = IProtocolVersions(deploy.mustGetAddress("ProtocolVersionsImpl")); IProtocolVersions protocolVersionsImpl = IProtocolVersions(artifacts.mustGetAddress("ProtocolVersionsImpl"));
// Wipe out the initialized slot so the proxy can be initialized again // Wipe out the initialized slot so the proxy can be initialized again
vm.store(address(protocolVersions), bytes32(0), bytes32(0)); vm.store(address(protocolVersions), bytes32(0), bytes32(0));
......
...@@ -42,8 +42,8 @@ contract SystemConfig_Initialize_Test is SystemConfig_Init { ...@@ -42,8 +42,8 @@ contract SystemConfig_Initialize_Test is SystemConfig_Init {
batcherHash = bytes32(uint256(uint160(deploy.cfg().batchSenderAddress()))); batcherHash = bytes32(uint256(uint160(deploy.cfg().batchSenderAddress())));
gasLimit = uint64(deploy.cfg().l2GenesisBlockGasLimit()); gasLimit = uint64(deploy.cfg().l2GenesisBlockGasLimit());
unsafeBlockSigner = deploy.cfg().p2pSequencerAddress(); unsafeBlockSigner = deploy.cfg().p2pSequencerAddress();
systemConfigImpl = deploy.mustGetAddress("SystemConfigImpl"); systemConfigImpl = artifacts.mustGetAddress("SystemConfigImpl");
optimismMintableERC20Factory = deploy.mustGetAddress("OptimismMintableERC20FactoryProxy"); optimismMintableERC20Factory = artifacts.mustGetAddress("OptimismMintableERC20FactoryProxy");
} }
/// @dev Tests that constructor sets the correct values. /// @dev Tests that constructor sets the correct values.
......
...@@ -24,7 +24,7 @@ contract L2CrossDomainMessenger_Test is CommonTest { ...@@ -24,7 +24,7 @@ contract L2CrossDomainMessenger_Test is CommonTest {
/// @dev Tests that the implementation is initialized correctly. /// @dev Tests that the implementation is initialized correctly.
function test_constructor_succeeds() external view { function test_constructor_succeeds() external view {
IL2CrossDomainMessenger impl = IL2CrossDomainMessenger impl =
IL2CrossDomainMessenger(EIP1967Helper.getImplementation(deploy.mustGetAddress("L2CrossDomainMessenger"))); IL2CrossDomainMessenger(EIP1967Helper.getImplementation(artifacts.mustGetAddress("L2CrossDomainMessenger")));
assertEq(address(impl.OTHER_MESSENGER()), address(0)); assertEq(address(impl.OTHER_MESSENGER()), address(0));
assertEq(address(impl.otherMessenger()), address(0)); assertEq(address(impl.otherMessenger()), address(0));
assertEq(address(impl.l1CrossDomainMessenger()), address(0)); assertEq(address(impl.l1CrossDomainMessenger()), address(0));
......
...@@ -27,7 +27,7 @@ contract L2StandardBridge_Test is CommonTest { ...@@ -27,7 +27,7 @@ contract L2StandardBridge_Test is CommonTest {
/// @dev Test that the bridge's constructor sets the correct values. /// @dev Test that the bridge's constructor sets the correct values.
function test_constructor_succeeds() external view { function test_constructor_succeeds() external view {
IL2StandardBridge impl = IL2StandardBridge impl =
IL2StandardBridge(payable(EIP1967Helper.getImplementation(deploy.mustGetAddress("L2StandardBridge")))); IL2StandardBridge(payable(EIP1967Helper.getImplementation(artifacts.mustGetAddress("L2StandardBridge"))));
// The implementation contract is initialized with a 0 L1 bridge address, // The implementation contract is initialized with a 0 L1 bridge address,
// but the L2 cross-domain-messenger is always set to the predeploy address for both proxy and implementation. // but the L2 cross-domain-messenger is always set to the predeploy address for both proxy and implementation.
assertEq(address(impl.MESSENGER()), Predeploys.L2_CROSS_DOMAIN_MESSENGER, "constructor zero check MESSENGER"); assertEq(address(impl.MESSENGER()), Predeploys.L2_CROSS_DOMAIN_MESSENGER, "constructor zero check MESSENGER");
......
...@@ -106,7 +106,7 @@ contract PredeploysBaseTest is CommonTest { ...@@ -106,7 +106,7 @@ contract PredeploysBaseTest is CommonTest {
} }
if (_isInitializable(addr)) { if (_isInitializable(addr)) {
assertEq(l2Genesis.loadInitializedSlot({ _sourceName: cname, _deploymentName: cname }), uint8(1)); assertEq(artifacts.loadInitializedSlot({ _sourceName: cname, _deploymentName: cname }), uint8(1));
} }
} }
} }
......
...@@ -43,8 +43,8 @@ contract DeployOwnershipTest is Test, DeployOwnership { ...@@ -43,8 +43,8 @@ contract DeployOwnershipTest is Test, DeployOwnership {
/// @dev Test the example Foundation Safe configurations, against the expected configuration, and /// @dev Test the example Foundation Safe configurations, against the expected configuration, and
/// check that they both have the same configuration. /// check that they both have the same configuration.
function test_exampleFoundationSafes_configuration_succeeds() public { function test_exampleFoundationSafes_configuration_succeeds() public {
Safe upgradeSafe = Safe(payable(mustGetAddress("FoundationUpgradeSafe"))); Safe upgradeSafe = Safe(payable(artifacts.mustGetAddress("FoundationUpgradeSafe")));
Safe operationsSafe = Safe(payable(mustGetAddress("FoundationOperationsSafe"))); Safe operationsSafe = Safe(payable(artifacts.mustGetAddress("FoundationOperationsSafe")));
SafeConfig memory exampleFoundationConfig = _getExampleFoundationConfig(); SafeConfig memory exampleFoundationConfig = _getExampleFoundationConfig();
// Ensure the safes both match the example configuration // Ensure the safes both match the example configuration
...@@ -58,13 +58,13 @@ contract DeployOwnershipTest is Test, DeployOwnership { ...@@ -58,13 +58,13 @@ contract DeployOwnershipTest is Test, DeployOwnership {
/// @dev Test the example Security Council Safe configuration. /// @dev Test the example Security Council Safe configuration.
function test_exampleSecurityCouncilSafe_configuration_succeeds() public { function test_exampleSecurityCouncilSafe_configuration_succeeds() public {
Safe securityCouncilSafe = Safe(payable(mustGetAddress("SecurityCouncilSafe"))); Safe securityCouncilSafe = Safe(payable(artifacts.mustGetAddress("SecurityCouncilSafe")));
SecurityCouncilConfig memory exampleSecurityCouncilConfig = _getExampleCouncilConfig(); SecurityCouncilConfig memory exampleSecurityCouncilConfig = _getExampleCouncilConfig();
_checkSafeConfig(exampleSecurityCouncilConfig.safeConfig, securityCouncilSafe); _checkSafeConfig(exampleSecurityCouncilConfig.safeConfig, securityCouncilSafe);
// Guard Checks // Guard Checks
address livenessGuard = mustGetAddress("LivenessGuard"); address livenessGuard = artifacts.mustGetAddress("LivenessGuard");
// The Safe's getGuard method is internal, so we read directly from storage // The Safe's getGuard method is internal, so we read directly from storage
// https://github.com/safe-global/safe-contracts/blob/v1.4.0/contracts/base/GuardManager.sol#L66-L72 // https://github.com/safe-global/safe-contracts/blob/v1.4.0/contracts/base/GuardManager.sol#L66-L72
...@@ -77,7 +77,7 @@ contract DeployOwnershipTest is Test, DeployOwnership { ...@@ -77,7 +77,7 @@ contract DeployOwnershipTest is Test, DeployOwnership {
} }
// Module Checks // Module Checks
address livenessModule = mustGetAddress("LivenessModule"); address livenessModule = artifacts.mustGetAddress("LivenessModule");
(address[] memory modules, address nextModule) = (address[] memory modules, address nextModule) =
ModuleManager(securityCouncilSafe).getModulesPaginated(SENTINEL_MODULES, 2); ModuleManager(securityCouncilSafe).getModulesPaginated(SENTINEL_MODULES, 2);
assertEq(modules.length, 1); assertEq(modules.length, 1);
...@@ -97,14 +97,14 @@ contract DeployOwnershipTest is Test, DeployOwnership { ...@@ -97,14 +97,14 @@ contract DeployOwnershipTest is Test, DeployOwnership {
/// @dev Test the example Guardian Safe configuration. /// @dev Test the example Guardian Safe configuration.
function test_exampleGuardianSafe_configuration_succeeds() public view { function test_exampleGuardianSafe_configuration_succeeds() public view {
Safe guardianSafe = Safe(payable(mustGetAddress("GuardianSafe"))); Safe guardianSafe = Safe(payable(artifacts.mustGetAddress("GuardianSafe")));
address[] memory owners = new address[](1); address[] memory owners = new address[](1);
owners[0] = mustGetAddress("SecurityCouncilSafe"); owners[0] = artifacts.mustGetAddress("SecurityCouncilSafe");
GuardianConfig memory guardianConfig = _getExampleGuardianConfig(); GuardianConfig memory guardianConfig = _getExampleGuardianConfig();
_checkSafeConfig(guardianConfig.safeConfig, guardianSafe); _checkSafeConfig(guardianConfig.safeConfig, guardianSafe);
// DeputyGuardianModule checks // DeputyGuardianModule checks
address deputyGuardianModule = mustGetAddress("DeputyGuardianModule"); address deputyGuardianModule = artifacts.mustGetAddress("DeputyGuardianModule");
(address[] memory modules, address nextModule) = (address[] memory modules, address nextModule) =
ModuleManager(guardianSafe).getModulesPaginated(SENTINEL_MODULES, 2); ModuleManager(guardianSafe).getModulesPaginated(SENTINEL_MODULES, 2);
assertEq(modules.length, 1); assertEq(modules.length, 1);
......
...@@ -57,21 +57,25 @@ contract ForkLive is Deployer { ...@@ -57,21 +57,25 @@ contract ForkLive is Deployer {
// Superchain shared contracts // Superchain shared contracts
saveProxyAndImpl("SuperchainConfig", superchainToml, ".superchain_config_addr"); saveProxyAndImpl("SuperchainConfig", superchainToml, ".superchain_config_addr");
saveProxyAndImpl("ProtocolVersions", superchainToml, ".protocol_versions_addr"); saveProxyAndImpl("ProtocolVersions", superchainToml, ".protocol_versions_addr");
save("OPContractsManager", vm.parseTomlAddress(superchainToml, ".op_contracts_manager_proxy_addr")); artifacts.save("OPContractsManager", vm.parseTomlAddress(superchainToml, ".op_contracts_manager_proxy_addr"));
// Core contracts // Core contracts
save("ProxyAdmin", vm.parseTomlAddress(opToml, ".addresses.ProxyAdmin")); artifacts.save("ProxyAdmin", vm.parseTomlAddress(opToml, ".addresses.ProxyAdmin"));
saveProxyAndImpl("SystemConfig", opToml, ".addresses.SystemConfigProxy"); saveProxyAndImpl("SystemConfig", opToml, ".addresses.SystemConfigProxy");
// Bridge contracts // Bridge contracts
address optimismPortal = vm.parseTomlAddress(opToml, ".addresses.OptimismPortalProxy"); address optimismPortal = vm.parseTomlAddress(opToml, ".addresses.OptimismPortalProxy");
save("OptimismPortalProxy", optimismPortal); artifacts.save("OptimismPortalProxy", optimismPortal);
save("OptimismPortal2Impl", EIP1967Helper.getImplementation(optimismPortal)); artifacts.save("OptimismPortal2Impl", EIP1967Helper.getImplementation(optimismPortal));
address addressManager = vm.parseTomlAddress(opToml, ".addresses.AddressManager"); address addressManager = vm.parseTomlAddress(opToml, ".addresses.AddressManager");
save("AddressManager", addressManager); artifacts.save("AddressManager", addressManager);
save("L1CrossDomainMessengerImpl", IAddressManager(addressManager).getAddress("OVM_L1CrossDomainMessenger")); artifacts.save(
save("L1CrossDomainMessengerProxy", vm.parseTomlAddress(opToml, ".addresses.L1CrossDomainMessengerProxy")); "L1CrossDomainMessengerImpl", IAddressManager(addressManager).getAddress("OVM_L1CrossDomainMessenger")
);
artifacts.save(
"L1CrossDomainMessengerProxy", vm.parseTomlAddress(opToml, ".addresses.L1CrossDomainMessengerProxy")
);
saveProxyAndImpl("OptimismMintableERC20Factory", opToml, ".addresses.OptimismMintableERC20FactoryProxy"); saveProxyAndImpl("OptimismMintableERC20Factory", opToml, ".addresses.OptimismMintableERC20FactoryProxy");
saveProxyAndImpl("L1StandardBridge", opToml, ".addresses.L1StandardBridgeProxy"); saveProxyAndImpl("L1StandardBridge", opToml, ".addresses.L1StandardBridgeProxy");
saveProxyAndImpl("L1ERC721Bridge", opToml, ".addresses.L1ERC721BridgeProxy"); saveProxyAndImpl("L1ERC721Bridge", opToml, ".addresses.L1ERC721BridgeProxy");
...@@ -82,16 +86,17 @@ contract ForkLive is Deployer { ...@@ -82,16 +86,17 @@ contract ForkLive is Deployer {
saveProxyAndImpl("DelayedWETH", opToml, ".addresses.DelayedWETHProxy"); saveProxyAndImpl("DelayedWETH", opToml, ".addresses.DelayedWETHProxy");
// Fault proof non-proxied contracts // Fault proof non-proxied contracts
save("PreimageOracle", vm.parseTomlAddress(opToml, ".addresses.PreimageOracle")); artifacts.save("PreimageOracle", vm.parseTomlAddress(opToml, ".addresses.PreimageOracle"));
save("MipsSingleton", vm.parseTomlAddress(opToml, ".addresses.MIPS")); artifacts.save("MipsSingleton", vm.parseTomlAddress(opToml, ".addresses.MIPS"));
IDisputeGameFactory disputeGameFactory = IDisputeGameFactory(mustGetAddress("DisputeGameFactoryProxy")); IDisputeGameFactory disputeGameFactory =
save("FaultDisputeGame", vm.parseTomlAddress(opToml, ".addresses.FaultDisputeGame")); IDisputeGameFactory(artifacts.mustGetAddress("DisputeGameFactoryProxy"));
artifacts.save("FaultDisputeGame", vm.parseTomlAddress(opToml, ".addresses.FaultDisputeGame"));
// The PermissionedDisputeGame and PermissionedDelayedWETHProxy are not listed in the registry for OP, so we // The PermissionedDisputeGame and PermissionedDelayedWETHProxy are not listed in the registry for OP, so we
// look it up onchain // look it up onchain
IFaultDisputeGame permissionedDisputeGame = IFaultDisputeGame permissionedDisputeGame =
IFaultDisputeGame(address(disputeGameFactory.gameImpls(GameTypes.PERMISSIONED_CANNON))); IFaultDisputeGame(address(disputeGameFactory.gameImpls(GameTypes.PERMISSIONED_CANNON)));
save("PermissionedDisputeGame", address(permissionedDisputeGame)); artifacts.save("PermissionedDisputeGame", address(permissionedDisputeGame));
save("PermissionedDelayedWETHProxy", address(permissionedDisputeGame.weth())); artifacts.save("PermissionedDelayedWETHProxy", address(permissionedDisputeGame.weth()));
} }
/// @notice Saves the proxy and implementation addresses for a contract name /// @notice Saves the proxy and implementation addresses for a contract name
...@@ -100,9 +105,9 @@ contract ForkLive is Deployer { ...@@ -100,9 +105,9 @@ contract ForkLive is Deployer {
/// @param _tomlKey The key in the superchain config file to get the proxy address /// @param _tomlKey The key in the superchain config file to get the proxy address
function saveProxyAndImpl(string memory _contractName, string memory _tomlPath, string memory _tomlKey) internal { function saveProxyAndImpl(string memory _contractName, string memory _tomlPath, string memory _tomlKey) internal {
address proxy = vm.parseTomlAddress(_tomlPath, _tomlKey); address proxy = vm.parseTomlAddress(_tomlPath, _tomlKey);
save(string.concat(_contractName, "Proxy"), proxy); artifacts.save(string.concat(_contractName, "Proxy"), proxy);
address impl = EIP1967Helper.getImplementation(proxy); address impl = EIP1967Helper.getImplementation(proxy);
require(impl != address(0), "Upgrade: Implementation address is zero"); require(impl != address(0), "Upgrade: Implementation address is zero");
save(string.concat(_contractName, "Impl"), impl); artifacts.save(string.concat(_contractName, "Impl"), impl);
} }
} }
...@@ -11,7 +11,7 @@ import { ForkLive } from "test/setup/ForkLive.s.sol"; ...@@ -11,7 +11,7 @@ import { ForkLive } from "test/setup/ForkLive.s.sol";
import { Fork, LATEST_FORK } from "scripts/libraries/Config.sol"; import { Fork, LATEST_FORK } from "scripts/libraries/Config.sol";
import { L2Genesis, L1Dependencies } from "scripts/L2Genesis.s.sol"; import { L2Genesis, L1Dependencies } from "scripts/L2Genesis.s.sol";
import { OutputMode, Fork, ForkUtils } from "scripts/libraries/Config.sol"; import { OutputMode, Fork, ForkUtils } from "scripts/libraries/Config.sol";
import { Artifacts } from "scripts/Artifacts.s.sol";
// Libraries // Libraries
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { Preinstalls } from "src/libraries/Preinstalls.sol"; import { Preinstalls } from "src/libraries/Preinstalls.sol";
...@@ -65,6 +65,11 @@ contract Setup { ...@@ -65,6 +65,11 @@ contract Setup {
/// mutating any nonces. MUST not have constructor logic. /// mutating any nonces. MUST not have constructor logic.
Deploy internal constant deploy = Deploy(address(uint160(uint256(keccak256(abi.encode("optimism.deploy")))))); Deploy internal constant deploy = Deploy(address(uint160(uint256(keccak256(abi.encode("optimism.deploy"))))));
/// @notice The address of the Artifacts contract. Set into state by Deployer.setUp() with `etch` to avoid
/// mutating any nonces. MUST not have constructor logic.
Artifacts public constant artifacts =
Artifacts(address(uint160(uint256(keccak256(abi.encode("optimism.artifacts"))))));
L2Genesis internal constant l2Genesis = L2Genesis internal constant l2Genesis =
L2Genesis(address(uint160(uint256(keccak256(abi.encode("optimism.l2genesis")))))); L2Genesis(address(uint160(uint256(keccak256(abi.encode("optimism.l2genesis"))))));
...@@ -149,7 +154,7 @@ contract Setup { ...@@ -149,7 +154,7 @@ contract Setup {
// deploy.setUp() will either: // deploy.setUp() will either:
// 1. deploy a fresh system or // 1. deploy a fresh system or
// 2. fork from L1 // 2. fork from L1
// It will then save the appropriate name/address pairs to disk using Artifacts.save() // It will then save the appropriate name/address pairs to disk using artifacts.save()
deploy.setUp(); deploy.setUp();
console.log("Setup: L1 setup done!"); console.log("Setup: L1 setup done!");
...@@ -197,26 +202,26 @@ contract Setup { ...@@ -197,26 +202,26 @@ contract Setup {
deploy.run(); deploy.run();
console.log("Setup: completed L1 deployment, registering addresses now"); console.log("Setup: completed L1 deployment, registering addresses now");
optimismPortal2 = IOptimismPortal2(deploy.mustGetAddress("OptimismPortalProxy")); optimismPortal2 = IOptimismPortal2(artifacts.mustGetAddress("OptimismPortalProxy"));
systemConfig = ISystemConfig(deploy.mustGetAddress("SystemConfigProxy")); systemConfig = ISystemConfig(artifacts.mustGetAddress("SystemConfigProxy"));
l1StandardBridge = IL1StandardBridge(deploy.mustGetAddress("L1StandardBridgeProxy")); l1StandardBridge = IL1StandardBridge(artifacts.mustGetAddress("L1StandardBridgeProxy"));
l1CrossDomainMessenger = IL1CrossDomainMessenger(deploy.mustGetAddress("L1CrossDomainMessengerProxy")); l1CrossDomainMessenger = IL1CrossDomainMessenger(artifacts.mustGetAddress("L1CrossDomainMessengerProxy"));
vm.label( vm.label(
AddressAliasHelper.applyL1ToL2Alias(address(l1CrossDomainMessenger)), "L1CrossDomainMessengerProxy_aliased" AddressAliasHelper.applyL1ToL2Alias(address(l1CrossDomainMessenger)), "L1CrossDomainMessengerProxy_aliased"
); );
addressManager = IAddressManager(deploy.mustGetAddress("AddressManager")); addressManager = IAddressManager(artifacts.mustGetAddress("AddressManager"));
l1ERC721Bridge = IL1ERC721Bridge(deploy.mustGetAddress("L1ERC721BridgeProxy")); l1ERC721Bridge = IL1ERC721Bridge(artifacts.mustGetAddress("L1ERC721BridgeProxy"));
l1OptimismMintableERC20Factory = l1OptimismMintableERC20Factory =
IOptimismMintableERC20Factory(deploy.mustGetAddress("OptimismMintableERC20FactoryProxy")); IOptimismMintableERC20Factory(artifacts.mustGetAddress("OptimismMintableERC20FactoryProxy"));
protocolVersions = IProtocolVersions(deploy.mustGetAddress("ProtocolVersionsProxy")); protocolVersions = IProtocolVersions(artifacts.mustGetAddress("ProtocolVersionsProxy"));
superchainConfig = ISuperchainConfig(deploy.mustGetAddress("SuperchainConfigProxy")); superchainConfig = ISuperchainConfig(artifacts.mustGetAddress("SuperchainConfigProxy"));
anchorStateRegistry = IAnchorStateRegistry(deploy.mustGetAddress("AnchorStateRegistryProxy")); anchorStateRegistry = IAnchorStateRegistry(artifacts.mustGetAddress("AnchorStateRegistryProxy"));
disputeGameFactory = IDisputeGameFactory(deploy.mustGetAddress("DisputeGameFactoryProxy")); disputeGameFactory = IDisputeGameFactory(artifacts.mustGetAddress("DisputeGameFactoryProxy"));
delayedWeth = IDelayedWETH(deploy.mustGetAddress("DelayedWETHProxy")); delayedWeth = IDelayedWETH(artifacts.mustGetAddress("DelayedWETHProxy"));
if (deploy.cfg().useAltDA()) { if (deploy.cfg().useAltDA()) {
dataAvailabilityChallenge = dataAvailabilityChallenge =
IDataAvailabilityChallenge(deploy.mustGetAddress("DataAvailabilityChallengeProxy")); IDataAvailabilityChallenge(artifacts.mustGetAddress("DataAvailabilityChallengeProxy"));
} }
console.log("Setup: registered L1 deployments"); console.log("Setup: registered L1 deployments");
} }
......
...@@ -33,7 +33,7 @@ contract OptimismMintableTokenFactory_Test is CommonTest { ...@@ -33,7 +33,7 @@ contract OptimismMintableTokenFactory_Test is CommonTest {
/// @notice Tests that the upgrade is successful. /// @notice Tests that the upgrade is successful.
function test_upgrading_succeeds() external { function test_upgrading_succeeds() external {
IProxy proxy = IProxy(deploy.mustGetAddress("OptimismMintableERC20FactoryProxy")); IProxy proxy = IProxy(artifacts.mustGetAddress("OptimismMintableERC20FactoryProxy"));
// Check an unused slot before upgrading. // Check an unused slot before upgrading.
bytes32 slot21Before = vm.load(address(l1OptimismMintableERC20Factory), bytes32(uint256(21))); bytes32 slot21Before = vm.load(address(l1OptimismMintableERC20Factory), bytes32(uint256(21)));
assertEq(bytes32(0), slot21Before); assertEq(bytes32(0), slot21Before);
......
...@@ -57,7 +57,7 @@ contract Initializer_Test is CommonTest { ...@@ -57,7 +57,7 @@ contract Initializer_Test is CommonTest {
contracts.push( contracts.push(
InitializeableContract({ InitializeableContract({
name: "SuperchainConfigImpl", name: "SuperchainConfigImpl",
target: deploy.mustGetAddress("SuperchainConfigImpl"), target: artifacts.mustGetAddress("SuperchainConfigImpl"),
initCalldata: abi.encodeCall(superchainConfig.initialize, (address(0), false)) initCalldata: abi.encodeCall(superchainConfig.initialize, (address(0), false))
}) })
); );
...@@ -73,7 +73,7 @@ contract Initializer_Test is CommonTest { ...@@ -73,7 +73,7 @@ contract Initializer_Test is CommonTest {
contracts.push( contracts.push(
InitializeableContract({ InitializeableContract({
name: "L1CrossDomainMessengerImpl", name: "L1CrossDomainMessengerImpl",
target: deploy.mustGetAddress("L1CrossDomainMessengerImpl"), target: artifacts.mustGetAddress("L1CrossDomainMessengerImpl"),
initCalldata: abi.encodeCall( initCalldata: abi.encodeCall(
l1CrossDomainMessenger.initialize, (superchainConfig, optimismPortal2, systemConfig) l1CrossDomainMessenger.initialize, (superchainConfig, optimismPortal2, systemConfig)
) )
...@@ -93,7 +93,7 @@ contract Initializer_Test is CommonTest { ...@@ -93,7 +93,7 @@ contract Initializer_Test is CommonTest {
contracts.push( contracts.push(
InitializeableContract({ InitializeableContract({
name: "DisputeGameFactoryImpl", name: "DisputeGameFactoryImpl",
target: deploy.mustGetAddress("DisputeGameFactoryImpl"), target: artifacts.mustGetAddress("DisputeGameFactoryImpl"),
initCalldata: abi.encodeCall(disputeGameFactory.initialize, (address(0))) initCalldata: abi.encodeCall(disputeGameFactory.initialize, (address(0)))
}) })
); );
...@@ -109,7 +109,7 @@ contract Initializer_Test is CommonTest { ...@@ -109,7 +109,7 @@ contract Initializer_Test is CommonTest {
contracts.push( contracts.push(
InitializeableContract({ InitializeableContract({
name: "DelayedWETHImpl", name: "DelayedWETHImpl",
target: deploy.mustGetAddress("DelayedWETHImpl"), target: artifacts.mustGetAddress("DelayedWETHImpl"),
initCalldata: abi.encodeCall(delayedWeth.initialize, (address(0), ISuperchainConfig(address(0)))) initCalldata: abi.encodeCall(delayedWeth.initialize, (address(0), ISuperchainConfig(address(0))))
}) })
); );
...@@ -125,7 +125,7 @@ contract Initializer_Test is CommonTest { ...@@ -125,7 +125,7 @@ contract Initializer_Test is CommonTest {
contracts.push( contracts.push(
InitializeableContract({ InitializeableContract({
name: "OptimismPortal2Impl", name: "OptimismPortal2Impl",
target: deploy.mustGetAddress("OptimismPortal2Impl"), target: artifacts.mustGetAddress("OptimismPortal2Impl"),
initCalldata: abi.encodeCall( initCalldata: abi.encodeCall(
optimismPortal2.initialize, optimismPortal2.initialize,
( (
...@@ -157,7 +157,7 @@ contract Initializer_Test is CommonTest { ...@@ -157,7 +157,7 @@ contract Initializer_Test is CommonTest {
contracts.push( contracts.push(
InitializeableContract({ InitializeableContract({
name: "SystemConfigImpl", name: "SystemConfigImpl",
target: deploy.mustGetAddress("SystemConfigImpl"), target: artifacts.mustGetAddress("SystemConfigImpl"),
initCalldata: abi.encodeCall( initCalldata: abi.encodeCall(
systemConfig.initialize, systemConfig.initialize,
( (
...@@ -229,7 +229,7 @@ contract Initializer_Test is CommonTest { ...@@ -229,7 +229,7 @@ contract Initializer_Test is CommonTest {
contracts.push( contracts.push(
InitializeableContract({ InitializeableContract({
name: "ProtocolVersionsImpl", name: "ProtocolVersionsImpl",
target: deploy.mustGetAddress("ProtocolVersionsImpl"), target: artifacts.mustGetAddress("ProtocolVersionsImpl"),
initCalldata: abi.encodeCall( initCalldata: abi.encodeCall(
protocolVersions.initialize, (address(0), ProtocolVersion.wrap(1), ProtocolVersion.wrap(2)) protocolVersions.initialize, (address(0), ProtocolVersion.wrap(1), ProtocolVersion.wrap(2))
) )
...@@ -249,7 +249,7 @@ contract Initializer_Test is CommonTest { ...@@ -249,7 +249,7 @@ contract Initializer_Test is CommonTest {
contracts.push( contracts.push(
InitializeableContract({ InitializeableContract({
name: "L1StandardBridgeImpl", name: "L1StandardBridgeImpl",
target: deploy.mustGetAddress("L1StandardBridgeImpl"), target: artifacts.mustGetAddress("L1StandardBridgeImpl"),
initCalldata: abi.encodeCall( initCalldata: abi.encodeCall(
l1StandardBridge.initialize, (l1CrossDomainMessenger, superchainConfig, systemConfig) l1StandardBridge.initialize, (l1CrossDomainMessenger, superchainConfig, systemConfig)
) )
...@@ -269,7 +269,7 @@ contract Initializer_Test is CommonTest { ...@@ -269,7 +269,7 @@ contract Initializer_Test is CommonTest {
contracts.push( contracts.push(
InitializeableContract({ InitializeableContract({
name: "L1ERC721BridgeImpl", name: "L1ERC721BridgeImpl",
target: deploy.mustGetAddress("L1ERC721BridgeImpl"), target: artifacts.mustGetAddress("L1ERC721BridgeImpl"),
initCalldata: abi.encodeCall(l1ERC721Bridge.initialize, (l1CrossDomainMessenger, superchainConfig)) initCalldata: abi.encodeCall(l1ERC721Bridge.initialize, (l1CrossDomainMessenger, superchainConfig))
}) })
); );
...@@ -285,7 +285,7 @@ contract Initializer_Test is CommonTest { ...@@ -285,7 +285,7 @@ contract Initializer_Test is CommonTest {
contracts.push( contracts.push(
InitializeableContract({ InitializeableContract({
name: "OptimismMintableERC20FactoryImpl", name: "OptimismMintableERC20FactoryImpl",
target: deploy.mustGetAddress("OptimismMintableERC20FactoryImpl"), target: artifacts.mustGetAddress("OptimismMintableERC20FactoryImpl"),
initCalldata: abi.encodeCall(l1OptimismMintableERC20Factory.initialize, (address(l1StandardBridge))) initCalldata: abi.encodeCall(l1OptimismMintableERC20Factory.initialize, (address(l1StandardBridge)))
}) })
); );
...@@ -301,7 +301,7 @@ contract Initializer_Test is CommonTest { ...@@ -301,7 +301,7 @@ contract Initializer_Test is CommonTest {
contracts.push( contracts.push(
InitializeableContract({ InitializeableContract({
name: "DataAvailabilityChallengeImpl", name: "DataAvailabilityChallengeImpl",
target: deploy.mustGetAddress("DataAvailabilityChallengeImpl"), target: artifacts.mustGetAddress("DataAvailabilityChallengeImpl"),
initCalldata: abi.encodeCall(dataAvailabilityChallenge.initialize, (address(0), 0, 0, 0, 0)) initCalldata: abi.encodeCall(dataAvailabilityChallenge.initialize, (address(0), 0, 0, 0, 0))
}) })
); );
...@@ -418,7 +418,7 @@ contract Initializer_Test is CommonTest { ...@@ -418,7 +418,7 @@ contract Initializer_Test is CommonTest {
string memory deploymentName = _getRealContractName(_contract.name); string memory deploymentName = _getRealContractName(_contract.name);
// Grab the value of the "initialized" storage slot. // Grab the value of the "initialized" storage slot.
uint8 initializedSlotVal = deploy.loadInitializedSlot({ uint8 initializedSlotVal = artifacts.loadInitializedSlot({
_sourceName: _removeSuffix(deploymentName), _sourceName: _removeSuffix(deploymentName),
_deploymentName: deploymentName _deploymentName: deploymentName
}); });
......
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