Skip to content

Commit af402b3

Browse files
authored
Merge pull request #1292 from ethereum-optimism/testnet-genesis
Update Genesis Creation Documentation to Use op-deployer
2 parents e337db2 + 17210b7 commit af402b3

File tree

4 files changed

+102
-96
lines changed

4 files changed

+102
-96
lines changed

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

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,6 @@ Once you have `genesis.json` and `rollup.json`:
7575
2. Configure op-node with rollup.json.
7676
3. Set up additional off-chain infrastructure as needed (block explorer, indexers, etc.). For more on architecture, see [Architecture overview](/operators/chain-operators/architecture).
7777

78-
### Step 3: Get data
79-
80-
Now that you have your `genesis.json` and `rollup.json` you can spin up a node on your network.
81-
You can also use the following inspect subcommands to get additional data:
82-
83-
```bash
84-
./bin/op-deployer inspect l1 --workdir .deployer <l2-chain-id> # outputs all L1 contract addresses for an L2 chain
85-
./bin/op-deployer inspect deploy-config --workdir .deployer <l2-chain-id> # outputs the deploy config for an L2 chain
86-
```
87-
8878
## Legacy method: using foundry script
8979

9080
The following guide shows you how to generate the L2 genesis file `genesis.json`. This is a JSON
@@ -147,7 +137,7 @@ DEPLOY_CONFIG_PATH=<PATH_TO_MY_DEPLOY_CONFIG> \
147137
STATE_DUMP_PATH=<PATH_TO_WRITE_L2_ALLOCS> \
148138
forge script scripts/L2Genesis.s.sol:L2Genesis \
149139
--sig 'runWithStateDump()'
150-
````
140+
```
151141

152142
## Subcommand (op-node genesis l2)
153143

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

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ lang: en-US
44
description: Learn how to deploy the OP Stack L1 smart contracts.
55
---
66

7-
import { Callout } from 'nextra/components'
7+
import { Callout, Steps } from 'nextra/components'
88

99
# OP Stack smart contract deployment
1010

@@ -15,14 +15,10 @@ For the latest recommended method, use [op-deployer](/operators/chain-operators/
1515

1616
The following guide shows you how to deploy the OP Stack L1 smart contracts.
1717
The primary development branch is `develop`, however **you should only deploy
18-
official contract releases**. You can visit the see the [smart contract overview](/stack/smart-contracts#official-releases)
18+
official contract releases**. You can visit the [smart contract overview](/stack/smart-contracts#official-releases)
1919
for the official release versions. Changes to the smart contracts are
2020
generally not considered backwards compatible.
2121

22-
<Callout>
23-
Standard OP Stack chains should use the latest governance approved and audited versions of the smart contract code.
24-
</Callout>
25-
2622
## Deployment configuration
2723

2824
Deploying your OP Stack contracts requires creating a deployment configuration
@@ -31,17 +27,29 @@ monorepo subdirectory: [packages/contracts-bedrock/deploy-config](https://github
3127
For the full set of deployment configuration options and their meanings, you
3228
can see the [rollup deployment configuration page](/operators/chain-operators/configuration/rollup).
3329

34-
## Deployment script
30+
For a detailed explanation of the configuration options and their meanings, refer to the [rollup deployment configuration page](/operators/chain-operators/configuration/rollup).
31+
32+
## Using `op-deployer`
33+
34+
The recommended way to deploy the L1 smart contracts is with the `op-deployer` tool.
35+
Follow the steps in this [section](/operators/chain-operators/tutorials/create-l2-rollup#using-op-deployer) to learn how it works.
36+
37+
38+
## Deployment script (Legacy method)
39+
40+
<Callout type="warning">
41+
The following deployment information outlines the legacy method for deploying the OP Stack L1 contracts.
42+
This method is not recommended and is provided only for historical context.
43+
</Callout>
3544

36-
The smart contracts are deployed using [foundry](https://github.com/foundry-rs)
37-
and you can find the script's source code in the monorepo at
45+
The legacy method for deploying smart contracts uses [foundry](https://github.com/foundry-rs) and the deployment script located in the monorepo at
3846
[packages/contracts-bedrock/scripts/deploy/Deploy.s.sol](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol).
3947

4048
### State diff
4149

42-
Before deploying the contracts, you can verify the state diff by using the `runWithStateDiff()` function signature in the deployment script, which produces
43-
the outputs inside [`snapshots/state-diff/`](https://github.com/ethereum-optimism/optimism/tree/develop/packages/contracts-bedrock/snapshots/state-diff).
44-
Run the deployment with state diffs by executing:
50+
You can verify the state diff before deploying the contracts by using the `runWithStateDiff()` function in the deployment script.
51+
This produces outputs in [`snapshots/state-diff/`](https://github.com/ethereum-optimism/optimism/tree/develop/packages/contracts-bedrock/snapshots/state-diff).
52+
Run the deployment with state diffs using the following command:
4553

4654
```bash
4755
forge script -vvv scripts/deploy/Deploy.s.sol:Deploy --sig 'runWithStateDiff()' --rpc-url $ETH_RPC_URL --broadcast --private-key $PRIVATE_KEY
@@ -92,8 +100,7 @@ enabled.
92100
Starting with permissioned fault proofs gives chain operators time to get comfortable
93101
running the additional infrastructure requirements: [op-challenger](https://github.com/ethereum-optimism/optimism/tree/develop/op-challenger) and
94102
[monitoring](https://github.com/ethereum-optimism/monitorism/tree/main). There are also
95-
additional changes to the economics of operating a permissionless fault proof that chain
96-
operators should have a firm understanding of.
103+
additional changes to the economics of operating a permissionless fault proof that chain operators should fully understand.
97104

98105
## Next steps
99106

pages/operators/chain-operators/tools/op-deployer.mdx

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,17 @@ The base use case for `op-deployer` is deploying new OP Chains. This process is
2828

2929
To get started with `op-deployer`, create an intent file that defines your desired chain configuration. Use the built-in `op-deployer` utility to generate this file:
3030

31+
<Callout type="info">
32+
op-deployer uses a declarative intent file to determine how a new chain should be configured.
33+
Then, it runs through a deployment pipeline to actually deploy the chain.
34+
</Callout>
35+
3136
```
3237
./bin/op-deployer init --l1-chain-id 11155111 --l2-chain-ids <l2-chain-id> --workdir .deployer
3338
```
3439

40+
Replace `<l2-chain-id>` with the exact value.
41+
3542
This command will create a directory called `.deployer` in your current working directory containing the intent file and an empty `state.json` file. `state.json` is populated with the results of your deployment, and never needs to be edited directly.
3643

3744
Your intent file will need to be modified to your parameters, but it will initially look something like this:
@@ -43,39 +50,40 @@ Your intent file will need to be modified to your parameters, but it will initia
4350

4451

4552
```toml
46-
deploymentStrategy = "live" # Deploying a chain to a live network i.e. Sepolia
47-
l1ChainID = 11155111 # The chain ID of the L1 chain you'll be deploying to
53+
configType = "standard-overrides"
54+
l1ChainID = 11155111 # The chain ID of Sepolia (L1) you'll be deploying to.
4855
fundDevAccounts = true # Whether or not to fund dev accounts using the test... junk mnemonic on L2.
49-
l1ContractsLocator = "tag://op-contracts/v1.6.0" # L1 smart contracts versions
56+
l1ContractsLocator = "tag://op-contracts/v1.8.0-rc.4" # L1 smart contracts versions
5057
l2ContractsLocator = "tag://op-contracts/v1.7.0-beta.1+l2-contracts" # L2 smart contracts versions
5158

5259
# Delete this table if you are using the shared Superchain contracts on the L1
5360
# If you are deploying your own SuperchainConfig and ProtocolVersions contracts, fill in these details
5461
[superchainRoles]
55-
proxyAdminOwner = "0xb9cdf788704088a4c0191d045c151fcbe2db14a4"
56-
protocolVersionsOwner = "0x85d646ed26c3f46400ede51236d8d7528196849b"
57-
guardian = "0x8c7e4a51acb17719d225bd17598b8a94b46c8767"
62+
proxyAdminOwner = "0x1eb2ffc903729a0f03966b917003800b145f56e2"
63+
protocolVersionsOwner = "0x79add5713b383daa0a138d3c4780c7a1804a8090"
64+
guardian = "0x7a50f00e8d05b95f98fe38d8bee366a7324dcf7e"
5865

5966
# List of L2s to deploy. op-deployer can deploy multiple L2s at once
6067
[[chains]]
6168
# Your chain's ID, encoded as a 32-byte hex string
62-
id = "0x0000000000000000000000000000000000000000000000000000000000003039"
69+
id = "0x00000000000000000000000000000000000000000000000000000a25406f3e60"
6370
# Update the fee recipient contract
64-
baseFeeVaultRecipient = "0x0000000000000000000000000000000000000000"
65-
l1FeeVaultRecipient = "0x0000000000000000000000000000000000000000"
66-
sequencerFeeVaultRecipient = "0x0000000000000000000000000000000000000000"
71+
baseFeeVaultRecipient = "0x100f829718B5Be38013CC7b29c5c62a08D00f1ff"
72+
l1FeeVaultRecipient = "0xbAEaf33e883068937aB4a50871f2FD52e241013A"
73+
sequencerFeeVaultRecipient = "0xd0D5D18F0ebb07B7d728b14AAE014eedA814d6BD"
74+
eip1559DenominatorCanyon = 250
6775
eip1559Denominator = 50
6876
eip1559Elasticity = 6
6977
# Various ownership roles for your chain. When you use op-deployer init, these roles are generated using the
7078
# test... junk mnemonic. You should replace these with your own addresses for production chains.
7179
[chains.roles]
72-
l1ProxyAdminOwner = "0x1a66b55a4f0139c32eddf4f8c60463afc3832e76"
73-
l2ProxyAdminOwner = "0x7759a8a43aa6a7ee9434ddb597beed64180c40fd"
74-
systemConfigOwner = "0x8e35d9523a0c4c9ac537d254079c2398c6f3b35f"
75-
unsafeBlockSigner = "0xbb19dce4ce51f353a98dbab31b5fa3bc80dc7769"
76-
batcher = "0x0e9c62712ab826e06b16b2236ce542f711eaffaf"
77-
proposer = "0x86dfafe0689e20685f7872e0cb264868454627bc"
78-
challenger = "0xf1658da627dd0738c555f9572f658617511c49d5"
80+
l1ProxyAdminOwner = "0xdf5a644aed1b5d6cE0DA2aDd778bc5f39d97Ac88"
81+
l2ProxyAdminOwner = "0xC40445CD88dDa2A410F86F6eF8E00fd52D8381FD"
82+
systemConfigOwner = "0xB32296E6929F2507dB8153A64b036D175Ac6E89e"
83+
unsafeBlockSigner = "0xA53526b516df4eEe3791734CE85311569e0eAD78"
84+
batcher = "0x8680d36811420359093fd321ED386a6e76BE2AF3"
85+
proposer = "0x41b3B204099771aDf857F826015703A1030b6675"
86+
challenger = "0x7B51A480dAeE699CA3a4F68F9AAA434452112eF7"
7987

8088
```
8189

@@ -96,10 +104,12 @@ You can also do chain by chain configurations in the `chains` table.
96104

97105
Now that you've created your intent file, you can apply it to your chain to deploy the L1 smart contracts:
98106

99-
```
100-
op-deployer apply --workdir .deployer --l1-rpc-url <rpc-url> --private-key <private key hex>
107+
```bash
108+
./bin/op-deployer apply --workdir .deployer --l1-rpc-url <rpc-url> --private-key <private key hex>
101109
```
102110

111+
* Replace `<rpc-url>` with your `L1_RPC_URL` and `<private key>` with your private key
112+
103113
This command will deploy the OP Stack to L1. It will deploy all L2s specified in the intent file. Superchain
104114
configuration will be set to the Superchain-wide defaults - i.e., your chain will be opted into the [Superchain pause](https://specs.optimism.io/protocol/superchain-config.html#pausability)
105115
and will use the same [protocol versions](https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/superchain-upgrades.md)
@@ -113,17 +123,17 @@ address as other chains on the Superchain.
113123

114124
Inspect the `state.json` file by navigating to your working directory. With the contracts deployed, generate the genesis and rollup configuration files by running the following commands:
115125

116-
```
117-
op-deployer inspect genesis --workdir .deployer <l2-chain-id> > .deployer/genesis.json
118-
op-deployer inspect rollup --workdir .deployer <l2-chain-id> > .deployer/rollup.json
126+
```bash
127+
./bin/op-deployer inspect genesis --workdir .deployer <l2-chain-id> > .deployer/genesis.json
128+
./bin/op-deployer inspect rollup --workdir .deployer <l2-chain-id> > .deployer/rollup.json
119129
```
120130

121-
Now that you have your `genesis.json` and `rollup.json` you can spin up a node on your network. You can also use the following inspect subcommands to get additional data:
131+
Now that you have your `genesis.json` and `rollup.json` you can spin up a node on your network. You can also use the following inspect subcommands to get additional chain artifacts:
122132

123-
```
124-
op-deployer inspect l1 --workdir .deployer <l2-chain-id> # outputs all L1 contract addresses for an L2 chain
125-
op-deployer inspect deploy-config --workdir .deployer <l2-chain-id> # outputs the deploy config for an L2 chain
126-
op-deployer inspect l2-semvers --workdir .deployer <l2-chain-id> # outputs the semvers for all L2 chains
133+
```bash
134+
./bin/op-deployer inspect l1 --workdir .deployer <l2-chain-id> # outputs all L1 contract addresses for an L2 chain
135+
./bin/op-deployer inspect deploy-config --workdir .deployer <l2-chain-id> # outputs the deploy config for an L2 chain
136+
./bin/op-deployer inspect l2-semvers --workdir .deployer <l2-chain-id> # outputs the semvers for all L2 chains
127137
```
128138
</Steps>
129139

pages/operators/chain-operators/tutorials/create-l2-rollup.mdx

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import { WipCallout } from '@/components/WipCallout'
1010
<WipCallout />
1111
# Creating your own L2 rollup testnet
1212

13-
14-
1513
<Callout type="info">
1614
Please **be prepared to set aside approximately one hour** to get everything running properly and **make sure to read through the guide carefully**.
1715
You don't want to miss any important steps that might cause issues down the line.
@@ -419,74 +417,75 @@ cast codesize 0x4e59b44847b379578588920cA78FbF26c0B4956C --rpc-url $L1_RPC_URL
419417

420418
Once you've configured your network, it's time to deploy the L1 contracts necessary for the functionality of the chain.
421419

422-
<Steps>
420+
## Using `op-deployer`
423421

424-
{<h3>Deploy the L1 contracts</h3>}
422+
The `op-deployer` tool simplifies the creation of genesis and rollup configuration files (`genesis.json` and `rollup.json`).
423+
These files are crucial for initializing the execution client (`op-geth`) and consensus client (`op-node`) for your network.
425424

426-
```bash
427-
forge script scripts/Deploy.s.sol:Deploy --private-key $GS_ADMIN_PRIVATE_KEY --broadcast --rpc-url $L1_RPC_URL --slow
428-
```
425+
The recommended flow for creating a genesis file and rollup configuration file on the OP Stack is as follows:
429426

430-
<Callout>
431-
If you see a nondescript error that includes `EvmError: Revert` and `Script failed` then you likely need to change the `IMPL_SALT` environment variable.
432-
This variable determines the addresses of various smart contracts that are deployed via [CREATE2](https://eips.ethereum.org/EIPS/eip-1014).
433-
If the same `IMPL_SALT` is used to deploy the same contracts twice, the second deployment will fail.
434-
**You can generate a new `IMPL_SALT` by running `direnv allow` anywhere in the Optimism Monorepo.**
427+
1. **Deploy the L1 contracts** using [op-deployer](/operators/chain-operators/tools/op-deployer).
428+
2. **Generate** both the L2 genesis file (`genesis.json`) and the rollup configuration file (`rollup.json`) using op-deployer's `inspect` commands.
429+
3. **Initialize** your off-chain components (e.g., execution client, consensus client).
430+
431+
<Callout type="info">
432+
Using op-deployer for chain initialization is a requirement for all chains intending to be for chains who intend to be standard and join the superchain.
433+
This ensures standardization and compatibility across the OP Stack ecosystem.
435434
</Callout>
436435

437-
</Steps>
436+
### Prerequisites
438437

439-
## Generate the L2 config files
438+
1. You have installed the `op-deployer` binary following the instructions in [deployer docs](/operators/chain-operators/tools/op-deployer#installation).
439+
After installation, extract the `op-deployer` into your `PATH` and `cd op-deployer`.
440440

441-
Now that you've set up the L1 smart contracts you can automatically generate several configuration files that are used within the Consensus Client and the Execution Client.
441+
2. You have created and customized an intent file in a `.deployer` directory, typically by running:
442442

443-
You need to generate three important files:
443+
```bash
444+
./bin/op-deployer init --l1-chain-id <YOUR_L1_CHAIN_ID> --l2-chain-ids <YOUR_L2_CHAIN_ID> --workdir .deployer
445+
```
444446

445-
1. `genesis.json` includes the genesis state of the chain for the Execution Client.
446-
2. `rollup.json` includes configuration information for the Consensus Client.
447-
3. `jwt.txt` is a [JSON Web Token](https://jwt.io/introduction) that allows the Consensus Client and the Execution Client to communicate securely (the same mechanism is used in Ethereum clients).
447+
Replace `<YOUR_L1_CHAIN_ID>` and `<YOUR_L2_CHAIN_ID>` with their respective values, see a list of [`chainIds`](https://chainid.network/).
448448

449-
<Steps>
449+
3. You have edited that intent file to your liking (roles, addresses, etc.).
450+
451+
### Step 1: Deploy the L1 contracts
450452

451-
{<h3>Navigate to the op-node package</h3>}
453+
To deploy your chain to L1, run:
452454

453455
```bash
454-
cd ~/optimism/op-node
456+
./bin/op-deployer apply --workdir .deployer \
457+
--l1-rpc-url <RPC_URL_FOR_L1> \
458+
--private-key <DEPLOYER_PRIVATE_KEY_HEX>
455459
```
456460

457-
{<h3>Create genesis files</h3>}
461+
* Replace `<RPC_URL_FOR_L1>` with the L1 RPC URL.
462+
* Replace `<DEPLOYER_PRIVATE_KEY_HEX>` with the private key of the account used for deployment.
458463

459-
Now you'll generate the `genesis.json` and `rollup.json` files within the `op-node` folder:
464+
This command:
460465

461-
```bash
462-
go run cmd/main.go genesis l2 \
463-
--deploy-config ../packages/contracts-bedrock/deploy-config/getting-started.json \
464-
--l1-deployments ../packages/contracts-bedrock/deployments/getting-started/.deploy \
465-
--outfile.l2 genesis.json \
466-
--outfile.rollup rollup.json \
467-
--l1-rpc $L1_RPC_URL
468-
```
466+
* Reads your intent file in `.deployer/.`
467+
* Deploys the OP Stack contracts to the specified L1.
468+
* Updates a local `state.json` file with the results of the deployment.
469469

470-
{<h3>Create an authentication key</h3>}
470+
### Step 2: Generate your L2 genesis file and rollup file
471471

472-
Next you'll create a [JSON Web Token](https://jwt.io/introduction) that will be used to authenticate the Consensus Client and the Execution Client.
473-
This token is used to ensure that only the Consensus Client and the Execution Client can communicate with each other.
474-
You can generate a JWT with the following command:
472+
After your L1 contracts have been deployed, generate the L2 genesis and rollup configuration files by inspecting the deployer's `state.json.`
475473

476474
```bash
477-
openssl rand -hex 32 > jwt.txt
475+
./bin/op-deployer inspect genesis --workdir .deployer <L2_CHAIN_ID> > .deployer/genesis.json
476+
./bin/op-deployer inspect rollup --workdir .deployer <L2_CHAIN_ID> > .deployer/rollup.json
478477
```
479478

480-
{<h3>Copy genesis files into the op-geth directory</h3>}
479+
* genesis.json is the file you will provide to your execution client (e.g. op-geth).
480+
* rollup.json is the file you will provide to your consensus client (e.g. op-node).
481481

482-
Finally, you'll need to copy the `genesis.json` file and `jwt.txt` file into `op-geth` so you can use it to initialize and run `op-geth`:
482+
### Step 3: Initialize your off-chain components
483483

484-
```bash
485-
cp genesis.json ~/op-geth
486-
cp jwt.txt ~/op-geth
487-
```
484+
Once you have `genesis.json` and `rollup.json`:
488485

489-
</Steps>
486+
1. Initialize op-geth using genesis.json.
487+
2. Configure op-node with rollup.json.
488+
3. Set up additional off-chain infrastructure as needed (block explorer, indexers, etc.). For more on architecture, see [Architecture overview](/operators/chain-operators/architecture).
490489

491490
## Initialize `op-geth`
492491

0 commit comments

Comments
 (0)