deployer

package
v1.19.6 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 45 Imported by: 0

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
)

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")
	DefaultSystemConfigProxySepolia common.Address = common.HexToAddress("0x034edD2A225f7f429A63E0f1D2084B9E0A93b538")
)

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, %s, %s", DeploymentTargetLive, DeploymentTargetGenesis, DeploymentTargetCalldata, DeploymentTargetNoop),
		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 = &cli.BoolFlag{
		Name:    UseForgeFlagName,
		Usage:   "use Forge instead of script.Host for deployment scripts",
		EnvVars: PrefixEnvVar("USE_FORGE"),
		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. Must cover the runtime of the off-chain pipeline between anchor selection and OPCM.deploy " +
			"landing on L1, including the prestate build. " +
			fmt.Sprintf("Must be at least %d seconds.", standard.MinGenesisTimeOffsetSeconds),
		EnvVars: PrefixEnvVar("GENESIS_TIME_OFFSET"),
		Value:   standard.DefaultGenesisTimeOffsetSeconds,
	}
)
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 ApplyPipeline

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

func ChainIDFromRPC

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

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 DeployMockSP1Verifier added in v1.19.5

func DeployMockSP1Verifier(
	ctx context.Context,
	client *ethclient.Client,
	key *ecdsa.PrivateKey,
	artifactsFS foundry.StatDirFs,
) (common.Address, error)

DeployMockSP1Verifier deploys the test-only raw SP1 verifier used by development environments. The OPCM release wraps it in SP1PlonkAdapter; callers must not use it directly as an IZKVerifier.

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

	UseForge 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
	UseForge           bool
	// DeployMockSP1Verifier is a test-only opt-in for development environments.
	DeployMockSP1Verifier bool
	PrivateKey            string
	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
	// 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"
	DeploymentTargetCalldata DeploymentTarget = "calldata"
	DeploymentTargetNoop     DeploymentTarget = "noop"
)

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
	// 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
cmd/mktar command
integration_test
cli

Jump to

Keyboard shortcuts

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