e2e

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cleanup

func Cleanup(_ context.Context, testnet *Testnet) error

Cleanup removes the Docker Compose containers and testnet directory.

func GetHeights

func GetHeights(ctx context.Context, testnet *Testnet) ([]int64, error)

GetHeights loops through all running nodes and returns an array of heights in order of highest to lowest.

func InitNode

func InitNode(node *Node, genesis types.GenesisDoc, rootDir string) error

func MakeAppConfig

func MakeAppConfig(_ *Node) (*serverconfig.Config, error)

func MakeConfig

func MakeConfig(node *Node) (*config.Config, error)

func MakeGenesis

func MakeGenesis(testnet *Testnet) (types.GenesisDoc, error)

func Setup

func Setup(ctx context.Context, testnet *Testnet) error

func SetupImages

func SetupImages(ctx context.Context, testnet *Testnet) error

SetupImages ensures that all the requisite docker images for each used celestia consensus version.

func Start

func Start(ctx context.Context, testnet *Testnet) error

Start commences the testnet.

func Stop

func Stop(_ context.Context, testnet *Testnet) error

Stop stops the currently running network

func WaitForHeight

func WaitForHeight(ctx context.Context, testnet *Testnet, height int64) error

WaitForHeight waits until the first node reaches the height specified. If no progress is made within a 20 second window then the function times out with an error.

func WaitForNBlocks

func WaitForNBlocks(ctx context.Context, testnet *Testnet, blocks int64) error

WaitForNBlocks queries the current latest height and waits until the network progresses to "blocks" blocks ahead.

func WriteAddressBook

func WriteAddressBook(peers []string, file string) error

func WriteDockerCompose

func WriteDockerCompose(testnet *Testnet, file string) error

Types

type Account

type Account struct {
	Name   string
	Tokens int64
	Key    crypto.PrivKey
}

func (Account) Validate

func (a Account) Validate() error

type Manifest

type Manifest struct {
	Nodes    map[string]*ManifestNode    `toml:"node"`
	Accounts map[string]*ManifestAccount `toml:"account"`
}

func LoadManifest

func LoadManifest(file string) (Manifest, error)

LoadManifest loads a testnet manifest from a file.

func (Manifest) Save

func (m Manifest) Save(file string) error

Save saves the testnet manifest to a file.

type ManifestAccount

type ManifestAccount struct {
	// Tokens symbolizes the genesis supply of liquid tokens to that account
	Tokens int64 `toml:"tokens"`

	// The key type to derive the account key from. Defaults to secp256k1
	KeyType string `toml:"key_type"`
}

ManifestAccounts represent SDK accounts that sign and submit transactions. If the account has the same name as the node it is the operator address for the validator. Unless specified it will have a default self delegation All accounts specfied are created at genesis.

type ManifestNode

type ManifestNode struct {
	// Versions is an array of binary versions that the node
	// will run in it's lifetime. A series of upgrades can be
	// triggered by the upgrade command or will happen automatically
	// across a testnet.
	//
	// Version strings are used to pull  docker images from ghcr.io.
	// Alternatively, use "current", if you want to use the binary
	// based on the current branch. You must have the image built by
	// running "make docker". Default set to "current"
	Versions []string `toml:"versions"`

	// The height that the node will start at
	StartHeight int64 `toml:"start_height"`

	// Peers are the set of peers that initially populate the address
	// book. Persistent peers and seeds are currently not supported
	// By default all nodes declared in the manifest are included
	Peers []string `toml:"peers"`

	// SelfDelegation is the delegation of the validator when they
	// first come up. If set to 0, the node is not considered a validator
	SelfDelegation int64 `toml:"self_delegation"`
}

type Node

type Node struct {
	Name           string
	Versions       []string
	StartHeight    int64
	Peers          []string
	SignerKey      crypto.PrivKey
	NetworkKey     crypto.PrivKey
	AccountKey     crypto.PrivKey
	IP             net.IP
	ProxyPort      uint32
	SelfDelegation int64
}

func (Node) AddressP2P

func (n Node) AddressP2P(withID bool) string

Address returns a P2P endpoint address for the node.

func (Node) AddressRPC

func (n Node) AddressRPC() string

Address returns an RPC endpoint address for the node.

func (Node) Client

func (n Node) Client() (*http.HTTP, error)

func (Node) IsValidator

func (n Node) IsValidator() bool

func (Node) Validate

func (n Node) Validate() error

type Testnet

type Testnet struct {
	Name     string // also used as the chain-id
	Dir      string
	IP       *net.IPNet
	Nodes    map[string]*Node
	Accounts map[string]*Account
}

func LoadTestnet

func LoadTestnet(manifest Manifest, file string) (*Testnet, error)

func (*Testnet) GetAllVersions

func (t *Testnet) GetAllVersions() []string

func (*Testnet) NodesByStartHeight

func (t *Testnet) NodesByStartHeight() []*Node

func (*Testnet) Validate

func (t *Testnet) Validate() (err error)

Jump to

Keyboard shortcuts

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