Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/crate-crypto/go-kzg-4844 v1.1.0
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3
github.com/ethereum-optimism/superchain-registry/validation v0.0.0-20250205201532-8ff62ada16e1
github.com/ethereum-optimism/superchain-registry/validation v0.0.0-20250228185245-d4bb112dc979
github.com/ethereum/go-ethereum v1.15.1
github.com/fatih/color v1.18.0
github.com/fsnotify/fsnotify v1.8.0
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,12 @@ github.com/ethereum-optimism/op-geth v1.101500.2-rc.1 h1:CCQtyKKobjMbK9jYd676YbH
github.com/ethereum-optimism/op-geth v1.101500.2-rc.1/go.mod h1:OMpyVMMy5zpAAHlR5s/aGbXRk+7cIKczUEIJj54APbY=
github.com/ethereum-optimism/superchain-registry/validation v0.0.0-20250205201532-8ff62ada16e1 h1:OqRYDcjiOx5QCLn5krpd3BK1CW+VfSZx7YIa6zY9ePE=
github.com/ethereum-optimism/superchain-registry/validation v0.0.0-20250205201532-8ff62ada16e1/go.mod h1:NZ816PzLU1TLv1RdAvYAb6KWOj4Zm5aInT0YpDVml2Y=
github.com/ethereum-optimism/superchain-registry/validation v0.0.0-20250226225001-eda352a0be39 h1:PKn3dL9W0FyGC/oynhP6T43P0Xm80W+woW53lRUp2nE=
github.com/ethereum-optimism/superchain-registry/validation v0.0.0-20250226225001-eda352a0be39/go.mod h1:NZ816PzLU1TLv1RdAvYAb6KWOj4Zm5aInT0YpDVml2Y=
github.com/ethereum-optimism/superchain-registry/validation v0.0.0-20250227173852-b4f7e4022c2e h1:CWdI4k9JxMvWLv6HjWuAFJuuEwMEEwKdW/mOVnrNBD8=
github.com/ethereum-optimism/superchain-registry/validation v0.0.0-20250227173852-b4f7e4022c2e/go.mod h1:NZ816PzLU1TLv1RdAvYAb6KWOj4Zm5aInT0YpDVml2Y=
github.com/ethereum-optimism/superchain-registry/validation v0.0.0-20250228185245-d4bb112dc979 h1:P37l7EFCz5KxE20+yPa3LWiH2Cg+xx6lQ4mOKYCZFPs=
github.com/ethereum-optimism/superchain-registry/validation v0.0.0-20250228185245-d4bb112dc979/go.mod h1:NZ816PzLU1TLv1RdAvYAb6KWOj4Zm5aInT0YpDVml2Y=
github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA=
github.com/ethereum/c-kzg-4844 v1.0.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
github.com/ethereum/go-verkle v0.2.2 h1:I2W0WjnrFUIzzVPwm8ykY+7pL2d4VhlsePn4j7cnFk8=
Expand Down
2 changes: 0 additions & 2 deletions op-chain-ops/interopgen/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ type OPCMImplementationsConfig struct {
FaultProof SuperFaultProofConfig

UseInterop bool // to deploy Interop implementation contracts, instead of the regular ones.

StandardVersionsToml string // serialized string of superchain-registry 'standard-versions-mainnet.toml' file
}

type SuperchainConfig struct {
Expand Down
5 changes: 1 addition & 4 deletions op-chain-ops/interopgen/recipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"fmt"
"math/big"

"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/standard"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/params"
Expand Down Expand Up @@ -79,8 +77,7 @@ func (r *InteropDevRecipe) Build(addrs devkeys.Addresses) (*WorldConfig, error)
DisputeGameFinalityDelaySeconds: big.NewInt(6),
MipsVersion: big.NewInt(1),
},
UseInterop: true,
StandardVersionsToml: standard.VersionsMainnetData,
UseInterop: true,
},
SuperchainL1DeployConfig: genesis.SuperchainL1DeployConfig{
RequiredProtocolVersion: params.OPStackSupport,
Expand Down
2 changes: 2 additions & 0 deletions op-deployer/book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- [Usage](user-guide/usage.md)
- [init](user-guide/init.md)
- [apply](user-guide/apply.md)
- [bootstrap](user-guide/bootstrap.md)
- [Known Limitations](user-guide/known-limitations.md)

# Reference Guide
Expand All @@ -16,3 +17,4 @@
- [Deployment Pipeline](reference-guide/pipeline.md)
- [Scripting Engine](reference-guide/engine.md)
- [Artifacts Locators](reference-guide/artifacts-locators.md)
- [Releases](reference-guide/releases.md)
17 changes: 1 addition & 16 deletions op-deployer/book/src/reference-guide/artifacts-locators.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,4 @@ Locators can be one of three types:
cached on disk to avoid repeated downloads.
- `https://` locators, which point to a tarball of contract artifacts somewhere on the web. HTTP locators are cached
just like tagged locators are, but they are not validated against a checksum.
- `file://` locators, which point to a directory on disk containing the artifacts.

## Version Hints

OP Deployer supports multiple different contract versions at the same time. Sometimes, contracts at version X are
backwards-incompatible with version Y. OP Deployer will support both versions at the same time when this happens.
However, OP Deployer needs to know which versioning behavior to use with each locator. For `tag` locators this is
easy since the behavior is encoded in the tag itself. However, it's more complicated for `https` and `file` locators.

To support multiple versions of each contract, OP Deployer supports specifying _version hints_ in the locator. These
hints are URL fragments (e.g., the part of the URL that comes after the `#` symbol) denoting how OP Deployer should
treat the artifacts at that URL. For example, the URL `https://example.com/artifacts.tar.gz#v1` would treat the
artifacts at the URL with the versioning behavior of version `v1`.

This only applies to `https` and `file` locators. `tag` locators are versioned by the tag itself, and any hints will
be ignored.
- `file://` locators, which point to a directory on disk containing the artifacts.
90 changes: 90 additions & 0 deletions op-deployer/book/src/reference-guide/releases.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Releases

## Versioning

For all releases after `v0.0.11`, each minor version of OP Deployer will support the current governance-approved
release of the smart contracts as well as the tip of the `develop` branch at the time the tag was created. If you
want to deploy an earlier version of the contracts (which may be dangerous!), you should use an earlier version of
OP Deployer. This setup allows our smart contract developers to make breaking changes on `develop`, while still
allowing new chains to be deployed and upgraded using production-ready smart contracts.

For example (note that these are just examples, check out the [releases][releases] page for the exact versions to use):

- `v0.1.x` : Supports deploying `develop` and `op-contracts/v2.0.0`.
- `v0.2.x`: Supports deploying `develop` and `op-contracts/v3.0.0`.

If you deploy from an HTTPS or file [locator](./artifacts-locators.md), the deployment behavior will match that of
the supported tag. For example, if you use `v0.1.x` then the deployment will work as if you were deploying
`op-contracts/v2.0.0`. Typically, errors like `unknown selector: <some hex>` imply that you're using the wrong
version of OP Deployer for your contract artifacts. If this happens, we recommend trying different versions until
you get one that works. Note that this workflow is **not recommended** for production chains.

[releases]: https://github.com/ethereum-optimism/optimism/releases

## Adding Support for New Contract Versions

Adding support for a new contract version is a multi-step process. Here's a high-level overview. For the sake of
simplicity we will assume you are adding support for a new `rc` release.

### Step 1: Add Support on `develop`

**This section is designed for people developing OP Deployer itself.**

First, you need to add support for the new contract version on the `develop` branch. This means ensuring that the
deployment pipeline supports whatever changes are required for the new version. Typically, this means passing in new
deployment variables, and responding to ABI changes in the Solidity scripts/OPCM.

### Step 2: Add the Published Artifacts

Run the following from the root of the monorepo:

```bash
cd packages/contracts-bedrock
just clean
just build
bash scripts/ops/calculate-checksum.sh
# copy the outputted checksum
cd ../../op-deployer
just calculate-artifacts-hash <checksum>
```

This will calculate the checksum of your artifacts as well as the hash of the artifacts tarball. OP Deployer uses
these values to download and verify tagged contract locators.

Now, update `standard/standard.go` with these values so that the new artifacts tarball can be downloaded:

```go
// Add a new const for your release

const ContractsVXTag = "op-contracts/vX.Y.Z"

var taggedReleases = map[string]TaggedRelease{
// Other releases...
ContractsVXTag: {
ArtifactsHash: common.HexToHash("<the artifacts hash>"),
ContentHash: common.HexToHash("<the checksum>"),
},
}

// Update the L1/L2 versions accordingly
func IsSupportedL1Version(tag string) bool {
return tag == ContractsVXTag
}
```

### Step 3: Update the SR With the New Release

Add the new RC to the [standard versions][std-vers] in the Superchain Registry.

[std-vers]: https://github.com/ethereum-optimism/superchain-registry/tree/main/validation/standard

### Step 4: Update the `validation` Package

The SR is pulled into OP Deployer via the `validation` package. Update it by running the following command from the
root of the monorepo:

```shell
go get -u github.com/ethereum-optimism/superchain-registry/validation@<SR commit SHA>
```

That should be it!
55 changes: 55 additions & 0 deletions op-deployer/book/src/user-guide/bootstrap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# The Bootstrap Commands

Bootstrap commands are used to deploy global singletons and implementation contracts for use with future invocations
of `apply`. 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`.

There are several bootstrap commands available, which you can view by running `op-deployer bootstrap --help`. We'll
focus on the most important ones below.

## Implementations

You can bootstrap implementations by running a command like this:

```shell
op-deployer bootstrap implementations \
--artifacts-locator <locator> \
--l1-contracts-release op-contracts/<your-release> \
--l1-rpc-url <rpc url> \
--mips-version <1 or 2, for MIPS32 or MIPS64> \
--private-key <some private key> \
--protocol-versions-proxy <protocol versions proxy address> \
--superchain-config-proxy <superchain config proxy address> \
--upgrade-controller <upgrade controller address>
```

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

The command will output a JSON like the one below:

```json
{
"Opcm": "0x4eeb114aaf812e21285e5b076030110e7e18fed9",
"DelayedWETHImpl": "0x5e40b9231b86984b5150507046e354dbfbed3d9e",
"OptimismPortalImpl": "0x2d7e764a0d9919e16983a46595cfa81fc34fa7cd",
"PreimageOracleSingleton": "0x1fb8cdfc6831fc866ed9c51af8817da5c287add3",
"MipsSingleton": "0xf027f4a985560fb13324e943edf55ad6f1d15dc1",
"SystemConfigImpl": "0x760c48c62a85045a6b69f07f4a9f22868659cbcc",
"L1CrossDomainMessengerImpl": "0x3ea6084748ed1b2a9b5d4426181f1ad8c93f6231",
"L1ERC721BridgeImpl": "0x276d3730f219f7ec22274f7263180b8452b46d47",
"L1StandardBridgeImpl": "0x78972e88ab8bbb517a36caea23b931bab58ad3c6",
"OptimismMintableERC20FactoryImpl": "0x5493f4677a186f64805fe7317d6993ba4863988f",
"DisputeGameFactoryImpl": "0x4bba758f006ef09402ef31724203f316ab74e4a0",
"AnchorStateRegistryImpl": "0x7b465370bb7a333f99edd19599eb7fb1c2d3f8d2",
"SuperchainConfigImpl": "0x4da82a327773965b8d4d85fa3db8249b387458e7",
"ProtocolVersionsImpl": "0x37e15e4d6dffa9e5e320ee1ec036922e563cb76c"
}
```

**It is safe to call this command from a hot wallet.** None of the contracts deployed by this command are "ownable,"
so the deployment address has no further control over the system.
2 changes: 2 additions & 0 deletions op-deployer/book/src/user-guide/known-limitations.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ OP Deployer is subject to some known limitations which we're working on addressi

## Tagged Releases on New Chains

**Fixed in all versions after v0.0.11.**

It is not currently possible to deploy chains using tagged contract locators (i.e., those starting with `tag://`)
anywhere except Sepolia and Ethereum mainnet. If you try to, you'll see an error like this:

Expand Down
5 changes: 0 additions & 5 deletions op-deployer/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,3 @@ calculate-artifacts-hash checksum:
just download-artifacts {{checksum}} /tmp/artifact.tgz
sha256sum /tmp/artifact.tgz
rm /tmp/artifact.tgz

# Sync standard versions
sync-standard-version:
curl -Lo ./pkg/deployer/standard/standard-versions-mainnet.toml https://raw.githubusercontent.com/ethereum-optimism/superchain-registry/refs/heads/main/validation/standard/standard-versions-mainnet.toml
curl -Lo ./pkg/deployer/standard/standard-versions-sepolia.toml https://raw.githubusercontent.com/ethereum-optimism/superchain-registry/refs/heads/main/validation/standard/standard-versions-sepolia.toml
1 change: 0 additions & 1 deletion op-deployer/pkg/deployer/bootstrap/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ var Commands = []*cli.Command{
Usage: "Bootstraps implementations.",
Flags: cliapp.ProtectFlags(ImplementationsFlags),
Action: ImplementationsCLI,
Hidden: true,
},
{
Name: "proxy",
Expand Down
4 changes: 4 additions & 0 deletions op-deployer/pkg/deployer/bootstrap/implementations.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ func Implementations(ctx context.Context, cfg ImplementationsConfig) (opcm.Deplo

lgr := cfg.Logger

if cfg.ArtifactsLocator.IsTag() && !standard.IsSupportedL1Version(cfg.ArtifactsLocator.Tag) {
return dio, fmt.Errorf("unsupported L1 version: %s", cfg.ArtifactsLocator.Tag)
}

artifactsFS, err := artifacts.Download(ctx, cfg.ArtifactsLocator, artifacts.BarProgressor(), cfg.CacheDir)
if err != nil {
return dio, fmt.Errorf("failed to download artifacts: %w", err)
Expand Down
8 changes: 6 additions & 2 deletions op-deployer/pkg/deployer/integration_test/apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@ func TestEndToEndApply(t *testing.T) {
intent, st := newIntent(t, l1ChainID, dk, l2ChainID1, loc, loc)
intent.L1ContractsLocator = artifacts.DefaultL1ContractsLocator
intent.L2ContractsLocator = artifacts.DefaultL2ContractsLocator
cg := ethClientCodeGetter(ctx, l1Client)

require.ErrorIs(t, deployer.ApplyPipeline(
require.NoError(t, deployer.ApplyPipeline(
ctx,
deployer.ApplyPipelineOpts{
DeploymentTarget: deployer.DeploymentTargetLive,
Expand All @@ -141,7 +142,10 @@ func TestEndToEndApply(t *testing.T) {
StateWriter: pipeline.NoopStateWriter(),
CacheDir: testCacheDir,
},
), pipeline.ErrRefusingToDeployTaggedReleaseWithoutOPCM)
))

validateSuperchainDeployment(t, st, cg)
validateOPChainDeployment(t, cg, st, intent, false)
})

t.Run("with calldata broadcasts", func(t *testing.T) {
Expand Down
5 changes: 4 additions & 1 deletion op-deployer/pkg/deployer/opcm/dispute_game.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

type DeployDisputeGameInput struct {
Release string
StandardVersionsToml string
VmAddress common.Address
GameKind string
GameType uint32
Expand All @@ -24,6 +23,10 @@ type DeployDisputeGameInput struct {
Challenger common.Address
}

func (input *DeployDisputeGameInput) StandardVersionsToml() string {
return ""
}

func (input *DeployDisputeGameInput) InputSet() bool {
return true
}
Expand Down
3 changes: 0 additions & 3 deletions op-deployer/pkg/deployer/opcm/dispute_game_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,13 @@ func TestDeployDisputeGame(t *testing.T) {
)
require.NoError(t, err)

standardVersionsTOML, err := standard.L1VersionsDataFor(11155111)
require.NoError(t, err)
vmAddr := common.Address{'V'}
host.ImportAccount(vmAddr, types.Account{Code: vmCode})
// Address has to match the one returned by vmCode for oracle()(address)
host.ImportAccount(common.HexToAddress("0x92240135b46fc1142dA181f550aE8f595B858854"), types.Account{Code: oracleCode})

input := DeployDisputeGameInput{
Release: "dev",
StandardVersionsToml: standardVersionsTOML,
VmAddress: vmAddr,
GameKind: "PermissionedDisputeGame",
GameType: 1,
Expand Down
Loading