deployer

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 39 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	EnvVarPrefix              = flags.EnvVarPrefix
	L1RPCURLFlagName          = flags.L1RPCURLFlagName
	CacheDirFlagName          = flags.CacheDirFlagName
	L1ChainIDFlagName         = flags.L1ChainIDFlagName
	ArtifactsLocatorFlagName  = flags.ArtifactsLocatorFlagName
	L2ChainIDsFlagName        = flags.L2ChainIDsFlagName
	WorkdirFlagName           = flags.WorkdirFlagName
	OutdirFlagName            = flags.OutdirFlagName
	PrivateKeyFlagName        = flags.PrivateKeyFlagName
	PrestateFlagName          = flags.PrestateFlagName
	IntentTypeFlagName        = flags.IntentTypeFlagName
	VerifierAPIKeyFlagName    = flags.VerifierAPIKeyFlagName
	EtherscanAPIKeyFlagName   = flags.EtherscanAPIKeyFlagName // Deprecated: use VerifierAPIKeyFlagName
	InputFileFlagName         = flags.InputFileFlagName
	ContractNameFlagName      = flags.ContractNameFlagName
	VerifierTypeFlagName      = flags.VerifierTypeFlagName
	VerifierUrlFlagName       = flags.VerifierUrlFlagName
	UseForgeFlagName          = flags.UseForgeFlagName
	GenesisTimeOffsetFlagName = flags.GenesisTimeOffsetFlagName

	ReceiptQueryIntervalFlagName  = flags.ReceiptQueryIntervalFlagName
	DeployMockSP1VerifierFlagName = flags.DeployMockSP1VerifierFlagName
)

Variables

View Source
var (
	Uint256Type = opcm.MustType("uint256")
	BytesType   = opcm.MustType("bytes")
	AddressType = opcm.MustType("address")
	Bytes32Type = opcm.MustType("bytes32")
)

Primitive ABI types primarily used with `abi.Arguments` to pack/unpack values when calling contract methods.

View Source
var (
	SepoliaChainID                  uint64         = 11155111
	DefaultL1ProxyAdminOwnerSepolia common.Address = common.HexToAddress("0x1Eb2fFc903729a0F03966B917003800b145F56E2")
)

Constants for Sepolia chain.

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:   flags.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"),
	}
	PrestateFlag = &cli.StringFlag{
		Name:    PrestateFlagName,
		Usage:   "Selected permissionless-game absolute prestate hash. Fails if a differing intent value is set.",
		EnvVars: PrefixEnvVar("DISPUTE_ABSOLUTE_PRESTATE"),
	}
	DeploymentTargetFlag = &cli.StringFlag{
		Name:    "deployment-target",
		Usage:   fmt.Sprintf("Where to deploy L1 contracts. Options: %s, %s", DeploymentTargetLive, DeploymentTargetGenesis),
		EnvVars: PrefixEnvVar("DEPLOYMENT_TARGET"),
		Value:   string(DeploymentTargetLive),
	}
	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",
		},
	}
	VerifierAPIKeyFlag = &cli.StringFlag{
		Name:    VerifierAPIKeyFlagName,
		Usage:   "API key for contract verifier (etherscan, blockscout, etc.)",
		EnvVars: append(PrefixEnvVar("VERIFIER_API_KEY"), PrefixEnvVar("ETHERSCAN_API_KEY")...),
		Aliases: []string{EtherscanAPIKeyFlagName},
	}
	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"),
	}
	VerifierFlag = &cli.StringFlag{
		Name:    VerifierTypeFlagName,
		Usage:   "contract verifier type(s) to use. Comma-separated for multiple verifiers. Options: etherscan, blockscout, custom. Defaults to etherscan and blockscout",
		EnvVars: PrefixEnvVar("VERIFIER_TYPE"),
		Value:   "etherscan,blockscout",
	}
	VerifierUrlFlag = &cli.StringFlag{
		Name:    VerifierUrlFlagName,
		Usage:   "verifier URL (optional for blockscout, required for custom, ignored for etherscan)",
		EnvVars: PrefixEnvVar("VERIFIER_URL"),
	}
	NoVerifyFlag = &cli.BoolFlag{
		Name:    "no-verify",
		Usage:   "skip automatic contract verification after deployment",
		EnvVars: PrefixEnvVar("NO_VERIFY"),
		Value:   false,
	}
	// UseForgeFlag is kept, hidden, through the v0.9 line so that callers who pass it keep working.
	UseForgeFlag = &cli.BoolFlag{
		Name:    UseForgeFlagName,
		Usage:   "deprecated: forge always runs the deployment scripts, so true has no effect and false is refused",
		EnvVars: PrefixEnvVar("USE_FORGE"),
		Hidden:  true,
	}
	ReceiptQueryIntervalFlag = &cli.DurationFlag{
		Name:    ReceiptQueryIntervalFlagName,
		Usage:   "for tests: how often to poll for each broadcast's receipt, from 50ms to 1s; 0 uses the default of 1s",
		EnvVars: PrefixEnvVar("RECEIPT_QUERY_INTERVAL"),
		Value:   broadcaster.DefaultReceiptQueryInterval,
		Hidden:  true,
	}
	DeployMockSP1VerifierFlag = &cli.BoolFlag{
		Name: DeployMockSP1VerifierFlagName,
		Usage: "deploy a mock SP1 verifier for the ZK dispute game, on an L1 without a release verifier, " +
			"in a genesis or live. Development only: the mock accepts every proof.",
		EnvVars: PrefixEnvVar("DEPLOY_MOCK_SP1_VERIFIER"),
		Value:   false,
	}
	GenesisTimeOffsetFlag = &cli.Uint64Flag{
		Name: GenesisTimeOffsetFlagName,
		Usage: "Offset in seconds added to the L1 anchor block's timestamp to produce the committed L2 genesis " +
			"timestamp. A zero offset starts genesis at the anchor timestamp; nodes produce catch-up blocks for " +
			"elapsed block times. Use a larger offset to schedule genesis after deployment.",
		EnvVars: PrefixEnvVar("GENESIS_TIME_OFFSET"),
	}
)
View Source
var PrestateFlags = []cli.Flag{
	WorkdirFlag,
	PrestateFlag,
}

Functions

func Apply

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

func ApplyCLI

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

func ApplyL1DevGenesis added in v1.20.2

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

ApplyL1DevGenesis deploys the superchain and implementations into a new L1 dev genesis, with no chains. Preinstalls go in first, so the deployer keeps its nonce for later deploys on the live L1.

func ApplyPipeline

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

func ChainIDFromRPC

func ChainIDFromRPC(ctx context.Context, rpcURL string) (*big.Int, error)

func CheckUseForgeFlag added in v1.21.0

func CheckUseForgeFlag(cliCtx *cli.Context, l log.Logger) error

CheckUseForgeFlag warns that --use-forge has no effect. It refuses --use-forge=false, which asked for the removed Go script host, rather than run forge against the caller's explicit choice.

func Continue added in v1.19.5

func Continue(ctx context.Context, cfg ContinueConfig) error

Continue resumes a prepared deployment after simulating and validating every pending chain. This global preflight prevents predictable partial deployments but cannot make independent L1 transactions atomic. Each chain's pinned anchor and the deployer nonce are therefore rechecked immediately before broadcast, and any drift stops the remaining sends.

func ContinueCLI added in v1.19.5

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

func CreateCacheDir

func CreateCacheDir(cacheDir string) error

func Init

func Init(cfg InitConfig) error

func InitCLI

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

func PrefixEnvVar

func PrefixEnvVar(name string) []string

func Prepare added in v1.19.5

func Prepare(ctx context.Context, cfg PrepareConfig) error

func PrepareCLI added in v1.19.5

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

func Prestate added in v1.19.5

func Prestate(ctx context.Context, cfg PrestateConfig) error

func PrestateCLI added in v1.19.5

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

Types

type ApplyConfig

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

	// ReceiptQueryInterval is how often to poll for each broadcast's receipt. Zero uses the broadcaster's default.
	ReceiptQueryInterval time.Duration
	// DeployMockSP1Verifier deploys an accept-all SP1 verifier on an L1 without a release verifier.
	DeployMockSP1Verifier bool
	// contains filtered or unexported fields
}

func (*ApplyConfig) Check

func (a *ApplyConfig) Check() error

type ApplyPipelineOpts

type ApplyPipelineOpts struct {
	L1RPCUrl           string
	DeploymentTarget   DeploymentTarget
	DeployerPrivateKey *ecdsa.PrivateKey
	Intent             *state.Intent
	State              *state.State
	Logger             log.Logger
	StateWriter        pipeline.StateWriter
	CacheDir           string
	// DeployMockSP1Verifier is a test-only opt-in for development environments.
	DeployMockSP1Verifier bool
	// AllowUnoptimizedContracts is a test-only opt-in that lets oversized dev-profile
	// artifacts build an L2 genesis. A genesis deployment always allows them.
	AllowUnoptimizedContracts bool
	Workdir                   string
	ReceiptQueryInterval      time.Duration
}

type ContinueConfig added in v1.19.5

type ContinueConfig struct {
	Workdir    string
	L1RPCUrl   string
	PrivateKey string
	CacheDir   string
	Logger     log.Logger
	// ReceiptQueryInterval is how often to poll for each broadcast's receipt. Zero uses the broadcaster's default.
	ReceiptQueryInterval time.Duration
	// contains filtered or unexported fields
}

func (*ContinueConfig) Check added in v1.19.5

func (c *ContinueConfig) Check() error

type DeploymentTarget

type DeploymentTarget string
const (
	DeploymentTargetLive    DeploymentTarget = "live"
	DeploymentTargetGenesis DeploymentTarget = "genesis"
)

func NewDeploymentTarget

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

type PrepareConfig added in v1.19.5

type PrepareConfig struct {
	Workdir string
	Logger  log.Logger
	// PrivateKey of the deployer account. Its address is used as the dry-run
	// sender, operator MUST use the same key for the eventual broadcast.
	PrivateKey string
	// L1RPCUrl is the L1 endpoint that prepare forks to dry-run OPCM.deploy.
	L1RPCUrl string
	// CacheDir is where downloaded artifacts are cached.
	CacheDir string
	// GenesisTimeOffset is the number of seconds added to the L1 anchor block's timestamp
	// to produce the committed L2 genesis timestamp.
	GenesisTimeOffset uint64
	// AllowUnoptimizedContracts is a test-only opt-in that lets oversized dev-profile
	// artifacts build an L2 genesis.
	AllowUnoptimizedContracts bool
	// contains filtered or unexported fields
}

func (*PrepareConfig) Check added in v1.19.5

func (c *PrepareConfig) Check() error

type PrestateConfig added in v1.19.5

type PrestateConfig struct {
	Workdir     string
	Logger      log.Logger
	Prestate    string
	PrestateSet bool
}

func (*PrestateConfig) Check added in v1.19.5

func (c *PrestateConfig) Check() error

Directories

Path Synopsis
bundle
Package bundle packs a built forge project into the contracts bundle that op-deployer runs forge on.
Package bundle packs a built forge project into the contracts bundle that op-deployer runs forge on.
cmd/mktar command
integration_test
cli

Jump to

Keyboard shortcuts

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