localnet

package
v1.13.4 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2025 License: BSD-3-Clause Imports: 45 Imported by: 0

Documentation

Overview

Copyright (C) 2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.

Index

Constants

This section is empty.

Variables

View Source
var ErrNetworkNotRunning = errors.New("network is not running")

Functions

func AddNodeToLocalCluster

func AddNodeToLocalCluster(
	app *application.Lux,
	printFunc func(msg string, args ...interface{}),
	clusterName string,
	httpPort uint32,
	stakingPort uint32,
) (*tmpnet.Node, error)

Adds a new fresh node with given [httpPort] and [stakingPort] into cluster [clusterName] conf, and starts it Copies all node conf from the first node of the cluster, including connection settings, tracked subnets, blockchain config files. Downloads luxd DB for testnet nodes Finally waits for all the blockchains validated by the cluster to be bootstrapped

func BlockchainAlreadyDeployedOnLocalNetwork

func BlockchainAlreadyDeployedOnLocalNetwork(app *application.Lux, blockchainName string) (bool, error)

Indicates if [blockchainName] is found to be deployed on the local network, based on the VMID associated to it

func CreateLocalCluster

func CreateLocalCluster(
	app *application.Lux,
	printFunc func(msg string, args ...interface{}),
	clusterName string,
	luxdBinPath string,
	pluginDir string,
	defaultFlags map[string]interface{},
	connectionSettings ConnectionSettings,
	numNodes uint32,
	nodeSettings []NodeSetting,
	trackedSubnets []ids.ID,
	networkModel models.Network,
	downloadDB bool,
	bootstrap bool,
) (*tmpnet.Network, error)

Create a local cluster [clusterName] connected to another network, based on [connectionSettings]. Set up [numNodes] nodes, either with fresh keys and ports, or based on settings given by [nodeSettings] If [downloadDB] is set, and network is testnet, downloads the current luxd DB -note: db download is not desired if migrating from a network runner cluster- If [bootstrap] is set, starts the nodes

func CreateLocalNetwork

func CreateLocalNetwork(
	app *application.Lux,
	networkDir string,
	numNodes uint32,
	pluginDir string,
	luxdBinPath string,
) error

Create a local network of [numNodes] nodes at [networkDir] using luxd binary at [luxdBinPath] Make local network meta to point to it

func DownloadLuxdDB

func DownloadLuxdDB(
	clusterNetwork models.Network,
	rootDir string,
	nodeNames []string,
	log logging.Logger,
	printFunc func(msg string, args ...interface{}),
) error

Downloads luxd database into the given [nodeNames] To be used on [testnet] only, after creating the nodes, but previously starting them.

func GetDefaultNetworkConf

func GetDefaultNetworkConf(numNodes uint32) (
	uint32,
	*genesis.UnparsedConfig,
	[]byte,
	map[string]interface{},
	[]*tmpnet.Node,
	error,
)

GetDefaultNetworkConf creates a default network configuration of [numNodes] compatible with TmpNet usage, where the first len(networkConf.NodeConfigs) /== 5/ will have default local network NodeID/BLSInfo/Ports, and the remaining ones will be dynamically generated. It returns the local network's: - genesis - upgrade - common flags - node confs

func GetFilteredLocalClusters

func GetFilteredLocalClusters(
	app *application.Lux,
	running bool,
	network models.Network,
	blockchainName string,
) ([]string, error)

Gets a list of clusters filtered by running status, network model, and validated blockchains

func GetLocalCluster

func GetLocalCluster(
	app *application.Lux,
	clusterName string,
) (*tmpnet.Network, error)

Returns the tmpnet associated to the local cluster

func GetLocalClusterDir

func GetLocalClusterDir(
	app *application.Lux,
	clusterName string,
) string

Returns the directory associated to the local cluster

func GetLocalClusterEndpoint

func GetLocalClusterEndpoint(
	app *application.Lux,
	clusterName string,
) (string, error)

Returns the endpoint associated to the cluster If the network is not running it errors

func GetLocalClusterNetworkModel

func GetLocalClusterNetworkModel(
	app *application.Lux,
	clusterName string,
) (models.Network, error)

Returns the network model the local cluster given by [clusterName]

func GetLocalClusterTrackedSubnets

func GetLocalClusterTrackedSubnets(
	app *application.Lux,
	clusterName string,
) ([]ids.ID, error)

Returns the subnets tracked by [clusterName]

func GetLocalClusterURIs

func GetLocalClusterURIs(
	app *application.Lux,
	clusterName string,
) ([]string, error)

Get local cluster URIs

func GetLocalClusters

func GetLocalClusters(app *application.Lux) ([]string, error)

Get list of all local clusters

func GetLocalNetwork

func GetLocalNetwork(app *application.Lux) (*tmpnet.Network, error)

Returns the tmpnet associated to the local network If the network is not alive it errors

func GetLocalNetworkDefaultContext

func GetLocalNetworkDefaultContext() (context.Context, context.CancelFunc)

Returns a context large enough to support all local network operations

func GetLocalNetworkDir

func GetLocalNetworkDir(app *application.Lux) (string, error)

Returns the tmpnet directory associated to the local network If the network is not alive it errors

func GetLocalNetworkEndpoint

func GetLocalNetworkEndpoint(app *application.Lux) (string, error)

Returns the endpoint associated to the local network If the network is not alive it errors

func GetLocalNetworkLuxdVersion

func GetLocalNetworkLuxdVersion(app *application.Lux) (bool, string, int, error)

Returns luxd version and RPC version for the local network

func GetLocalNetworkRelayerConfigPath

func GetLocalNetworkRelayerConfigPath(app *application.Lux, networkDir string) (bool, string, error)

Returns the configuration file for the local network relayer if [networkDir] is given, assumes that the local network is running from that dir

func GetLocalNetworkWallet

func GetLocalNetworkWallet(
	app *application.Lux,
	subnetIDs []ids.ID,
) (*primary.Wallet, error)

GetLocalNetworkWallet returns a wallet that can operate on the local network initialized to recognice all given [subnetIDs] as pre generated

func GetNetworkModel

func GetNetworkModel(
	networkDir string,
) (models.Network, error)

Returns the network model for the network at [networkDir]

func GetNewTmpNetNodes

func GetNewTmpNetNodes(
	numNodes uint32,
	nodeSettings []NodeSetting,
	trackedSubnets []ids.ID,
) ([]*tmpnet.Node, error)

Return a slice of new [numNodes] nodes, setting keys and ports to either fresh values, or values present at companion [nodeSettings] slice If [trackedSubnets] are given, set up appropriate flag

func GetRunningLocalClusters

func GetRunningLocalClusters(app *application.Lux) ([]string, error)

Gets a list of clusters that are running

func GetRunningLocalClustersConnectedToLocalNetwork

func GetRunningLocalClustersConnectedToLocalNetwork(app *application.Lux) ([]string, error)

Gets a list of clusters connected to local network that are also running

func GetTmpNetAvailableLogs

func GetTmpNetAvailableLogs(
	networkDir string,
	blockchainID ids.ID,
	includeCChain bool,
) ([]string, error)

Get paths for most important luxd logs that are present on the network nodes

func GetTmpNetBootstrappers

func GetTmpNetBootstrappers(
	networkDir string,
	skipNodeID ids.NodeID,
) ([]string, []string, error)

Get network bootstrappers to use to connect to the network

func GetTmpNetEndpoint

func GetTmpNetEndpoint(network *tmpnet.Network) (string, error)

Get a endpoint to operate with the network

func GetTmpNetFirstNode

func GetTmpNetFirstNode(network *tmpnet.Network) (*tmpnet.Node, error)

Get first node of the network

func GetTmpNetFirstRunningNode

func GetTmpNetFirstRunningNode(network *tmpnet.Network) (*tmpnet.Node, error)

Get first running node of the network

func GetTmpNetGenesis

func GetTmpNetGenesis(
	networkDir string,
) ([]byte, error)

Get network genesis

func GetTmpNetLuxdBinaryPath

func GetTmpNetLuxdBinaryPath(networkDir string) (string, error)

Returns luxd path persisted at [networkDir]

func GetTmpNetNetwork

func GetTmpNetNetwork(networkDir string) (*tmpnet.Network, error)

Reads in a tmpnet

func GetTmpNetNetworkID

func GetTmpNetNetworkID(network *tmpnet.Network) (uint32, error)

Returns Network ID of [network] Using this instead of network.GetNetworkID because latest one reads in an empty genesis for public networks on some cases, returning an ID of 0

func GetTmpNetNetworkWithURIFix

func GetTmpNetNetworkWithURIFix(networkDir string) (*tmpnet.Network, error)

reads in tmpnet for external reference. preferred over tmpnet version due to URI transformation

func GetTmpNetNodeNetworkID

func GetTmpNetNodeNetworkID(node *tmpnet.Node) (uint32, error)

Returns Network ID of a node

func GetTmpNetNodeURIsWithFix

func GetTmpNetNodeURIsWithFix(
	networkDir string,
) ([]string, error)

Get all node URIs of the network. transformates URIs

func GetTmpNetTrackedSubnets

func GetTmpNetTrackedSubnets(
	nodes []*tmpnet.Node,
) ([]ids.ID, error)

Returns the subnets tracked by [nodes]

func GetTmpNetUpgrade

func GetTmpNetUpgrade(
	networkDir string,
) ([]byte, error)

Get network upgrade

func IsLocalClusterBlockchainBootstrapped

func IsLocalClusterBlockchainBootstrapped(
	app *application.Lux,
	clusterName string,
	blockchainID string,
	subnetID ids.ID,
) (bool, error)

Indicates if a blockchain is bootstrapped on the local network If the network has no validators for the blockchain, it fails

func IsLocalClusterTrackingSubnet

func IsLocalClusterTrackingSubnet(
	app *application.Lux,
	clusterName string,
	subnetID ids.ID,
) (bool, error)

Indicates if the cluster tracks a subnet at all

func IsLocalNetworkBlockchainBootstrapped

func IsLocalNetworkBlockchainBootstrapped(
	app *application.Lux,
	blockchainID string,
	subnetID ids.ID,
) (bool, error)

Indicates if a blockchain is bootstrapped on the local network If the network has no validators for the blockchain, it fails

func IsLocalNetworkRunning

func IsLocalNetworkRunning(app *application.Lux) (bool, error)

Returns true if all local network nodes are running

func IsLocalNetworkTrackingSubnet

func IsLocalNetworkTrackingSubnet(
	app *application.Lux,
	subnetID ids.ID,
) (bool, error)

Indicates if the local network tracks a subnet at all

func IsPublicNetwork

func IsPublicNetwork(networkID uint32) bool

Indicates wether a given network ID is for public network

func IsTmpNetBlockchainBootstrapped

func IsTmpNetBlockchainBootstrapped(
	ctx context.Context,
	network *tmpnet.Network,
	blockchainID string,
	subnetID ids.ID,
) (bool, error)

Indicates if the given blockchain is bootstrapped on the network Check this for all network nodes that are also trackers of the subnet If the network does not track the blockchain at all, it errors

func IsTmpNetNodeTrackingSubnet

func IsTmpNetNodeTrackingSubnet(
	nodes []*tmpnet.Node,
	subnetID ids.ID,
) (bool, error)

Indicates if any of the [nodes] do track [subnetID]

func LoadLocalCluster

func LoadLocalCluster(
	app *application.Lux,
	clusterName string,
	luxdBinaryPath string,
) error

Loads an already existing cluster [clusterName] Waits for all blockchains validated by the cluster to be bootstrapped Sets default aliases for all blockchains validated by the cluster If [blockchainName] is given, updates the blockchain configuration for it

func LoadLocalNetwork

func LoadLocalNetwork(
	app *application.Lux,
	networkDir string,
	luxdBinPath string,
) error

Load a local network at [networkDir] using luxd binary at [luxdBinPath] Make local network meta to point to it

func LocalClusterExists

func LocalClusterExists(
	app *application.Lux,
	clusterName string,
) bool

Indicates if the local cluster exists and has valid data on its directory

func LocalClusterHealth

func LocalClusterHealth(
	app *application.Lux,
	clusterName string,
) (bool, bool, error)

Indicates if P-Chain is bootstrapped on the network, and also if all blockchain that have validators on the network, are bootstrapped

func LocalClusterIsConnectedToNetwork

func LocalClusterIsConnectedToNetwork(
	app *application.Lux,
	clusterName string,
	networkModel models.Network,
) (bool, error)

Indicates if the cluster [clusterName] is connected to a network of kind [networkModel]

func LocalClusterIsPartiallyRunning

func LocalClusterIsPartiallyRunning(app *application.Lux, clusterName string) (bool, error)

Indicates if local cluster is partially running (only some nodes are executing) Useful for stop and destroy flows that need to accomplish the operation regardless the cluster is operative

func LocalClusterIsRunning

func LocalClusterIsRunning(app *application.Lux, clusterName string) (bool, error)

Indicates if local cluster is running

func LocalClusterName

func LocalClusterName(network models.Network, blockchainName string) string

Returns stardard cluster name as generated from [network] and [blockchainName]

func LocalClusterRemove

func LocalClusterRemove(
	app *application.Lux,
	clusterName string,
) error

Removes local cluster [clusterName] First stops it if needed

func LocalClusterStop

func LocalClusterStop(
	app *application.Lux,
	clusterName string,
) error

Stops local cluster [clusterName]

func LocalClusterTrackSubnet

func LocalClusterTrackSubnet(
	app *application.Lux,
	printFunc func(msg string, args ...interface{}),
	clusterName string,
	blockchainName string,
) error

Tracks the subnet of [blockchainName] in the cluster given by [clusterName]

func LocalNetworkHealth

func LocalNetworkHealth(
	app *application.Lux,
) (bool, bool, error)

Indicates if P-Chain is bootstrapped on the local network, and also if all blockchains that have validators on the local network, or in clusters connected to the local network, are bootstrapped

func LocalNetworkMetaExists

func LocalNetworkMetaExists(
	app *application.Lux,
) bool

LocalNetworkMetaExists indicates if the metadata file exists

func LocalNetworkStop

func LocalNetworkStop(app *application.Lux) error

Stops the local network

func LocalNetworkTrackSubnet

func LocalNetworkTrackSubnet(
	app *application.Lux,
	printFunc func(msg string, args ...interface{}),
	blockchainName string,
) error

Restart all nodes on local network to track [blockchainName]. Before that, set up VM binary, blockchain and subnet config information After the blockchain is bootstrapped, add alias for [blockchainName]->[blockchainID] Finally persist all new blockchain RPC URLs into blockchain sidecar.

func MigrateANRToTmpNet

func MigrateANRToTmpNet(
	app *application.Lux,
	printFunc func(msg string, args ...interface{}),
) error

Called from 'internal/migrations' previously to any command execution Iterates over all local clusters, finding if there is a legacy network runner one If that is the case, renames it with migratedSuffix, creates a new tmpnet cluster based on all network runner cluster info, and then remove the legacy one on success If the is a cluster running, first stops it, and any relayer associated with it, then migrate the cluster, then run thew new one again, together with the relayer Relayer stop/start is needed because a connected relayer makes bootstrapping to fail upon cluster restart

func PrintBlockchainEndpoints

func PrintBlockchainEndpoints(
	app *application.Lux,
	printFunc func(msg string, args ...interface{}),
	networkDir string,
	blockchain BlockchainInfo,
) error

PrintBlockchainEndpoints prints out a table of (RPC Kind, RPC) for the given [blockchain] associated to the the given tmpnet [networkDir] RPC Kind to be in [Localhost, Codespace] where the latest is used only if inside a codespace environment

func PrintEndpoints

func PrintEndpoints(
	app *application.Lux,
	printFunc func(msg string, args ...interface{}),
	blockchainName string,
) error

PrintEndpoints prints the endpoint information for the executing local network, including primary nodes, l1 nodes, and blockchain URLs for all blockchains in the network If [blockchainName] is given, only prints information for it

func PrintL1Endpoints

func PrintL1Endpoints(
	app *application.Lux,
	printFunc func(msg string, args ...interface{}),
) error

PrintL1Endpoints prints out a table of (Node ID, Endpoint, L1) for all running clusters connected to the local network If the environment is codespace based, It also adds a node codespace URI

func PrintNetworkEndpoints

func PrintNetworkEndpoints(
	title string,
	printFunc func(msg string, args ...interface{}),
	networkDir string,
) error

PrintNetworkEndpoints prints out a table of (Node ID, Node URI) for a given tmpnet [networkDir], with a given [title] If the environment is codespace based, It also adds a node codespace URI

func RefreshLocalClusterAliases

func RefreshLocalClusterAliases(
	app *application.Lux,
	clusterName string,
) error

Sets default aliases for all blockchains validated by the cluster

func RemoveLocalNetworkMeta

func RemoveLocalNetworkMeta(
	app *application.Lux,
) error

RemoveLocalNetworkMeta removes the metadata file

func SaveLocalNetworkMeta

func SaveLocalNetworkMeta(
	app *application.Lux,
	networkDir string,
) error

SaveLocalNetworkMeta saves the tmpnet directory of the currently executing local network to the metadata file

func SetupLuxdBinary

func SetupLuxdBinary(
	app *application.Lux,
	luxdVersion string,
	luxdBinaryPath string,
) (string, error)

SetupLuxdBinary: * checks if luxd is installed in the local binary path * if not, it downloads and installs it (os - and archive dependent) * returns the location of the luxd path

func SetupVMBinary

func SetupVMBinary(
	app *application.Lux,
	blockchainName string,
) (string, error)

SetupVMBinary ensures a binary for [blockchainName]'s VM is locally available, and provides a path to it

func TmpNetAddNode

func TmpNetAddNode(
	ctx context.Context,
	log logging.Logger,
	network *tmpnet.Network,
	node *tmpnet.Node,
	httpPort uint32,
	stakingPort uint32,
) error

Adds the given node to the [network] conf, and starts it Waits for P-Chain to be bootstrapped, and persists ports for the node

func TmpNetAddNonSovereignValidators

func TmpNetAddNonSovereignValidators(
	ctx context.Context,
	network *tmpnet.Network,
	subnetID ids.ID,
	wallet *primary.Wallet,
) error

Add all network nodes of [network] as non SOV validators of [subnetID], using [wallet] to pay for fees If a node is already validator for the subnet, does nothing with it

func TmpNetBootstrap

func TmpNetBootstrap(
	ctx context.Context,
	log logging.Logger,
	networkDir string,
) error

Starts all nodes of [networkDir], and waits for P-chain to be bootstrapped Then, persists HTTP and Staking ports (changing the config from dynamic ports -if set to 0- into persisted ones)

func TmpNetCopyNode

func TmpNetCopyNode(
	node *tmpnet.Node,
) (*tmpnet.Node, error)

Copies node data into a new fresh node that is to be used in the same network Keeps information regarding genesis, upgrade, bootstrappers, tracked subnets, ...

func TmpNetCreate

func TmpNetCreate(
	ctx context.Context,
	log logging.Logger,
	networkDir string,
	luxdBinPath string,
	pluginDir string,
	networkID uint32,
	bootstrapIPs []string,
	bootstrapIDs []string,
	genesis *genesis.UnparsedConfig,
	upgradeBytes []byte,
	defaultFlags map[string]interface{},
	nodes []*tmpnet.Node,
	bootstrap bool,
) (*tmpnet.Network, error)

Creates a new tmpnet with the given parameters Accepts: - setting specific [networkDir] for the network, - a list of [nodes] where some of them have pregenerated parameters - genesis and [upgradeBytes] - [bootstrapIPs] and [bootstrapIDs] to be used (if bootstrapping from another custom network) - can be bootstrapped or not depending on [bootstrap] setting

func TmpNetEnableSybilProtection

func TmpNetEnableSybilProtection(
	networkDir string,
) error

Enables sybil proyection on [networkDir] This is disabled by default on tmpnet for 1-node networks, but is generally

needed for 1-node clusters that connect to other network

func TmpNetInstallVM

func TmpNetInstallVM(
	log logging.Logger,
	network *tmpnet.Network,
	binaryPath string,
	vmID ids.ID,
) error

Install the given VM binary into the appropriate location with the appropriate name

func TmpNetLoad

func TmpNetLoad(
	ctx context.Context,
	log logging.Logger,
	networkDir string,
	luxdBinPath string,
) (*tmpnet.Network, error)

Bootstrap a previously generated network If [luxdBinPath] is given, uses it instead of the persisted one

func TmpNetMove

func TmpNetMove(
	oldDir string,
	newDir string,
) error

Copies a tmpnet from [oldDir] to [newDir], fixing configuration so the new network can be bootstrapped

func TmpNetPersistPorts

func TmpNetPersistPorts(
	network *tmpnet.Network,
) error

Persists http and staking ports of a running network

func TmpNetRestartNode

func TmpNetRestartNode(
	ctx context.Context,
	log logging.Logger,
	network *tmpnet.Network,
	node *tmpnet.Node,
) error

Restart given node of [network]

func TmpNetRestartNodes

func TmpNetRestartNodes(
	ctx context.Context,
	log logging.Logger,
	printFunc func(msg string, args ...interface{}),
	network *tmpnet.Network,
	nodes []*tmpnet.Node,
	subnetIDs []ids.ID,
) error

Restart given [nodes] of [network] If [subnetIDs] are given, configure the nodes to track the subnets

func TmpNetSetAlias

func TmpNetSetAlias(
	nodes []*tmpnet.Node,
	blockchainID string,
	alias string,
	subnetID ids.ID,
) error

Assign alias [alias]->[blockchainID] to the given [nodes] of [network] if none of the nodes validate the blockchain, it errors

func TmpNetSetBlockchainConfig

func TmpNetSetBlockchainConfig(
	network *tmpnet.Network,
	nodes []*tmpnet.Node,
	blockchainID ids.ID,
	blockchainConfig []byte,
	blockchainUpgrades []byte,
) error

Set up blockchain config for the given [nodes] of [network]

func TmpNetSetDefaultAliases

func TmpNetSetDefaultAliases(ctx context.Context, networkDir string) error

Assign alias [blockchain.Name]->[blockchain.ID] for all non standard blockchains on the [network] if the blockchain is not tracked by the network, skips it

func TmpNetSetNodeBlockchainConfig

func TmpNetSetNodeBlockchainConfig(
	network *tmpnet.Network,
	nodeID ids.NodeID,
	blockchainID ids.ID,
	blockchainConfig []byte,
	blockchainUpgrades []byte,
) error

Set up blockchain config for the given [nodeID] of the [network]

func TmpNetSetSubnetConfig

func TmpNetSetSubnetConfig(
	network *tmpnet.Network,
	subnetID ids.ID,
	subnetConfig []byte,
) error

Set up subnet config for all nodes in the network

func TmpNetStartNode

func TmpNetStartNode(
	ctx context.Context,
	log logging.Logger,
	network *tmpnet.Network,
	node *tmpnet.Node,
) error

Starts given node of [network]

func TmpNetStop

func TmpNetStop(
	networkDir string,
) error

Stops the given network

func TmpNetTrackSubnet

func TmpNetTrackSubnet(
	ctx context.Context,
	log logging.Logger,
	printFunc func(msg string, args ...interface{}),
	networkDir string,
	sovereign bool,
	blockchainID ids.ID,
	subnetID ids.ID,
	wallet *primary.Wallet,
) error

Restart all nodes on [networkDir] to track [subnetID]. If [wallet] is given, for non [sovereign] flows, add nodes as non sovereign validators Waits until both P-Chain and the blockchain [blockchainID] are bootstrapped

func TmpNetUpdateBlockchainConfig

func TmpNetUpdateBlockchainConfig(
	log logging.Logger,
	networkDir string,
	subnetID ids.ID,
	blockchainID ids.ID,
	vmID ids.ID,
	vmBinaryPath string,
	blockchainConfig []byte,
	perNodeBlockchainConfig map[ids.NodeID][]byte,
	blockchainUpgrades []byte,
	subnetConfig []byte,
	nodeConfig map[string]interface{},
) error

Set up blockchain config file from [vmBinaryPath], [blockchainConfig], [perNodeBlockchainConfig], [blockchainUpgrades], [subnetConfig]

func TmpNetWaitNonSovereignValidators

func TmpNetWaitNonSovereignValidators(ctx context.Context, network *tmpnet.Network, subnetID ids.ID) error

Waits until all the network nodes of [network] are included as validators of [subnetID] as verified on GetCurrentValidators P-Chain API call

func TrackSubnet

func TrackSubnet(
	app *application.Lux,
	printFunc func(msg string, args ...interface{}),
	blockchainName string,
	networkDir string,
	wallet *primary.Wallet,
) error

Tracks the given [blockchainName] at network given on [networkDir] After P-Chain is bootstrapped, set alias [blockchainName]->blockchainID for the network, and persists RPC into sidecar Use both for local networks and local clusters

func UpdateBlockchainConfig

func UpdateBlockchainConfig(
	app *application.Lux,
	networkDir string,
	blockchainName string,
) error

Update network given by [networkDir], with all blockchain config of [blockchainName]

func WaitLocalClusterBlockchainBootstrapped

func WaitLocalClusterBlockchainBootstrapped(
	ctx context.Context,
	app *application.Lux,
	clusterName string,
	blockchainID string,
	subnetID ids.ID,
) error

Waits for cluster [clusterName] to have [blockchainID] bootstrapped

func WaitTmpNetBlockchainBootstrapped

func WaitTmpNetBlockchainBootstrapped(
	ctx context.Context,
	network *tmpnet.Network,
	blockchainID string,
	subnetID ids.ID,
) error

Waits for the given blockchain to be bootstrapped on network Check this for all network nodes that are also validators of the subnet If the network does not validate the blockchain at all, it errors

func WriteExtraLocalNetworkData

func WriteExtraLocalNetworkData(
	app *application.Lux,
	rootDataDir string,
	relayerPath string,
	cchainWarpMessengerAddress string,
	cchainWarpRegistryAddress string,
) error

Writes extra information for the local network, not available on the primary storage

Types

type BlockchainInfo

type BlockchainInfo struct {
	Name     string
	ID       ids.ID
	SubnetID ids.ID
	VMID     ids.ID
}

func GetBlockchainsInfo

func GetBlockchainsInfo(endpoint string) ([]BlockchainInfo, error)

Gathers blockchain info for all non standard blockchains at [endpoint]

func GetLocalClusterBlockchainsInfo

func GetLocalClusterBlockchainsInfo(
	app *application.Lux,
	clusterName string,
) ([]BlockchainInfo, error)

Returns blockchain info for all non standard blockchains deployed into the network

func GetLocalClusterManagedBlockchainsInfo

func GetLocalClusterManagedBlockchainsInfo(
	app *application.Lux,
	clusterName string,
) ([]BlockchainInfo, error)

Returns blockchain info for all blockchains deployed into the network, that are managed by CLI

func GetLocalClusterManagedTrackedBlockchains

func GetLocalClusterManagedTrackedBlockchains(
	app *application.Lux,
	clusterName string,
) ([]BlockchainInfo, error)

Return a list of managed blockchains that are tracked at least by one node in the cluster

func GetLocalClusterTrackedBlockchains

func GetLocalClusterTrackedBlockchains(
	app *application.Lux,
	clusterName string,
) ([]BlockchainInfo, error)

Return a list of blockchains that are tracked at least by one node in the cluster

func GetLocalNetworkBlockchainsInfo

func GetLocalNetworkBlockchainsInfo(app *application.Lux) ([]BlockchainInfo, error)

Returns blockchain info for all non standard blockchains deployed into the local network

func GetManagedBlockchainsInfo

func GetManagedBlockchainsInfo(app *application.Lux, network models.Network) ([]BlockchainInfo, error)

Gathers blockchain info for all blockchains of [network] managed by CLI

type ConnectionSettings

type ConnectionSettings struct {
	NetworkID    uint32
	Genesis      []byte
	Upgrade      []byte
	BootstrapIDs []string
	BootstrapIPs []string
}

A connection setting is either the network ID for a public network, or the full settings for a custom network

func GetLocalNetworkConnectionInfo

func GetLocalNetworkConnectionInfo(
	app *application.Lux,
) (ConnectionSettings, error)

Get connections settings needed to connect a cluster to the local network

type ExtraLocalNetworkData

type ExtraLocalNetworkData struct {
	RelayerPath                      string
	CChainTeleporterMessengerAddress string
	CChainTeleporterRegistryAddress  string
}

information that is persisted alongside the local network

func GetExtraLocalNetworkData

func GetExtraLocalNetworkData(app *application.Lux, rootDataDir string) (bool, ExtraLocalNetworkData, error)

Gathers extra information for the local network, not available on the primary storage

type LocalNetworkMeta

type LocalNetworkMeta struct {
	NetworkDir string `json:"networkDir"`
}

Local network metadata keeps reference to the tmpnet directory of the currently executing local network

func GetLocalNetworkMeta

func GetLocalNetworkMeta(
	app *application.Lux,
) (*LocalNetworkMeta, error)

GetLocalNetworkMeta returns the metadata contents

type NodeSetting

type NodeSetting struct {
	StakingTLSKey    []byte
	StakingCertKey   []byte
	StakingSignerKey []byte
	HTTPPort         uint64
	StakingPort      uint64
}

type RunningStatus

type RunningStatus int64
const (
	UndefinedRunningStatus RunningStatus = iota
	NotRunning                           // no network node is running
	PartiallyRunning                     // only part of the network nodes are running
	Running                              // all network nodes are running
)

func GetTmpNetRunningStatus

func GetTmpNetRunningStatus(networkDir string) (RunningStatus, error)

Indicates whether the given network has all, part, or none of its nodes running

func LocalNetworkRunningStatus

func LocalNetworkRunningStatus(app *application.Lux) (RunningStatus, error)

Indicates if all, some or none of the local network nodes are running

Jump to

Keyboard shortcuts

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