Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mainnet] Q1 Mainnet Pause Test #132

Merged
merged 3 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions mainnet/2024-03-05-pause-unpause-test/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
OP_COMMIT=10b06fb49861053999a89533d846ee5c2ccb33e1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this commit should be fine (looks like it's from November)? just curious how we decided on this commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great question -- in short, the OptimismPortal contract has changed a lot since we deployed to mainnet. The Semver we're currently on is 1.7.0, and the interface changed when Optimism implemented their SuperchainConfig to store their pause instead. Hence, we need to use a much older commit.

BASE_CONTRACTS_COMMIT=fe492be3478134b2305c207a12b153eca04148c0

OPTIMISM_PORTAL_PROXY=0x49048044D57e1C92A77f79988d21Fa8fAF74E97e
GUARDIAN=0x14536667Cd30e52C0b458BaACcB9faDA7046E056
Comment on lines +4 to +5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

41 changes: 41 additions & 0 deletions mainnet/2024-03-05-pause-unpause-test/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
include ../../Makefile
include ../.env
include .env

ifndef LEDGER_ACCOUNT
override LEDGER_ACCOUNT = 0
endif

##
# Incident response commands
# Note that --ledger --hd-paths <PATH> can be replaced with --private-key $(PRIVATE_KEY)
# in any command when using a local key.
##

# Pause OptimismPortal Commands

.PHONY: pause-portal-sign
pause-portal-sign: deps
$(GOPATH)/bin/eip712sign --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" -- \
forge script --rpc-url $(L1_RPC_URL) PausePortal --sig "sign()"

.PHONY: pause-portal-run
pause-portal-run: deps
forge script --rpc-url $(L1_RPC_URL) \
PausePortal --sig "run(bytes)" $(SIGNATURES) \
--ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" \
--broadcast

# Unpause OptimismPortal Commands

.PHONY: unpause-portal-sign
unpause-portal-sign: deps
$(GOPATH)/bin/eip712sign --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" -- \
forge script --rpc-url $(L1_RPC_URL) UnpausePortal --sig "sign()"

.PHONY: unpause-portal-run
unpause-portal-run: deps
forge script --rpc-url $(L1_RPC_URL) \
UnpausePortal --sig "run(bytes)" $(SIGNATURES) \
--ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" \
--broadcast
20 changes: 20 additions & 0 deletions mainnet/2024-03-05-pause-unpause-test/foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[profile.default]
src = 'src'
out = 'out'
libs = ['lib']
broadcast = 'records'
fs_permissions = [ {access = "read-write", path = "./"} ]
optimizer = true
optimizer_runs = 999999
solc_version = "0.8.15"
via-ir = true
remappings = [
'@eth-optimism-bedrock/=lib/optimism/packages/contracts-bedrock/',
'@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts',
'@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts',
'@rari-capital/solmate/=lib/solmate/',
'@base-contracts/=lib/base-contracts',
'solady/=lib/solady/src/'
]

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
33 changes: 33 additions & 0 deletions mainnet/2024-03-05-pause-unpause-test/script/PausePortal.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import "@base-contracts/script/universal/MultisigBuilder.sol";
import "@eth-optimism-bedrock/src/L1/OptimismPortal.sol";

contract PausePortal is MultisigBuilder {
address internal OPTIMISM_PORTAL_PROXY = vm.envAddress("OPTIMISM_PORTAL_PROXY");
address internal GUARDIAN = vm.envAddress("GUARDIAN");

function _postCheck() internal override view {
OptimismPortal optimismPortal = OptimismPortal(payable(OPTIMISM_PORTAL_PROXY));
require(optimismPortal.paused() == true, "PausePortal: Portal did not get paused");
}

function _buildCalls() internal override view returns (IMulticall3.Call3[] memory) {
IMulticall3.Call3[] memory calls = new IMulticall3.Call3[](1);

calls[0] = IMulticall3.Call3({
target: OPTIMISM_PORTAL_PROXY,
allowFailure: false,
callData: abi.encodeCall(
OptimismPortal.pause, ()
)
});

return calls;
}

function _ownerSafe() internal override view returns (address) {
return GUARDIAN;
}
}
33 changes: 33 additions & 0 deletions mainnet/2024-03-05-pause-unpause-test/script/UnpausePortal.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import "@base-contracts/script/universal/MultisigBuilder.sol";
import "@eth-optimism-bedrock/src/L1/OptimismPortal.sol";

contract UnpausePortal is MultisigBuilder {
address internal OPTIMISM_PORTAL_PROXY = vm.envAddress("OPTIMISM_PORTAL_PROXY");
address internal GUARDIAN = vm.envAddress("GUARDIAN");

function _postCheck() internal override view {
OptimismPortal optimismPortal = OptimismPortal(payable(OPTIMISM_PORTAL_PROXY));
require(optimismPortal.paused() == false, "UnpausePortal: Portal did not get unpaused");
}

function _buildCalls() internal override view returns (IMulticall3.Call3[] memory) {
IMulticall3.Call3[] memory calls = new IMulticall3.Call3[](1);

calls[0] = IMulticall3.Call3({
target: OPTIMISM_PORTAL_PROXY,
allowFailure: false,
callData: abi.encodeCall(
OptimismPortal.unpause, ()
)
});

return calls;
}

function _ownerSafe() internal override view returns (address) {
return GUARDIAN;
}
}