Skip to content

Commit d032aea

Browse files
authored
op-deployer: update devdocs, flag defaults, error message (#15364)
* op-deployer: update devdocs * default to OPStackSupport for bootstrap protocol-version flags * return all valid tags in error message * add validation to --l1-contracts-locator flag * remove L1ContractsRelease flag (auto-set)
1 parent ac8118d commit d032aea

File tree

7 files changed

+102
-41
lines changed

7 files changed

+102
-41
lines changed

op-deployer/book/src/reference-guide/artifacts-locators.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ Locators can be one of three types:
1212
downloaded using a tagged locator are validated against a hardcoded checksum in the OP Deployer implementation.
1313
This prevents tampering with the contract artifacts once they have been tagged. Additionally, tagged locators are
1414
cached on disk to avoid repeated downloads.
15+
- ex: `tag://op-contracts/v1.8.0-rc.4`
1516
- `https://` locators, which point to a tarball of contract artifacts somewhere on the web. HTTP locators are cached
1617
just like tagged locators are, but they are not validated against a checksum.
17-
- `file://` locators, which point to a directory on disk containing the artifacts.
18+
- ex: `https://<url-to-remote-forge-artifacts>`
19+
- `file://` locators, which point to a directory on local disk containing the artifacts.
20+
- ex: `file://<path-to-repo-root>/packages/contracts-bedrock/forge-artifacts`

op-deployer/book/src/user-guide/bootstrap.md

+57-24
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,70 @@
11
# The Bootstrap Commands
22

3-
Bootstrap commands are used to deploy global singletons and implementation contracts for use with future invocations
4-
of `apply`. Most users won't need to use these commands, since `op-deployer apply` will automatically use
5-
predeployed contracts if they are available. However, you may need to use bootstrap commands if you're deploying
6-
chains to an L1 that isn't natively supported by `op-deployer`.
3+
> Note: if you are joining an existing superchain, you can skip to the `init` and `apply` commands to create your L2 chain(s)
74
8-
There are several bootstrap commands available, which you can view by running `op-deployer bootstrap --help`. We'll
9-
focus on the most important ones below.
5+
Bootstrap commands are used to deploy global singletons and implementation contracts for new superchains.
6+
The deployed contract be then be use with future invocations of `apply` so that new L2 chains can join that superchain.
7+
Most users won't need to use these commands, since `op-deployer apply` will automatically use predeployed contracts if they are available. However, you may need to use bootstrap commands if you're deploying chains to an L1 that isn't natively supported by `op-deployer`.
108

11-
## Implementations
9+
There are several bootstrap commands available, which you can view by running `op-deployer bootstrap --help`. We'll
10+
focus on the most important ones, which should be run in the sequence listed below.
1211

13-
You can bootstrap implementations by running a command like this:
12+
**It is safe to call these commands from a hot wallet.** None of the contracts deployed by these command are "ownable,"
13+
so the deployment address has no further control over the system.
14+
15+
# 1. bootstrap superchain
16+
17+
```shell
18+
op-deployer bootstrap superchain \
19+
--l1-rpc-url="<rpc url>" \
20+
--private-key="<contract deployer private key>" \
21+
--artifacts-locator="<locator>" \
22+
--outfile="./.deployer/bootstrap_superchain.json" \
23+
--superchain-proxy-admin-owner="<role address>" \
24+
--protocol-versions-owner="<role address>" \
25+
--guardian="<role address>"
26+
```
27+
28+
### --required-protocol-version, --recommended-protocol-version (optional)
29+
Defaults to `OPStackSupport` value read from `op-geth`, but can be overridden by these flags.
30+
31+
### --superchain-proxy-admin-owner, --protocol-versions-owner, --guardian
32+
In a dev environment, these can all be hot wallet EOAs. In a production environment, `--guardian` should be an HSM (hardward security module) protected hot wallet and the other two should be multisig cold-wallets (e.g. Gnosis Safes).
33+
34+
### Output
35+
36+
This command will deploy several contracts, and output a JSON like the one below:
37+
38+
```json
39+
{
40+
"proxyAdminAddress": "0x269b95a33f48a9055b82ce739b0c105a83edd64a",
41+
"superchainConfigImplAddress": "0x2f4c87818d67fc3c365ea10051b94f98893f3c64",
42+
"superchainConfigProxyAddress": "0xd0c74806fa114c0ec176c0bf2e1e84ff0a8f91a1",
43+
"protocolVersionsImplAddress": "0xbded9e39e497a34a522af74cf018ca9717c5897e",
44+
"protocolVersionsProxyAddress": "0x2e8e4b790044c1e7519caac687caffd4cafca2d4"
45+
}
46+
```
47+
48+
# 2. bootstrap implementations
1449

1550
```shell
1651
op-deployer bootstrap implementations \
17-
--artifacts-locator <locator> \
18-
--l1-contracts-release op-contracts/<your-release> \
19-
--l1-rpc-url <rpc url> \
20-
--mips-version <1 or 2, for MIPS32 or MIPS64> \
21-
--private-key <some private key> \
22-
--protocol-versions-proxy <protocol versions proxy address> \
23-
--superchain-config-proxy <superchain config proxy address> \
24-
--upgrade-controller <upgrade controller address>
52+
--artifacts-locator="<locator>" \
53+
--l1-rpc-url="<rpc url>" \
54+
--outfile="./.deployer/bootstrap_implementations.json" \
55+
--mips-version="<1 or 2, for MIPS32 or MIPS64>" \
56+
--private-key="<contract deployer private key>" \
57+
--protocol-versions-proxy="<address output from bootstrap superchain>" \
58+
--superchain-config-proxy="<address output from bootstrap superchain>" \
59+
--upgrade-controller="<superchain-proxy-admin-owner used in bootstrap superchain>"
2560
```
2661

27-
This command will deploy implementations, blueprints, and the OPCM. Deployments are (for the most part)
28-
deterministic, so contracts will only be deployed once per chain as long as the implementation and constructor args
29-
remain the same. This applies to the `op-deployer apply` pipeline - that is, if someone else ran `op-deployer
30-
boostrap implementations` at some point on a given L1 chain, then the `apply` pipeline will re-use those
31-
implementations.
62+
### Output
63+
64+
This command will deploy implementations, blueprints, and the OPCM. Deployments are (for the most part)
65+
deterministic, so contracts will only be deployed once per chain as long as the implementation and constructor args
66+
remain the same. This applies to the `op-deployer apply` pipeline - that is, if someone else ran `op-deployer boostrap implementations`
67+
at some point on a given L1 chain, then the `apply` pipeline will re-use those implementations.
3268

3369
The command will output a JSON like the one below:
3470

@@ -50,6 +86,3 @@ The command will output a JSON like the one below:
5086
"ProtocolVersionsImpl": "0x37e15e4d6dffa9e5e320ee1ec036922e563cb76c"
5187
}
5288
```
53-
54-
**It is safe to call this command from a hot wallet.** None of the contracts deployed by this command are "ownable,"
55-
so the deployment address has no further control over the system.

op-deployer/book/src/user-guide/init.md

+18-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ l1ChainID = 11155420
3232
fundDevAccounts = false
3333
useInterop = false
3434
l1ContractsLocator = "tag://op-contracts/v1.8.0-rc.4"
35-
l2ContractsLocator = "op-contracts/v1.7.0-beta.1+l2-contracts"
35+
l2ContractsLocator = "tag://op-contracts/v1.7.0-beta.1+l2-contracts"
3636

3737
[superchainRoles]
3838
proxyAdminOwner = "0xeAAA3fd0358F476c86C26AE77B7b89a069730570"
@@ -58,6 +58,22 @@ l2ContractsLocator = "op-contracts/v1.7.0-beta.1+l2-contracts"
5858
```
5959

6060
Before you can use your intent file for a deployment, you will need to update all zero values to whatever is
61-
appropriate for your chain.
61+
appropriate for your chain. For dev environments, it is ok to use all EOAs/hot-wallets.
62+
63+
## Production Setup
64+
In production environments, you should use a more secure setup with cold-wallet multisigs (e.g. Gnosis Safes) for the following:
65+
* `baseFeeVaultRecipient`
66+
* `l1FeeVaultRecipient`
67+
* `sequencerFeeVaultRecipient`
68+
* `l1ProxyAdminOwner`
69+
* `l2ProxyAdminOwner`
70+
* `systemConfigOwner`
71+
72+
HSMs (hardware security modules) are recommended for the following hot-wallets:
73+
* `unsafeBlockSigner`
74+
* `batcher`
75+
* `proposer`
76+
* `challenger`
77+
6278

6379
[stages]: ../architecture/pipeline.md

op-deployer/pkg/deployer/bootstrap/flags.go

-6
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,6 @@ var (
108108
Usage: "Recommended protocol version (semver)",
109109
EnvVars: deployer.PrefixEnvVar("RECOMMENDED_PROTOCOL_VERSION"),
110110
}
111-
L1ContractsReleaseFlag = &cli.StringFlag{
112-
Name: L1ContractsReleaseFlagName,
113-
Usage: "Release version to set OPCM implementations for, of the format `op-contracts/vX.Y.Z`.",
114-
EnvVars: deployer.PrefixEnvVar("L1_CONTRACTS_RELEASE"),
115-
}
116111
SuperchainConfigProxyFlag = &cli.StringFlag{
117112
Name: "superchain-config-proxy",
118113
Usage: "Superchain config proxy.",
@@ -145,7 +140,6 @@ var ImplementationsFlags = []cli.Flag{
145140
deployer.PrivateKeyFlag,
146141
OutfileFlag,
147142
deployer.ArtifactsLocatorFlag,
148-
L1ContractsReleaseFlag,
149143
MIPSVersionFlag,
150144
WithdrawalDelaySecondsFlag,
151145
MinProposalSizeBytesFlag,

op-deployer/pkg/deployer/bootstrap/implementations.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@ func (c *ImplementationsConfig) Check() error {
7070
if c.ArtifactsLocator == nil {
7171
return errors.New("artifacts locator must be specified")
7272
}
73-
if c.L1ContractsRelease == "" {
74-
return errors.New("L1 contracts release must be specified")
73+
if c.ArtifactsLocator.IsTag() {
74+
c.L1ContractsRelease = c.ArtifactsLocator.Tag
75+
} else {
76+
c.L1ContractsRelease = "dev"
7577
}
7678
if c.MIPSVersion != 1 && c.MIPSVersion != 2 {
7779
return errors.New("MIPS version must be specified as either 1 or 2")

op-deployer/pkg/deployer/bootstrap/superchain.go

+14-5
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,24 @@ func SuperchainCLI(cliCtx *cli.Context) error {
113113
Paused: paused,
114114
}
115115

116-
if err := cfg.RequiredProtocolVersion.UnmarshalText([]byte(requiredVersionStr)); err != nil {
117-
return fmt.Errorf("failed to parse required protocol version: %w", err)
116+
// Default to op-geth params.OPStackSupport if not specified for required and recommended protocolversions
117+
if requiredVersionStr != "" {
118+
if err := cfg.RequiredProtocolVersion.UnmarshalText([]byte(requiredVersionStr)); err != nil {
119+
return fmt.Errorf("failed to parse required protocol version: %w", err)
120+
}
121+
} else {
122+
cfg.RequiredProtocolVersion = params.OPStackSupport
118123
}
119-
if err := cfg.RecommendedProtocolVersion.UnmarshalText([]byte(recommendedVersionStr)); err != nil {
120-
return fmt.Errorf("failed to parse required protocol version: %w", err)
124+
125+
if recommendedVersionStr != "" {
126+
if err := cfg.RecommendedProtocolVersion.UnmarshalText([]byte(recommendedVersionStr)); err != nil {
127+
return fmt.Errorf("failed to parse recommended protocol version: %w", err)
128+
}
129+
} else {
130+
cfg.RecommendedProtocolVersion = params.OPStackSupport
121131
}
122132

123133
ctx := ctxinterrupt.WithCancelOnInterrupt(cliCtx.Context)
124-
125134
dso, err := Superchain(ctx, cfg)
126135
if err != nil {
127136
return fmt.Errorf("failed to deploy superchain: %w", err)

op-deployer/pkg/deployer/standard/standard.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,11 @@ func ProtocolVersionsOwner(chainID uint64) (common.Address, error) {
204204
func ArtifactsURLForTag(tag string) (*url.URL, error) {
205205
release, ok := taggedReleases[tag]
206206
if !ok {
207-
return nil, fmt.Errorf("unsupported tag: %s", tag)
207+
var validTagsStr string
208+
for t := range taggedReleases {
209+
validTagsStr += fmt.Sprintf(" %s\n", t)
210+
}
211+
return nil, fmt.Errorf("unsupported tag: %s\nValid tags are:\n%s", tag, validTagsStr)
208212
}
209213

210214
return url.Parse(release.URL())

0 commit comments

Comments
 (0)