Skip to content

Commit d18cb9d

Browse files
Merge pull request #1563 from ethereum-optimism/contract-updates
Smart contract section
2 parents dd5f42e + 2521d60 commit d18cb9d

File tree

13 files changed

+1137
-790
lines changed

13 files changed

+1137
-790
lines changed

pages/operators/chain-operators/deploy/overview.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ contracts that are deployed when the chain is created.
3838
Standard OP Stack chains should only use governance approved and audited
3939
smart contracts. The monorepo has them tagged with the following pattern
4040
`op-contracts/vX.X.X` and you can review the release notes for details on the
41-
changes. Read more about the details in our [Smart Contract Release Section](/stack/smart-contracts#official-releases).
41+
changes. Read more about the details in our [Smart Contract Release Section](/stack/smart-contracts/smart-contracts#official-releases).
4242
</Callout>
4343

4444
## Sequencer node

pages/operators/chain-operators/deploy/smart-contracts.mdx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ Deploying OP Stack L1 contracts is a critical step in setting up your rollup.
3232
generally not considered backwards compatible.
3333
</Callout>
3434

35-
## Deployment workflow
36-
3735
<Steps>
38-
### Install op-deployer
36+
37+
### Install op-deployer
3938

4039
First, install the `op-deployer` tool following the [installation instructions](/operators/chain-operators/tools/op-deployer#installation).
4140

pages/operators/chain-operators/self-hosted.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ There are two main steps to get started building your own self-hosted OP Chain:
3535
* **Chain Architecture**: OP Chains use execution and consensus clients as well as the OP Stack's privileged roles. For more details, see the [Chain Architecture](/operators/chain-operators/architecture) guide.
3636
* **Smart Contracts**: OP Chains use several smart contracts on the L1
3737
blockchain to manage aspects of the Rollup. Each OP Stack chain has its own
38-
set of [L1 smart contracts](/stack/smart-contracts),
39-
[L2 predeploy contracts](/stack/smart-contracts),
38+
set of [L1 smart contracts](/stack/smart-contracts/smart-contracts),
39+
[L2 predeploy contracts](/stack/smart-contracts/smart-contracts),
4040
and [L2 preinstall contracts](/operators/chain-operators/features/preinstalls)
4141
that are deployed when the chain is created.
4242
* **Preinstalls**: OP Chains come with [preinstalled core contracts](/operators/chain-operators/features/preinstalls), making them usable as soon as a chain is initialized on the OP Stack.

pages/stack/_meta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
"design-principles": "Design philosophy & principles",
1010
"components": "OP Stack components",
1111
"public-devnets": "Public devnets",
12-
"smart-contracts": "Smart contracts",
1312
"superchain-ops-guide": "Superchain-ops upgrades",
1413
"opcm": "OP Contracts Manager",
14+
"smart-contracts": "Smart contracts",
1515
"rollup": "Rollup",
1616
"fault-proofs": "Fault proofs",
1717
"transactions": "Transactions",

pages/stack/opcm.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { Callout, Tabs, Steps } from 'nextra/components'
2424

2525
The OP Contracts Manager is a contract that deploys the L1 contracts for an OP Stack chain in a single transaction. It provides a minimal set of user-configurable parameters to ensure that the resulting chain meets the standard configuration requirements. Additionally, as of [Upgrade 13](https://gov.optimism.io/t/upgrade-proposal-13-opcm-and-incident-response-improvements/9739), instances of OPCM can upgrade existing OP Stack chains.
2626

27-
The version deployed is always a governance-approved contract release. The set of governance approved contract releases can be found on the Optimism Monorepo releases page, and is the set of releases named `op-contracts/vX.Y.Z`. It deploys the [Fault Proof System](/stack/fault-proofs/explainer), using the [PermissionedDisputeGame](/stack/smart-contracts#permissioneddisputegame).
27+
The version deployed is always a governance-approved contract release. The set of governance approved contract releases can be found on the Optimism Monorepo releases page, and is the set of releases named `op-contracts/vX.Y.Z`. It deploys the [Fault Proof System](/stack/fault-proofs/explainer), using the [PermissionedDisputeGame](/stack/smart-contracts/smart-contracts#permissioneddisputegame).
2828

2929
## Purpose
3030

pages/stack/smart-contracts.mdx

Lines changed: 11 additions & 777 deletions
Large diffs are not rendered by default.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"smart-contracts": "Smart Contracts",
3+
"superchain-ops-guide": "Upgrade using superchain-op",
4+
"op-deployer-upgrade.mdx": "Upgrade using op-deployer",
5+
"upgrade-op-contracts-1-3-1-8.mdx": "Upgrade OP Contracts v1.3.0 to v1.8.0"
6+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
title: Upgrade L1 contracts using `op-deployer`
3+
description: Learn about how to upgrade smart contracts using op-deployer
4+
lang: en-US
5+
content_type: guide
6+
topic: smart-contract-deployer-upgrade
7+
personas:
8+
- protocol-developer
9+
- chain-operator
10+
categories:
11+
- protocol
12+
- l1-contracts
13+
- contract-upgrades
14+
is_imported_content: 'false'
15+
---
16+
17+
import { Steps } from 'nextra/components'
18+
19+
# Upgrade L1 contracts using `op-deployer`
20+
21+
[`op-deployer`](/operators/chain-operators/tools/op-deployer) simplifies the process of deploying and upgrading the OP Stack. Using the `upgrade` command, you can upgrade a chain from one version to the next.
22+
23+
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 upgraded to the latest version by running multiple upgrade commands in sequence.
24+
25+
Unlike the bootstrap or apply commands, upgrade does not directly interact with the chain. Instead, it generates calldata. You can then use this calldata with cast, Gnosis SAFE, or whatever tooling you use to manage your L1.
26+
27+
## Limitations of `upgrade`
28+
29+
There are a few limitations to `upgrade`:
30+
31+
Using the standard OP Contracts Manager currently requires you to be using the standard shared SuperchainConfig contract. If you're not using this, you will need to utilize the `bootstrap` command to deploy your own Superchain target, including your own `opcm` instance.
32+
33+
## Using `upgrade`
34+
35+
<Steps>
36+
### Install `op-deployer`
37+
38+
[Install `op-deployer`](/operators/chain-operators/tools/op-deployer#installation) from source or pre-built binary.
39+
40+
### Create a `config.json` file
41+
42+
Create a `config.json` file using the following example:
43+
44+
```json
45+
{
46+
"prank": "<address of the contract of the L1 ProxyAdmin owner>",
47+
"opcm": "<address of the chain's OPCM>",
48+
"chainConfigs": [
49+
{
50+
"systemConfigProxy": "<address of the chain's system config proxy>",
51+
"proxyAdmin": "<address of the chain's proxy admin>",
52+
"absolutePrestate": "<32-byte hash of the chain's absolute prestate>"
53+
}
54+
]
55+
}
56+
```
57+
58+
The standard OPCM instances (`opcm` in the example above) and absolute prestates (`absolutePrestate`) are found in the superchain registry:
59+
60+
* `opcm`: under `op_contracts_manager` for [Mainnet](https://github.com/ethereum-optimism/superchain-registry/blob/main/validation/standard/standard-versions-mainnet.toml) and [Sepolia](https://github.com/ethereum-optimism/superchain-registry/blob/main/validation/standard/standard-versions-sepolia.toml).
61+
* `absolutePrestate`: the `hash` under your [chosen upgrade](https://github.com/ethereum-optimism/superchain-registry/blob/main/validation/standard/standard-prestates.toml)
62+
63+
### Generate calldata
64+
65+
Run the following command:
66+
67+
```bash
68+
op-deployer upgrade <version> \
69+
--config <path to config JSON>
70+
```
71+
72+
`version` must be either major release `2.0` or higher.
73+
74+
The output should look like:
75+
76+
```json
77+
{
78+
"to": "<maps to the prank address>",
79+
"data": "<calldata>",
80+
"value": "0x0"
81+
}
82+
```
83+
84+
Now you have the calldata that can be executed onchain to perform the L1 contract upgrade. You should simulate this upgrade and make sure the changes are expected. You can reference the validation files of previously executed upgrade tasks in the [superchain-ops repo](https://github.com/ethereum-optimism/superchain-ops/blob/main/tasks/eth/022-holocene-fp-upgrade/NestedSignFromJson.s.sol) to see what the expected changes are. Once you're confident the state changes are expected, you can sign and execute the upgrade.
85+
</Steps>

0 commit comments

Comments
 (0)