environment

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Local          = "local"
	StagingTestnet = "staging_testnet"
	StagingMainnet = "staging_mainnet"
	Staging        = "staging" // Note this is currently the equivalent of staging_testnet.
	ProdMainnet    = "prod_mainnet"
	ProdTestnet    = "prod_testnet"
	Prod           = "prod"

	// Legacy environments to be cleaned up once the migration to the above environments is completed.
	Testnet    = "testnet"
	Mainnet    = "mainnet"
	SolStaging = "solana-staging" // Note this is testnet staging for Solana.
)

Variables

This section is empty.

Functions

func Load added in v0.41.0

func Load(
	ctx context.Context,
	domain fdomain.Domain,
	envKey string,
	opts ...LoadEnvironmentOption,
) (fdeployment.Environment, error)

Types

type AnvilChainsOutput added in v0.41.0

type AnvilChainsOutput struct {
	Chains       map[uint64]fevm.Chain
	ForkClients  map[uint64]ForkedOnchainClient
	ChainConfigs map[uint64]ChainConfig
}

AnvilChainsOutput represents the output of the newAnvilChains function.

type ChainConfig added in v0.41.0

type ChainConfig struct {
	ChainID  string // chain id as per EIP-155
	HTTPRPCs []RPCs // http rpcs to connect to the chain
}

ChainConfig represents the configuration for a chain.

type ForkedEnvironment added in v0.41.0

type ForkedEnvironment struct {
	fdeployment.Environment
	ChainConfigs map[uint64]ChainConfig
	ForkClients  map[uint64]ForkedOnchainClient
}

ForkedEnvironment represents a forked deployment environment. It embeds a standard environment with the addition of a client for forking per fchain.

func LoadFork added in v0.47.0

func LoadFork(
	ctx context.Context,
	domain fdomain.Domain,
	env string,
	blockNumbers map[uint64]*big.Int,
	opts ...LoadEnvironmentOption,
) (ForkedEnvironment, error)

LoadFork loads a deployment environment in which the chains are forks of real networks. Provides access to a forking client per chain that allows users to send transactions without signatures.

Limitations: - EVM only

func (ForkedEnvironment) ApplyChangesetOutput added in v0.41.0

func (e ForkedEnvironment) ApplyChangesetOutput(ctx context.Context, output fdeployment.ChangesetOutput) (ForkedEnvironment, error)

ApplyChangesetOutput executes MCMS proposals and merges addresses into the address book.

type ForkedOnchainClient added in v0.41.0

type ForkedOnchainClient interface {
	// SendTransaction sends transaction data from one address to another.
	// Implementations should ensure that the transaction doesn't need a valid signature to be accepted.
	SendTransaction(ctx context.Context, from string, to string, data []byte) error
}

ForkedOnchainClient is a client for a fork of a blockchain node. It should be able to send transactions from any address without the need for a private key.

type LoadConfig added in v0.38.0

type LoadConfig struct {
	// contains filtered or unexported fields
}

LoadConfig contains configuration parameters for loading an environment.

This struct holds all the configurable options that affect how an environment is loaded, including which components to initialize, which chains to load, and various behavioral flags.

func (*LoadConfig) Configure added in v0.47.0

func (c *LoadConfig) Configure(opts []LoadEnvironmentOption)

Configure applies a slice of LoadEnvironmentOption functions to the LoadConfig.

This method is used internally by the Load function to apply user-provided configuration options to the default LoadConfig instance.

type LoadEnvironmentOption added in v0.41.0

type LoadEnvironmentOption func(*LoadConfig)

LoadEnvironmentOption is a functional option type for configuring environment loading.

func OnlyLoadChainsFor added in v0.41.0

func OnlyLoadChainsFor(chainsSelectors []uint64) LoadEnvironmentOption

OnlyLoadChainsFor configures the environment to load only specified chains for a migration.

This option optimizes environment loading by restricting it to only the chains required for a specific migration. This can significantly reduce loading time and resource usage when working with environments that support many chains.

By default, if this option is not specified, all chains are loaded. If chainsSelectors is set to nil or empty, no chains will be loaded.

func WithAnvilKeyAsDeployer added in v0.41.0

func WithAnvilKeyAsDeployer() LoadEnvironmentOption

WithAnvilKeyAsDeployer configures the environment to use Anvil's default private key as the EVM deployer key.

This option is intended for local development and testing with forked EVM environments. When enabled, the environment will use Anvil's well-known private key instead of generating or loading a different deployer key.

Warning: This should NEVER be used in production environments as the Anvil key is publicly known.

func WithDryRunJobDistributor added in v0.47.0

func WithDryRunJobDistributor() LoadEnvironmentOption

WithDryRunJobDistributor configures the environment to use a dry-run Job Distributor.

The dry-run Job Distributor is a special mode that allows safe testing of operations that would normally modify the Job Distributor state. In this mode:

  • Read operations are forwarded to the real Job Distributor backend
  • Write operations are stubbed out and logged but not executed
  • This allows testing of migration logic without affecting production systems

This option is particularly useful for:

  • Running fork tests without affecting the production environment
  • Testing migrations against production environments safely
  • Validating operation logic before actual deployment
  • Debugging issues without side effects

func WithLogger added in v0.47.0

func WithLogger(lggr logger.Logger) LoadEnvironmentOption

WithLogger configures the environment to use a custom logger instance.

The logger is used throughout the environment loading process and subsequent operations for debugging, informational messages, and error reporting. By default, a new logger instance is created automatically.

This option is useful when you need to:

  • Use a specific logger configuration (log level, format, output)
  • Integrate with existing logging infrastructure
  • Use a test logger for unit tests
  • Share a logger instance across multiple components

func WithOperationRegistry added in v0.41.0

func WithOperationRegistry(registry *operations.OperationRegistry) LoadEnvironmentOption

WithOperationRegistry configures the environment to use a custom operation registry.

The operation registry contains all available operations that can be executed within the environment. By default, a new empty registry is created. This option allows you to provide a pre-configured registry with custom operations or modified behavior.

func WithReporter added in v0.41.0

func WithReporter(reporter operations.Reporter) LoadEnvironmentOption

WithReporter configures a custom operations reporter for environment loading.

The reporter is responsible for tracking and recording operations performed during environment loading and subsequent operations. By default, a memory-based reporter is used, but this option allows you to provide a custom implementation.

func WithoutJD added in v0.41.0

func WithoutJD() LoadEnvironmentOption

WithoutJD configures the environment to skip Job Distributor initialization.

By default, the environment loading process initializes the Job Distributor component. This option disables that initialization, which can be useful for:

  • Changeset executions that don't require offchain components
  • Faster environment loading when JD is not needed
  • Testing scenarios where JD dependencies are not available

WARNING: When this option is used, env.Offchain will be nil. Any code that attempts to use env.Offchain will panic. Ensure your migration or operation does not depend on Job Distributor functionality.

type RPCs added in v0.41.0

type RPCs struct {
	External string
}

RPCs represents the internal and external RPCs for a chain.

Jump to

Keyboard shortcuts

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