Commit 1f106f78 authored by Matthew Slipper's avatar Matthew Slipper Committed by GitHub

op-deployer: Package for production (#12491)

* op-deployer: Package for production

This PR:

1. Moves op-deployer into a standalone package at the root of the monorepo.
2. Updates CI given the move above.
3. Adds infrastructure for `goreleaser` so that we can provide pre-build binaries to our users.

* fix error in config

* add dep

* move filter

* filters

* goimports

* remove deployer docker builds

* goimports

* remove superfluous package renames

* use correct monorepo dir

* fix bad package renames

* cancel child context

* use different context in cleanup

* log enclave ID
parent c92c8226
...@@ -850,6 +850,7 @@ jobs: ...@@ -850,6 +850,7 @@ jobs:
op-program op-program
op-service op-service
op-supervisor op-supervisor
op-deployer
packages/contracts-bedrock/scripts/checks/semver-natspec packages/contracts-bedrock/scripts/checks/semver-natspec
) )
formatted_packages="" formatted_packages=""
...@@ -1274,6 +1275,24 @@ jobs: ...@@ -1274,6 +1275,24 @@ jobs:
command: bash scripts/ops/publish-artifacts.sh command: bash scripts/ops/publish-artifacts.sh
working_directory: packages/contracts-bedrock working_directory: packages/contracts-bedrock
go-release:
parameters:
module:
description: Go Module Name
type: string
filename:
description: Goreleaser config file
default: .goreleaser.yaml
type: string
machine: true
resource_class: ethereum-optimism/latitude-1
steps:
- checkout
- run:
name: Run goreleaser
command: |
./bin/goreleaser release --clean -f ./<<parameters.module>>/<<parameters.filename>>
workflows: workflows:
main: main:
when: when:
...@@ -1351,9 +1370,9 @@ workflows: ...@@ -1351,9 +1370,9 @@ workflows:
requires: requires:
- contracts-bedrock-build - contracts-bedrock-build
- go-test-kurtosis: - go-test-kurtosis:
name: op-chain-ops-integration name: op-deployer-integration
module: op-chain-ops module: op-deployer
test_directory: ./deployer/integration_test test_directory: ./pkg/deployer/integration_test
uses_artifacts: true uses_artifacts: true
requires: ["contracts-bedrock-build"] requires: ["contracts-bedrock-build"]
- go-e2e-test: - go-e2e-test:
...@@ -1385,7 +1404,7 @@ workflows: ...@@ -1385,7 +1404,7 @@ workflows:
- check-generated-mocks-op-node - check-generated-mocks-op-node
- check-generated-mocks-op-service - check-generated-mocks-op-service
- go-mod-download - go-mod-download
- op-chain-ops-integration - op-deployer-integration
- op-program-compat - op-program-compat
- op-e2e-HTTP-tests - op-e2e-HTTP-tests
- op-e2e-fault-proof-tests - op-e2e-fault-proof-tests
...@@ -1414,7 +1433,6 @@ workflows: ...@@ -1414,7 +1433,6 @@ workflows:
- op-conductor - op-conductor
- da-server - da-server
- op-supervisor - op-supervisor
- op-deployer
- cannon - cannon
- cannon-prestate - cannon-prestate
- check-generated-mocks-op-node - check-generated-mocks-op-node
...@@ -1435,6 +1453,16 @@ workflows: ...@@ -1435,6 +1453,16 @@ workflows:
ignore-dirs: ignore-dirs:
./packages/contracts-bedrock/lib ./packages/contracts-bedrock/lib
go-release-deployer:
jobs:
- go-release:
filters:
tags:
only: /^op-deployer.*/
branches:
ignore: /.*/
module: op-deployer
release: release:
when: when:
not: not:
...@@ -1505,7 +1533,6 @@ workflows: ...@@ -1505,7 +1533,6 @@ workflows:
- da-server-docker-release - da-server-docker-release
- op-ufm-docker-release - op-ufm-docker-release
- op-supervisor-docker-release - op-supervisor-docker-release
- op-deployer-docker-release
- cannon-docker-release - cannon-docker-release
# Standard (xlarge) AMD-only docker images go here # Standard (xlarge) AMD-only docker images go here
- docker-build: - docker-build:
......
...@@ -5,12 +5,13 @@ import ( ...@@ -5,12 +5,13 @@ import (
"fmt" "fmt"
"math/big" "math/big"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/opcm"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/opcm"
"github.com/ethereum-optimism/optimism/op-chain-ops/foundry" "github.com/ethereum-optimism/optimism/op-chain-ops/foundry"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis" "github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis/beacondeposit" "github.com/ethereum-optimism/optimism/op-chain-ops/genesis/beacondeposit"
......
...@@ -4,11 +4,12 @@ import ( ...@@ -4,11 +4,12 @@ import (
"fmt" "fmt"
"math/big" "math/big"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/opcm"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/params"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/opcm"
"github.com/ethereum-optimism/optimism/op-chain-ops/devkeys" "github.com/ethereum-optimism/optimism/op-chain-ops/devkeys"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis" "github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
) )
......
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
# The lines below are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
version: 2
project_name: op-deployer
before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
builds:
- id: main
main: ./cmd/op-deployer
binary: op-deployer
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
ignore:
- goos: windows
goarch: arm64
- goos: linux
goarch: arm64
mod_timestamp: "{{ .CommitTimestamp }}"
ldflags:
- -X main.GitCommit={{ .FullCommit }}
- -X main.GitDate={{ .CommitDate }}
- -X github.com/ethereum-optimism/optimism/op-chain-ops/deployer/version.Version={{ .Version }}
- -X github.com/ethereum-optimism/optimism/op-chain-ops/deployer/version.Meta="unstable"
archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: "{{ .ProjectName }}-{{.Version}}-{{ tolower .Os }}-{{ .Arch }}"
# use zip for windows archives
wrap_in_directory: true
format_overrides:
- goos: windows
format: zip
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
release:
github:
owner: ethereum-optimism
name: optimism
make_latest: false
monorepo:
tag_prefix: op-deployer/
dir: op-deployer
\ No newline at end of file
...@@ -4,14 +4,13 @@ import ( ...@@ -4,14 +4,13 @@ import (
"fmt" "fmt"
"os" "os"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/bootstrap" "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/bootstrap"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/inspect"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/version"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/version"
opservice "github.com/ethereum-optimism/optimism/op-service" opservice "github.com/ethereum-optimism/optimism/op-service"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/inspect"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer"
"github.com/ethereum-optimism/optimism/op-service/cliapp" "github.com/ethereum-optimism/optimism/op-service/cliapp"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
......
build:
go build -o bin/op-deployer cmd/op-deployer/main.go
\ No newline at end of file
...@@ -6,9 +6,9 @@ import ( ...@@ -6,9 +6,9 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/state" "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/pipeline"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/state"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/pipeline"
opcrypto "github.com/ethereum-optimism/optimism/op-service/crypto" opcrypto "github.com/ethereum-optimism/optimism/op-service/crypto"
"github.com/ethereum-optimism/optimism/op-service/ctxinterrupt" "github.com/ethereum-optimism/optimism/op-service/ctxinterrupt"
oplog "github.com/ethereum-optimism/optimism/op-service/log" oplog "github.com/ethereum-optimism/optimism/op-service/log"
......
...@@ -8,9 +8,10 @@ import ( ...@@ -8,9 +8,10 @@ import (
"math/big" "math/big"
"strings" "strings"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer" "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/opcm" "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/opcm"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/pipeline" "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/pipeline"
"github.com/ethereum-optimism/optimism/op-chain-ops/script" "github.com/ethereum-optimism/optimism/op-chain-ops/script"
opcrypto "github.com/ethereum-optimism/optimism/op-service/crypto" opcrypto "github.com/ethereum-optimism/optimism/op-service/crypto"
"github.com/ethereum-optimism/optimism/op-service/ctxinterrupt" "github.com/ethereum-optimism/optimism/op-service/ctxinterrupt"
......
package bootstrap package bootstrap
import ( import (
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer" "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer"
"github.com/ethereum-optimism/optimism/op-service/cliapp" "github.com/ethereum-optimism/optimism/op-service/cliapp"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
......
...@@ -7,11 +7,11 @@ import ( ...@@ -7,11 +7,11 @@ import (
"path" "path"
"strings" "strings"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/opcm" "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/opcm"
state2 "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/state"
op_service "github.com/ethereum-optimism/optimism/op-service" op_service "github.com/ethereum-optimism/optimism/op-service"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/state"
"github.com/ethereum-optimism/optimism/op-chain-ops/devkeys" "github.com/ethereum-optimism/optimism/op-chain-ops/devkeys"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
...@@ -74,7 +74,7 @@ func Init(cfg InitConfig) error { ...@@ -74,7 +74,7 @@ func Init(cfg InitConfig) error {
return fmt.Errorf("invalid config for init: %w", err) return fmt.Errorf("invalid config for init: %w", err)
} }
intent := &state.Intent{ intent := &state2.Intent{
L1ChainID: cfg.L1ChainID, L1ChainID: cfg.L1ChainID,
FundDevAccounts: true, FundDevAccounts: true,
L1ContractsLocator: opcm.DefaultL1ContractsLocator, L1ContractsLocator: opcm.DefaultL1ContractsLocator,
...@@ -96,7 +96,7 @@ func Init(cfg InitConfig) error { ...@@ -96,7 +96,7 @@ func Init(cfg InitConfig) error {
} }
return addr return addr
} }
intent.SuperchainRoles = state.SuperchainRoles{ intent.SuperchainRoles = state2.SuperchainRoles{
ProxyAdminOwner: addrFor(devkeys.L1ProxyAdminOwnerRole.Key(l1ChainIDBig)), ProxyAdminOwner: addrFor(devkeys.L1ProxyAdminOwnerRole.Key(l1ChainIDBig)),
ProtocolVersionsOwner: addrFor(devkeys.SuperchainProtocolVersionsOwner.Key(l1ChainIDBig)), ProtocolVersionsOwner: addrFor(devkeys.SuperchainProtocolVersionsOwner.Key(l1ChainIDBig)),
Guardian: addrFor(devkeys.SuperchainConfigGuardianKey.Key(l1ChainIDBig)), Guardian: addrFor(devkeys.SuperchainConfigGuardianKey.Key(l1ChainIDBig)),
...@@ -104,14 +104,14 @@ func Init(cfg InitConfig) error { ...@@ -104,14 +104,14 @@ func Init(cfg InitConfig) error {
for _, l2ChainID := range cfg.L2ChainIDs { for _, l2ChainID := range cfg.L2ChainIDs {
l2ChainIDBig := l2ChainID.Big() l2ChainIDBig := l2ChainID.Big()
intent.Chains = append(intent.Chains, &state.ChainIntent{ intent.Chains = append(intent.Chains, &state2.ChainIntent{
ID: l2ChainID, ID: l2ChainID,
BaseFeeVaultRecipient: common.Address{}, BaseFeeVaultRecipient: common.Address{},
L1FeeVaultRecipient: common.Address{}, L1FeeVaultRecipient: common.Address{},
SequencerFeeVaultRecipient: common.Address{}, SequencerFeeVaultRecipient: common.Address{},
Eip1559Denominator: 50, Eip1559Denominator: 50,
Eip1559Elasticity: 6, Eip1559Elasticity: 6,
Roles: state.ChainRoles{ Roles: state2.ChainRoles{
ProxyAdminOwner: addrFor(devkeys.L2ProxyAdminOwnerRole.Key(l2ChainIDBig)), ProxyAdminOwner: addrFor(devkeys.L2ProxyAdminOwnerRole.Key(l2ChainIDBig)),
SystemConfigOwner: addrFor(devkeys.SystemConfigOwner.Key(l2ChainIDBig)), SystemConfigOwner: addrFor(devkeys.SystemConfigOwner.Key(l2ChainIDBig)),
GovernanceTokenOwner: addrFor(devkeys.L2ProxyAdminOwnerRole.Key(l2ChainIDBig)), GovernanceTokenOwner: addrFor(devkeys.L2ProxyAdminOwnerRole.Key(l2ChainIDBig)),
...@@ -123,7 +123,7 @@ func Init(cfg InitConfig) error { ...@@ -123,7 +123,7 @@ func Init(cfg InitConfig) error {
}) })
} }
st := &state.State{ st := &state2.State{
Version: 1, Version: 1,
} }
......
...@@ -3,9 +3,10 @@ package inspect ...@@ -3,9 +3,10 @@ package inspect
import ( import (
"fmt" "fmt"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer"
op_service "github.com/ethereum-optimism/optimism/op-service" op_service "github.com/ethereum-optimism/optimism/op-service"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
......
...@@ -3,8 +3,9 @@ package inspect ...@@ -3,8 +3,9 @@ package inspect
import ( import (
"fmt" "fmt"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/pipeline" "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/pipeline"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/state" state2 "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/state"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis" "github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
"github.com/ethereum-optimism/optimism/op-node/rollup" "github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core"
...@@ -38,7 +39,7 @@ func GenesisCLI(cliCtx *cli.Context) error { ...@@ -38,7 +39,7 @@ func GenesisCLI(cliCtx *cli.Context) error {
return nil return nil
} }
func GenesisAndRollup(globalState *state.State, chainID common.Hash) (*core.Genesis, *rollup.Config, error) { func GenesisAndRollup(globalState *state2.State, chainID common.Hash) (*core.Genesis, *rollup.Config, error) {
if globalState.AppliedIntent == nil { if globalState.AppliedIntent == nil {
return nil, nil, fmt.Errorf("chain state is not applied - run op-deployer apply") return nil, nil, fmt.Errorf("chain state is not applied - run op-deployer apply")
} }
...@@ -58,7 +59,7 @@ func GenesisAndRollup(globalState *state.State, chainID common.Hash) (*core.Gene ...@@ -58,7 +59,7 @@ func GenesisAndRollup(globalState *state.State, chainID common.Hash) (*core.Gene
return nil, nil, fmt.Errorf("failed to unmarshal genesis: %w", err) return nil, nil, fmt.Errorf("failed to unmarshal genesis: %w", err)
} }
config, err := state.CombineDeployConfig( config, err := state2.CombineDeployConfig(
globalState.AppliedIntent, globalState.AppliedIntent,
chainIntent, chainIntent,
globalState, globalState,
......
...@@ -3,7 +3,8 @@ package inspect ...@@ -3,7 +3,8 @@ package inspect
import ( import (
"fmt" "fmt"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/pipeline" "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/pipeline"
"github.com/ethereum-optimism/optimism/op-service/ioutil" "github.com/ethereum-optimism/optimism/op-service/ioutil"
"github.com/ethereum-optimism/optimism/op-service/jsonutil" "github.com/ethereum-optimism/optimism/op-service/jsonutil"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
......
...@@ -3,7 +3,8 @@ package inspect ...@@ -3,7 +3,8 @@ package inspect
import ( import (
"fmt" "fmt"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/pipeline" "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/pipeline"
"github.com/ethereum-optimism/optimism/op-service/ioutil" "github.com/ethereum-optimism/optimism/op-service/ioutil"
"github.com/ethereum-optimism/optimism/op-service/jsonutil" "github.com/ethereum-optimism/optimism/op-service/jsonutil"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
......
...@@ -13,15 +13,15 @@ import ( ...@@ -13,15 +13,15 @@ import (
"testing" "testing"
"time" "time"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/opcm" "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/opcm"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/pipeline"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/state"
op_e2e "github.com/ethereum-optimism/optimism/op-e2e" op_e2e "github.com/ethereum-optimism/optimism/op-e2e"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer"
"github.com/holiman/uint256" "github.com/holiman/uint256"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/pipeline"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/state"
"github.com/ethereum-optimism/optimism/op-chain-ops/devkeys" "github.com/ethereum-optimism/optimism/op-chain-ops/devkeys"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis" "github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
opcrypto "github.com/ethereum-optimism/optimism/op-service/crypto" opcrypto "github.com/ethereum-optimism/optimism/op-service/crypto"
...@@ -192,7 +192,7 @@ func makeIntent( ...@@ -192,7 +192,7 @@ func makeIntent(
) (*state.Intent, *state.State) { ) (*state.Intent, *state.State) {
_, testFilename, _, ok := runtime.Caller(0) _, testFilename, _, ok := runtime.Caller(0)
require.Truef(t, ok, "failed to get test filename") require.Truef(t, ok, "failed to get test filename")
monorepoDir := path.Join(path.Dir(testFilename), "..", "..", "..") monorepoDir := path.Join(path.Dir(testFilename), "..", "..", "..", "..")
artifactsDir := path.Join(monorepoDir, "packages", "contracts-bedrock", "forge-artifacts") artifactsDir := path.Join(monorepoDir, "packages", "contracts-bedrock", "forge-artifacts")
artifactsURL, err := url.Parse(fmt.Sprintf("file://%s", artifactsDir)) artifactsURL, err := url.Parse(fmt.Sprintf("file://%s", artifactsDir))
require.NoError(t, err) require.NoError(t, err)
......
...@@ -6,7 +6,8 @@ import ( ...@@ -6,7 +6,8 @@ import (
"math/big" "math/big"
"strings" "strings"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/broadcaster" "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/broadcaster"
"github.com/ethereum-optimism/optimism/op-chain-ops/foundry" "github.com/ethereum-optimism/optimism/op-chain-ops/foundry"
"github.com/ethereum-optimism/optimism/op-chain-ops/script" "github.com/ethereum-optimism/optimism/op-chain-ops/script"
"github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/accounts/abi"
......
...@@ -15,7 +15,7 @@ import ( ...@@ -15,7 +15,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/opcm" "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/opcm"
"github.com/ethereum-optimism/optimism/op-chain-ops/foundry" "github.com/ethereum-optimism/optimism/op-chain-ops/foundry"
) )
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"os" "os"
"testing" "testing"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/opcm" "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/opcm"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
......
...@@ -5,9 +5,10 @@ import ( ...@@ -5,9 +5,10 @@ import (
"fmt" "fmt"
"path" "path"
state2 "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/state"
"github.com/ethereum-optimism/optimism/op-chain-ops/foundry" "github.com/ethereum-optimism/optimism/op-chain-ops/foundry"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/state"
opcrypto "github.com/ethereum-optimism/optimism/op-service/crypto" opcrypto "github.com/ethereum-optimism/optimism/op-service/crypto"
"github.com/ethereum-optimism/optimism/op-service/jsonutil" "github.com/ethereum-optimism/optimism/op-service/jsonutil"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
...@@ -23,25 +24,25 @@ type Env struct { ...@@ -23,25 +24,25 @@ type Env struct {
Logger log.Logger Logger log.Logger
} }
func ReadIntent(workdir string) (*state.Intent, error) { func ReadIntent(workdir string) (*state2.Intent, error) {
intentPath := path.Join(workdir, "intent.toml") intentPath := path.Join(workdir, "intent.toml")
intent, err := jsonutil.LoadTOML[state.Intent](intentPath) intent, err := jsonutil.LoadTOML[state2.Intent](intentPath)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to read intent file: %w", err) return nil, fmt.Errorf("failed to read intent file: %w", err)
} }
return intent, nil return intent, nil
} }
func ReadState(workdir string) (*state.State, error) { func ReadState(workdir string) (*state2.State, error) {
statePath := path.Join(workdir, "state.json") statePath := path.Join(workdir, "state.json")
st, err := jsonutil.LoadJSON[state.State](statePath) st, err := jsonutil.LoadJSON[state2.State](statePath)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to read state file: %w", err) return nil, fmt.Errorf("failed to read state file: %w", err)
} }
return st, nil return st, nil
} }
func WriteState(workdir string, st *state.State) error { func WriteState(workdir string, st *state2.State) error {
statePath := path.Join(workdir, "state.json") statePath := path.Join(workdir, "state.json")
return st.WriteToFile(statePath) return st.WriteToFile(statePath)
} }
...@@ -51,4 +52,4 @@ type ArtifactsBundle struct { ...@@ -51,4 +52,4 @@ type ArtifactsBundle struct {
L2 foundry.StatDirFs L2 foundry.StatDirFs
} }
type Stage func(ctx context.Context, env *Env, bundle ArtifactsBundle, intent *state.Intent, st *state.State) error type Stage func(ctx context.Context, env *Env, bundle ArtifactsBundle, intent *state2.Intent, st *state2.State) error
...@@ -5,7 +5,8 @@ import ( ...@@ -5,7 +5,8 @@ import (
"fmt" "fmt"
"math/big" "math/big"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/broadcaster" broadcaster2 "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/broadcaster"
"github.com/ethereum-optimism/optimism/op-chain-ops/foundry" "github.com/ethereum-optimism/optimism/op-chain-ops/foundry"
"github.com/ethereum-optimism/optimism/op-chain-ops/script" "github.com/ethereum-optimism/optimism/op-chain-ops/script"
opcrypto "github.com/ethereum-optimism/optimism/op-service/crypto" opcrypto "github.com/ethereum-optimism/optimism/op-service/crypto"
...@@ -14,10 +15,10 @@ import ( ...@@ -14,10 +15,10 @@ import (
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
) )
type BroadcasterFactory func(opts CallScriptBroadcastOpts) (broadcaster.Broadcaster, error) type BroadcasterFactory func(opts CallScriptBroadcastOpts) (broadcaster2.Broadcaster, error)
func KeyedBroadcaster(opts CallScriptBroadcastOpts) (broadcaster.Broadcaster, error) { func KeyedBroadcaster(opts CallScriptBroadcastOpts) (broadcaster2.Broadcaster, error) {
return broadcaster.NewKeyedBroadcaster(broadcaster.KeyedBroadcasterOpts{ return broadcaster2.NewKeyedBroadcaster(broadcaster2.KeyedBroadcasterOpts{
Logger: opts.Logger, Logger: opts.Logger,
ChainID: opts.L1ChainID, ChainID: opts.L1ChainID,
Client: opts.Client, Client: opts.Client,
...@@ -26,8 +27,8 @@ func KeyedBroadcaster(opts CallScriptBroadcastOpts) (broadcaster.Broadcaster, er ...@@ -26,8 +27,8 @@ func KeyedBroadcaster(opts CallScriptBroadcastOpts) (broadcaster.Broadcaster, er
}) })
} }
func DiscardBroadcaster(opts CallScriptBroadcastOpts) (broadcaster.Broadcaster, error) { func DiscardBroadcaster(opts CallScriptBroadcastOpts) (broadcaster2.Broadcaster, error) {
return broadcaster.DiscardBroadcaster(), nil return broadcaster2.DiscardBroadcaster(), nil
} }
type CallScriptBroadcastOpts struct { type CallScriptBroadcastOpts struct {
......
...@@ -5,8 +5,9 @@ import ( ...@@ -5,8 +5,9 @@ import (
"fmt" "fmt"
"math/big" "math/big"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/opcm" "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/opcm"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/state" "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/state"
"github.com/ethereum-optimism/optimism/op-chain-ops/foundry" "github.com/ethereum-optimism/optimism/op-chain-ops/foundry"
"github.com/ethereum-optimism/optimism/op-chain-ops/script" "github.com/ethereum-optimism/optimism/op-chain-ops/script"
) )
......
...@@ -5,19 +5,19 @@ import ( ...@@ -5,19 +5,19 @@ import (
"crypto/rand" "crypto/rand"
"fmt" "fmt"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/opcm" "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/opcm"
state2 "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/state"
"github.com/ethereum-optimism/optimism/op-chain-ops/script" "github.com/ethereum-optimism/optimism/op-chain-ops/script"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/state"
) )
func IsSupportedStateVersion(version int) bool { func IsSupportedStateVersion(version int) bool {
return version == 1 return version == 1
} }
func Init(ctx context.Context, env *Env, _ ArtifactsBundle, intent *state.Intent, st *state.State) error { func Init(ctx context.Context, env *Env, _ ArtifactsBundle, intent *state2.Intent, st *state2.State) error {
lgr := env.Logger.New("stage", "init") lgr := env.Logger.New("stage", "init")
lgr.Info("initializing pipeline") lgr.Info("initializing pipeline")
...@@ -46,7 +46,7 @@ func Init(ctx context.Context, env *Env, _ ArtifactsBundle, intent *state.Intent ...@@ -46,7 +46,7 @@ func Init(ctx context.Context, env *Env, _ ArtifactsBundle, intent *state.Intent
// Have to do this weird pointer thing below because the Superchain Registry defines its // Have to do this weird pointer thing below because the Superchain Registry defines its
// own Address type. // own Address type.
st.SuperchainDeployment = &state.SuperchainDeployment{ st.SuperchainDeployment = &state2.SuperchainDeployment{
ProxyAdminAddress: proxyAdmin, ProxyAdminAddress: proxyAdmin,
ProtocolVersionsProxyAddress: common.Address(*superCfg.Config.ProtocolVersionsAddr), ProtocolVersionsProxyAddress: common.Address(*superCfg.Config.ProtocolVersionsAddr),
SuperchainConfigProxyAddress: common.Address(*superCfg.Config.SuperchainConfigAddr), SuperchainConfigProxyAddress: common.Address(*superCfg.Config.SuperchainConfigAddr),
...@@ -56,7 +56,7 @@ func Init(ctx context.Context, env *Env, _ ArtifactsBundle, intent *state.Intent ...@@ -56,7 +56,7 @@ func Init(ctx context.Context, env *Env, _ ArtifactsBundle, intent *state.Intent
if err != nil { if err != nil {
return fmt.Errorf("error getting OPCM proxy address: %w", err) return fmt.Errorf("error getting OPCM proxy address: %w", err)
} }
st.ImplementationsDeployment = &state.ImplementationsDeployment{ st.ImplementationsDeployment = &state2.ImplementationsDeployment{
OpcmProxyAddress: opcmProxy, OpcmProxyAddress: opcmProxy,
} }
} }
......
...@@ -8,14 +8,15 @@ import ( ...@@ -8,14 +8,15 @@ import (
"fmt" "fmt"
"math/big" "math/big"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/opcm" "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/opcm"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/state" state2 "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/state"
"github.com/ethereum-optimism/optimism/op-chain-ops/foundry" "github.com/ethereum-optimism/optimism/op-chain-ops/foundry"
"github.com/ethereum-optimism/optimism/op-chain-ops/script" "github.com/ethereum-optimism/optimism/op-chain-ops/script"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
) )
func GenerateL2Genesis(ctx context.Context, env *Env, bundle ArtifactsBundle, intent *state.Intent, st *state.State, chainID common.Hash) error { func GenerateL2Genesis(ctx context.Context, env *Env, bundle ArtifactsBundle, intent *state2.Intent, st *state2.State, chainID common.Hash) error {
lgr := env.Logger.New("stage", "generate-l2-genesis") lgr := env.Logger.New("stage", "generate-l2-genesis")
lgr.Info("generating L2 genesis", "id", chainID.Hex()) lgr.Info("generating L2 genesis", "id", chainID.Hex())
...@@ -30,7 +31,7 @@ func GenerateL2Genesis(ctx context.Context, env *Env, bundle ArtifactsBundle, in ...@@ -30,7 +31,7 @@ func GenerateL2Genesis(ctx context.Context, env *Env, bundle ArtifactsBundle, in
return fmt.Errorf("failed to get chain state: %w", err) return fmt.Errorf("failed to get chain state: %w", err)
} }
initCfg, err := state.CombineDeployConfig(intent, thisIntent, st, thisChainState) initCfg, err := state2.CombineDeployConfig(intent, thisIntent, st, thisChainState)
if err != nil { if err != nil {
return fmt.Errorf("failed to combine L2 init config: %w", err) return fmt.Errorf("failed to combine L2 init config: %w", err)
} }
......
...@@ -5,14 +5,14 @@ import ( ...@@ -5,14 +5,14 @@ import (
"fmt" "fmt"
"math/big" "math/big"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/broadcaster" "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/broadcaster"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/opcm"
state2 "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/state"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/opcm"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/state"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
) )
func DeployOPChain(ctx context.Context, env *Env, bundle ArtifactsBundle, intent *state.Intent, st *state.State, chainID common.Hash) error { func DeployOPChain(ctx context.Context, env *Env, bundle ArtifactsBundle, intent *state2.Intent, st *state2.State, chainID common.Hash) error {
lgr := env.Logger.New("stage", "deploy-opchain") lgr := env.Logger.New("stage", "deploy-opchain")
if !shouldDeployOPChain(intent, st, chainID) { if !shouldDeployOPChain(intent, st, chainID) {
...@@ -72,7 +72,7 @@ func DeployOPChain(ctx context.Context, env *Env, bundle ArtifactsBundle, intent ...@@ -72,7 +72,7 @@ func DeployOPChain(ctx context.Context, env *Env, bundle ArtifactsBundle, intent
return fmt.Errorf("error deploying OP chain: %w", err) return fmt.Errorf("error deploying OP chain: %w", err)
} }
st.Chains = append(st.Chains, &state.ChainState{ st.Chains = append(st.Chains, &state2.ChainState{
ID: chainID, ID: chainID,
ProxyAdminAddress: dco.OpChainProxyAdmin, ProxyAdminAddress: dco.OpChainProxyAdmin,
AddressManagerAddress: dco.AddressManager, AddressManagerAddress: dco.AddressManager,
...@@ -94,7 +94,7 @@ func DeployOPChain(ctx context.Context, env *Env, bundle ArtifactsBundle, intent ...@@ -94,7 +94,7 @@ func DeployOPChain(ctx context.Context, env *Env, bundle ArtifactsBundle, intent
return nil return nil
} }
func shouldDeployOPChain(intent *state.Intent, st *state.State, chainID common.Hash) bool { func shouldDeployOPChain(intent *state2.Intent, st *state2.State, chainID common.Hash) bool {
for _, chain := range st.Chains { for _, chain := range st.Chains {
if chain.ID == chainID { if chain.ID == chainID {
return false return false
......
...@@ -5,15 +5,16 @@ import ( ...@@ -5,15 +5,16 @@ import (
"fmt" "fmt"
"math/big" "math/big"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/opcm"
state2 "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/state"
"github.com/ethereum-optimism/optimism/op-chain-ops/script" "github.com/ethereum-optimism/optimism/op-chain-ops/script"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/opcm"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/state"
"github.com/ethereum-optimism/optimism/op-chain-ops/foundry" "github.com/ethereum-optimism/optimism/op-chain-ops/foundry"
"github.com/ethereum-optimism/optimism/op-node/rollup" "github.com/ethereum-optimism/optimism/op-node/rollup"
) )
func DeploySuperchain(ctx context.Context, env *Env, bundle ArtifactsBundle, intent *state.Intent, st *state.State) error { func DeploySuperchain(ctx context.Context, env *Env, bundle ArtifactsBundle, intent *state2.Intent, st *state2.State) error {
lgr := env.Logger.New("stage", "deploy-superchain") lgr := env.Logger.New("stage", "deploy-superchain")
if !shouldDeploySuperchain(intent, st) { if !shouldDeploySuperchain(intent, st) {
...@@ -63,7 +64,7 @@ func DeploySuperchain(ctx context.Context, env *Env, bundle ArtifactsBundle, int ...@@ -63,7 +64,7 @@ func DeploySuperchain(ctx context.Context, env *Env, bundle ArtifactsBundle, int
return fmt.Errorf("error deploying superchain: %w", err) return fmt.Errorf("error deploying superchain: %w", err)
} }
st.SuperchainDeployment = &state.SuperchainDeployment{ st.SuperchainDeployment = &state2.SuperchainDeployment{
ProxyAdminAddress: dso.SuperchainProxyAdmin, ProxyAdminAddress: dso.SuperchainProxyAdmin,
SuperchainConfigProxyAddress: dso.SuperchainConfigProxy, SuperchainConfigProxyAddress: dso.SuperchainConfigProxy,
SuperchainConfigImplAddress: dso.SuperchainConfigImpl, SuperchainConfigImplAddress: dso.SuperchainConfigImpl,
...@@ -75,6 +76,6 @@ func DeploySuperchain(ctx context.Context, env *Env, bundle ArtifactsBundle, int ...@@ -75,6 +76,6 @@ func DeploySuperchain(ctx context.Context, env *Env, bundle ArtifactsBundle, int
return nil return nil
} }
func shouldDeploySuperchain(intent *state.Intent, st *state.State) bool { func shouldDeploySuperchain(intent *state2.Intent, st *state2.State) bool {
return st.SuperchainDeployment == nil return st.SuperchainDeployment == nil
} }
...@@ -4,7 +4,8 @@ import ( ...@@ -4,7 +4,8 @@ import (
"fmt" "fmt"
"math/big" "math/big"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/opcm" "github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/opcm"
"github.com/ethereum-optimism/optimism/op-service/ioutil" "github.com/ethereum-optimism/optimism/op-service/ioutil"
"github.com/ethereum-optimism/optimism/op-service/jsonutil" "github.com/ethereum-optimism/optimism/op-service/jsonutil"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
......
...@@ -21,15 +21,6 @@ func StartEnclave(t *testing.T, ctx context.Context, lgr log.Logger, pkg string, ...@@ -21,15 +21,6 @@ func StartEnclave(t *testing.T, ctx context.Context, lgr log.Logger, pkg string,
enclaveCtx, err := kurtosisCtx.CreateEnclave(ctx, enclaveID) enclaveCtx, err := kurtosisCtx.CreateEnclave(ctx, enclaveID)
require.NoError(t, err) require.NoError(t, err)
t.Cleanup(func() {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
err = kurtosisCtx.DestroyEnclave(ctx, enclaveID)
if err != nil {
lgr.Error("Error destroying enclave", "err", err)
}
})
stream, _, err := enclaveCtx.RunStarlarkRemotePackage( stream, _, err := enclaveCtx.RunStarlarkRemotePackage(
ctx, ctx,
pkg, pkg,
...@@ -39,6 +30,17 @@ func StartEnclave(t *testing.T, ctx context.Context, lgr log.Logger, pkg string, ...@@ -39,6 +30,17 @@ func StartEnclave(t *testing.T, ctx context.Context, lgr log.Logger, pkg string,
) )
require.NoError(t, err) require.NoError(t, err)
t.Cleanup(func() {
cancelCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
err = kurtosisCtx.DestroyEnclave(cancelCtx, enclaveID)
if err != nil {
lgr.Error("Error destroying enclave", "err", err, "id", enclaveID)
return
}
lgr.Info("Enclave destroyed", "enclave", enclaveID)
})
logKurtosisOutput := func(msg string) { logKurtosisOutput := func(msg string) {
lgr.Info(fmt.Sprintf("[KURTOSIS] %s", msg)) lgr.Info(fmt.Sprintf("[KURTOSIS] %s", msg))
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment