-
Notifications
You must be signed in to change notification settings - Fork 391
feat: Add Task to Switch to Permissioned Game and Blacklist Addresses #489
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
base: main
Are you sure you want to change the base?
Changes from all commits
a786588
f761424
28bf2bd
eda82fa
9fb2d57
6a57626
4013a7e
fc54b97
88d35c9
56dd64d
1c06c68
c553fca
8db838c
23f3cb0
6ec1146
24e12ed
8839fb3
6c193ea
15386a8
94c1451
a01a582
7384d6a
e483c92
f2d2846
c5308c9
b91345e
65e420c
026757a
a52bdbd
ad4b6d2
e69c6a7
fc07fb9
4a7cff2
f2198de
404c9df
06f3e4c
8c63cc2
83ec9c5
3d36078
d2d0ee6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| OP_COMMIT= | ||
| BASE_CONTRACTS_COMMIT=be7c7a642e430fa64b04b63203839f8c81f48466 | ||
|
|
||
| RECORD_STATE_DIFF=true | ||
|
|
||
| # The block number at which the divergence occurred | ||
| L2_DIVERGENCE_BLOCK_NUMBER= | ||
| # Comma seperated array of addresses to blacklist | ||
| ADDRESSES_TO_BLACKLIST= | ||
|
|
||
| # Mainnet Config | ||
| SYSTEM_CONFIG=0x73a79Fab69143498Ed3712e519A88a918e1f4072 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can remove this - it is automatically included from the network .env files now |
||
|
|
||
| # Optimism Guardian Multisig (controls Anchor State Registry) | ||
| OWNER_SAFE=0x09f7150D8c019BeF34450d6920f6B3608ceFdAf2 | ||
| # Owner of Optimism Guardian Multisig | ||
| OP_SECURITY_COUNCIL_SAFE=0xc2819DC788505Aac350142A7A707BF9D03E3Bd03 | ||
| DISPUTE_GAME_FACTORY=0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e | ||
| SENDER=0x1822b35B09f5ce1C78ecbC06AC0A4e17885b925e | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can actually remove |
||
|
|
||
| # # Sepolia Config | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can remove this entire sepolia config section |
||
| # SYSTEM_CONFIG=0xf272670eb55e895584501d564AfEB048bEd26194 | ||
|
|
||
| # # Optimism Guardian Multisig (controls Anchor State Registry) | ||
| # OWNER_SAFE=0x7a50f00e8D05b95F98fE38d8BeE366a7324dCf7E | ||
| # # Owner of Optimism Guardian Multisig | ||
| # OP_SECURITY_COUNCIL_SAFE=0xf64bc17485f0B4Ea5F06A96514182FC4cB561977 | ||
| # DISPUTE_GAME_FACTORY=0xd6E6dBf4F7EA0ac412fD8b65ED297e64BB7a06E1 | ||
| # # used to simulate | ||
| # SENDER=0x1084092Ac2f04c866806CF3d4a385Afa4F6A6C97 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Facilitator Guide | ||
|
|
||
| Guide for facilitators after collecting signatures from signers. | ||
|
|
||
| ### 1. Update repo: | ||
|
|
||
| ```bash | ||
| cd contract-deployments | ||
| git pull | ||
| cd mainnet/TODO | ||
| make deps | ||
| ``` | ||
|
|
||
| ### 2. Approve upgrade | ||
|
|
||
| ```bash | ||
| SIGNATURES=AAABBBCCC make approve-op | ||
| ``` | ||
|
|
||
| ### 3. Execute upgrade | ||
|
|
||
| ```bash | ||
| SIGNATURES=AAABBBCCC make execute | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| include ../../Makefile | ||
| include ../../Multisig.mk | ||
|
|
||
| include ../.env | ||
| include .env | ||
|
|
||
| ifndef LEDGER_ACCOUNT | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can remove this |
||
| override LEDGER_ACCOUNT = 0 | ||
| endif | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we define |
||
| RPC_URL = $(L1_RPC_URL) | ||
| SCRIPT_NAME = SwitchToPermissionedGame | ||
|
|
||
| .PHONY: gen-validation | ||
| gen-validation: checkout-signer-tool run-script | ||
|
|
||
| .PHONY: run-script | ||
| run-script: | ||
| mkdir validations; \ | ||
| cd $(SIGNER_TOOL_PATH); \ | ||
| npm ci; \ | ||
| bun run scripts/genValidationFile.ts --rpc-url $(RPC_URL) \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can use a macro here from #629 (if it gets merged) |
||
| --workdir .. --forge-cmd 'forge script --rpc-url $(RPC_URL) \ | ||
| $(SCRIPT_NAME) --sig "sign(address[])" ["$(OP_SECURITY_COUNCIL_SAFE)"] --sender $(SENDER)' --out ../validations/op-signer.json; | ||
|
|
||
| .PHONY: approve-op | ||
| approve-op: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's remove the |
||
| $(call MULTISIG_APPROVE,$(OP_SECURITY_COUNCIL_SAFE),$(SIGNATURES)) | ||
|
|
||
| # Execute | ||
| .PHONY: execute | ||
| execute: | ||
| $(call MULTISIG_EXECUTE,0x) | ||
|
|
||
|
|
||
| .PHONY: find-dispute-games-offchain | ||
| find-dispute-games-offchain: pip-install | ||
| RPC_URL=$(RPC_URL) DISPUTE_GAME_FACTORY=$(DISPUTE_GAME_FACTORY) L2_DIVERGENCE_BLOCK_NUMBER=$(L2_DIVERGENCE_BLOCK_NUMBER) \ | ||
| python3 script/fetch_dispute_games.py | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This won't work - there isn't a local python script anymore |
||
|
|
||
| .PHONY: pip-install | ||
| pip-install: | ||
| pip3 install -r script/requirements.txt | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| # Switch to Permissioned Game and Blacklist Addresses | ||
|
|
||
| Status: PENDING | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Status can be |
||
|
|
||
| ## Description | ||
|
|
||
| This task contains scripts that will blacklist fault dispute games after a provided L2 block number in the AnchorStateRegistry. | ||
| This can only be done by the "Optimism Guardian Multisig" which is a single-nested multisig controlled by the OP Security Council. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is now done by our proxy admin owner. OP has nothing to do with it |
||
|
|
||
| Because this requires searching through all dispute games, the time required for the task to execute may take some time. There are | ||
| two options: | ||
|
|
||
| 1. If the `ADDRESSES_TO_BLACKLIST` environment variable is NOT set, the forge script will attempt to search for dispute games | ||
| Note: this may take 10+ minutes | ||
|
|
||
| 2. If the `ADDRESSES_TO_BLACKLIST` environment variable IS set, the forge script will NOT search and will just blacklist the addresses | ||
| provided. | ||
|
|
||
| There is a python script at https://github.com/base/dispute-game-tool that can be run with `make find-dispute-games-offchain` that will use the provided RPC_URL to search for the list of games to blacklist _offchain_. This typically takes a minute or two. The output | ||
| is the comma-separated `ADDRESSES_TO_BLACKLIST` environment variable that can be copied over to the `.env` file, so that | ||
| the forge script can directly blacklist just those addresses. | ||
|
|
||
| ## Install dependencies | ||
|
|
||
| ### 1. Update foundry | ||
|
|
||
| ```bash | ||
| foundryup | ||
| ``` | ||
|
|
||
| ### 2. Install Node.js if needed | ||
|
|
||
| First, check if you have node installed | ||
|
|
||
| ```bash | ||
| node --version | ||
| ``` | ||
|
|
||
| If you see a version output from the above command, you can move on. Otherwise, install node | ||
|
|
||
| ```bash | ||
| brew install node | ||
| ``` | ||
|
|
||
| ## Sign Task | ||
|
|
||
| ### 1. Update repo: | ||
|
|
||
| ```bash | ||
| cd contract-deployments | ||
| git pull | ||
| ``` | ||
|
|
||
| ### 2. Run the signing tool (NOTE: do not enter the task directory. Run this command from the project's root). | ||
|
|
||
| ```bash | ||
| make sign-task | ||
| ``` | ||
|
|
||
| ### 3. Open the UI at [http://localhost:3000](http://localhost:3000) | ||
|
|
||
| ### 4. Send signature to facilitator | ||
|
|
||
| You may now kill the Signer Tool process in your terminal window by running `Ctrl + C`. | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,113 @@ | ||||||
| // SPDX-License-Identifier: MIT | ||||||
| pragma solidity 0.8.15; | ||||||
|
|
||||||
| import {Vm} from "forge-std/Vm.sol"; | ||||||
| import {stdJson} from "forge-std/StdJson.sol"; | ||||||
| import {IMulticall3} from "forge-std/interfaces/IMulticall3.sol"; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the multicall import is unused |
||||||
| import {console} from "forge-std/console.sol"; | ||||||
| import {IAnchorStateRegistry} from "@base-contracts/src/dispute/FaultDisputeGame.sol"; | ||||||
| import {SystemConfig} from "@base-contracts/src/L1/SystemConfig.sol"; | ||||||
| import {IDisputeGame, GameStatus} from "@base-contracts/src/dispute/AnchorStateRegistry.sol"; | ||||||
| import {IDisputeGameFactory} from "@base-contracts/interfaces/dispute/IDisputeGameFactory.sol"; | ||||||
| import {FaultDisputeGame} from "@base-contracts/src/dispute/PermissionedDisputeGame.sol"; | ||||||
| import {GameTypes, GameType} from "@base-contracts/src/dispute/lib/Types.sol"; | ||||||
| import {MultisigScript} from "@base-contracts/script/universal/MultisigScript.sol"; | ||||||
| import {Simulation} from "@base-contracts/script/universal/Simulation.sol"; | ||||||
| import {Enum} from "@base-contracts/script/universal/IGnosisSafe.sol"; | ||||||
|
|
||||||
| /// @notice This script updates the FaultDisputeGame and PermissionedDisputeGame implementations in the | ||||||
| /// DisputeGameFactory contract. | ||||||
| contract SwitchToPermissionedGame is MultisigScript { | ||||||
| using stdJson for string; | ||||||
|
|
||||||
| // TODO: Confirm expected version | ||||||
| string public constant EXPECTED_VERSION = "1.4.1"; | ||||||
|
|
||||||
| address public immutable OWNER_SAFE; | ||||||
| uint64 public immutable L2_DIVERGENCE_BLOCK_NUMBER; | ||||||
| string public RAW_ADDRESSES_TO_BLACKLIST; | ||||||
|
|
||||||
| SystemConfig internal _SYSTEM_CONFIG = SystemConfig(vm.envAddress("SYSTEM_CONFIG")); | ||||||
|
|
||||||
| IAnchorStateRegistry anchorStateRegistry; | ||||||
| IDisputeGame[] gamesToBlacklist; | ||||||
|
|
||||||
| constructor() { | ||||||
| OWNER_SAFE = vm.envAddress("OWNER_SAFE"); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Owner safe is actually now the proxy admin owner
Suggested change
|
||||||
| RAW_ADDRESSES_TO_BLACKLIST = vm.envString("ADDRESSES_TO_BLACKLIST"); | ||||||
| L2_DIVERGENCE_BLOCK_NUMBER = uint64(vm.envUint("L2_DIVERGENCE_BLOCK_NUMBER")); | ||||||
| } | ||||||
|
|
||||||
| function setUp() public { | ||||||
| IDisputeGameFactory dgfProxy = IDisputeGameFactory(_SYSTEM_CONFIG.disputeGameFactory()); | ||||||
| FaultDisputeGame currentFdg = FaultDisputeGame(address(dgfProxy.gameImpls(GameTypes.CANNON))); | ||||||
| anchorStateRegistry = currentFdg.anchorStateRegistry(); | ||||||
|
|
||||||
| // Split by commas | ||||||
| string[] memory parts = vm.split(RAW_ADDRESSES_TO_BLACKLIST, ","); | ||||||
|
|
||||||
| // vm.split("", ",") return [""] with size 1 | ||||||
| if (parts.length == 0 || (parts.length == 1 && bytes(parts[0]).length == 0)) { | ||||||
| console.log("searching for addresses to blacklist"); | ||||||
| getGamesToBlacklist(dgfProxy); | ||||||
| } else { | ||||||
| console.log("using provided address_to_blacklist list"); | ||||||
| for (uint256 i; i < parts.length; i++) { | ||||||
| address address_to_blacklist = vm.parseAddress(parts[i]); | ||||||
| gamesToBlacklist.push(IDisputeGame(address_to_blacklist)); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| console.log("total games to blacklist", gamesToBlacklist.length); | ||||||
| } | ||||||
|
|
||||||
| function getGamesToBlacklist(IDisputeGameFactory dgfProxy) internal { | ||||||
| uint256 totalNumGames = dgfProxy.gameCount(); | ||||||
| console.log("total games to search", totalNumGames); | ||||||
|
|
||||||
| for (uint256 i = 0; i < totalNumGames; i = i + 1) { | ||||||
| (,, IDisputeGame game) = dgfProxy.gameAtIndex(i); | ||||||
| if (game.status() == GameStatus.IN_PROGRESS && game.l2SequenceNumber() >= L2_DIVERGENCE_BLOCK_NUMBER) { | ||||||
| // this game is in progress and challenges a block at or after the divergence block | ||||||
| gamesToBlacklist.push(game); | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| // Confirm the CURRENT_RETIREMENT_TIMESTAMP is updated to the block time. | ||||||
| function _postCheck(Vm.AccountAccess[] memory, Simulation.Payload memory) internal view override { | ||||||
| for (uint256 i = 0; i < gamesToBlacklist.length; i = i + 1) { | ||||||
| require(anchorStateRegistry.isGameBlacklisted(gamesToBlacklist[i]), "post-110"); | ||||||
| } | ||||||
| require( | ||||||
| GameType.unwrap(anchorStateRegistry.respectedGameType()) == GameType.unwrap(GameTypes.PERMISSIONED_CANNON), | ||||||
| "post-111" | ||||||
| ); | ||||||
| } | ||||||
|
|
||||||
| function _buildCalls() internal view override returns (Call[] memory) { | ||||||
| Call[] memory calls = new Call[](gamesToBlacklist.length + 1); | ||||||
|
|
||||||
| calls[0] = Call({ | ||||||
| operation: Enum.Operation.Call, | ||||||
| target: address(anchorStateRegistry), | ||||||
| data: abi.encodeCall(IAnchorStateRegistry.setRespectedGameType, (GameTypes.PERMISSIONED_CANNON)), | ||||||
| value: 0 | ||||||
| }); | ||||||
|
|
||||||
| for (uint256 i = 0; i < gamesToBlacklist.length; i = i + 1) { | ||||||
| calls[i + 1] = Call({ | ||||||
| operation: Enum.Operation.Call, | ||||||
| target: address(anchorStateRegistry), | ||||||
| data: abi.encodeCall(IAnchorStateRegistry.blacklistDisputeGame, (gamesToBlacklist[i])), | ||||||
| value: 0 | ||||||
| }); | ||||||
| } | ||||||
|
|
||||||
| return calls; | ||||||
| } | ||||||
|
|
||||||
| function _ownerSafe() internal view override returns (address) { | ||||||
| return OWNER_SAFE; | ||||||
| } | ||||||
| } | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same simplifications can be applied here. Owner safe is our proxy admin owner which is already defined in the network .env files. We don't need to define addresses here that are already represented |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can remove
OP_COMMIT