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

WIP reproducing issue 268 #287

Closed
wants to merge 2 commits into from
Closed
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
23 changes: 22 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,27 @@ jobs:
just simulate-council
just prepare-json
just simulate-council # simulate again to make sure the json is still valid

just_simulate_eth-013-fp-upgrade-fjord-repro:
docker:
- image: <<pipeline.parameters.ci_builder_image>>
steps:
- checkout
- run:
name: just simulate
command: |
go install github.com/mikefarah/yq/v4@latest
just install
cd tasks/eth/013-fp-upgrade-fjord-repro
export SIMULATE_WITHOUT_LEDGER=1
just \
--dotenv-path $(pwd)/.env \
--justfile ../../../nested.just \
simulate council
just \
--dotenv-path $(pwd)/.env \
--justfile ../../../nested.just \
simulate foundation

forge_build:
docker:
- image: <<pipeline.parameters.ci_builder_image>>
Expand Down Expand Up @@ -224,3 +244,4 @@ workflows:
- just_simulate_sc_rehearsal_1
- just_simulate_sc_rehearsal_2
- just_simulate_sc_rehearsal_4
- just_simulate_eth-013-fp-upgrade-fjord-repro
11 changes: 11 additions & 0 deletions tasks/eth/013-fp-upgrade-fjord-repro/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ETH_RPC_URL="https://ethereum.publicnode.com"
OWNER_SAFE=0x5a0Aae59D09fccBdDb6C6CcEB07B7279367C3d2A
COUNCIL_SAFE=0xc2819DC788505Aac350142A7A707BF9D03E3Bd03
FOUNDATION_SAFE=0x847B5c174615B1B7fDF770882256e2D3E95b9D92

# based on current nonce. 011 and 012, while sequenced before 013, do not use these safes
SAFE_NONCE_0X5A0AAE59D09FCCBDDB6C6CCEB07B7279367C3D2A=5
# based on current nonce. 011 and 012, while sequenced before 013, do not use these safes
SAFE_NONCE_0XC2819DC788505AAC350142A7A707BF9D03E3BD03=6
# Current nonce is 4. However, 012 is sequenced to use 4 nonce. And 011 does not use this safe.
SAFE_NONCE_0X847B5C174615B1B7FDF770882256E2D3E95B9D92=6
37 changes: 37 additions & 0 deletions tasks/eth/013-fp-upgrade-fjord-repro/EXEC.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Execution

This section describes the transactions used to execute the upgrade. The upgrade is a batch of `2` transactions executed on chain ID `1`.

## Tx #1: Upgrade FaultDisputeGame implementation in DisputeGameFactoryProxy


**Function Signature:** `setImplementation(uint32,address)`

**To:** `0xe5965Ab5962eDc7477C8520243A95517CD252fA9`

**Value:** `0 WEI`

**Raw Input Data:** `0x14f6b1a30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f691f8a6d908b58c534b624cf16495b491e633ba`

### Inputs
**_impl:** `0xf691F8A6d908B58C534B624cF16495b491E633BA`

**_gameType:** `0`


## Tx #2: Upgrade PermissionedDisputeGame implementation in DisputeGameFactoryProxy


**Function Signature:** `setImplementation(uint32,address)`

**To:** `0xe5965Ab5962eDc7477C8520243A95517CD252fA9`

**Value:** `0 WEI`

**Raw Input Data:** `0x14f6b1a30000000000000000000000000000000000000000000000000000000000000001000000000000000000000000c307e93a7c530a184c98eade4545a412b857b62f`

### Inputs
**_gameType:** `1`

**_impl:** `0xc307e93a7C530a184c98EaDe4545a412b857b62f`

72 changes: 72 additions & 0 deletions tasks/eth/013-fp-upgrade-fjord-repro/NestedSignFromJson.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;

import {NestedSignFromJson as OriginalNestedSignFromJson} from "script/NestedSignFromJson.s.sol";
import {Types} from "@eth-optimism-bedrock/scripts/Types.sol";
import {console2 as console} from "forge-std/console2.sol";
import {stdJson} from "forge-std/StdJson.sol";
import {LibString} from "solady/utils/LibString.sol";
import {Vm, VmSafe} from "forge-std/Vm.sol";
import "@eth-optimism-bedrock/src/dispute/lib/Types.sol";
import {DisputeGameFactory} from "@eth-optimism-bedrock/src/dispute/DisputeGameFactory.sol";
import {FaultDisputeGame} from "@eth-optimism-bedrock/src/dispute/FaultDisputeGame.sol";
import {PermissionedDisputeGame} from "@eth-optimism-bedrock/src/dispute/PermissionedDisputeGame.sol";

contract NestedSignFromJson is OriginalNestedSignFromJson {
using LibString for string;

DisputeGameFactory dgfProxy;

// Safe contract for this task.
address immutable proxyAdminOwnerSafe = vm.envAddress("OWNER_SAFE");
address immutable securityCouncilSafe = vm.envAddress("COUNCIL_SAFE");
address immutable foundationUpgradesSafe = vm.envAddress("FOUNDATION_SAFE");
address immutable livenessGuard = 0x24424336F04440b1c28685a38303aC33C9D14a25;

// New dispute game implementations
// See governance proposal for verification - https://gov.optimism.io/t/upgrade-proposal-9-fjord-network-upgrade/8236
FaultDisputeGame constant faultDisputeGame = FaultDisputeGame(0xf691F8A6d908B58C534B624cF16495b491E633BA);
PermissionedDisputeGame constant permissionedDisputeGame = PermissionedDisputeGame(0xc307e93a7C530a184c98EaDe4545a412b857b62f);

/// @notice Sets up the dgfProxy
function setUp() public {
string memory addressesJson;

// Read addresses json
string memory path = "/lib/superchain-registry/superchain/extra/addresses/addresses.json";

try vm.readFile(string.concat(vm.projectRoot(), path)) returns (string memory data) {
addressesJson = data;
} catch {
revert(string.concat("Failed to read ", path));
}

dgfProxy = DisputeGameFactory(stdJson.readAddress(addressesJson, string.concat("$.", "10", ".DisputeGameFactoryProxy")));
}

function getCodeExceptions() internal pure override returns (address[] memory) {
// No code exceptions expected
}

function getAllowedStorageAccess() internal view override returns (address[] memory allowed) {
allowed = new address[](5);
allowed[0] = address(dgfProxy);
allowed[1] = proxyAdminOwnerSafe;
allowed[2] = securityCouncilSafe;
allowed[3] = foundationUpgradesSafe;
allowed[4] = livenessGuard;
}

function _postCheck(Vm.AccountAccess[] memory accesses, SimulationPayload memory) internal view override {
console.log("Running post-deploy assertions");
checkStateDiff(accesses);
checkDGFProxy();
console.log("All assertions passed!");
}

function checkDGFProxy() internal view {
console.log("check dispute game implementations");
require(address(faultDisputeGame) == address(dgfProxy.gameImpls(GameTypes.CANNON)), "dgf-100");
require(address(permissionedDisputeGame) == address(dgfProxy.gameImpls(GameTypes.PERMISSIONED_CANNON)), "dgf-200");
}
}
45 changes: 45 additions & 0 deletions tasks/eth/013-fp-upgrade-fjord-repro/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Mainnet Fjord Fault Proofs Upgrade

Status: [EXECUTED](https://etherscan.io/tx/0x7abecacd8b1a54db8f0835a5c82edfab96ff922a41d2faa914c339e3e9319b43)

## Objective

This is a playbook for upgrading Fault Proofs on Mainnet for Fjord compatibility.

This sets the `FaultDisputeGame` and `PermissionedDisputeGame` implementations in the `DisputeGameFactory` to newly deployed contracts that have an updated prestate.

The proposal was:

- [x] Posted on the governance forum [here](https://gov.optimism.io/t/upgrade-proposal-9-fjord-network-upgrade/8236).
- [x] Approved by Token House voting [here](https://vote.optimism.io/proposals/19894803675554157870919000647998468859257602050917884642551010462863037711179).
- [x] Not vetoed by the Citizens' house [here](https://snapshot.org/#/citizenshouse.eth/proposal/0x14336dfcb086279e47ef8fffbd6282984d392f1b9eaf22f76547210df6451c43).
- [x] [Executed on OP Sepolia](https://github.com/ethereum-optimism/superchain-ops/tree/main/tasks/sep/011-fjord-upgrade).

The governance proposal should be treated as the source of truth and used to verify the correctness of the onchain operations.

Governance post of the upgrade can be found at https://gov.optimism.io/t/upgrade-proposal-9-fjord-network-upgrade/8236.

Details on the upgrade procedure can be found in [EXEC.md](./EXEC.md). Signers need not validate the, but they are provided for reference.

## Preparing the Upgrade

The new Fault Dispute Game contract implementations have been pre-deployed to mainnet.

- `FaultDisputeGame`: [`0xf691F8A6d908B58C534B624cF16495b491E633BA`](https://etherscan.io/address/0xc307e93a7C530a184c98EaDe4545a412b857b62f)
- `PermissionedDisputeGame` - [`0xc307e93a7C530a184c98EaDe4545a412b857b62f`](https://etherscan.io/address/0xc307e93a7C530a184c98EaDe4545a412b857b62f)

## Simulation

Please see the "Simulating and Verifying the Transaction" instructions in [NESTED.md](../../../NESTED.md).

When simulating, ensure the logs say `Using script /your/path/to/superchain-ops/tasks/eth/013-fp-upgrade-fjord/NestedSignFromJson.s.sol`. This ensures all safety checks are run. If the default `NestedSignFromJson.s.sol` script is shown (without the full path), something is wrong and the safety checks will not run.

Do NOT yet proceed to the "Execute the Transaction" section.

## Signing and execution

Please see the signing and execution instructions in [NESTED.md](../../../NESTED.md).

### State Validations

Please see the instructions for [validation](./VALIDATION.md).
Loading