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:
op-program
op-service
op-supervisor
op-deployer
packages/contracts-bedrock/scripts/checks/semver-natspec
)
formatted_packages=""
......@@ -1274,6 +1275,24 @@ jobs:
command: bash scripts/ops/publish-artifacts.sh
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:
main:
when:
......@@ -1351,9 +1370,9 @@ workflows:
requires:
- contracts-bedrock-build
- go-test-kurtosis:
name: op-chain-ops-integration
module: op-chain-ops
test_directory: ./deployer/integration_test
name: op-deployer-integration
module: op-deployer
test_directory: ./pkg/deployer/integration_test
uses_artifacts: true
requires: ["contracts-bedrock-build"]
- go-e2e-test:
......@@ -1385,7 +1404,7 @@ workflows:
- check-generated-mocks-op-node
- check-generated-mocks-op-service
- go-mod-download
- op-chain-ops-integration
- op-deployer-integration
- op-program-compat
- op-e2e-HTTP-tests
- op-e2e-fault-proof-tests
......@@ -1414,7 +1433,6 @@ workflows:
- op-conductor
- da-server
- op-supervisor
- op-deployer
- cannon
- cannon-prestate
- check-generated-mocks-op-node
......@@ -1435,6 +1453,16 @@ workflows:
ignore-dirs:
./packages/contracts-bedrock/lib
go-release-deployer:
jobs:
- go-release:
filters:
tags:
only: /^op-deployer.*/
branches:
ignore: /.*/
module: op-deployer
release:
when:
not:
......@@ -1505,7 +1533,6 @@ workflows:
- da-server-docker-release
- op-ufm-docker-release
- op-supervisor-docker-release
- op-deployer-docker-release
- cannon-docker-release
# Standard (xlarge) AMD-only docker images go here
- docker-build:
......
......@@ -5,12 +5,13 @@ import (
"fmt"
"math/big"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/opcm"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"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/genesis"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis/beacondeposit"
......
......@@ -4,11 +4,12 @@ import (
"fmt"
"math/big"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/opcm"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"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/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 (
"fmt"
"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"
"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/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 (
"fmt"
"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"
"github.com/ethereum-optimism/optimism/op-service/ctxinterrupt"
oplog "github.com/ethereum-optimism/optimism/op-service/log"
......
......@@ -8,9 +8,10 @@ import (
"math/big"
"strings"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/opcm"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/pipeline"
"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-chain-ops/script"
opcrypto "github.com/ethereum-optimism/optimism/op-service/crypto"
"github.com/ethereum-optimism/optimism/op-service/ctxinterrupt"
......
package bootstrap
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/urfave/cli/v2"
)
......
......@@ -7,11 +7,11 @@ import (
"path"
"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"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/state"
"github.com/ethereum-optimism/optimism/op-chain-ops/devkeys"
"github.com/ethereum/go-ethereum/common"
"github.com/urfave/cli/v2"
......@@ -74,7 +74,7 @@ func Init(cfg InitConfig) error {
return fmt.Errorf("invalid config for init: %w", err)
}
intent := &state.Intent{
intent := &state2.Intent{
L1ChainID: cfg.L1ChainID,
FundDevAccounts: true,
L1ContractsLocator: opcm.DefaultL1ContractsLocator,
......@@ -96,7 +96,7 @@ func Init(cfg InitConfig) error {
}
return addr
}
intent.SuperchainRoles = state.SuperchainRoles{
intent.SuperchainRoles = state2.SuperchainRoles{
ProxyAdminOwner: addrFor(devkeys.L1ProxyAdminOwnerRole.Key(l1ChainIDBig)),
ProtocolVersionsOwner: addrFor(devkeys.SuperchainProtocolVersionsOwner.Key(l1ChainIDBig)),
Guardian: addrFor(devkeys.SuperchainConfigGuardianKey.Key(l1ChainIDBig)),
......@@ -104,14 +104,14 @@ func Init(cfg InitConfig) error {
for _, l2ChainID := range cfg.L2ChainIDs {
l2ChainIDBig := l2ChainID.Big()
intent.Chains = append(intent.Chains, &state.ChainIntent{
intent.Chains = append(intent.Chains, &state2.ChainIntent{
ID: l2ChainID,
BaseFeeVaultRecipient: common.Address{},
L1FeeVaultRecipient: common.Address{},
SequencerFeeVaultRecipient: common.Address{},
Eip1559Denominator: 50,
Eip1559Elasticity: 6,
Roles: state.ChainRoles{
Roles: state2.ChainRoles{
ProxyAdminOwner: addrFor(devkeys.L2ProxyAdminOwnerRole.Key(l2ChainIDBig)),
SystemConfigOwner: addrFor(devkeys.SystemConfigOwner.Key(l2ChainIDBig)),
GovernanceTokenOwner: addrFor(devkeys.L2ProxyAdminOwnerRole.Key(l2ChainIDBig)),
......@@ -123,7 +123,7 @@ func Init(cfg InitConfig) error {
})
}
st := &state.State{
st := &state2.State{
Version: 1,
}
......
......@@ -3,9 +3,10 @@ package inspect
import (
"fmt"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer"
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/urfave/cli/v2"
)
......
......@@ -3,8 +3,9 @@ package inspect
import (
"fmt"
"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-deployer/pkg/deployer/pipeline"
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-node/rollup"
"github.com/ethereum/go-ethereum/core"
......@@ -38,7 +39,7 @@ func GenesisCLI(cliCtx *cli.Context) error {
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 {
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
return nil, nil, fmt.Errorf("failed to unmarshal genesis: %w", err)
}
config, err := state.CombineDeployConfig(
config, err := state2.CombineDeployConfig(
globalState.AppliedIntent,
chainIntent,
globalState,
......
......@@ -3,7 +3,8 @@ package inspect
import (
"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/jsonutil"
"github.com/ethereum/go-ethereum/common"
......
......@@ -3,7 +3,8 @@ package inspect
import (
"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/jsonutil"
"github.com/urfave/cli/v2"
......
......@@ -13,15 +13,15 @@ import (
"testing"
"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"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer"
"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/genesis"
opcrypto "github.com/ethereum-optimism/optimism/op-service/crypto"
......@@ -192,7 +192,7 @@ func makeIntent(
) (*state.Intent, *state.State) {
_, testFilename, _, ok := runtime.Caller(0)
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")
artifactsURL, err := url.Parse(fmt.Sprintf("file://%s", artifactsDir))
require.NoError(t, err)
......
......@@ -6,7 +6,8 @@ import (
"math/big"
"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/script"
"github.com/ethereum/go-ethereum/accounts/abi"
......
......@@ -15,7 +15,7 @@ import (
"strings"
"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"
)
......
......@@ -9,7 +9,7 @@ import (
"os"
"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"
)
......
......@@ -5,9 +5,10 @@ import (
"fmt"
"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/deployer/state"
opcrypto "github.com/ethereum-optimism/optimism/op-service/crypto"
"github.com/ethereum-optimism/optimism/op-service/jsonutil"
"github.com/ethereum/go-ethereum/common"
......@@ -23,25 +24,25 @@ type Env struct {
Logger log.Logger
}
func ReadIntent(workdir string) (*state.Intent, error) {
func ReadIntent(workdir string) (*state2.Intent, error) {
intentPath := path.Join(workdir, "intent.toml")
intent, err := jsonutil.LoadTOML[state.Intent](intentPath)
intent, err := jsonutil.LoadTOML[state2.Intent](intentPath)
if err != nil {
return nil, fmt.Errorf("failed to read intent file: %w", err)
}
return intent, nil
}
func ReadState(workdir string) (*state.State, error) {
func ReadState(workdir string) (*state2.State, error) {
statePath := path.Join(workdir, "state.json")
st, err := jsonutil.LoadJSON[state.State](statePath)
st, err := jsonutil.LoadJSON[state2.State](statePath)
if err != nil {
return nil, fmt.Errorf("failed to read state file: %w", err)
}
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")
return st.WriteToFile(statePath)
}
......@@ -51,4 +52,4 @@ type ArtifactsBundle struct {
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 (
"fmt"
"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/script"
opcrypto "github.com/ethereum-optimism/optimism/op-service/crypto"
......@@ -14,10 +15,10 @@ import (
"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) {
return broadcaster.NewKeyedBroadcaster(broadcaster.KeyedBroadcasterOpts{
func KeyedBroadcaster(opts CallScriptBroadcastOpts) (broadcaster2.Broadcaster, error) {
return broadcaster2.NewKeyedBroadcaster(broadcaster2.KeyedBroadcasterOpts{
Logger: opts.Logger,
ChainID: opts.L1ChainID,
Client: opts.Client,
......@@ -26,8 +27,8 @@ func KeyedBroadcaster(opts CallScriptBroadcastOpts) (broadcaster.Broadcaster, er
})
}
func DiscardBroadcaster(opts CallScriptBroadcastOpts) (broadcaster.Broadcaster, error) {
return broadcaster.DiscardBroadcaster(), nil
func DiscardBroadcaster(opts CallScriptBroadcastOpts) (broadcaster2.Broadcaster, error) {
return broadcaster2.DiscardBroadcaster(), nil
}
type CallScriptBroadcastOpts struct {
......
......@@ -5,8 +5,9 @@ import (
"fmt"
"math/big"
"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-deployer/pkg/deployer/opcm"
"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/script"
)
......
......@@ -5,19 +5,19 @@ import (
"crypto/rand"
"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/go-ethereum/common"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/state"
)
func IsSupportedStateVersion(version int) bool {
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.Info("initializing pipeline")
......@@ -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
// own Address type.
st.SuperchainDeployment = &state.SuperchainDeployment{
st.SuperchainDeployment = &state2.SuperchainDeployment{
ProxyAdminAddress: proxyAdmin,
ProtocolVersionsProxyAddress: common.Address(*superCfg.Config.ProtocolVersionsAddr),
SuperchainConfigProxyAddress: common.Address(*superCfg.Config.SuperchainConfigAddr),
......@@ -56,7 +56,7 @@ func Init(ctx context.Context, env *Env, _ ArtifactsBundle, intent *state.Intent
if err != nil {
return fmt.Errorf("error getting OPCM proxy address: %w", err)
}
st.ImplementationsDeployment = &state.ImplementationsDeployment{
st.ImplementationsDeployment = &state2.ImplementationsDeployment{
OpcmProxyAddress: opcmProxy,
}
}
......
......@@ -8,14 +8,15 @@ import (
"fmt"
"math/big"
"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-deployer/pkg/deployer/opcm"
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/script"
"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.Info("generating L2 genesis", "id", chainID.Hex())
......@@ -30,7 +31,7 @@ func GenerateL2Genesis(ctx context.Context, env *Env, bundle ArtifactsBundle, in
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 {
return fmt.Errorf("failed to combine L2 init config: %w", err)
}
......
......@@ -5,14 +5,14 @@ import (
"fmt"
"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"
)
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")
if !shouldDeployOPChain(intent, st, chainID) {
......@@ -72,7 +72,7 @@ func DeployOPChain(ctx context.Context, env *Env, bundle ArtifactsBundle, intent
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,
ProxyAdminAddress: dco.OpChainProxyAdmin,
AddressManagerAddress: dco.AddressManager,
......@@ -94,7 +94,7 @@ func DeployOPChain(ctx context.Context, env *Env, bundle ArtifactsBundle, intent
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 {
if chain.ID == chainID {
return false
......
......@@ -5,15 +5,16 @@ import (
"fmt"
"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/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-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")
if !shouldDeploySuperchain(intent, st) {
......@@ -63,7 +64,7 @@ func DeploySuperchain(ctx context.Context, env *Env, bundle ArtifactsBundle, int
return fmt.Errorf("error deploying superchain: %w", err)
}
st.SuperchainDeployment = &state.SuperchainDeployment{
st.SuperchainDeployment = &state2.SuperchainDeployment{
ProxyAdminAddress: dso.SuperchainProxyAdmin,
SuperchainConfigProxyAddress: dso.SuperchainConfigProxy,
SuperchainConfigImplAddress: dso.SuperchainConfigImpl,
......@@ -75,6 +76,6 @@ func DeploySuperchain(ctx context.Context, env *Env, bundle ArtifactsBundle, int
return nil
}
func shouldDeploySuperchain(intent *state.Intent, st *state.State) bool {
func shouldDeploySuperchain(intent *state2.Intent, st *state2.State) bool {
return st.SuperchainDeployment == nil
}
......@@ -4,7 +4,8 @@ import (
"fmt"
"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/jsonutil"
"github.com/ethereum/go-ethereum/common"
......
......@@ -21,15 +21,6 @@ func StartEnclave(t *testing.T, ctx context.Context, lgr log.Logger, pkg string,
enclaveCtx, err := kurtosisCtx.CreateEnclave(ctx, enclaveID)
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(
ctx,
pkg,
......@@ -39,6 +30,17 @@ func StartEnclave(t *testing.T, ctx context.Context, lgr log.Logger, pkg string,
)
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) {
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