Skip to content

Commit

Permalink
sep/025: Add task to fix sepolia fp upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianst committed Dec 18, 2024
1 parent 3591eec commit 91a5dc2
Show file tree
Hide file tree
Showing 7 changed files with 246 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,28 @@ parameters:
type: integer
default: 5

commands:
simulate_nested:
description: "Runs simulations of a nested task"
parameters:
task:
type: string
steps:
- checkout
- run:
name: "simulate nested << parameters.task >>"
command: |
just install
cd tasks/<< parameters.task >>
SIMULATE_WITHOUT_LEDGER=true just \
--dotenv-path $(pwd)/.env \
--justfile ../../../nested.just \
simulate foundation
SIMULATE_WITHOUT_LEDGER=true just \
--dotenv-path $(pwd)/.env \
--justfile ../../../nested.just \
simulate council
jobs:
check_sepolia_rpc_endpoints:
circleci_ip_ranges: true
Expand Down Expand Up @@ -186,6 +208,7 @@ jobs:
just install
forge --version
forge build --deny-warnings
forge_fmt:
docker:
- image: <<pipeline.parameters.ci_builder_image>>
Expand Down Expand Up @@ -220,6 +243,13 @@ jobs:
yq --version
forge --version
simulate_sep_025:
docker:
- image: << pipeline.parameters.ci_builder_image >>
steps:
- simulate_nested:
task: "sep/025-fp-holocene-upgrade-fix"

workflows:
main:
jobs:
Expand Down Expand Up @@ -247,3 +277,4 @@ workflows:
- just_simulate_sc_rehearsal_1
- just_simulate_sc_rehearsal_2
- just_simulate_sc_rehearsal_4
- simulate_sep_025
6 changes: 6 additions & 0 deletions tasks/sep/025-fp-holocene-upgrade-fix/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ETH_RPC_URL="https://ethereum-sepolia.publicnode.com"
COUNCIL_SAFE=0xf64bc17485f0B4Ea5F06A96514182FC4cB561977
FOUNDATION_SAFE=0xDEe57160aAfCF04c34C887B5962D0a69676d3C8B
OWNER_SAFE=0x1Eb2fFc903729a0F03966B917003800b145F56E2
SAFE_NONCE=""
SIMULATE_WITHOUT_LEDGER=0 # 1
34 changes: 34 additions & 0 deletions tasks/sep/025-fp-holocene-upgrade-fix/NestedSignFromJson.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;

import {console2 as console} from "forge-std/console2.sol";
import {Vm} from "forge-std/Vm.sol";
import {Simulation} from "@base-contracts/script/universal/Simulation.sol";
import {NestedSignFromJson as OriginalNestedSignFromJson} from "script/NestedSignFromJson.s.sol";
import {DisputeGameUpgrade} from "script/verification/DisputeGameUpgrade.s.sol";
import {CouncilFoundationNestedSign } from "script/verification/CouncilFoundationNestedSign.s.sol";
import {SuperchainRegistry} from "script/verification/Verification.s.sol";

contract NestedSignFromJson is OriginalNestedSignFromJson, CouncilFoundationNestedSign, DisputeGameUpgrade {
constructor() SuperchainRegistry("sepolia", "op", "v1.8.0-rc.4")
DisputeGameUpgrade(
0x03f89406817db1ed7fd8b31e13300444652cdb0b9c509a674de43483b2f83568, // absolutePrestate
0xe591Ebbc2Ba0EAd3db6a0867cC132Fe1c123F448, // faultDisputeGame
0xb51baD2d9Da9f94d6A4A5A493Ae6469005611B68 // permissionedDisputeGame
) {}

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

function getAllowedStorageAccess() internal view override returns (address[] memory) {
return allowedStorageAccess;
}

function getCodeExceptions() internal view override returns (address[] memory) {
return codeExceptions;
}
}
38 changes: 38 additions & 0 deletions tasks/sep/025-fp-holocene-upgrade-fix/OVERVIEW.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Holocene Hardfork - Proof Contract Upgrades
Upgrades the `MIPS.sol`, `FaultDisputeGame.sol`, and `PermissionedDisputeGame.sol` contracts for Holocene.

The batch will be executed on chain ID `11155111`, and contains `2` transactions.

## Tx #1: Upgrade `PERMISSIONED_CANNON` game type in `DisputeGameFactory`
Upgrades the `PERMISSIONED_CANNON` game type to the new Holocene deployment, with an updated version of `op-program` as the absolute prestate hash.

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

**To:** `0x05F9613aDB30026FFd634f38e5C4dFd30a197Fa1`

**Value:** `0 WEI`

**Raw Input Data:** `0x14f6b1a30000000000000000000000000000000000000000000000000000000000000001000000000000000000000000b51bad2d9da9f94d6a4a5a493ae6469005611b68`

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

**_impl:** `0xb51baD2d9Da9f94d6A4A5A493Ae6469005611B68`


## Tx #2: Upgrade `CANNON` game type in `DisputeGameFactory`
Upgrades the `CANNON` game type to the new Holocene deployment, with an updated version of `op-program` as the absolute prestate hash.

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

**To:** `0x05F9613aDB30026FFd634f38e5C4dFd30a197Fa1`

**Value:** `0 WEI`

**Raw Input Data:** `0x14f6b1a30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e591ebbc2ba0ead3db6a0867cc132fe1c123f448`

### Inputs
**_impl:** `0xe591Ebbc2Ba0EAd3db6a0867cC132Fe1c123F448`

**_gameType:** `0`

46 changes: 46 additions & 0 deletions tasks/sep/025-fp-holocene-upgrade-fix/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Holocene Hardfork Upgrade

Status: DRAFT, NOT READY TO SIGN

## Objective

Upgrades the Fault Proof contracts for the Holocene hardfork.

The proposal was:

- [ ] Posted on the governance forum.
- [ ] Approved by Token House voting.
- [ ] Not vetoed by the Citizens' house.
- [ ] Executed on OP Mainnet.

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 <placeholder>.

This upgrades the Fault Proof contracts in the
[op-contracts/v1.8.0](https://github.com/ethereum-optimism/optimism/tree/op-contracts/v1.8.0-rc.1) release.

## Pre-deployments

- `MIPS` - `0x69470D6970Cd2A006b84B1d4d70179c892cFCE01`
- `FaultDisputeGame` - `0xe591Ebbc2Ba0EAd3db6a0867cC132Fe1c123F448`
- `PermissionedDisputeGame` - `0xb51baD2d9Da9f94d6A4A5A493Ae6469005611B68`

## 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/<path>/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.

## State Validation

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

## Execution

This upgrade
* Changes dispute game implementation of the `CANNON` and `PERMISSIONED_CANNON` game types to contain a `op-program` release for the Holocene hardfork, which contains
the Holocene fork implementation as well as a `ChainConfig` and `RollupConfig` for the L2 chain being upgraded.
* Upgrades `MIPS.sol` to support the `F_GETFD` syscall, required by the golang 1.22+ runtime.

See the [overview](./OVERVIEW.md) and `input.json` bundle for more details.
24 changes: 24 additions & 0 deletions tasks/sep/025-fp-holocene-upgrade-fix/VALIDATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Validation

This document can be used to validate the state diff resulting from the execution of the upgrade
transaction.

For each contract listed in the state diff, please verify that no contracts or state changes shown in the Tenderly diff are missing from this document. Additionally, please verify that for each contract:

- The following state changes (and none others) are made to that contract. This validates that no unexpected state changes occur.
- All addresses (in section headers and storage values) match the provided name, using the Etherscan and Superchain Registry links provided. This validates the bytecode deployed at the addresses contains the correct logic.
- All key values match the semantic meaning provided, which can be validated using the storage layout links provided.

## State Changes

### `0x05F9613aDB30026FFd634f38e5C4dFd30a197Fa1` (`DisputeGameFactoryProxy`)

- **Key**: `0xffdfc1249c027f9191656349feb0761381bb32c9f557e01f419fd08754bf5a1b` <br/>
**Before**: `0x0000000000000000000000005e0877a8f6692ed470013e651c4357d0c4941e6c` <br/>
**After**: `0x000000000000000000000000e591ebbc2ba0ead3db6a0867cc132fe1c123f448` <br/>
**Meaning**: Updates the CANNON game type implementation. Verify that the new implementation is set using `cast call 0x05F9613aDB30026FFd634f38e5C4dFd30a197Fa1 "gameImpls(uint32)(address)" 0`. Where `0` is the [`CANNON` game type](https://github.com/ethereum-optimism/optimism/blob/op-contracts/v1.4.0/packages/contracts-bedrock/src/dispute/lib/Types.sol#L28).

- **Key**: `0x4d5a9bd2e41301728d41c8e705190becb4e74abe869f75bdb405b63716a35f9e` <br/>
**Before**: `0x0000000000000000000000004ed046e66c96600dae1a4ec39267bb0ce476e8cc` <br/>
**After**: `0x000000000000000000000000b51bad2d9da9f94d6a4a5a493ae6469005611b68` <br/>
**Meaning**: Updates the PERMISSIONED_CANNON game type implementation. Verify that the new implementation is set using `cast call 0x05F9613aDB30026FFd634f38e5C4dFd30a197Fa1 "gameImpls(uint32)(address)" 1`. Where `1` is the [`PERMISSIONED_CANNON` game type](https://github.com/ethereum-optimism/optimism/blob/op-contracts/v1.4.0/packages/contracts-bedrock/src/dispute/lib/Types.sol#L31).
67 changes: 67 additions & 0 deletions tasks/sep/025-fp-holocene-upgrade-fix/input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"chainId": 11155111,
"metadata": {
"name": "Holocene Hardfork - Proof Contract Upgrades",
"description": "Upgrades the `MIPS.sol`, `FaultDisputeGame.sol`, and `PermissionedDisputeGame.sol` contracts for Holocene."
},
"transactions": [
{
"metadata": {
"name": "Upgrade `PERMISSIONED_CANNON` game type in `DisputeGameFactory`",
"description": "Upgrades the `PERMISSIONED_CANNON` game type to the new Holocene deployment, with an updated version of `op-program` as the absolute prestate hash."
},
"to": "0x05F9613aDB30026FFd634f38e5C4dFd30a197Fa1",
"value": "0x0",
"data": "0x14f6b1a30000000000000000000000000000000000000000000000000000000000000001000000000000000000000000b51bad2d9da9f94d6a4a5a493ae6469005611b68",
"contractMethod": {
"type": "function",
"name": "setImplementation",
"inputs": [
{
"name": "_gameType",
"type": "uint32"
},
{
"name": "_impl",
"type": "address"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
"contractInputsValues": {
"_gameType": "1",
"_impl": "0xb51baD2d9Da9f94d6A4A5A493Ae6469005611B68"
}
},
{
"metadata": {
"name": "Upgrade `CANNON` game type in `DisputeGameFactory`",
"description": "Upgrades the `CANNON` game type to the new Holocene deployment, with an updated version of `op-program` as the absolute prestate hash."
},
"to": "0x05F9613aDB30026FFd634f38e5C4dFd30a197Fa1",
"value": "0x0",
"data": "0x14f6b1a30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e591ebbc2ba0ead3db6a0867cc132fe1c123f448",
"contractMethod": {
"type": "function",
"name": "setImplementation",
"inputs": [
{
"name": "_gameType",
"type": "uint32"
},
{
"name": "_impl",
"type": "address"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
"contractInputsValues": {
"_gameType": "0",
"_impl": "0xe591Ebbc2Ba0EAd3db6a0867cC132Fe1c123F448"
}
}
]
}

0 comments on commit 91a5dc2

Please sign in to comment.