runner

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrChainAlreadyExists = errors.New("chain already exists")
)

Functions

This section is empty.

Types

type ChainDetails

type ChainDetails struct {
	RpcUrl    string
	GrpcUrl   string
	EvmRpcUrl string

	ChainId      string
	StakingDenom string
}

ChainDetails wraps information about the properties & endpoints of a chain.

func (ChainDetails) EvmClient

func (c ChainDetails) EvmClient() (*ethclient.Client, error)

EvmClient dials the underlying EVM RPC url and returns an ethclient.

func (ChainDetails) RpcConn added in v0.25.0

func (c ChainDetails) RpcConn() (*rpchttpclient.HTTP, error)

RpcConn creates a new connection to the underlying Rpc url.

type Chains

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

Chains wraps a map of name -> details about how to connect to a chain. It prevents registering multiple chains with the same name & encapsulates panicking if attempting to access a chain that does not exist.

func NewChains

func NewChains() Chains

NewChains creates an empty Chains map.

func (Chains) MustGetChain

func (c Chains) MustGetChain(name string) *ChainDetails

MustGetChain returns the chain of a given name, or panics if a chain with that name has not been registered.

func (*Chains) Register

func (c *Chains) Register(name string, chain *ChainDetails) error

Register adds a chain to the map. It returns an error if a ChainDetails with that name has already been registered.

type KvtoolRunner added in v0.25.0

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

KvtoolRunner implements a NodeRunner that spins up local chains with kvtool. It has support for the following: - running a Kava node - optionally, running an IBC node with a channel opened to the Kava node - optionally, start the Kava node on one version and upgrade to another

func NewKvtoolRunner added in v0.25.0

func NewKvtoolRunner(config KvtoolRunnerConfig) *KvtoolRunner

NewKvtoolRunner creates a new KvtoolRunner.

func (*KvtoolRunner) Shutdown added in v0.25.0

func (k *KvtoolRunner) Shutdown()

Shutdown implements NodeRunner. For KvtoolRunner, it shuts down the local kvtool network. To prevent shutting down the chain (eg. to preserve logs or examine post-test state) use the `SkipShutdown` option on the config.

func (*KvtoolRunner) StartChains added in v0.25.0

func (k *KvtoolRunner) StartChains() Chains

StartChains implements NodeRunner. For KvtoolRunner, it sets up, runs, and connects to a local chain via kvtool.

type KvtoolRunnerConfig added in v0.25.0

type KvtoolRunnerConfig struct {
	KavaConfigTemplate string

	ImageTag   string
	IncludeIBC bool

	EnableAutomatedUpgrade  bool
	KavaUpgradeName         string
	KavaUpgradeHeight       int64
	KavaUpgradeBaseImageTag string

	SkipShutdown bool
}

type LiveNodeRunner added in v0.25.0

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

LiveNodeRunner implements NodeRunner for an already-running chain. If a LiveNodeRunner is used, end-to-end tests are run against a live chain.

func NewLiveNodeRunner added in v0.25.0

func NewLiveNodeRunner(config LiveNodeRunnerConfig) *LiveNodeRunner

NewLiveNodeRunner creates a new LiveNodeRunner.

func (LiveNodeRunner) Shutdown added in v0.25.0

func (LiveNodeRunner) Shutdown()

Shutdown implements NodeRunner. As the chains are externally operated, this is a no-op.

func (LiveNodeRunner) StartChains added in v0.25.0

func (r LiveNodeRunner) StartChains() Chains

StartChains implements NodeRunner. It initializes connections to the chain based on parameters. It attempts to ping the necessary endpoints and panics if they cannot be reached.

type LiveNodeRunnerConfig added in v0.25.0

type LiveNodeRunnerConfig struct {
	KavaRpcUrl    string
	KavaGrpcUrl   string
	KavaEvmRpcUrl string

	UpgradeHeight int64
}

LiveNodeRunnerConfig implements NodeRunner. It connects to a running network via the RPC, GRPC, and EVM urls.

type NodeRunner

type NodeRunner interface {
	StartChains() Chains
	Shutdown()
}

NodeRunner is responsible for starting and managing docker containers to run a node.

Jump to

Keyboard shortcuts

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