relayer

package
v3.0.0-...-28c6083 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package relayer contains general functionality relevant to individual relayer implementations.

Subpackages under relayer provide implementations of the ibc.Relayer interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FullCapabilities

func FullCapabilities() map[Capability]bool

FullCapabilities returns a mapping of all known relayer features to true, indicating that all features are supported. FullCapabilities returns a new map every time it is called, so callers are free to set one value to false if they support everything but one or two features.

Types

type Capability

type Capability int

Capability indicates a relayer's support of a given feature.

const (
	TimestampTimeout Capability = iota
	HeightTimeout

	// Whether the relayer supports a one-off flush command.
	Flush
)

The list of relayer capabilities that interchaintest understands.

func (Capability) String

func (i Capability) String() string

type DockerRelayer

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

DockerRelayer provides a common base for relayer implementations that run on Docker.

func NewDockerRelayer

func NewDockerRelayer(ctx context.Context, log *zap.Logger, testName string, cli *client.Client, networkID string, c RelayerCommander, options ...RelayerOption) (*DockerRelayer, error)

NewDockerRelayer returns a new DockerRelayer.

func (*DockerRelayer) AddChainConfiguration

func (r *DockerRelayer) AddChainConfiguration(ctx context.Context, rep ibc.RelayerExecReporter, chainConfig ibc.ChainConfig, keyName, rpcAddr, grpcAddr string) error

func (*DockerRelayer) AddKey

func (r *DockerRelayer) AddKey(ctx context.Context, rep ibc.RelayerExecReporter, chainID, keyName, coinType string) (ibc.Wallet, error)

func (*DockerRelayer) AddWallet

func (r *DockerRelayer) AddWallet(chainID string, wallet ibc.Wallet)

AddWallet adds a stores a wallet for the given chain ID.

func (*DockerRelayer) Bind

func (r *DockerRelayer) Bind() []string

Bind returns the home folder bind point for running the node.

func (*DockerRelayer) CreateChannel

func (r *DockerRelayer) CreateChannel(ctx context.Context, rep ibc.RelayerExecReporter, pathName string, opts ibc.CreateChannelOptions) error

func (*DockerRelayer) CreateClients

func (r *DockerRelayer) CreateClients(ctx context.Context, rep ibc.RelayerExecReporter, pathName string, opts ibc.CreateClientOptions) error

func (*DockerRelayer) CreateConnections

func (r *DockerRelayer) CreateConnections(ctx context.Context, rep ibc.RelayerExecReporter, pathName string) error

func (*DockerRelayer) Exec

func (*DockerRelayer) Flush

func (r *DockerRelayer) Flush(ctx context.Context, rep ibc.RelayerExecReporter, pathName, channelID string) error

func (*DockerRelayer) GeneratePath

func (r *DockerRelayer) GeneratePath(ctx context.Context, rep ibc.RelayerExecReporter, srcChainID, dstChainID, pathName string) error

func (*DockerRelayer) GetChannels

func (r *DockerRelayer) GetChannels(ctx context.Context, rep ibc.RelayerExecReporter, chainID string) ([]ibc.ChannelOutput, error)

func (*DockerRelayer) GetClients

func (r *DockerRelayer) GetClients(ctx context.Context, rep ibc.RelayerExecReporter, chainID string) (ibc.ClientOutputs, error)

func (*DockerRelayer) GetConnections

func (r *DockerRelayer) GetConnections(ctx context.Context, rep ibc.RelayerExecReporter, chainID string) (ibc.ConnectionOutputs, error)

func (*DockerRelayer) GetWallet

func (r *DockerRelayer) GetWallet(chainID string) (ibc.Wallet, bool)

func (*DockerRelayer) HomeDir

func (r *DockerRelayer) HomeDir() string

HomeDir returns the home directory of the relayer on the underlying Docker container's filesystem.

func (*DockerRelayer) HostName

func (r *DockerRelayer) HostName(pathName string) string

func (*DockerRelayer) LinkPath

func (r *DockerRelayer) LinkPath(ctx context.Context, rep ibc.RelayerExecReporter, pathName string, channelOpts ibc.CreateChannelOptions, clientOpts ibc.CreateClientOptions) error

func (*DockerRelayer) ModifyTomlConfigFile

func (r *DockerRelayer) ModifyTomlConfigFile(ctx context.Context, relativePath string, modification testutil.Toml) error

Modify a toml config file in relayer home directory

func (*DockerRelayer) Name

func (r *DockerRelayer) Name() string

func (*DockerRelayer) ReadFileFromHomeDir

func (r *DockerRelayer) ReadFileFromHomeDir(ctx context.Context, relativePath string) ([]byte, error)

ReadFileFromHomeDir reads a file at the relative path specified and returns the contents. The file is relative to the home directory in the relayer container.

func (*DockerRelayer) RestoreKey

func (r *DockerRelayer) RestoreKey(ctx context.Context, rep ibc.RelayerExecReporter, cfg ibc.ChainConfig, keyName, mnemonic string) error

func (*DockerRelayer) SetClientContractHash

func (r *DockerRelayer) SetClientContractHash(ctx context.Context, rep ibc.RelayerExecReporter, cfg ibc.ChainConfig, hash string) error

func (*DockerRelayer) StartRelayer

func (r *DockerRelayer) StartRelayer(ctx context.Context, rep ibc.RelayerExecReporter, pathNames ...string) error

func (*DockerRelayer) StopRelayer

func (r *DockerRelayer) StopRelayer(ctx context.Context, rep ibc.RelayerExecReporter) error

func (*DockerRelayer) UpdateClients

func (r *DockerRelayer) UpdateClients(ctx context.Context, rep ibc.RelayerExecReporter, pathName string) error

func (*DockerRelayer) UpdatePath

func (r *DockerRelayer) UpdatePath(ctx context.Context, rep ibc.RelayerExecReporter, pathName string, filter ibc.ChannelFilter) error

func (*DockerRelayer) UseDockerNetwork

func (r *DockerRelayer) UseDockerNetwork() bool

func (*DockerRelayer) WriteFileToHomeDir

func (r *DockerRelayer) WriteFileToHomeDir(ctx context.Context, relativePath string, contents []byte) error

WriteFileToHomeDir writes the given contents to a file at the relative path specified. The file is relative to the home directory in the relayer container.

type RelayerCommander

type RelayerCommander interface {
	// Name is the name of the relayer, e.g. "rly" or "hermes".
	Name() string

	DefaultContainerImage() string
	DefaultContainerVersion() string

	// The Docker user to use in created container.
	// For interchaintest, must be of the format: uid:gid.
	DockerUser() string

	// ConfigContent generates the content of the config file that will be passed to AddChainConfiguration.
	ConfigContent(ctx context.Context, cfg ibc.ChainConfig, keyName, rpcAddr, grpcAddr string) ([]byte, error)

	// ParseAddKeyOutput processes the output of AddKey
	// to produce the wallet that was created.
	ParseAddKeyOutput(stdout, stderr string) (ibc.Wallet, error)

	// ParseRestoreKeyOutput extracts the address from the output of RestoreKey.
	ParseRestoreKeyOutput(stdout, stderr string) string

	// ParseGetChannelsOutput processes the output of GetChannels
	// to produce the channel output values.
	ParseGetChannelsOutput(stdout, stderr string) ([]ibc.ChannelOutput, error)

	// ParseGetConnectionsOutput processes the output of GetConnections
	// to produce the connection output values.
	ParseGetConnectionsOutput(stdout, stderr string) (ibc.ConnectionOutputs, error)

	// ParseGetClientsOutput processes the output of GetClients
	// to produce the client output values.
	ParseGetClientsOutput(stdout, stderr string) (ibc.ClientOutputs, error)

	// Init is the command to run on the first call to AddChainConfiguration.
	// If the returned command is nil or empty, nothing will be executed.
	Init(homeDir string) []string

	AddChainConfiguration(containerFilePath, homeDir string) []string
	AddKey(chainID, keyName, coinType, homeDir string) []string
	CreateChannel(pathName string, opts ibc.CreateChannelOptions, homeDir string) []string
	CreateClients(pathName string, opts ibc.CreateClientOptions, homeDir string) []string
	CreateConnections(pathName, homeDir string) []string
	Flush(pathName, channelID, homeDir string) []string
	GeneratePath(srcChainID, dstChainID, pathName, homeDir string) []string
	UpdatePath(pathName, homeDir string, filter ibc.ChannelFilter) []string
	GetChannels(chainID, homeDir string) []string
	GetConnections(chainID, homeDir string) []string
	GetClients(chainID, homeDir string) []string
	LinkPath(pathName, homeDir string, channelOpts ibc.CreateChannelOptions, clientOpts ibc.CreateClientOptions) []string
	RestoreKey(chainID, keyName, coinType, mnemonic, homeDir string) []string
	StartRelayer(homeDir string, pathNames ...string) []string
	UpdateClients(pathName, homeDir string) []string
	CreateWallet(keyName, address, mnemonic string) ibc.Wallet
}

type RelayerOption

type RelayerOption interface {
	// contains filtered or unexported methods
}

RelayerOption is used to customize the relayer configuration, whether constructed with the RelayerFactory or with the more specific NewDockerRelayer or NewCosmosRelayer methods.

func CustomDockerImage

func CustomDockerImage(repository string, version string, uidGid string) RelayerOption

CustomDockerImage overrides the default relayer docker image. uidGid is the uid:gid format owner that should be used within the container. If uidGid is empty, root user will be assumed.

func HomeDir

func HomeDir(homeDir string) RelayerOption

func ImagePull

func ImagePull(pull bool) RelayerOption

func StartupFlags

func StartupFlags(flags ...string) RelayerOption

StartupFlags appends additional flags when starting the relayer.

type RelayerOptionDockerImage

type RelayerOptionDockerImage struct {
	DockerImage ibc.DockerImage
}

type RelayerOptionExtraStartFlags

type RelayerOptionExtraStartFlags struct {
	Flags []string
}

type RelayerOptionHomeDir

type RelayerOptionHomeDir struct {
	HomeDir string
}

RelayerOptionHomeDir allows the configuration of the relayer home directory.

type RelayerOptionImagePull

type RelayerOptionImagePull struct {
	Pull bool
}

type RelayerOptions

type RelayerOptions []RelayerOption

Directories

Path Synopsis
Package rly provides an interface to the cosmos relayer running in a Docker container.
Package rly provides an interface to the cosmos relayer running in a Docker container.

Jump to

Keyboard shortcuts

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