-
Notifications
You must be signed in to change notification settings - Fork 329
feat: Add Task Template for Switching Base to a Permissioned Game and Retiring Existing Dispute Games #434
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
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
a786588
init run
jjtny1 f761424
update only template
jjtny1 28bf2bd
rename to switch to permissioned game
jjtny1 eda82fa
update script name
jjtny1 9fb2d57
update readme
jjtny1 6a57626
fix typo
jjtny1 4013a7e
add postcheck for permissioned cannon
jjtny1 fc54b97
add gametype postcheck
jjtny1 88d35c9
add filled in senders for base simulation
jjtny1 56dd64d
Merge branch 'main' into joby.thundil/retire-games-template
jjtny1 7384d6a
update readme
jjtny1 e483c92
fix makefile
jjtny1 c5308c9
Merge branch 'main' into joby.thundil/retire-games-template
jjtny1 f8f9c3f
pr feedback
jjtny1 95e5edb
fix readme
jjtny1 f701ab8
fix comment
jjtny1 2ae4922
rm unused variable
jjtny1 504edab
make compatible with signer tool
jjtny1 a2a5d8c
Merge branch 'main' into joby.thundil/retire-games-template
jjtny1 43ceec2
update readmes
jjtny1 90641dd
pr feedback
jjtny1 2b989d1
pr feedback
jjtny1 de29cc7
Merge branch 'main' into joby.thundil/retire-games-template
jjtny1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jjtny1 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| OP_COMMIT= | ||
| BASE_CONTRACTS_COMMIT= | ||
|
|
||
| RECORD_STATE_DIFF=true | ||
|
|
||
| # Mainnet Config | ||
| SYSTEM_CONFIG=0x73a79Fab69143498Ed3712e519A88a918e1f4072 | ||
|
|
||
| # Optimism Guardian Multisig (controls Anchor State Registry) | ||
| OWNER_SAFE=0x09f7150D8c019BeF34450d6920f6B3608ceFdAf2 | ||
| # Owner of Optimism Guardian Multisig | ||
| OP_SECURITY_COUNCIL_SAFE=0xc2819DC788505Aac350142A7A707BF9D03E3Bd03 | ||
|
|
||
| SENDER=0x1822b35B09f5ce1C78ecbC06AC0A4e17885b925e # used to simulate | ||
|
|
||
| # #Sepolia Config | ||
| #SYSTEM_CONFIG=0xf272670eb55e895584501d564AfEB048bEd26194 | ||
|
|
||
| # #Optimism Guardian Multisig (controls Anchor State Registry) | ||
| #OWNER_SAFE=0x7a50f00e8D05b95F98fE38d8BeE366a7324dCf7E | ||
| # #Owner of Optimism Guardian Multisig | ||
| #OP_SECURITY_COUNCIL_SAFE=0xf64bc17485f0B4Ea5F06A96514182FC4cB561977 | ||
|
|
||
| # # used to simulate | ||
| #SENDER=0x1084092Ac2f04c866806CF3d4a385Afa4F6A6C97 |
33 changes: 33 additions & 0 deletions
33
setup-templates/template-switch-to-permissioned-game/Makefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| include ../../Makefile | ||
| include ../../Multisig.mk | ||
|
|
||
| include ../.env | ||
| include .env | ||
|
|
||
| ifndef LEDGER_ACCOUNT | ||
| override LEDGER_ACCOUNT = 0 | ||
| endif | ||
|
|
||
| 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) \ | ||
| --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: | ||
| $(call MULTISIG_APPROVE,$(OP_SECURITY_COUNCIL_SAFE),$(SIGNATURES)) | ||
|
|
||
| # Execute | ||
| .PHONY: execute | ||
| execute: | ||
| $(call MULTISIG_EXECUTE,0x) |
51 changes: 51 additions & 0 deletions
51
setup-templates/template-switch-to-permissioned-game/README.md
jjtny1 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # Switch to Permissioned Games | ||
|
|
||
| Status: READY TO SIGN | ||
|
|
||
| ## Description | ||
|
|
||
| Switches Base to Permissioned Fault Dispute Games and retires existing games. | ||
|
|
||
| ## 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 | ||
jjtny1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| You may now kill the Signer Tool process in your terminal window by running `Ctrl + C`. | ||
|
|
||
20 changes: 20 additions & 0 deletions
20
setup-templates/template-switch-to-permissioned-game/foundry.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 = 200 | ||
| via-ir = false | ||
| 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/', | ||
| '@lib-keccak/=lib/lib-keccak/contracts/lib', | ||
| ] | ||
|
|
||
| # See more config options https://github.com/foundry-rs/foundry/tree/master/config |
65 changes: 65 additions & 0 deletions
65
setup-templates/template-switch-to-permissioned-game/script/SwitchToPermissionedGame.sol
jjtny1 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| // SPDX-License-Identifier: MIT | ||
| pragma solidity 0.8.15; | ||
|
|
||
| import {Vm} from "forge-std/Vm.sol"; | ||
| import {IMulticall3} from "forge-std/interfaces/IMulticall3.sol"; | ||
| import {IAnchorStateRegistry} from "@eth-optimism-bedrock/src/dispute/FaultDisputeGame.sol"; | ||
| import {SystemConfig} from "@eth-optimism-bedrock/src/L1/SystemConfig.sol"; | ||
| import {DisputeGameFactory} from "@eth-optimism-bedrock/src/dispute/DisputeGameFactory.sol"; | ||
| import {FaultDisputeGame} from "@eth-optimism-bedrock/src/dispute/PermissionedDisputeGame.sol"; | ||
| import {GameTypes, GameType} from "@eth-optimism-bedrock/src/dispute/lib/Types.sol"; | ||
| import {MultisigScript} from "@base-contracts/script/universal/MultisigScript.sol"; | ||
| import {Simulation} from "@base-contracts/script/universal/Simulation.sol"; | ||
|
|
||
| /// @notice This script updates the respectedGameType and retires existing games in the AnchorStateRegistry. | ||
| contract SwitchToPermissionedGame is MultisigScript { | ||
| address public immutable OWNER_SAFE; | ||
|
|
||
| SystemConfig internal immutable _SYSTEM_CONFIG = SystemConfig(vm.envAddress("SYSTEM_CONFIG")); | ||
|
|
||
| IAnchorStateRegistry anchorStateRegistry; | ||
|
|
||
| constructor() { | ||
| OWNER_SAFE = vm.envAddress("OWNER_SAFE"); | ||
| } | ||
|
|
||
| function setUp() public { | ||
| DisputeGameFactory dgfProxy = DisputeGameFactory(_SYSTEM_CONFIG.disputeGameFactory()); | ||
| FaultDisputeGame currentFdg = FaultDisputeGame(address(dgfProxy.gameImpls(GameTypes.CANNON))); | ||
| anchorStateRegistry = currentFdg.anchorStateRegistry(); | ||
| } | ||
|
|
||
| // Confirm the retirementTimestamp is updated to the block time and the | ||
| // respectedGameType is updated to PERMISSIONED_CANNON. | ||
| function _postCheck(Vm.AccountAccess[] memory, Simulation.Payload memory) internal view override { | ||
| require(anchorStateRegistry.retirementTimestamp() == block.timestamp, "post-110"); | ||
| require( | ||
| GameType.unwrap(anchorStateRegistry.respectedGameType()) == GameType.unwrap(GameTypes.PERMISSIONED_CANNON), | ||
| "post-111" | ||
| ); | ||
| } | ||
|
|
||
| function _buildCalls() internal view override returns (IMulticall3.Call3Value[] memory) { | ||
| IMulticall3.Call3Value[] memory calls = new IMulticall3.Call3Value[](2); | ||
|
|
||
| calls[0] = IMulticall3.Call3Value({ | ||
| target: address(anchorStateRegistry), | ||
| allowFailure: false, | ||
| callData: abi.encodeCall(IAnchorStateRegistry.setRespectedGameType, (GameTypes.PERMISSIONED_CANNON)), | ||
| value: 0 | ||
| }); | ||
|
|
||
| calls[1] = IMulticall3.Call3Value({ | ||
| target: address(anchorStateRegistry), | ||
| allowFailure: false, | ||
| callData: abi.encodeCall(IAnchorStateRegistry.updateRetirementTimestamp, ()), | ||
| value: 0 | ||
| }); | ||
|
|
||
| return calls; | ||
| } | ||
|
|
||
| function _ownerSafe() internal view override returns (address) { | ||
| return OWNER_SAFE; | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.