deployer

package
v1.14.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2025 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvVarPrefix             = "DEPLOYER"
	L1RPCURLFlagName         = "l1-rpc-url"
	CacheDirFlagName         = "cache-dir"
	L1ChainIDFlagName        = "l1-chain-id"
	ArtifactsLocatorFlagName = "artifacts-locator"
	L2ChainIDsFlagName       = "l2-chain-ids"
	WorkdirFlagName          = "workdir"
	OutdirFlagName           = "outdir"
	PrivateKeyFlagName       = "private-key"
	IntentTypeFlagName       = "intent-type"
	EtherscanAPIKeyFlagName  = "etherscan-api-key"
	InputFileFlagName        = "input-file"
	ContractNameFlagName     = "contract-name"
)

Variables

View Source
var (
	// OptimismPortalInteropDevFlag enables the OptimismPortalInterop contract.
	OptimismPortalInteropDevFlag = common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000001")

	// CannonKonaDevFlag enables Kona as the default cannon prover.
	CannonKonaDevFlag = common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000010")

	// DeployV2DisputeGamesDevFlag enables deployment of V2 dispute game contracts.
	DeployV2DisputeGamesDevFlag = common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000100")
)

Development feature flag constants that mirror the solidity DevFeatures library. These use a 32 byte bitmap for easy integration between op-deployer and contracts.

View Source
var (
	L1RPCURLFlag = &cli.StringFlag{
		Name: L1RPCURLFlagName,
		Usage: "RPC URL for the L1 chain. Must be set for live chains. " +
			"Must be blank for chains deploying to local allocs files.",
		EnvVars: []string{
			"L1_RPC_URL",
		},
	}
	ArtifactsLocatorFlag = &cli.StringFlag{
		Name:    ArtifactsLocatorFlagName,
		Usage:   "Locator for artifacts.",
		EnvVars: PrefixEnvVar("ARTIFACTS_LOCATOR"),
		Value:   artifacts.EmbeddedLocatorString,
	}
	CacheDirFlag = &cli.StringFlag{
		Name: CacheDirFlagName,
		Usage: "Cache directory. " +
			"If set, the deployer will attempt to cache downloaded artifacts in the specified directory.",
		EnvVars: PrefixEnvVar("CACHE_DIR"),
		Value:   DefaultCacheDir(),
	}
	L1ChainIDFlag = &cli.Uint64Flag{
		Name:    L1ChainIDFlagName,
		Usage:   "Chain ID of the L1 chain.",
		EnvVars: PrefixEnvVar("L1_CHAIN_ID"),
		Value:   11155111,
	}
	L2ChainIDsFlag = &cli.StringFlag{
		Name:    L2ChainIDsFlagName,
		Usage:   "Comma-separated list of L2 chain IDs to deploy.",
		EnvVars: PrefixEnvVar("L2_CHAIN_IDS"),
	}
	WorkdirFlag = &cli.StringFlag{
		Name:    WorkdirFlagName,
		Usage:   "Directory storing intent and stage. Defaults to the current directory.",
		EnvVars: PrefixEnvVar("WORKDIR"),
		Value:   cwd(),
		Aliases: []string{
			OutdirFlagName,
		},
	}
	PrivateKeyFlag = &cli.StringFlag{
		Name:    PrivateKeyFlagName,
		Usage:   "Private key of the deployer account.",
		EnvVars: PrefixEnvVar("PRIVATE_KEY"),
	}
	DeploymentTargetFlag = &cli.StringFlag{
		Name:    "deployment-target",
		Usage:   fmt.Sprintf("Where to deploy L1 contracts. Options: %s, %s, %s, %s", DeploymentTargetLive, DeploymentTargetGenesis, DeploymentTargetCalldata, DeploymentTargetNoop),
		EnvVars: PrefixEnvVar("DEPLOYMENT_TARGET"),
		Value:   string(DeploymentTargetLive),
	}
	OpProgramSvcUrlFlag = &cli.StringFlag{
		Name:    "op-program-svc-url",
		Usage:   "URL of the OP Program SVC",
		EnvVars: PrefixEnvVar("OP_PROGRAM_SVC_URL"),
	}
	IntentTypeFlag = &cli.StringFlag{
		Name: IntentTypeFlagName,
		Usage: fmt.Sprintf("Intent config type to use. Options: %s (default), %s, %s",
			state.IntentTypeStandard,
			state.IntentTypeCustom,
			state.IntentTypeStandardOverrides),
		EnvVars: PrefixEnvVar("INTENT_TYPE"),
		Value:   string(state.IntentTypeStandard),
		Aliases: []string{
			"intent-config-type",
		},
	}
	EtherscanAPIKeyFlag = &cli.StringFlag{
		Name:     EtherscanAPIKeyFlagName,
		Usage:    "etherscan API key for contract verification.",
		EnvVars:  PrefixEnvVar("ETHERSCAN_API_KEY"),
		Required: true,
	}
	InputFileFlag = &cli.StringFlag{
		Name:    InputFileFlagName,
		Usage:   "filepath of input file for command",
		EnvVars: PrefixEnvVar("INPUT_FILE"),
	}
	ContractNameFlag = &cli.StringFlag{
		Name:    ContractNameFlagName,
		Usage:   "(optional) contract name matching a field within the input file",
		EnvVars: PrefixEnvVar("CONTRACT_NAME"),
	}
)
View Source
var GlobalFlags = append([]cli.Flag{CacheDirFlag}, oplog.CLIFlags(EnvVarPrefix)...)
View Source
var UpgradeFlags = []cli.Flag{
	L1RPCURLFlag,
	PrivateKeyFlag,
	DeploymentTargetFlag,
}

Functions

func Apply

func Apply(ctx context.Context, cfg ApplyConfig) error

func ApplyCLI

func ApplyCLI() func(cliCtx *cli.Context) error

func ApplyPipeline

func ApplyPipeline(
	ctx context.Context,
	opts ApplyPipelineOpts,
) error

func CreateCacheDir added in v1.14.1

func CreateCacheDir(cacheDir string) error

func DefaultCacheDir added in v1.12.0

func DefaultCacheDir() string

func Init

func Init(cfg InitConfig) error

func InitCLI

func InitCLI() func(ctx *cli.Context) error

func IsDevFeatureEnabled added in v1.14.0

func IsDevFeatureEnabled(bitmap, flag common.Hash) bool

IsDevFeatureEnabled checks if a specific development feature is enabled in a feature bitmap. It performs a bitwise AND operation between the bitmap and the feature flag to determine if the feature is enabled. This follows the same pattern as the solidity DevFeatures library.

func PrefixEnvVar

func PrefixEnvVar(name string) []string

Types

type ApplyConfig

type ApplyConfig struct {
	L1RPCUrl         string
	Workdir          string
	PrivateKey       string
	DeploymentTarget DeploymentTarget
	Logger           log.Logger
	CacheDir         string

	PreStateBuilder pipeline.PreStateBuilder
	// contains filtered or unexported fields
}

func (*ApplyConfig) Check

func (a *ApplyConfig) Check() error

type ApplyPipelineOpts added in v1.10.0

type ApplyPipelineOpts struct {
	L1RPCUrl           string
	DeploymentTarget   DeploymentTarget
	DeployerPrivateKey *ecdsa.PrivateKey
	Intent             *state.Intent
	State              *state.State
	Logger             log.Logger
	StateWriter        pipeline.StateWriter
	CacheDir           string
	PreStateBuilder    pipeline.PreStateBuilder
}

type DeploymentTarget added in v1.11.0

type DeploymentTarget string
const (
	DeploymentTargetLive     DeploymentTarget = "live"
	DeploymentTargetGenesis  DeploymentTarget = "genesis"
	DeploymentTargetCalldata DeploymentTarget = "calldata"
	DeploymentTargetNoop     DeploymentTarget = "noop"
)

func NewDeploymentTarget added in v1.11.0

func NewDeploymentTarget(s string) (DeploymentTarget, error)

type InitConfig

type InitConfig struct {
	IntentType state.IntentType
	L1ChainID  uint64
	Outdir     string
	L2ChainIDs []common.Hash
}

func (*InitConfig) Check

func (c *InitConfig) Check() error

Directories

Path Synopsis
integration_test
cli
v3_0_0
Package v3_0_0 implements the upgrade to v3.0.0 (U14).
Package v3_0_0 implements the upgrade to v3.0.0 (U14).
v4_0_0
Package v4_0_0 implements the upgrade to v4.0.0 (U16).
Package v4_0_0 implements the upgrade to v4.0.0 (U16).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL