subnet

package
v1.4.3-rc.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: BSD-3-Clause Imports: 57 Imported by: 2

Documentation

Overview

Copyright (C) 2022, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSubnetAuthKeysInWallet = errors.New("auth wallet does not contain subnet auth keys")

Functions

func CheckNodeIsInSubnetValidators added in v1.4.0

func CheckNodeIsInSubnetValidators(subnetID ids.ID, nodeID string) (bool, error)

func GetChainIDs added in v1.4.0

func GetChainIDs(endpoint string, chainName string) (string, string, error)

func GetCurrentSupply added in v1.2.0

func GetCurrentSupply(subnetID ids.ID) error

func GetFirstEndpoint added in v1.1.0

func GetFirstEndpoint(clusterInfo *rpcpb.ClusterInfo, chain string) string

GetFirstEndpoint get a human readable endpoint for the given chain

func GetLocallyDeployedSubnets added in v1.1.0

func GetLocallyDeployedSubnets() (map[string]struct{}, error)

Returns an error if the server cannot be contacted. You may want to ignore this error.

func GetLocallyDeployedSubnetsFromFile added in v1.1.1

func GetLocallyDeployedSubnetsFromFile(app *application.Avalanche) ([]string, error)

func GetPublicSubnetValidators added in v1.2.1

func GetPublicSubnetValidators(subnetID ids.ID, network models.Network) ([]platformvm.ClientPermissionlessValidator, error)

func GetSubnetValidators added in v1.2.0

func GetSubnetValidators(subnetID ids.ID) ([]platformvm.ClientPermissionlessValidator, error)

func HasEndpoints added in v1.1.0

func HasEndpoints(clusterInfo *rpcpb.ClusterInfo) bool

HasEndpoints returns true if cluster info contains custom blockchains

func IsSubnetValidator added in v1.2.0

func IsSubnetValidator(subnetID ids.ID, nodeID ids.NodeID, network models.Network) (bool, error)

func IssueAddPermissionlessDelegatorTx added in v1.2.4

func IssueAddPermissionlessDelegatorTx(
	kc keychain.Keychain,
	subnetID ids.ID,
	nodeID ids.NodeID,
	stakeAmount uint64,
	assetID ids.ID,
	startTime uint64,
	endTime uint64,
) (ids.ID, error)

func IssueAddPermissionlessValidatorTx added in v1.2.1

func IssueAddPermissionlessValidatorTx(
	kc keychain.Keychain,
	subnetID ids.ID,
	nodeID ids.NodeID,
	stakeAmount uint64,
	assetID ids.ID,
	startTime uint64,
	endTime uint64,
) (ids.ID, error)

func IssuePFromXImportTx added in v1.3.4

func IssuePFromXImportTx(
	wallet primary.Wallet,
	usingLedger bool,
	hasOnlyOneKey bool,
	owner *secp256k1fx.OutputOwners,
) (ids.ID, error)

func IssueRemoveSubnetValidatorTx added in v1.2.0

func IssueRemoveSubnetValidatorTx(kc keychain.Keychain, subnetID ids.ID, nodeID ids.NodeID) (ids.ID, error)

func IssueTransformSubnetTx added in v1.2.0

func IssueTransformSubnetTx(
	elasticSubnetConfig models.ElasticSubnetConfig,
	kc keychain.Keychain,
	subnetID ids.ID,
	tokenName string,
	tokenSymbol string,
	maxSupply uint64,
) (ids.ID, ids.ID, error)

func IssueXToPExportTx added in v1.3.4

func IssueXToPExportTx(
	wallet primary.Wallet,
	usingLedger bool,
	hasOnlyOneKey bool,
	assetID ids.ID,
	amount uint64,
	owner *secp256k1fx.OutputOwners,
) (ids.ID, error)

func SetDefaultSnapshot added in v0.1.4

func SetDefaultSnapshot(snapshotsDir string, resetCurrentSnapshot bool, avagoVersion string, isSingleNode bool) (bool, error)

Initialize default snapshot with bootstrap snapshot archive If force flag is set to true, overwrite the default snapshot if it exists

func WaitForHealthy added in v1.1.0

func WaitForHealthy(
	ctx context.Context,
	cli client.Client,
) (*rpcpb.ClusterInfo, error)

WaitForHealthy polls continuously until the network is ready to be used

Types

type DeployInfo added in v1.4.0

type DeployInfo struct {
	SubnetID                   ids.ID
	BlockchainID               ids.ID
	TeleporterMessengerAddress string
	TeleporterRegistryAddress  string
}

type ExtraLocalNetworkData added in v1.4.0

type ExtraLocalNetworkData struct {
	CChainTeleporterMessengerAddress string
	CChainTTeleporterRegistryAddress string
}

func GetExtraLocalNetworkData added in v1.4.0

func GetExtraLocalNetworkData(app *application.Avalanche) (*ExtraLocalNetworkData, error)

type LocalDeployer added in v0.2.2

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

func NewLocalDeployer added in v0.1.3

func NewLocalDeployer(
	app *application.Avalanche,
	avagoVersion string,
	avagoBinaryPath string,
	vmBin string,
) *LocalDeployer

uses either avagoVersion or avagoBinaryPath

func (*LocalDeployer) BackendStartedHere added in v0.2.2

func (d *LocalDeployer) BackendStartedHere() bool

BackendStartedHere returns true if the backend was started by this run, or false if it found it there already

func (*LocalDeployer) DeployToLocalNetwork added in v0.2.2

func (d *LocalDeployer) DeployToLocalNetwork(chain string, chainGenesis []byte, genesisPath string) (*DeployInfo, error)

DeployToLocalNetwork does the heavy lifting: * it checks the gRPC is running, if not, it starts it * kicks off the actual deployment

func (*LocalDeployer) SetupLocalEnv added in v0.2.2

func (d *LocalDeployer) SetupLocalEnv() (bool, string, error)

SetupLocalEnv also does some heavy lifting: * sets up default snapshot if not installed * checks if avalanchego is installed in the local binary path * if not, it downloads it and installs it (os - and archive dependent) * returns the location of the avalanchego path

func (*LocalDeployer) StartServer added in v0.2.2

func (d *LocalDeployer) StartServer() error

type PublicDeployer added in v0.2.0

type PublicDeployer struct {
	LocalDeployer
	// contains filtered or unexported fields
}

func NewPublicDeployer added in v0.2.0

func NewPublicDeployer(app *application.Avalanche, kc *keychain.Keychain, network models.Network) *PublicDeployer

func (*PublicDeployer) AddPermissionlessDelegator added in v1.2.4

func (d *PublicDeployer) AddPermissionlessDelegator(
	subnetID ids.ID,
	subnetAssetID ids.ID,
	nodeID ids.NodeID,
	stakeAmount uint64,
	startTime uint64,
	endTime uint64,
	recipientAddr ids.ShortID,
) (ids.ID, error)

func (*PublicDeployer) AddPermissionlessValidator added in v1.2.4

func (d *PublicDeployer) AddPermissionlessValidator(
	subnetID ids.ID,
	subnetAssetID ids.ID,
	nodeID ids.NodeID,
	stakeAmount uint64,
	startTime uint64,
	endTime uint64,
	recipientAddr ids.ShortID,
	delegationFee uint32,
	popBytes []byte,
	proofOfPossession *signer.ProofOfPossession,
) (ids.ID, error)

func (*PublicDeployer) AddValidator added in v0.2.0

func (d *PublicDeployer) AddValidator(
	controlKeys []string,
	subnetAuthKeysStrs []string,
	subnetID ids.ID,
	transferSubnetOwnershipTxID ids.ID,
	nodeID ids.NodeID,
	weight uint64,
	startTime time.Time,
	duration time.Duration,
) (bool, *txs.Tx, []string, error)

adds a subnet validator to the given [subnetID]

  • creates an add subnet validator tx
  • sets the change output owner to be a wallet address (if not, it may go to any other subnet auth address)
  • signs the tx with the wallet as the owner of fee outputs and a possible subnet auth key
  • if partially signed, returns the tx so that it can later on be signed by the rest of the subnet auth keys
  • if fully signed, issues it

func (*PublicDeployer) Commit added in v1.0.0

func (d *PublicDeployer) Commit(
	tx *txs.Tx,
) (ids.ID, error)

func (*PublicDeployer) CreateAssetTx added in v1.2.2

func (d *PublicDeployer) CreateAssetTx(
	tokenName string,
	tokenSymbol string,
	denomination byte,
	initialState map[uint32][]verify.State,
) (ids.ID, error)

func (*PublicDeployer) DeployBlockchain added in v1.2.1

func (d *PublicDeployer) DeployBlockchain(
	controlKeys []string,
	subnetAuthKeysStrs []string,
	subnetID ids.ID,
	transferSubnetOwnershipTxID ids.ID,
	chain string,
	genesis []byte,
) (bool, ids.ID, *txs.Tx, []string, error)

creates a blockchain for the given [subnetID]

  • creates a create blockchain tx
  • sets the change output owner to be a wallet address (if not, it may go to any other subnet auth address)
  • signs the tx with the wallet as the owner of fee outputs and a possible subnet auth key
  • if partially signed, returns the tx so that it can later on be signed by the rest of the subnet auth keys
  • if fully signed, issues it

func (*PublicDeployer) DeploySubnet added in v1.2.1

func (d *PublicDeployer) DeploySubnet(
	controlKeys []string,
	threshold uint32,
) (ids.ID, error)

- creates a subnet for [chain] using the given [controlKeys] and [threshold] as subnet authentication parameters

func (*PublicDeployer) ExportToPChainTx added in v1.2.2

func (d *PublicDeployer) ExportToPChainTx(
	subnetAssetID ids.ID,
	owner *secp256k1fx.OutputOwners,
	assetAmount uint64,
) (ids.ID, error)

func (*PublicDeployer) ImportFromXChain added in v1.2.2

func (d *PublicDeployer) ImportFromXChain(
	owner *secp256k1fx.OutputOwners,
) (ids.ID, error)

func (*PublicDeployer) RemoveValidator added in v1.2.0

func (d *PublicDeployer) RemoveValidator(
	controlKeys []string,
	subnetAuthKeysStrs []string,
	subnetID ids.ID,
	transferSubnetOwnershipTxID ids.ID,
	nodeID ids.NodeID,
) (bool, *txs.Tx, []string, error)

removes a subnet validator from the given subnet - verifies that the wallet is one of the subnet auth keys (so as to sign the AddSubnetValidator tx) - if operation is multisig (len(subnetAuthKeysStrs) > 1):

  • creates a remove subnet validator tx
  • sets the change output owner to be a wallet address (if not, it may go to any other subnet auth address)
  • signs the tx with the wallet as the owner of fee outputs and a possible subnet auth key
  • if partially signed, returns the tx so that it can later on be signed by the rest of the subnet auth keys
  • if fully signed, issues it

func (*PublicDeployer) Sign added in v1.0.0

func (d *PublicDeployer) Sign(
	tx *txs.Tx,
	subnetAuthKeysStrs []string,
	subnetID ids.ID,
	transferSubnetOwnershipTxID ids.ID,
) error

func (*PublicDeployer) TransferSubnetOwnership added in v1.4.0

func (d *PublicDeployer) TransferSubnetOwnership(
	controlKeys []string,
	subnetAuthKeysStrs []string,
	subnetID ids.ID,
	transferSubnetOwnershipTxID ids.ID,
	newControlKeys []string,
	newThreshold uint32,
) (bool, *txs.Tx, []string, error)

change subnet owner for [subnetID]

  • creates a transfer subnet ownership tx
  • sets the change output owner to be a wallet address (if not, it may go to any other subnet auth address)
  • signs the tx with the wallet as the owner of fee outputs and a possible subnet auth key
  • if partially signed, returns the tx so that it can later on be signed by the rest of the subnet auth keys
  • if fully signed, issues it

func (*PublicDeployer) TransformSubnetTx added in v1.2.2

func (d *PublicDeployer) TransformSubnetTx(
	controlKeys []string,
	subnetAuthKeysStrs []string,
	elasticSubnetConfig models.ElasticSubnetConfig,
	subnetID ids.ID,
	transferSubnetOwnershipTxID ids.ID,
	subnetAssetID ids.ID,
) (bool, ids.ID, *txs.Tx, []string, error)

type Publisher added in v0.2.3

type Publisher interface {
	Publish(r *git.Repository, subnetName, vmName string, subnetYAML []byte, vmYAML []byte) error
	GetRepo() (*git.Repository, error)
}

func NewPublisher added in v0.2.3

func NewPublisher(repoDir, repoURL, alias string) Publisher

Jump to

Keyboard shortcuts

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