Documentation
¶
Overview ¶
Copyright (C) 2022-2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2022-2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2022-2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2022-2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2022-2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2022-2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2022-2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2022-2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2022-2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2022-2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2022-2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2022-2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2022-2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.
Index ¶
- Variables
- func AddNodeToLocalCluster(app *application.Lux, printFunc func(msg string, args ...interface{}), ...) (*tmpnet.Node, error)
- func BlockchainAlreadyDeployedOnLocalNetwork(app *application.Lux, blockchainName string) (bool, error)
- func CreateLocalCluster(app *application.Lux, printFunc func(msg string, args ...interface{}), ...) (*tmpnet.Network, error)
- func CreateLocalNetwork(app *application.Lux, networkDir string, numNodes uint32, pluginDir string, ...) error
- func DownloadLuxdDB(clusterNetwork models.Network, rootDir string, nodeNames []string, ...) error
- func GetDefaultNetworkConf(numNodes uint32) (uint32, *genesis.UnparsedConfig, []byte, map[string]interface{}, ...)
- func GetFilteredLocalClusters(app *application.Lux, running bool, network models.Network, ...) ([]string, error)
- func GetLocalCluster(app *application.Lux, clusterName string) (*tmpnet.Network, error)
- func GetLocalClusterDir(app *application.Lux, clusterName string) string
- func GetLocalClusterEndpoint(app *application.Lux, clusterName string) (string, error)
- func GetLocalClusterNetworkModel(app *application.Lux, clusterName string) (models.Network, error)
- func GetLocalClusterTrackedSubnets(app *application.Lux, clusterName string) ([]ids.ID, error)
- func GetLocalClusterURIs(app *application.Lux, clusterName string) ([]string, error)
- func GetLocalClusters(app *application.Lux) ([]string, error)
- func GetLocalNetwork(app *application.Lux) (*tmpnet.Network, error)
- func GetLocalNetworkDefaultContext() (context.Context, context.CancelFunc)
- func GetLocalNetworkDir(app *application.Lux) (string, error)
- func GetLocalNetworkEndpoint(app *application.Lux) (string, error)
- func GetLocalNetworkLuxdVersion(app *application.Lux) (bool, string, int, error)
- func GetLocalNetworkNodeURIs(app *application.Lux) ([]string, error)
- func GetLocalNetworkRelayerConfigPath(app *application.Lux, networkDir string) (bool, string, error)
- func GetLocalNetworkWallet(app *application.Lux, subnetIDs []ids.ID) (primary.Wallet, error)
- func GetNetworkModel(networkDir string) (models.Network, error)
- func GetNewTmpNetNodes(numNodes uint32, nodeSettings []NodeSetting, trackedSubnets []ids.ID) ([]*tmpnet.Node, error)
- func GetRunningLocalClusters(app *application.Lux) ([]string, error)
- func GetRunningLocalClustersConnectedToLocalNetwork(app *application.Lux) ([]string, error)
- func GetTmpNetAvailableLogs(networkDir string, blockchainID ids.ID, includeCChain bool) ([]string, error)
- func GetTmpNetBootstrappers(networkDir string, skipNodeID ids.NodeID) ([]string, []string, error)
- func GetTmpNetEndpoint(network *tmpnet.Network) (string, error)
- func GetTmpNetFirstNode(network *tmpnet.Network) (*tmpnet.Node, error)
- func GetTmpNetFirstRunningNode(network *tmpnet.Network) (*tmpnet.Node, error)
- func GetTmpNetGenesis(networkDir string) ([]byte, error)
- func GetTmpNetLuxdBinaryPath(networkDir string) (string, error)
- func GetTmpNetNetwork(networkDir string) (*tmpnet.Network, error)
- func GetTmpNetNetworkID(network *tmpnet.Network) (uint32, error)
- func GetTmpNetNetworkWithURIFix(networkDir string) (*tmpnet.Network, error)
- func GetTmpNetNodeNetworkID(node *tmpnet.Node) (uint32, error)
- func GetTmpNetNodeURIsWithFix(networkDir string) ([]string, error)
- func GetTmpNetTrackedSubnets(nodes []*tmpnet.Node) ([]ids.ID, error)
- func GetTmpNetUpgrade(networkDir string) ([]byte, error)
- func IsLocalClusterBlockchainBootstrapped(app *application.Lux, clusterName string, blockchainID string, subnetID ids.ID) (bool, error)
- func IsLocalClusterTrackingSubnet(app *application.Lux, clusterName string, subnetID ids.ID) (bool, error)
- func IsLocalNetworkBlockchainBootstrapped(app *application.Lux, blockchainID string, subnetID ids.ID) (bool, error)
- func IsLocalNetworkRunning(app *application.Lux) (bool, error)
- func IsLocalNetworkTrackingSubnet(app *application.Lux, subnetID ids.ID) (bool, error)
- func IsPublicNetwork(networkID uint32) bool
- func IsRunning(app *application.Lux) (bool, error)
- func IsTmpNetBlockchainBootstrapped(ctx context.Context, network *tmpnet.Network, blockchainID string, ...) (bool, error)
- func IsTmpNetNodeTrackingSubnet(nodes []*tmpnet.Node, subnetID ids.ID) (bool, error)
- func LoadLocalCluster(app *application.Lux, clusterName string, luxdBinaryPath string) error
- func LoadLocalNetwork(app *application.Lux, networkDir string, luxdBinPath string) error
- func LocalClusterExists(app *application.Lux, clusterName string) bool
- func LocalClusterHealth(app *application.Lux, clusterName string) (bool, bool, error)
- func LocalClusterIsConnectedToNetwork(app *application.Lux, clusterName string, networkModel models.Network) (bool, error)
- func LocalClusterIsPartiallyRunning(app *application.Lux, clusterName string) (bool, error)
- func LocalClusterIsRunning(app *application.Lux, clusterName string) (bool, error)
- func LocalClusterName(network models.Network, blockchainName string) string
- func LocalClusterRemove(app *application.Lux, clusterName string) error
- func LocalClusterStop(app *application.Lux, clusterName string) error
- func LocalClusterTrackSubnet(app *application.Lux, printFunc func(msg string, args ...interface{}), ...) error
- func LocalNetworkHealth(app *application.Lux) (bool, bool, error)
- func LocalNetworkIsRunning(app *application.Lux) (bool, error)
- func LocalNetworkMetaExists(app *application.Lux) bool
- func LocalNetworkStop(app *application.Lux) error
- func LocalNetworkTrackSubnet(app *application.Lux, printFunc func(msg string, args ...interface{}), ...) error
- func MigrateANRToTmpNet(app *application.Lux, printFunc func(msg string, args ...interface{})) error
- func NewLoggerAdapter(logger log.Logger) luxlog.Logger
- func PrintBlockchainEndpoints(app *application.Lux, printFunc func(msg string, args ...interface{}), ...) error
- func PrintEndpoints(app *application.Lux, printFunc func(msg string, args ...interface{}), ...) error
- func PrintL1Endpoints(app *application.Lux, printFunc func(msg string, args ...interface{})) error
- func PrintNetworkEndpoints(title string, printFunc func(msg string, args ...interface{}), ...) error
- func RefreshLocalClusterAliases(app *application.Lux, clusterName string) error
- func RemoveLocalNetworkMeta(app *application.Lux) error
- func SaveLocalNetworkMeta(app *application.Lux, networkDir string) error
- func SetupLuxdBinary(app *application.Lux, luxdVersion string, luxdBinaryPath string) (string, error)
- func SetupVMBinary(app *application.Lux, blockchainName string) (string, error)
- func StartLocalNetwork(app *application.Lux, name string, nodeVersion string) error
- func Stop(app *application.Lux) error
- func TmpNetAddNode(ctx context.Context, log luxlog.Logger, network *tmpnet.Network, ...) error
- func TmpNetAddNonSovereignValidators(ctx context.Context, network *tmpnet.Network, subnetID ids.ID, ...) error
- func TmpNetBootstrap(ctx context.Context, log luxlog.Logger, networkDir string) error
- func TmpNetCopyNode(node *tmpnet.Node) (*tmpnet.Node, error)
- func TmpNetCreate(ctx context.Context, log luxlog.Logger, networkDir string, luxdBinPath string, ...) (*tmpnet.Network, error)
- func TmpNetDisableSybilProtection(networkDir string) error
- func TmpNetEnableSybilProtection(networkDir string) error
- func TmpNetInstallVM(log luxlog.Logger, network *tmpnet.Network, binaryPath string, vmID ids.ID) error
- func TmpNetLoad(ctx context.Context, log luxlog.Logger, networkDir string, luxdBinPath string) (*tmpnet.Network, error)
- func TmpNetMove(oldDir string, newDir string) error
- func TmpNetPersistPorts(network *tmpnet.Network) error
- func TmpNetRestartNode(ctx context.Context, log luxlog.Logger, network *tmpnet.Network, ...) error
- func TmpNetRestartNodes(ctx context.Context, log luxlog.Logger, ...) error
- func TmpNetSetAlias(nodes []*tmpnet.Node, blockchainID string, alias string, subnetID ids.ID) error
- func TmpNetSetBlockchainConfig(network *tmpnet.Network, nodes []*tmpnet.Node, blockchainID ids.ID, ...) error
- func TmpNetSetDefaultAliases(ctx context.Context, networkDir string) error
- func TmpNetSetNodeBlockchainConfig(network *tmpnet.Network, nodeID ids.NodeID, blockchainID ids.ID, ...) error
- func TmpNetSetSubnetConfig(network *tmpnet.Network, subnetID ids.ID, subnetConfig []byte) error
- func TmpNetStartNode(ctx context.Context, log luxlog.Logger, network *tmpnet.Network, ...) error
- func TmpNetStop(networkDir string) error
- func TmpNetTrackSubnet(ctx context.Context, log luxlog.Logger, ...) error
- func TmpNetUpdateBlockchainConfig(log luxlog.Logger, networkDir string, subnetID ids.ID, blockchainID ids.ID, ...) error
- func TmpNetWaitNonSovereignValidators(ctx context.Context, network *tmpnet.Network, subnetID ids.ID) error
- func TrackSubnet(app *application.Lux, printFunc func(msg string, args ...interface{}), ...) error
- func UpdateBlockchainConfig(app *application.Lux, networkDir string, blockchainName string) error
- func WaitLocalClusterBlockchainBootstrapped(ctx context.Context, app *application.Lux, clusterName string, ...) error
- func WaitTmpNetBlockchainBootstrapped(ctx context.Context, network *tmpnet.Network, blockchainID string, ...) error
- func WriteExtraLocalNetworkData(app *application.Lux, rootDataDir string, relayerPath string, ...) error
- type BlockchainInfo
- func GetBlockchainsInfo(endpoint string) ([]BlockchainInfo, error)
- func GetLocalClusterBlockchainsInfo(app *application.Lux, clusterName string) ([]BlockchainInfo, error)
- func GetLocalClusterManagedBlockchainsInfo(app *application.Lux, clusterName string) ([]BlockchainInfo, error)
- func GetLocalClusterManagedTrackedBlockchains(app *application.Lux, clusterName string) ([]BlockchainInfo, error)
- func GetLocalClusterTrackedBlockchains(app *application.Lux, clusterName string) ([]BlockchainInfo, error)
- func GetLocalNetworkBlockchainsInfo(app *application.Lux) ([]BlockchainInfo, error)
- func GetManagedBlockchainsInfo(app *application.Lux, network models.Network) ([]BlockchainInfo, error)
- type ConnectionSettings
- type ExtraLocalNetworkData
- type LocalNetworkMeta
- type NodeSetting
- type RunningStatus
Constants ¶
This section is empty.
Variables ¶
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 luxlog.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 ¶
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 ¶
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 ¶
Returns luxd version and RPC version for the local network
func GetLocalNetworkNodeURIs ¶ added in v1.9.7
func GetLocalNetworkNodeURIs(app *application.Lux) ([]string, error)
GetLocalNetworkNodeURIs returns URIs for all running nodes in the local network. It first tries to get them from the local network, and if that fails, uses the default local endpoint.
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 ¶
GetLocalNetworkWallet returns a wallet that can operate on the local network initialized to recognize all given [subnetIDs] as pre generated
func GetNetworkModel ¶
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 ¶
Get a endpoint to operate with the network
func GetTmpNetFirstNode ¶
Get first node of the network
func GetTmpNetFirstRunningNode ¶
Get first running node of the network
func GetTmpNetGenesis ¶
Get network genesis First tries network-level genesis.json. If that doesn't have initialStakers, falls back to node1/genesis.json which contains the complete genesis with validators.
func GetTmpNetLuxdBinaryPath ¶
Returns luxd path persisted at [networkDir]
func GetTmpNetNetwork ¶
Reads in a tmpnet
func GetTmpNetNetworkID ¶
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 ¶
reads in tmpnet for external reference. preferred over tmpnet version due to URI transformation
func GetTmpNetNodeNetworkID ¶
Returns Network ID of a [node]
func GetTmpNetNodeURIsWithFix ¶
Get all node URIs of the network. transformates URIs
func GetTmpNetTrackedSubnets ¶
Returns the subnets tracked by [nodes]
func GetTmpNetUpgrade ¶
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 ¶
Indicates if the local network tracks a subnet at all
func IsPublicNetwork ¶
Indicates wether a given network ID is for public network
func IsRunning ¶
func IsRunning(app *application.Lux) (bool, error)
IsRunning checks if the local network is running
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 ¶
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 ¶
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 ¶
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 LocalNetworkIsRunning ¶
func LocalNetworkIsRunning(app *application.Lux) (bool, error)
LocalNetworkIsRunning is an alias for IsLocalNetworkRunning for backwards compatibility
func LocalNetworkMetaExists ¶
func LocalNetworkMetaExists( app *application.Lux, ) bool
LocalNetworkMetaExists indicates if the metadata file exists
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 NewLoggerAdapter ¶
NewLoggerAdapter creates a new adapter
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 StartLocalNetwork ¶
func StartLocalNetwork(app *application.Lux, name string, nodeVersion string) error
StartLocalNetwork starts the local network (placeholder - needs implementation)
func TmpNetAddNode ¶
func TmpNetAddNode( ctx context.Context, log luxlog.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 ¶
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 ¶
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 luxlog.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 TmpNetDisableSybilProtection ¶ added in v1.9.7
Disables sybil protection on [networkDir] This is needed for networks without initial stakers in genesis
func TmpNetEnableSybilProtection ¶
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 luxlog.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 luxlog.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 ¶
Copies a tmpnet from [oldDir] to [newDir], fixing configuration so the new network can be bootstrapped
func TmpNetPersistPorts ¶
Persists http and staking ports of a running network
func TmpNetRestartNode ¶
func TmpNetRestartNode( ctx context.Context, log luxlog.Logger, network *tmpnet.Network, node *tmpnet.Node, ) error
Restart given [node] of [network]
func TmpNetRestartNodes ¶
func TmpNetRestartNodes( ctx context.Context, log luxlog.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 ¶
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 ¶
Set up subnet config for all nodes in the network
func TmpNetStartNode ¶
func TmpNetStartNode( ctx context.Context, log luxlog.Logger, network *tmpnet.Network, node *tmpnet.Node, ) error
Starts given [node] of [network]
func TmpNetTrackSubnet ¶
func TmpNetTrackSubnet( ctx context.Context, log luxlog.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 luxlog.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 ¶
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 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