Skip to content

Commit

Permalink
Init with tempalte
Browse files Browse the repository at this point in the history
  • Loading branch information
stevieraykatz committed Mar 6, 2024
1 parent 0090a54 commit 424217a
Show file tree
Hide file tree
Showing 16 changed files with 301 additions and 170 deletions.
Empty file.
55 changes: 55 additions & 0 deletions mainnet/2024-03-07-ecotome-sysconfig-updates/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
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.
##

# Delete L2 Outputs Commands

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

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

# 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-07-ecotome-sysconfig-updates/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
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

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

contract DeleteL2Outputs is MultisigBuilder {
address constant internal L2_OUTPUT_ORACLE_PROXY = vm.envAddress("L2_OUTPUT_ORACLE_PROXY"); // TODO: define L2_OUTPUT_ORACLE_PROXY=xxx in the .env file
address constant internal CHALLENGER = vm.envAddress("CHALLENGER"); // TODO: define CHALLENGER=xxx in the .env file
address constant internal SAFE = vm.envAddress("SAFE"); // TODO: define SAFE=xxx in the .env file - ie the multisig which is signer on challenger>
uint256 constant internal L2_OUTPUT_INDEX = vm.envAddress("L2_OUTPUT_INDEX"); // TODO: define L2_OUTPUT_INDEX=xxx in the .env file - this is the index start deleting from (everything after will be deleted)

function _postCheck() internal override view {
L2OutputOracle l2OutputOracle = L2OutputOracle(L2_OUTPUT_ORACLE_PROXY);
require(l2OutputOracle.latestOutputIndex() < L2_OUTPUT_INDEX, "DeleteL2Outputs: L2OutputOracle did not get deleted");
}

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

L2OutputOracle l2OutputOracle = L2OutputOracle(L2_OUTPUT_ORACLE_PROXY);
bytes memory deleteL2OutputData = abi.encodeCall(
L2OutputOracle.deleteL2Outputs, (L2_OUTPUT_INDEX)
);

calls[0] = IMulticall3.Call3({
target: CHALLENGER,
allowFailure: false,
callData: abi.encodeCall(
Challenger1of2.execute, (deleteL2OutputData)
)
});

return calls;
}

function _ownerSafe() internal override view returns (address) {
return SAFE;
}
}
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/contracts/L1/OptimismPortal.sol";

contract PausePortal is MultisigBuilder {
address constant internal OPTIMISM_PORTAL_PROXY = vm.envAddress("OPTIMISM_PORTAL_PROXY"); // TODO: define OPTIMISM_PORTAL_PROXY=xxx in the .env file
address constant internal GUARDIAN = vm.envAddress("GUARDIAN"); // TODO: define GUARDIAN=xxx in the .env file

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;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

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

contract SetBatcherAddr is MultisigBuilder {
address constant internal NEW_BATCHER = vm.envAddress("NEW_BATCHER_ADDR"); // TODO: define NEW_BATCHER_ADDR=xxx in the .env file
address constant internal SYSTEM_CONFIG = vm.envAddress("SYSTEM_CONFIG_ADDR"); // TODO: define SYSTEM_CONFIG_ADDR=xxx in the .env file
address internal SYSTEM_CONFIG_OWNER = vm.envAddress("SYSTEM_CONFIG_OWNER"); // TODO: define SYSTEM_CONFIG_OWNER=xxx in the .env file


function _postCheck() internal override view {
SystemConfig systemConfig = SystemConfig(SYSTEM_CONFIG);
bytes32 batcherHash = bytes32(abi.encode(NEW_BATCHER));
require(systemConfig.batcherHash() == batcherHash, "SetBatcherAddr: batcherHash not set correctly");
}

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

bytes32 batcherHash = bytes32(abi.encode(NEW_BATCHER));

calls[0] = IMulticall3.Call3({
target: SYSTEM_CONFIG,
allowFailure: false,
callData: abi.encodeCall(
SystemConfig.setBatcherHash,
(batcherHash)
)
});

return calls;
}

function _ownerSafe() internal override view returns (address) {
return SYSTEM_CONFIG_OWNER;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import "@eth-optimism-bedrock/contracts/L1/L2OutputOracle.sol";
import "forge-std/Script.sol";

contract SetupNewProposer is Script {
address constant internal NEW_PROPOSER = vm.envUint("NEW_PROPOSER"); // TODO: define NEW_PROPOSER=xxx in the .env file
address constant internal DEPLOYER = vm.envAddress("DEPLOYER"); // TODO: define DEPLOYER=xxx in the .env file
address constant internal L2_OUTPUT_ORACLE_PROXY = vm.envAddress("L2_OUTPUT_ORACLE_PROXY"); // TODO: define L2_OUTPUT_ORACLE_PROXY=xxx in the .env file

function run() public {
L2OutputOracle existingL2OO = L2OutputOracle(L2_OUTPUT_ORACLE_PROXY);
uint256 oldSubmissionInterval = existingL2OO.SUBMISSION_INTERVAL();
uint256 oldL2BlockTime = existingL2OO.L2_BLOCK_TIME();
uint256 oldFinalizationPeriodSeconds = existingL2OO.FINALIZATION_PERIOD_SECONDS();
uint256 startingBlockNumber = existingL2OO.startingBlockNumber();
uint256 startingTimestamp = existingL2OO.startingTimestamp();
address oldProposer = existingL2OO.PROPOSER();
address oldChallenger = existingL2OO.CHALLENGER();

console.log(oldProposer);
console.log(NEW_PROPOSER);

// Deploy L2OutputOracle new implementation wiht the new submission interval
vm.broadcast(DEPLOYER);
L2OutputOracle l2OutputOracleImpl = new L2OutputOracle({
_submissionInterval: oldSubmissionInterval,
_l2BlockTime: oldL2BlockTime,
_startingBlockNumber: startingBlockNumber,
_startingTimestamp: startingTimestamp,
_proposer: NEW_PROPOSER,
_challenger: oldChallenger,
_finalizationPeriodSeconds: oldFinalizationPeriodSeconds
});

require(l2OutputOracleImpl.L2_BLOCK_TIME() == oldL2BlockTime, "Deploy: l2OutputOracle l2BlockTime is incorrect");
require(l2OutputOracleImpl.PROPOSER() == NEW_PROPOSER, "Deploy: l2OutputOracle proposer is incorrect");

console.logAddress(address(l2OutputOracleImpl));
}
}
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/contracts/L1/OptimismPortal.sol";

contract UnpausePortal is MultisigBuilder {
address constant internal OPTIMISM_PORTAL_PROXY = vm.envAddress("OPTIMISM_PORTAL_PROXY"); // TODO: define OPTIMISM_PORTAL_PROXY=xxx in the .env file
address constant internal GUARDIAN = vm.envAddress("GUARDIAN"); // TODO: define GUARDIAN=xxx in the .env file

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;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import "@eth-optimism-bedrock/src/universal/ProxyAdmin.sol";
import "@base-contracts/script/universal/NestedMultisigBuilder.sol";

contract UpdateProposer is NestedMultisigBuilder {
// TODO: this assumes a new L2OutputOracle implementation contract has already been deployed. See SetupNewProposer.s.sol.

address internal PROXY_ADMIN_CONTRACT = vm.envAddress("L1_PROXY_ADMIN"); // TODO: define L1_PROXY_ADMIN=xxx in the .env file
address internal PROXY_ADMIN_OWNER = vm.envAddress("L1_NESTED_SAFE"); // TODO: define L1_NESTED_SAFE=xxx in the .env file
address internal L2_OUTPUT_PROPOSER = vm.envAddress("L2_OUTPUT_PROPOSER"); // TODO: define L2_OUTPUT_PROPOSER=xxx in the .env file
address internal L2_OUTPUT_PROPOSER_NEW_IMPL = vm.envAddress("L2_OUTPUT_PROPOSER_NEW_IMPL"); // TODO: define L2_OUTPUT_PROPOSER_NEW_IMPL=xxx in the .env file

function _postCheck() internal override view {
ProxyAdmin proxyAdmin = ProxyAdmin(PROXY_ADMIN_CONTRACT);
require(proxyAdmin.getProxyImplementation(L2_OUTPUT_PROPOSER).codehash == L2_OUTPUT_PROPOSER_NEW_IMPL.codehash);
}

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

calls[0] = IMulticall3.Call3({
target: PROXY_ADMIN_CONTRACT,
allowFailure: false,
callData: abi.encodeCall(
ProxyAdmin.upgrade,
(payable(L2_OUTPUT_PROPOSER), L2_OUTPUT_PROPOSER_NEW_IMPL)
)
});

return calls;
}

function _ownerSafe() internal override view returns (address) {
return PROXY_ADMIN_OWNER;
}
}
34 changes: 0 additions & 34 deletions mainnet/2024-03-07-sysconfig-updates/.github/workflows/test.yml

This file was deleted.

14 changes: 0 additions & 14 deletions mainnet/2024-03-07-sysconfig-updates/.gitignore

This file was deleted.

Loading

0 comments on commit 424217a

Please sign in to comment.