networks

package
v0.0.0-...-95bd726 Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Staker1NodeID = "NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg"
	Staker2NodeID = "NodeID-MFrZFVCXPv5iCn6M9K6XduxGTYp891xXZ"
	Staker3NodeID = "NodeID-NFBbbJ4qCmNaCzeW7sxErhvWqvEQMnYcN"
	Staker4NodeID = "NodeID-GWPcbFJZFfZreETSoWjPimr846mXEKCtu"
	Staker5NodeID = "NodeID-P7oB2McjBGgW2NXXWVYjV8JEDFoW9xDE5"
)
View Source
const Staker1Cert = `` /* 1869-byte string literal not displayed */
View Source
const Staker1PrivateKey = `` /* 3242-byte string literal not displayed */
View Source
const Staker2Cert = `` /* 1869-byte string literal not displayed */
View Source
const Staker2PrivateKey = `` /* 3246-byte string literal not displayed */
View Source
const Staker3Cert = `` /* 1872-byte string literal not displayed */
View Source
const Staker3PrivateKey = `` /* 3242-byte string literal not displayed */
View Source
const Staker4Cert = `` /* 1869-byte string literal not displayed */
View Source
const Staker4PrivateKey = `` /* 3242-byte string literal not displayed */
View Source
const Staker5Cert = `` /* 1869-byte string literal not displayed */
View Source
const Staker5PrivateKey = `` /* 3242-byte string literal not displayed */

Variables

View Source
var DefaultLocalNetGenesisConfig = NetworkGenesisConfig{
	Stakers: defaultStakers,

	FundedAddresses: FundedAddress{
		"6Y3kysjF9jnHnYkdS9yGAuoHyae2eNmeV",

		"PrivateKey-ewoqjP7PxY4yr3iLTpLisriqt94hdyDFNgchSxGGztUrTXtNN",
	},
}

DefaultLocalNetGenesisConfig contains the private keys and node IDs that come from caminogo for the 5 bootstrapper nodes. When using caminogo with the 'local' testnet option, the P-chain comes preloaded with five bootstrapper nodes whose node IDs are hardcoded in caminogo source. Node IDs are determined based off the TLS keys of the nodes, so to ensure that we can launch nodes with the same node ID (to validate, else we wouldn't be able to validate at all), the caminogo source code also provides the private keys for these nodes.

Functions

This section is empty.

Types

type FundedAddress

type FundedAddress struct {
	Address    string
	PrivateKey string
}

FundedAddress encapsulates a pre-funded address

type NetworkGenesisConfig

type NetworkGenesisConfig struct {
	Stakers         []StakerIdentity
	FundedAddresses FundedAddress
}

NetworkGenesisConfig encapusulates genesis information describing a network

type StakerIdentity

type StakerIdentity struct {
	NodeID     string
	PrivateKey string
	TLSCert    string
}

StakerIdentity contains a staker's identifying information

type TestCaminoNetwork

type TestCaminoNetwork struct {
	networks.Network
	// contains filtered or unexported fields
}

TestCaminoNetwork wraps Kurtosis' ServiceNetwork that is meant to be the interface tests use for interacting with Camino networks

func (TestCaminoNetwork) AddService

func (network TestCaminoNetwork) AddService(configurationID networks.ConfigurationID, serviceID networks.ServiceID) (*services.ServiceAvailabilityChecker, error)

AddService adds a service to the test Camino network, using the given configuration Args:

configurationID: The ID of the configuration to use for the service being added
serviceID: The ID to give the service being added

Returns:

An availability checker that will return true when teh newly-added service is available

func (TestCaminoNetwork) GetAllBootServiceIDs

func (network TestCaminoNetwork) GetAllBootServiceIDs() map[networks.ServiceID]bool

GetAllBootServiceIDs returns the service IDs of all the boot nodes in the network

func (TestCaminoNetwork) GetCaminoClient

func (network TestCaminoNetwork) GetCaminoClient(serviceID networks.ServiceID) (*apis.Client, error)

GetCaminoClient returns the API Client for the node with the given service ID

func (TestCaminoNetwork) RemoveService

func (network TestCaminoNetwork) RemoveService(serviceID networks.ServiceID) error

RemoveService removes the service with the given service ID from the network Args:

serviceID: The ID of the service to remove from the network

type TestCaminoNetworkLoader

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

TestCaminoNetworkLoader implements Kurtosis' NetworkLoader interface that's used for creating the test network of Camino services

func NewTestCaminoNetworkLoader

func NewTestCaminoNetworkLoader(
	isStaking bool,
	bootNodeImage string,
	bootNodeLogLevel caminoService.CaminoLogLevel,
	bootstrapperSnowQuorumSize int,
	bootstrapperSnowSampleSize int,
	txFee uint64,
	networkInitialTimeout time.Duration,
	serviceConfigs map[networks.ConfigurationID]TestCaminoNetworkServiceConfig,
	desiredServiceConfigs map[networks.ServiceID]networks.ConfigurationID) (*TestCaminoNetworkLoader, error)

NewTestCaminoNetworkLoader creates a new loader to create a TestCaminoNetwork with the specified parameters, transparently handling the creation of bootstrapper nodes. NOTE: Bootstrapper nodes will be created automatically, and will show up in the ServiceAvailabilityChecker map that gets returned upon initialization. Args:

isStaking: Whether the network will have staking enabled
bootNodeImage: The Docker image that should be used to launch the boot nodes
bootNodeLogLevel: The log level that the boot nodes will launch with
bootstrapperSnowQuorumSize: The Snow consensus sample size used for nodes in the network
bootstrapperSnowSampleSize: The Snow consensus quorum size used for nodes in the network
serviceConfigs: A mapping of service config ID -> config info that the network will provide to the test for use
desiredServiceConfigs: A map of service_id -> config_id, one per node, that this network will initialize with

func (TestCaminoNetworkLoader) ConfigureNetwork

func (loader TestCaminoNetworkLoader) ConfigureNetwork(builder *networks.ServiceNetworkBuilder) error

ConfigureNetwork defines the netwrok's service configurations to be used

func (TestCaminoNetworkLoader) InitializeNetwork

InitializeNetwork implements networks.NetworkLoader that initializes the Camino test network to the state specified at construction time, spinning up the correct number of bootstrapper nodes and subsequently the user-requested nodes. NOTE: The resulting services.ServiceAvailabilityChecker map will contain more IDs than the user requested as it will

contain boot nodes. The IDs that these boot nodes are an unspecified implementation detail.

func (TestCaminoNetworkLoader) WrapNetwork

func (loader TestCaminoNetworkLoader) WrapNetwork(network *networks.ServiceNetwork) (networks.Network, error)

WrapNetwork implements a networks.NetworkLoader function and wraps the underlying networks.ServiceNetwork with the TestCaminoNetwork

type TestCaminoNetworkServiceConfig

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

TestCaminoNetworkServiceConfig is Camino-specific layer of abstraction atop Kurtosis' service configurations that makes it a bit easier for users to define network service configurations specifically for Camino nodes

func NewTestCaminoNetworkServiceConfig

func NewTestCaminoNetworkServiceConfig(
	varyCerts bool,
	serviceLogLevel caminoService.CaminoLogLevel,
	imageName string,
	snowQuorumSize int,
	snowSampleSize int,
	networkInitialTimeout time.Duration,
	additionalCLIArgs map[string]string) *TestCaminoNetworkServiceConfig

NewTestCaminoNetworkServiceConfig creates a new Camino network service config with the given parameters Args:

varyCerts: True if the Camino services created with this configuration will have differing certs (and therefore
	differing node IDs), or the same cert (used for a test to see how the Camino network behaves with duplicate node
	IDs)
serviceLogLevel: The log level that Camino services started with this configuration will use
imageName: The name of the Docker image that Camino services started with this configuration will use
snowQuroumSize: The Snow protocol quorum size that Camino services started with this configuration will use
snowSampleSize: The Snow protocol sample size that Camino services started with this configuration will use
cliArgs: A key-value mapping of extra CLI args that will be passed to Camino services started with this configuration

Jump to

Keyboard shortcuts

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