Commit 21ea9dfa authored by Maurelian's avatar Maurelian

feat(ctb): Add phase2 function to MSD

parent 11135c6c
...@@ -285,7 +285,7 @@ contract SystemDictator is OwnableUpgradeable { ...@@ -285,7 +285,7 @@ contract SystemDictator is OwnableUpgradeable {
/** /**
* @notice Removes deprecated addresses from the AddressManager. * @notice Removes deprecated addresses from the AddressManager.
*/ */
function step3() external onlyOwner step(EXIT_1_NO_RETURN_STEP) { function step3() public onlyOwner step(EXIT_1_NO_RETURN_STEP) {
// Remove all deprecated addresses from the AddressManager // Remove all deprecated addresses from the AddressManager
string[17] memory deprecated = [ string[17] memory deprecated = [
"OVM_CanonicalTransactionChain", "OVM_CanonicalTransactionChain",
...@@ -315,7 +315,7 @@ contract SystemDictator is OwnableUpgradeable { ...@@ -315,7 +315,7 @@ contract SystemDictator is OwnableUpgradeable {
/** /**
* @notice Transfers system ownership to the ProxyAdmin. * @notice Transfers system ownership to the ProxyAdmin.
*/ */
function step4() external onlyOwner step(PROXY_TRANSFER_STEP) { function step4() public onlyOwner step(PROXY_TRANSFER_STEP) {
// Transfer ownership of the AddressManager to the ProxyAdmin. // Transfer ownership of the AddressManager to the ProxyAdmin.
config.globalConfig.addressManager.transferOwnership( config.globalConfig.addressManager.transferOwnership(
address(config.globalConfig.proxyAdmin) address(config.globalConfig.proxyAdmin)
...@@ -335,7 +335,7 @@ contract SystemDictator is OwnableUpgradeable { ...@@ -335,7 +335,7 @@ contract SystemDictator is OwnableUpgradeable {
/** /**
* @notice Upgrades and initializes proxy contracts. * @notice Upgrades and initializes proxy contracts.
*/ */
function step5() external onlyOwner step(5) { function step5() public onlyOwner step(5) {
// Dynamic config must be set before we can initialize the L2OutputOracle. // Dynamic config must be set before we can initialize the L2OutputOracle.
require(dynamicConfigSet, "SystemDictator: dynamic oracle config is not yet initialized"); require(dynamicConfigSet, "SystemDictator: dynamic oracle config is not yet initialized");
...@@ -418,6 +418,15 @@ contract SystemDictator is OwnableUpgradeable { ...@@ -418,6 +418,15 @@ contract SystemDictator is OwnableUpgradeable {
step2(); step2();
} }
/**
* @notice Calls the next remaings steps of the migration process.
*/
function phase2() external onlyOwner {
step3();
step4();
step5();
}
/** /**
* @notice Tranfers admin ownership to the final owner. * @notice Tranfers admin ownership to the final owner.
*/ */
......
...@@ -12,10 +12,11 @@ import { ...@@ -12,10 +12,11 @@ import {
getContractsFromArtifacts, getContractsFromArtifacts,
printJsonTransaction, printJsonTransaction,
isStep, isStep,
doStep,
printTenderlySimulationLink, printTenderlySimulationLink,
printCastCommand, printCastCommand,
liveDeployer, liveDeployer,
doPhase,
isStartOfPhase,
} from '../src/deploy-utils' } from '../src/deploy-utils'
const deployFn: DeployFunction = async (hre) => { const deployFn: DeployFunction = async (hre) => {
...@@ -92,7 +93,7 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -92,7 +93,7 @@ const deployFn: DeployFunction = async (hre) => {
// Make sure the dynamic system configuration has been set. // Make sure the dynamic system configuration has been set.
if ( if (
(await isStep(SystemDictator, 5)) && (await isStartOfPhase(SystemDictator, 2)) &&
!(await SystemDictator.dynamicConfigSet()) !(await SystemDictator.dynamicConfigSet())
) { ) {
console.log(` console.log(`
...@@ -169,17 +170,25 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -169,17 +170,25 @@ const deployFn: DeployFunction = async (hre) => {
) )
} }
// Step 3 clears out some state from the AddressManager. await doPhase({
await doStep({
isLiveDeployer, isLiveDeployer,
SystemDictator, SystemDictator,
step: 3, phase: 2,
message: ` message: `
Phase 2 includes the following steps:
Step 3 will clear out some legacy state from the AddressManager. Once you execute this step, Step 3 will clear out some legacy state from the AddressManager. Once you execute this step,
you WILL NOT BE ABLE TO RESTART THE SYSTEM using exit1(). You should confirm that the L2 you WILL NOT BE ABLE TO RESTART THE SYSTEM using exit1(). You should confirm that the L2
system is entirely operational before executing this step. system is entirely operational before executing this step.
Step 4 will transfer ownership of the AddressManager and L1StandardBridge to the ProxyAdmin.
Step 5 will initialize all Bedrock contracts. After this step is executed, the OptimismPortal
will be open for deposits but withdrawals will be paused if deploying a production network.
The Proposer will also be able to submit L2 outputs to the L2OutputOracle.
`, `,
checks: async () => { checks: async () => {
// Step 3 checks
const deads = [ const deads = [
'OVM_CanonicalTransactionChain', 'OVM_CanonicalTransactionChain',
'OVM_L2CrossDomainMessenger', 'OVM_L2CrossDomainMessenger',
...@@ -203,18 +212,8 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -203,18 +212,8 @@ const deployFn: DeployFunction = async (hre) => {
const addr = await AddressManager.getAddress(dead) const addr = await AddressManager.getAddress(dead)
assert(addr === ethers.constants.AddressZero) assert(addr === ethers.constants.AddressZero)
} }
},
})
// Step 4 transfers ownership of the AddressManager and L1StandardBridge to the ProxyAdmin. // Step 4 checks
await doStep({
isLiveDeployer,
SystemDictator,
step: 4,
message: `
Step 4 will transfer ownership of the AddressManager and L1StandardBridge to the ProxyAdmin.
`,
checks: async () => {
await assertContractVariable(AddressManager, 'owner', ProxyAdmin.address) await assertContractVariable(AddressManager, 'owner', ProxyAdmin.address)
assert( assert(
...@@ -222,20 +221,8 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -222,20 +221,8 @@ const deployFn: DeployFunction = async (hre) => {
from: ethers.constants.AddressZero, from: ethers.constants.AddressZero,
})) === ProxyAdmin.address })) === ProxyAdmin.address
) )
},
})
// Step 5 initializes all contracts. // Step 5 checks
await doStep({
isLiveDeployer,
SystemDictator,
step: 5,
message: `
Step 5 will initialize all Bedrock contracts. After this step is executed, the OptimismPortal
will be open for deposits but withdrawals will be paused if deploying a production network.
The Proposer will also be able to submit L2 outputs to the L2OutputOracle.
`,
checks: async () => {
// Check L2OutputOracle was initialized properly. // Check L2OutputOracle was initialized properly.
await assertContractVariable( await assertContractVariable(
L2OutputOracle, L2OutputOracle,
......
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