Skip to content

Commit

Permalink
[sepolia] Incident practice - pause and unpause Sepolia (#126)
Browse files Browse the repository at this point in the history
* Add auto-generated contracts and set up .env file

* Remove unneeded files and info

* Remove unneeded Makefile commands

* Refactor for EOA

* Remove constant type due to compiler issues

* Add require statements and slightly refactor

* Update Makefile for EOA signing and broadcasting

* Use addr for broadcasting
  • Loading branch information
nadir-akhtar-coinbase authored Mar 6, 2024
1 parent f81b887 commit 8f6beb5
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sepolia/2024-02-28-pause-unpause-portal/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
OP_COMMIT=10b06fb49861053999a89533d846ee5c2ccb33e1
BASE_CONTRACTS_COMMIT=fe492be3478134b2305c207a12b153eca04148c0

GUARDIAN=0xA9FF930151130fd19DA1F03E5077AFB7C78F8503
OPTIMISM_PORTAL_PROXY=0x49f53e41452C74589E85cA1677426Ba426459e85
GUARDIAN_PRIVATE_KEY= # TODO: Fill in when running script
29 changes: 29 additions & 0 deletions sepolia/2024-02-28-pause-unpause-portal/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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
pause-portal: deps
forge script --rpc-url $(L1_RPC_URL) \
PausePortal --private-key $(GUARDIAN_PRIVATE_KEY) \
--broadcast

# Unpause OptimismPortal Commands

.PHONY: unpause-portal
unpause-portal: deps
forge script --rpc-url $(L1_RPC_URL) \
UnpausePortal --private-key $(GUARDIAN_PRIVATE_KEY) \
--broadcast
19 changes: 19 additions & 0 deletions sepolia/2024-02-28-pause-unpause-portal/foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[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'
]

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

import "forge-std/Script.sol";
import "@eth-optimism-bedrock/src/L1/OptimismPortal.sol";

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

function run() external {
OptimismPortal optimismPortal = OptimismPortal(payable(OPTIMISM_PORTAL_PROXY));

vm.broadcast(GUARDIAN);
optimismPortal.pause();

require(optimismPortal.paused() == true, "PausePortal: failed to pause");
}
}
19 changes: 19 additions & 0 deletions sepolia/2024-02-28-pause-unpause-portal/script/UnpausePortal.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import "forge-std/Script.sol";
import "@eth-optimism-bedrock/src/L1/OptimismPortal.sol";

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

function run() external {
OptimismPortal optimismPortal = OptimismPortal(payable(OPTIMISM_PORTAL_PROXY));

vm.broadcast(GUARDIAN);
optimismPortal.unpause();

require(optimismPortal.paused() == false, "PausePortal: failed to unpause");
}
}

0 comments on commit 8f6beb5

Please sign in to comment.