This repository was archived by the owner on Apr 6, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 334
Deploy section #729
Merged
Merged
Deploy section #729
Changes from 4 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
d4a2b6f
adding deploy section
sbvegan e7e762e
small refactor to tutorial page
sbvegan 6700d4f
stopped at line 168 in config.go
sbvegan 3dc26c5
adding remaining missing configs
sbvegan f412cdc
linting
sbvegan 6b9a12e
adding standard configuration notes
sbvegan 4e366a2
adding some details
sbvegan 9294c2a
refactoring configuration page
sbvegan 9fc1240
removing configuration page link
sbvegan eb30500
Merge branch 'main' into deploy-section
sbvegan 6b4938b
updating current wip
sbvegan 9e87d06
new updates
sbvegan e71daa2
linting
sbvegan df82cc4
Apply suggestions from code review
sbvegan 33d6756
moving things around
sbvegan e66eb78
improving ledgibility
sbvegan 988d681
removing examples for now
sbvegan c0698cb
Merge branch 'main' into deploy-section
sbvegan e6c28a0
linting
sbvegan bc86bb2
Apply suggestions from code review
sbvegan bfebb3b
fixing broken links
sbvegan 3fc8c0c
adding fjord note
sbvegan 443e21c
Apply suggestions from code review
sbvegan 7a34dfd
Update smart-contracts.mdx
cpengilly 9a4e84a
some coderabbit suggestions
sbvegan f89f2a9
fixing header
sbvegan d8b47e5
Merge branch 'main' into deploy-section
sbvegan 97002d2
Update pages/builders/chain-operators/management/best-practices.mdx
sbvegan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "overview": "Overview", | ||
| "smart-contracts": "L1 Contract Deployment", | ||
| "genesis": "Genesis Creation", | ||
| "off-chain": "Off Chain Components" | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| --- | ||
| title: OP Stack Genesis Creation | ||
| lang: en-US | ||
| description: Learn how to create a genesis file for the OP Stack. | ||
| --- | ||
|
|
||
| import { Callout } from 'nextra/components' | ||
|
|
||
| # OP Stack Genesis Creation | ||
|
|
||
| The following guide shows you how to generate the L2 allocs. This is a JSON | ||
| file that represents the L2 genesis state. | ||
|
|
||
| ## [develop](https://github.com/ethereum-optimism/optimism/tree/develop) | ||
|
|
||
| <Callout type="warning"> | ||
| The primary development branch is `develop`. It contains the most up-to-date | ||
| software that remains backwards compatible with the latest experimental | ||
| netowrk deployments. **Changes to made to the smart contracts are usually | ||
| NOT considered backwards compatible.** | ||
| </Callout> | ||
|
|
||
| As of 2024-06-04, a foundry script is used to generate the L2 genesis allocs. | ||
| The `CONTRACT_ADDRESSES_PATH` env var represents the deployment artifact that | ||
| was generated during a contract deployment. The same deploy config JSON file | ||
| should be used for L1 contracts deployment as when generating the L2 genesis | ||
| allocs. The `STATE_DUMP_PATH` env var represents the filepath at which the | ||
| allocs will be written to on disk. | ||
|
|
||
| ``` | ||
| CONTRACT_ADDRESSES_PATH=deployments/artifact.json \ | ||
| DEPLOY_CONFIG_PATH=<PATH_TO_MY_DEPLOY_CONFIG> \ | ||
| STATE_DUMP_PATH=<PATH_TO_WRITE_L2_ALLOCS> \ | ||
| forge script scripts/L2Genesis.s.sol:L2Genesis \ | ||
| --sig 'runWithStateDump()' | ||
| ``` | ||
|
|
||
| ## [op-contracts/v1.3.0](https://github.com/ethereum-optimism/optimism/tree/op-contracts/v1.3.0) | ||
|
|
||
| The Multi-Chain Prep (MCP) L1 [release](https://github.com/ethereum-optimism/optimism/releases/tag/op-contracts%2Fv1.3.0), | ||
| cross-chain upgrades and mitigates potential exploitation risks during | ||
| emergency, multi-chain upgrades by transitioning chain-specific deployment | ||
| configuration variables from immutables into storage. It also extends | ||
| `SystemConfig` to contain the addresses of the network’s contracts. | ||
|
sbvegan marked this conversation as resolved.
Outdated
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| --- | ||
| title: OP Stack Off Chain Components | ||
| lang: en-US | ||
| description: Learn some best practices around running the OP Stack's off chain components. | ||
| --- | ||
|
|
||
| import { Callout } from 'nextra/components' | ||
|
|
||
| # OP Stack Off Chain Components | ||
|
|
||
| The following guide shows you some best practices around running the OP Stack's | ||
| off chain components. | ||
|
|
||
| ## [develop](https://github.com/ethereum-optimism/optimism/tree/develop) | ||
|
|
||
| <Callout type="warning"> | ||
| The primary development branch is `develop`. It contains the most up-to-date | ||
| software that remains backwards compatible with the latest experimental | ||
| netowrk deployments. **Changes to made to the smart contracts are usually | ||
| NOT considered backwards compatible.** | ||
| </Callout> | ||
|
|
||
|
|
||
| ## latest release | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| --- | ||
| title: OP Stack Deployment Overview | ||
| lang: en-US | ||
| description: Learn about the different components of deploying the OP Stack. | ||
| --- | ||
|
|
||
| import { Callout } from 'nextra/components' | ||
|
|
||
| # OP Stack Deployment Overview | ||
|
|
||
| When deploying an OP Stack chain, you'll be setting up four different | ||
| components. It's useful to understand what each of these components does before | ||
| you start deploying your chain. The OP Stack can be deployed as a L3 which | ||
|
sbvegan marked this conversation as resolved.
Outdated
|
||
| includes additional considerations. The following information assumes you're | ||
| deploying a L2 Rollup on Ethereum. | ||
|
|
||
| ## Smart Contracts | ||
|
|
||
| The OP Stack uses a set of smart contracts on the L1 blockchain to manage | ||
| aspects of the Rollup. Each OP Stack chain has its own set of L1 smart | ||
| contracts that are deployed when the chain is created. | ||
|
|
||
| <Callout type="warning"> | ||
| 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 on our [Smart Contract Release Section](/stack/protocol/rollup/smart-contracts#releases). | ||
| </Callout> | ||
|
|
||
| ## Sequencer Node | ||
|
|
||
| OP Stack chains use a Sequencer node to gather proposed transactions from users | ||
| and publish them to the L1 blockchain. OP Stack chains rely on at least one of | ||
| these Sequencer nodes. You can also run additional replica (non-Sequencer) | ||
| nodes. | ||
|
|
||
| ### Consensus Client | ||
|
|
||
| OP Stack Rollup nodes, like Ethereum nodes, have a consensus client. The | ||
| consensus client is responsible for determining the list and ordering of blocks | ||
| and transactions that are part of your blockchain. Several implementations of | ||
| the OP Stack consensus client exist, including `op-node` (maintained by the | ||
| Optimism Foundation), [`magi`](https://github.com/a16z/magi) (maintained by | ||
| a16z) and [`hildr`](https://github.com/optimism-java/hildr) (maintained by OptimismJ). | ||
|
|
||
| ### Execution Client | ||
|
|
||
| OP Stack nodes, like Ethereum nodes, also have an execution client. The | ||
| execution client is responsible for executing transactions and maintaining the | ||
| state of the blockchain. Various implementations of the OP Stack execution | ||
| client exist, including `op-geth` (maintained by Optimism Foundation), | ||
| [`op-erigon`](https://github.com/testinprod-io/op-erigon) | ||
| (maintained by Test in Prod), and [`op-nethermind`](https://docs.nethermind.io/get-started/installing-nethermind/#supported-networks). | ||
|
|
||
| ## Batcher | ||
|
|
||
| The Batcher is a service that publishes transactions from the Rollup to the L1 | ||
| blockchain. The Batcher runs continuously alongside the Sequencer and publishes | ||
| transactions in batches (hence the name) on a regular basis. | ||
|
sbvegan marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Proposer | ||
|
|
||
| The Proposer is a service responsible for publishing transactions *results* (in | ||
| the form of L2 state roots) to the L1 blockchain. This allows smart contracts | ||
| on L1 to read the state of the L2, which is necessary for cross-chain | ||
| communication and reconciliation between state changes. | ||
|
|
||
| ## Software Dependencies | ||
|
|
||
| | Dependency | Version | Version Check Command | | ||
| | ------------------------------------------------------------- | -------- | --------------------- | | ||
| | [git](https://git-scm.com/) | `^2` | `git --version` | | ||
| | [go](https://go.dev/) | `^1.21` | `go version` | | ||
| | [node](https://nodejs.org/en/) | `^20` | `node --version` | | ||
| | [pnpm](https://pnpm.io/installation) | `^8` | `pnpm --version` | | ||
| | [foundry](https://github.com/foundry-rs/foundry#installation) | `^0.2.0` | `forge --version` | | ||
| | [make](https://linux.die.net/man/1/make) | `^3` | `make --version` | | ||
| | [jq](https://github.com/jqlang/jq) | `^1.6` | `jq --version` | | ||
| | [direnv](https://direnv.net) | `^2` | `direnv --version` | | ||
|
|
||
| ### Notes on Specific Dependencies | ||
|
|
||
| #### `node` | ||
|
|
||
| We recommend using the latest LTS version of Node.js (currently v20). | ||
| [`nvm`](https://github.com/nvm-sh/nvm) is a useful tool that can help you | ||
| manage multiple versions of Node.js on your machine. You may experience | ||
| unexpected errors on older versions of Node.js. | ||
|
|
||
| #### `foundry` | ||
|
|
||
| It's recommended to use the scripts in the monorepo's `package.json` for | ||
| managing `foundry` to ensure you're always working with the correct version. | ||
| This approach simplifies the installation, update, and version checking | ||
| process. | ||
|
|
||
| #### `direnv` | ||
|
|
||
| Parts of our tutorial use [`direnv`](https://direnv.net) as a way of loading | ||
| environment variables from `.envrc` files into your shell. This means you won't | ||
| have to manually export environment variables every time you want to use them. | ||
| `direnv` only ever has access to files that you explicitly allow it to see. | ||
|
|
||
| After [installing `direnv`](https://direnv.net/docs/installation.html), you | ||
| will need to **make sure that [`direnv` is hooked into your shell](https://direnv.net/docs/hook.html)**. | ||
| Make sure you've followed [the guide on the `direnv` website](https://direnv.net/docs/hook.html), | ||
| then **close your terminal and reopen it** so that the changes take effect (or | ||
| `source` your config file if you know how to do that). | ||
|
|
||
| <Callout> | ||
| Make sure that you have correctly hooked `direnv` into your shell by modifying | ||
| your shell configuration file (like `~/.bashrc` or `~/.zshrc`). If you haven't | ||
| edited a config file then you probably haven't configured `direnv` properly | ||
| (and things might not work later). | ||
| </Callout> | ||
|
|
||
| ## Next Steps | ||
|
|
||
| * Check out what goes into [configuring](/builders/chain-operators/management/configuration) | ||
|
sbvegan marked this conversation as resolved.
Outdated
|
||
| an OP Stack Chain before you deploy. | ||
| * Learn how to create a rollup [genesis file](/builders/chain-operators/deploy/genesis). | ||
| * See what considrations need to be made when running the [off chain | ||
| components](/builders/chain-operators/deploy/off-chain). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| --- | ||
| title: OP Stack Smart Contract Deployment | ||
| lang: en-US | ||
| description: Learn how to deploy the OP Stack L1 smart contracts. | ||
| --- | ||
|
|
||
| import { Callout } from 'nextra/components' | ||
|
|
||
| # OP Stack Smart Contract Deployment | ||
|
|
||
| The following guide shows you how to deploy the OP Stack L1 smart contracts. | ||
| The primary development branch is `develop`. It contains the most up-to-date | ||
| software that remains backwards compatible with the latest experimental | ||
| network deployments. **Changes to made to the smart contracts are usually | ||
|
sbvegan marked this conversation as resolved.
Outdated
|
||
| NOT considered backwards compatible.** | ||
|
|
||
| <Callout> | ||
| Standard OP Stack chains should use governance approved and audited versions | ||
| of the smart contract code. | ||
| </Callout> | ||
|
|
||
| ## Deployment Configuration | ||
|
|
||
| https://github.com/ethereum-optimism/optimism/blob/develop/op-chain-ops/genesis/config.go | ||
|
sbvegan marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## [develop](https://github.com/ethereum-optimism/optimism/tree/develop) | ||
|
|
||
| <Callout type="warning"> | ||
| The primary development branch is `develop`. It contains the most up-to-date | ||
| software that remains backwards compatible with the latest experimental | ||
| netowrk deployments. **Changes to made to the smart contracts are usually | ||
| NOT considered backwards compatible.** | ||
|
sbvegan marked this conversation as resolved.
Outdated
|
||
| </Callout> | ||
|
|
||
| As of 2024-06-04, the smart contracts are deployed using `foundry`. The | ||
| `DEPLOYMENT_OUTFILE` env var will determine the filepath that the deployment | ||
| artifact is written to on disk after the deployment. It comes in the form of a | ||
| JSON file where keys are the names of the contracts and the values are the | ||
| addresses the contract was deployed to. | ||
|
|
||
| The `DEPLOY_CONFIG_PATH` is a filepath to a deploy config file, see the | ||
| deploy-config directory for examples and the DeployConfig definition for | ||
| descriptions of the values. | ||
|
|
||
| ``` | ||
| DEPLOYMENT_OUTFILE=deployments/artifact.json \ | ||
| DEPLOY_CONFIG_PATH=<PATH_TO_MY_DEPLOY_CONFIG> \ | ||
| forge script scripts/Deploy.s.sol:Deploy \ | ||
| --broadcast --private-key $PRIVATE_KEY \ | ||
| --rpc-url $ETH_RPC_URL | ||
| ``` | ||
|
|
||
| The `IMPL_SALT` env var can be used to set the create2 salt for deploying the | ||
| implementation contracts. | ||
|
|
||
| This will deploy an entire new system of L1 smart contracts including a new | ||
| SuperchainConfig. In the future there will be an easy way to deploy only | ||
| proxies and use shared implementations for each of the contracts as well as a | ||
| shared SuperchainConfig contract. | ||
|
|
||
|
sbvegan marked this conversation as resolved.
Outdated
|
||
| ### Deploying a single contract | ||
| All of the functions for deploying a single contract are public meaning that | ||
| the `--sig` argument to forge script can be used to target the deployment of a | ||
| single contract. | ||
|
|
||
| ## [op-contracts/v1.3.0](https://github.com/ethereum-optimism/optimism/tree/op-contracts/v1.3.0) | ||
|
|
||
| The Multi-Chain Prep (MCP) L1 [release](https://github.com/ethereum-optimism/optimism/releases/tag/op-contracts%2Fv1.3.0), | ||
| cross-chain upgrades and mitigates potential exploitation risks during | ||
| emergency, multi-chain upgrades by transitioning chain-specific deployment | ||
| configuration variables from immutables into storage. It also extends | ||
| `SystemConfig` to contain the addresses of the network’s contracts. | ||
|
sbvegan marked this conversation as resolved.
Outdated
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.