|
| 1 | +--- |
| 2 | +title: Chain upgrade guide using superchain-ops |
| 3 | +description: Learn about using superchain-ops to upgrade your chain |
| 4 | +lang: en-US |
| 5 | +content_type: guide |
| 6 | +topic: op-chain-upgrades-superchain-ops |
| 7 | +personas: |
| 8 | + - protocol-developer |
| 9 | + - chain-operator |
| 10 | +categories: |
| 11 | + - protocol |
| 12 | + - chain-deployment |
| 13 | + - smart-contracts |
| 14 | + - infrastructure |
| 15 | + - superchain-contracts |
| 16 | + - system-configuration |
| 17 | + - deployment-tooling |
| 18 | +is_imported_content: 'false' |
| 19 | +--- |
| 20 | + |
| 21 | +import { Callout } from 'nextra/components' |
| 22 | + |
| 23 | +# Chain upgrade guide using superchain-ops |
| 24 | + |
| 25 | +This guide outlines the process for upgrading Optimism chains using the `superchain-ops` repository. It's intended primarily for chains that are part of the Superchain, those with the Foundation or Security Council as signers, and/or chains requiring a highly secure and manual process. |
| 26 | + |
| 27 | +`superchain-ops` is a highly secure service designed for Optimism chains. It provides a structured and security-focused approach to chain upgrades. The process involves creating tasks that use predefined templates to generate the necessary upgrade transactions. |
| 28 | + |
| 29 | +## Who should use `superchain-ops` |
| 30 | + |
| 31 | +`superchain-ops` is primarily intended for: |
| 32 | + |
| 33 | +1. **Chains in the Superchain**: For standard chains officially part of the Superchain, upgrades are typically handled through `superchain-ops`. |
| 34 | + |
| 35 | +2. **Chains with Foundation or Security Council as signers**: If your chain has the Foundation multi-sig or Security Council as signers, your upgrade tasks should go through `superchain-ops`. |
| 36 | + |
| 37 | +3. **Chains requiring a highly secure and manual process**: For chains that prioritize security over automation, `superchain-ops` provides an intentionally manual workflow with thorough verification steps. |
| 38 | + |
| 39 | +For chains that don't fall into these categories, you'll need to generate appropriate call data for upgrades through other means or develop your own upgrade process for non-OPCM upgrades. |
| 40 | + |
| 41 | +## Understanding templates and tasks |
| 42 | + |
| 43 | +`superchain-ops` uses two key concepts: |
| 44 | + |
| 45 | +* **Templates**: Define what the upgrade is and contain the code for specific upgrade paths (e.g., 1.8 to 2.0). Templates are version-specific and live in the [/src/improvements/template](https://github.com/ethereum-optimism/superchain-ops/tree/main/src/improvements/template) directory. |
| 46 | + |
| 47 | +* **Tasks**: Chain-specific implementations of templates. Multiple tasks can use the same template for different chains. Tasks are organized by network (mainnet or testnet) in the [/src/improvements/tasks](https://github.com/ethereum-optimism/superchain-ops/tree/main/src/improvements/tasks) directory. |
| 48 | + |
| 49 | +## General upgrade process |
| 50 | + |
| 51 | +The following process outlines how to upgrade a chain using `superchain-ops`, using the 1.8 to 2.0 upgrade as an example. This same pattern applies to other OPCM-based upgrades (like 2.0 to 3.0). |
| 52 | + |
| 53 | +### Step 1: Clone the `superchain-ops` repository |
| 54 | + |
| 55 | +```bash |
| 56 | +git clone https://github.com/ethereum-optimism/superchain-ops.git |
| 57 | +cd superchain-ops |
| 58 | +``` |
| 59 | + |
| 60 | +### Step 2: Create a new task using the quick start |
| 61 | + |
| 62 | +```bash |
| 63 | +cd src/improvements/ |
| 64 | +just new task |
| 65 | +``` |
| 66 | + |
| 67 | +Follow the prompts to select the appropriate template (e.g., `opcm-upgrade-v200` for a 1.8 to 2.0 upgrade) and provide the necessary details. |
| 68 | + |
| 69 | +This will create a new task directory containing a `config.toml` and `README` file. The config file will look like this: |
| 70 | + |
| 71 | +```bash |
| 72 | +l2chains = [] # e.g. [{name = "OP Mainnet", chainId = 10}] |
| 73 | +templateName = "OPCMUpgradeV200" |
| 74 | + |
| 75 | +``` |
| 76 | + |
| 77 | +### Step 3: Configure the task |
| 78 | + |
| 79 | +Look through other tasks in the directory to find the information necessary for your upgrade. For example, when upgrading from 1.8 to 2.0, you can look at the [src/improvements/tasks/eth/002-opcm-upgrade-v200/config.toml](https://github.com/ethereum-optimism/superchain-ops/blob/main/src/improvements/tasks/eth/002-opcm-upgrade-v200/config.toml) file to see that your config file should look like the following: |
| 80 | + |
| 81 | +<Callout> |
| 82 | + Ensure you replace all addresses and other values in the example below |
| 83 | +</Callout> |
| 84 | + |
| 85 | +```bash |
| 86 | +l2chains = [ |
| 87 | + {name = "Unichain", chainId = 130} |
| 88 | +] |
| 89 | + |
| 90 | +templateName = "OPCMUpgradeV200" |
| 91 | + |
| 92 | +[opcmUpgrades] |
| 93 | +absolutePrestates = [ |
| 94 | + {absolutePrestate = "0x039facea52b20c605c05efb0a33560a92de7074218998f75bcdf61e8989cb5d9", chainId = 130}, |
| 95 | +] |
| 96 | + |
| 97 | +[addresses] |
| 98 | +OPCM = "0x026b2F158255Beac46c1E7c6b8BbF29A4b6A7B76" |
| 99 | +# Deployed March 27, 2025: https://etherscan.io/tx/0x902ce895f70a72110d40c9a734a26380b2e27c370aae90721cdfa1ac972cfff8 |
| 100 | +StandardValidatorV200 = "0xecabaeaa1d58261f1579232520c5b460ca58a164" |
| 101 | +ChildSafe1 = "0xb0c4C487C5cf6d67807Bc2008c66fa7e2cE744EC" |
| 102 | +ChildSafe2 = "0x847B5c174615B1B7fDF770882256e2D3E95b9D92" |
| 103 | +ChildSafe3 = "0xc2819DC788505Aac350142A7A707BF9D03E3Bd03" |
| 104 | +``` |
| 105 | + |
| 106 | +### Step 5: Simulate the task |
| 107 | + |
| 108 | +Before executing the upgrade, simulate it to ensure everything is configured correctly: |
| 109 | + |
| 110 | +```bash |
| 111 | +just clean && just install |
| 112 | +``` |
| 113 | + |
| 114 | +```bash |
| 115 | +# Nested |
| 116 | +SIMULATE_WITHOUT_LEDGER=1 just --dotenv-path $(pwd)/.env --justfile ../../../nested.just simulate <foundation|council|chain-governor|child-safe-1|child-safe-2|child-safe-3> |
| 117 | +# Single |
| 118 | +SIMULATE_WITHOUT_LEDGER=1 just --dotenv-path $(pwd)/.env --justfile ../../../single.just simulate |
| 119 | +``` |
| 120 | + |
| 121 | +This will run through the upgrade process without actually executing the transactions. |
| 122 | + |
| 123 | +### Step 6: Execute or submit for review |
| 124 | + |
| 125 | +For chains within the Superchain, submit a pull request to have your task reviewed. If your chain is not within the Superchain, execute the transaction yourself. |
| 126 | + |
| 127 | +## Using op-deployer to create calldata |
| 128 | + |
| 129 | +The `upgrade` command in op-deployer allows you to upgrade a chain from one version to another. It consists of several subcommands, one for each upgrade version. Think of it like a database migration: each upgrade command upgrades a chain from exactly one previous version to the next. A chain that is several versions behind can be upgrade to the latest version by running multiple upgrade commands in sequence. |
| 130 | + |
| 131 | +To learn about the `upgrade` command, check out our [devdocs](https://devdocs.optimism.io/op-deployer/user-guide/upgrade.html). |
0 commit comments