Skip to content

Smart contract section #1563

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 46 commits into from
May 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
e799212
Smart contract section
bradleycamacho Apr 10, 2025
31f44c4
Fixes
bradleycamacho Apr 10, 2025
95fb41a
Fix lint
bradleycamacho Apr 10, 2025
5798c3e
Delete page
bradleycamacho Apr 10, 2025
2b7f303
Final edits
bradleycamacho May 12, 2025
e24ee32
Merge branch 'main' into contract-updates
bradleycamacho May 12, 2025
2592df3
breadcrumbs
bradleycamacho May 12, 2025
2e8be36
Merge branch 'contract-updates' of https://github.com/ethereum-optimi…
bradleycamacho May 12, 2025
821a44a
Fix lint
bradleycamacho May 12, 2025
e7b621f
Restore op-deployer content
bradleycamacho May 14, 2025
29ce7cc
Auto-fix: Update breadcrumbs, spelling dictionary and other automated…
bradleycamacho May 14, 2025
4314609
Merge branch 'main' into contract-updates
bradleycamacho May 14, 2025
1777ceb
Auto-fix: Update breadcrumbs, spelling dictionary and other automated…
bradleycamacho May 14, 2025
af6ad15
Move superchain-ops doc and create op-deployer doc
bradleycamacho May 14, 2025
b1c5b13
Auto-fix: Update breadcrumbs, spelling dictionary and other automated…
bradleycamacho May 14, 2025
7e9f4d9
Fix breadcrumbs
bradleycamacho May 14, 2025
961ec92
Import steps
bradleycamacho May 14, 2025
83546b2
Add links in upgrade overview page
bradleycamacho May 14, 2025
3a2f0aa
Implement feedback
bradleycamacho May 29, 2025
afc447b
Auto-fix: Update breadcrumbs, spelling dictionary and other automated…
bradleycamacho May 29, 2025
2bc5942
small fix
bradleycamacho May 29, 2025
8001e14
Auto-fix: Update breadcrumbs, spelling dictionary and other automated…
bradleycamacho May 29, 2025
dad9b21
Clarify upgrades
bradleycamacho May 29, 2025
6ce9a54
Update 1.3>1.8
bradleycamacho May 29, 2025
c6e4eac
fix docker references
bradleycamacho May 29, 2025
cf11fdd
fix title
bradleycamacho May 29, 2025
c333b2d
Fix docker again
bradleycamacho May 29, 2025
71005ab
Fix nav
bradleycamacho May 29, 2025
d3f60f4
Auto-fix: Update breadcrumbs, spelling dictionary and other automated…
bradleycamacho May 29, 2025
6c5e6cc
Merge branch 'main' into contract-updates
bradleycamacho May 29, 2025
24ef5f7
Auto-fix: Update breadcrumbs, spelling dictionary and other automated…
bradleycamacho May 29, 2025
e5cced2
Fix checkout
bradleycamacho May 29, 2025
a528cf1
Remove redundant info
bradleycamacho May 29, 2025
45a9539
Add code block formatting
bradleycamacho May 29, 2025
29ca519
Implement feedback
bradleycamacho May 29, 2025
2ac88ad
Add missing output descriptions
bradleycamacho May 29, 2025
acf3ccc
Implement feedback and small fixes
bradleycamacho May 29, 2025
38be307
Auto-fix: Update breadcrumbs, spelling dictionary and other automated…
bradleycamacho May 29, 2025
b1ce3b1
Update pages/stack/smart-contracts/upgrade-op-contracts-1-3-1-8.mdx
bradleycamacho May 30, 2025
dabfc54
Update pages/stack/smart-contracts/upgrade-op-contracts-1-3-1-8.mdx
bradleycamacho May 30, 2025
046d657
Update pages/stack/smart-contracts/upgrade-op-contracts-1-3-1-8.mdx
bradleycamacho May 30, 2025
09715e6
Update pages/stack/smart-contracts/upgrade-op-contracts-1-3-1-8.mdx
bradleycamacho May 30, 2025
3ffb217
Update pages/stack/smart-contracts/upgrade-op-contracts-1-3-1-8.mdx
bradleycamacho May 30, 2025
8f96d23
Implement feedback
bradleycamacho May 30, 2025
e782df1
Merge branch 'contract-updates' of https://github.com/ethereum-optimi…
bradleycamacho May 30, 2025
2521d60
Merge branch 'main' into contract-updates
bradleycamacho May 30, 2025
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
2 changes: 1 addition & 1 deletion pages/operators/chain-operators/deploy/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ contracts that are deployed when the chain is created.
Standard OP Stack chains should only use governance approved and audited
smart contracts. The monorepo has them tagged with the following pattern
`op-contracts/vX.X.X` and you can review the release notes for details on the
changes. Read more about the details in our [Smart Contract Release Section](/stack/smart-contracts#official-releases).
changes. Read more about the details in our [Smart Contract Release Section](/stack/smart-contracts/smart-contracts#official-releases).
</Callout>

## Sequencer node
Expand Down
5 changes: 2 additions & 3 deletions pages/operators/chain-operators/deploy/smart-contracts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ Deploying OP Stack L1 contracts is a critical step in setting up your rollup.
generally not considered backwards compatible.
</Callout>

## Deployment workflow

<Steps>
### Install op-deployer

### Install op-deployer

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

Expand Down
4 changes: 2 additions & 2 deletions pages/operators/chain-operators/self-hosted.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ There are two main steps to get started building your own self-hosted OP Chain:
* **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.
* **Smart Contracts**: OP Chains use several smart contracts on the L1
blockchain to manage aspects of the Rollup. Each OP Stack chain has its own
set of [L1 smart contracts](/stack/smart-contracts),
[L2 predeploy contracts](/stack/smart-contracts),
set of [L1 smart contracts](/stack/smart-contracts/smart-contracts),
[L2 predeploy contracts](/stack/smart-contracts/smart-contracts),
and [L2 preinstall contracts](/operators/chain-operators/features/preinstalls)
that are deployed when the chain is created.
* **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.
Expand Down
2 changes: 1 addition & 1 deletion pages/stack/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"design-principles": "Design philosophy & principles",
"components": "OP Stack components",
"public-devnets": "Public devnets",
"smart-contracts": "Smart contracts",
"superchain-ops-guide": "Superchain-ops upgrades",
"opcm": "OP Contracts Manager",
"smart-contracts": "Smart contracts",
"rollup": "Rollup",
"fault-proofs": "Fault proofs",
"transactions": "Transactions",
Expand Down
2 changes: 1 addition & 1 deletion pages/stack/opcm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { Callout, Tabs, Steps } from 'nextra/components'

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.

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

## Purpose

Expand Down
788 changes: 11 additions & 777 deletions pages/stack/smart-contracts.mdx

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions pages/stack/smart-contracts/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"smart-contracts": "Smart Contracts",
"superchain-ops-guide": "Upgrade using superchain-op",
"op-deployer-upgrade.mdx": "Upgrade using op-deployer",
"upgrade-op-contracts-1-3-1-8.mdx": "Upgrade OP Contracts v1.3.0 to v1.8.0"
}
85 changes: 85 additions & 0 deletions pages/stack/smart-contracts/op-deployer-upgrade.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
title: Upgrade L1 contracts using `op-deployer`
description: Learn about how to upgrade smart contracts using op-deployer
lang: en-US
content_type: guide
topic: smart-contract-deployer-upgrade
personas:
- protocol-developer
- chain-operator
categories:
- protocol
- l1-contracts
- contract-upgrades
is_imported_content: 'false'
---

import { Steps } from 'nextra/components'

# Upgrade L1 contracts using `op-deployer`

[`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.

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.

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.

## Limitations of `upgrade`

There are a few limitations to `upgrade`:

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.

## Using `upgrade`

<Steps>
### Install `op-deployer`

[Install `op-deployer`](/operators/chain-operators/tools/op-deployer#installation) from source or pre-built binary.

### Create a `config.json` file

Create a `config.json` file using the following example:

```json
{
"prank": "<address of the contract of the L1 ProxyAdmin owner>",
"opcm": "<address of the chain's OPCM>",
"chainConfigs": [
{
"systemConfigProxy": "<address of the chain's system config proxy>",
"proxyAdmin": "<address of the chain's proxy admin>",
"absolutePrestate": "<32-byte hash of the chain's absolute prestate>"
}
]
}
```

The standard OPCM instances (`opcm` in the example above) and absolute prestates (`absolutePrestate`) are found in the superchain registry:

* `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).
* `absolutePrestate`: the `hash` under your [chosen upgrade](https://github.com/ethereum-optimism/superchain-registry/blob/main/validation/standard/standard-prestates.toml)

### Generate calldata

Run the following command:

```bash
op-deployer upgrade <version> \
--config <path to config JSON>
```

`version` must be either major release `2.0` or higher.

The output should look like:

```json
{
"to": "<maps to the prank address>",
"data": "<calldata>",
"value": "0x0"
}
```

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.
</Steps>
Loading