Commit 05e86e85 authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub

Merge pull request #3998 from ethereum-optimism/sc/ctb-msd-better-pause

fix(ctb): better XDM pause in MSD
parents dbb8721b 63d877a0
...@@ -49,15 +49,24 @@ contract MigrationSystemDictator is BaseSystemDictator { ...@@ -49,15 +49,24 @@ contract MigrationSystemDictator is BaseSystemDictator {
} }
/** /**
* @notice Pauses the system by shutting down the L1CrossDomainMessenger and clearing many * @notice Pauses the system by shutting down the L1CrossDomainMessenger and setting the
* addresses inside the AddressManager. * deposit halt flag to tell the Sequencer's DTL to stop accepting deposits.
*/ */
function step2() external onlyOwner step(2) { function step2() external onlyOwner step(2) {
// Pause the L1CrossDomainMessenger // Temporarily brick the L1CrossDomainMessenger by setting its implementation address to
L1CrossDomainMessenger(config.proxyAddressConfig.l1CrossDomainMessengerProxy).pause(); // address(0) which will cause the ResolvedDelegateProxy to revert. Better than pausing
// the L1CrossDomainMessenger via pause() because it can be easily reverted.
config.globalConfig.addressManager.setAddress("OVM_L1CrossDomainMessenger", address(0));
// TODO: Set the deposit halt flag.
}
// Remove all dead addresses from the AddressManager /**
string[18] memory deads = [ * @notice Removes deprecated addresses from the AddressManager.
*/
function step3() external onlyOwner step(3) {
// Remove all deprecated addresses from the AddressManager
string[18] memory deprecated = [
"Proxy__OVM_L1CrossDomainMessenger", "Proxy__OVM_L1CrossDomainMessenger",
"Proxy__OVM_L1StandardBridge", "Proxy__OVM_L1StandardBridge",
"OVM_CanonicalTransactionChain", "OVM_CanonicalTransactionChain",
...@@ -78,15 +87,15 @@ contract MigrationSystemDictator is BaseSystemDictator { ...@@ -78,15 +87,15 @@ contract MigrationSystemDictator is BaseSystemDictator {
"OVM_L1MultiMessageRelayer" "OVM_L1MultiMessageRelayer"
]; ];
for (uint256 i = 0; i < deads.length; i++) { for (uint256 i = 0; i < deprecated.length; i++) {
config.globalConfig.addressManager.setAddress(deads[i], address(0)); config.globalConfig.addressManager.setAddress(deprecated[i], address(0));
} }
} }
/** /**
* @notice Transfers system ownership to the ProxyAdmin. * @notice Transfers system ownership to the ProxyAdmin.
*/ */
function step3() external onlyOwner step(3) { function step4() external onlyOwner step(4) {
// 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)
...@@ -101,7 +110,11 @@ contract MigrationSystemDictator is BaseSystemDictator { ...@@ -101,7 +110,11 @@ contract MigrationSystemDictator is BaseSystemDictator {
/** /**
* @notice Upgrades and initializes proxy contracts. * @notice Upgrades and initializes proxy contracts.
*/ */
function step4() external onlyOwner step(4) { function step5() external onlyOwner step(5) {
// Pause the L1CrossDomainMessenger. Now we use the real pause() function because by the
// time we're done here we'll have access to the unpause() function.
L1CrossDomainMessenger(config.proxyAddressConfig.l1CrossDomainMessengerProxy).pause();
// Upgrade and initialize the L2OutputOracle. // Upgrade and initialize the L2OutputOracle.
config.globalConfig.proxyAdmin.upgradeAndCall( config.globalConfig.proxyAdmin.upgradeAndCall(
payable(config.proxyAddressConfig.l2OutputOracleProxy), payable(config.proxyAddressConfig.l2OutputOracleProxy),
...@@ -175,7 +188,7 @@ contract MigrationSystemDictator is BaseSystemDictator { ...@@ -175,7 +188,7 @@ contract MigrationSystemDictator is BaseSystemDictator {
/** /**
* @notice Unpauses the system at which point the system should be fully operational. * @notice Unpauses the system at which point the system should be fully operational.
*/ */
function step5() external onlyOwner step(5) { function step6() external onlyOwner step(6) {
// Unpause the L1CrossDomainMessenger. // Unpause the L1CrossDomainMessenger.
L1CrossDomainMessenger(config.proxyAddressConfig.l1CrossDomainMessengerProxy).unpause(); L1CrossDomainMessenger(config.proxyAddressConfig.l1CrossDomainMessengerProxy).unpause();
} }
...@@ -183,7 +196,7 @@ contract MigrationSystemDictator is BaseSystemDictator { ...@@ -183,7 +196,7 @@ contract MigrationSystemDictator is BaseSystemDictator {
/** /**
* @notice Tranfers admin ownership to the final owner. * @notice Tranfers admin ownership to the final owner.
*/ */
function step6() external onlyOwner step(6) { function step7() external onlyOwner step(7) {
// Transfer ownership of the L1CrossDomainMessenger to the final owner. // Transfer ownership of the L1CrossDomainMessenger to the final owner.
L1CrossDomainMessenger(config.proxyAddressConfig.l1CrossDomainMessengerProxy) L1CrossDomainMessenger(config.proxyAddressConfig.l1CrossDomainMessengerProxy)
.transferOwnership(config.globalConfig.finalOwner); .transferOwnership(config.globalConfig.finalOwner);
......
...@@ -188,7 +188,12 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -188,7 +188,12 @@ const deployFn: DeployFunction = async (hre) => {
) )
}, },
2: async () => { 2: async () => {
await assertContractVariable(L1CrossDomainMessenger, 'paused', true) assert(
(await AddressManager.getAddress('OVM_L1CrossDomainMessenger')) ===
ethers.constants.AddressZero
)
},
3: async () => {
const deads = [ const deads = [
'Proxy__OVM_L1CrossDomainMessenger', 'Proxy__OVM_L1CrossDomainMessenger',
'Proxy__OVM_L1StandardBridge', 'Proxy__OVM_L1StandardBridge',
...@@ -216,7 +221,7 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -216,7 +221,7 @@ const deployFn: DeployFunction = async (hre) => {
) )
} }
}, },
3: async () => { 4: async () => {
await assertContractVariable(AddressManager, 'owner', ProxyAdmin.address) await assertContractVariable(AddressManager, 'owner', ProxyAdmin.address)
assert( assert(
(await L1StandardBridgeProxy.callStatic.getOwner({ (await L1StandardBridgeProxy.callStatic.getOwner({
...@@ -224,7 +229,7 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -224,7 +229,7 @@ const deployFn: DeployFunction = async (hre) => {
})) === ProxyAdmin.address })) === ProxyAdmin.address
) )
}, },
4: async () => { 5: async () => {
// Check L2OutputOracle was initialized properly. // Check L2OutputOracle was initialized properly.
await assertContractVariable( await assertContractVariable(
L2OutputOracle, L2OutputOracle,
...@@ -279,6 +284,7 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -279,6 +284,7 @@ const deployFn: DeployFunction = async (hre) => {
) )
// Check L1CrossDomainMessenger was initialized properly. // Check L1CrossDomainMessenger was initialized properly.
await assertContractVariable(L1CrossDomainMessenger, 'paused', true)
try { try {
await L1CrossDomainMessenger.xDomainMessageSender() await L1CrossDomainMessenger.xDomainMessageSender()
assert(false, `L1CrossDomainMessenger was not initialized properly`) assert(false, `L1CrossDomainMessenger was not initialized properly`)
...@@ -318,10 +324,10 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -318,10 +324,10 @@ const deployFn: DeployFunction = async (hre) => {
L1CrossDomainMessenger.address L1CrossDomainMessenger.address
) )
}, },
5: async () => { 6: async () => {
await assertContractVariable(L1CrossDomainMessenger, 'paused', false) await assertContractVariable(L1CrossDomainMessenger, 'paused', false)
}, },
6: async () => { 7: async () => {
await assertContractVariable( await assertContractVariable(
L1CrossDomainMessenger, L1CrossDomainMessenger,
'owner', 'owner',
...@@ -335,7 +341,7 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -335,7 +341,7 @@ const deployFn: DeployFunction = async (hre) => {
}, },
} }
for (let i = 1; i <= 6; i++) { for (let i = 1; i <= 7; i++) {
if ((await MigrationSystemDictator.currentStep()) === i) { if ((await MigrationSystemDictator.currentStep()) === i) {
if (isLiveDeployer) { if (isLiveDeployer) {
console.log(`Executing step ${i}...`) console.log(`Executing step ${i}...`)
......
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