local

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: BSD-3-Clause Imports: 79 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// snapshots directory
	DefaultSnapshotsDir string
)
View Source
var (
	ErrSnapshotNotFound = errors.New("snapshot not found")
)

interface compliance

Functions

func GetSnapshotNames added in v1.9.0

func GetSnapshotNames(snapshotsDir string) ([]string, error)

func NewDefaultConfig

func NewDefaultConfig(
	binaryPath string,
	networkID uint32,
	genesisPath string,
	upgradePath string,
	beaconConfig map[ids.NodeID]netip.AddrPort,
) (network.Config, error)

NewDefaultConfig creates a new default network config

func NewDefaultConfigNNodes

func NewDefaultConfigNNodes(
	binaryPath string,
	numNodes uint32,
	networkID uint32,
	genesisPath string,
	upgradePath string,
	beaconConfig map[ids.NodeID]netip.AddrPort,
) (network.Config, error)

NewDefaultConfigNNodes creates a new default network config, with an arbitrary number of nodes

func NewDefaultNetwork

func NewDefaultNetwork(
	log logging.Logger,
	binaryPath string,
	reassignPortsIfUsed bool,
	redirectStdout bool,
	redirectStderr bool,
	zeroIP bool,
) (network.Network, error)

NewDefaultNetwork returns a new network using a pre-defined network configuration. The following addresses are pre-funded: X-Chain Address 1: X-custom18jma8ppw3nhx5r4ap8clazz0dps7rv5u9xde7p X-Chain Address 1 Key: PrivateKey-ewoqjP7PxY4yr3iLTpLisriqt94hdyDFNgchSxGGztUrTXtNN P-Chain Address 1: P-custom18jma8ppw3nhx5r4ap8clazz0dps7rv5u9xde7p P-Chain Address 1 Key: PrivateKey-ewoqjP7PxY4yr3iLTpLisriqt94hdyDFNgchSxGGztUrTXtNN C-Chain Address: 0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC C-Chain Address Key: 56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027 The following nodes are validators: * NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg * NodeID-MFrZFVCXPv5iCn6M9K6XduxGTYp891xXZ * NodeID-NFBbbJ4qCmNaCzeW7sxErhvWqvEQMnYcN * NodeID-GWPcbFJZFfZreETSoWjPimr846mXEKCtu * NodeID-P7oB2McjBGgW2NXXWVYjV8JEDFoW9xDE5

func NewNetwork

func NewNetwork(
	log logging.Logger,
	networkConfig network.Config,
	rootDir string,
	logRootDir string,
	snapshotsDir string,
	reassignPortsIfUsed bool,
	redirectStdout bool,
	redirectStderr bool,
	walletPrivateKey string,
	zeroIP bool,
) (network.Network, error)

NewNetwork returns a new network that uses the given log. Files (e.g. logs, databases) default to being written at directory [rootDir]. If there isn't a directory at [dir] one will be created. If len([dir]) == 0, files will be written underneath a new temporary directory. Snapshots are saved to snapshotsDir, defaults to DefaultSnapshotsDir if not given

func NewNetworkFromSnapshot

func NewNetworkFromSnapshot(
	log logging.Logger,
	snapshotsDir string,
	snapshotName string,
	snapshotPath string,
	rootDir string,
	logRootDir string,
	binaryPath string,
	pluginDir string,
	chainConfigs map[string]string,
	upgradeConfigs map[string]string,
	subnetConfigs map[string]string,
	flags map[string]interface{},
	reassignPortsIfUsed bool,
	redirectStdout bool,
	redirectStderr bool,
	inPlace bool,
	walletPrivateKey string,
	beaconConfig map[ids.NodeID]netip.AddrPort,
	zeroIP bool,
) (network.Network, error)

NewNetwork returns a new network from the given snapshot

func RemoveSnapshot added in v1.9.0

func RemoveSnapshot(
	snapshotsDir string,
	snapshotName string,
	snapshotPath string,
) error

Types

type NetworkState added in v1.6.0

type NetworkState struct {
	// Map from subnet id to elastic subnet tx id
	SubnetID2ElasticSubnetID map[string]string `json:"subnetID2ElasticSubnetID"`
	// Map from blockchain id to blockchain aliases
	BlockchainAliases map[string][]string `json:"blockchainAliases"`
}

NetworkState defines dynamic network information not available on blockchain db

type NodeProcess

type NodeProcess interface {
	// Sends a SIGINT to this process and returns the process's
	// exit code.
	// If [ctx] is cancelled, sends a SIGKILL to this process and descendants.
	// We assume sending a SIGKILL to a process will always successfully kill it.
	// Subsequent calls to [Stop] have no effect.
	Stop(ctx context.Context) int
	// Returns the status of the process.
	Status() status.Status
}

NodeProcess as an interface so we can mock running AvalancheGo binaries in tests

type NodeProcessCreator

type NodeProcessCreator interface {
	GetNodeVersion(config node.Config) (string, error)
	NewNodeProcess(config node.Config, startupTime time.Duration, args ...string) (NodeProcess, error)
}

NodeProcessCreator is an interface for new node process creation

type TestMsg

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

func NewTestMsg

func NewTestMsg(op message.Op, bytes []byte, bypassThrottling bool) *TestMsg

func (*TestMsg) BypassThrottling

func (m *TestMsg) BypassThrottling() bool

func (*TestMsg) Bytes

func (m *TestMsg) Bytes() []byte

func (*TestMsg) BytesSavedCompression

func (*TestMsg) BytesSavedCompression() int

func (*TestMsg) Op

func (m *TestMsg) Op() message.Op

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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