relayer

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 19 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) 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) CreateConfig

func (r *DockerRelayer) CreateConfig(ctx context.Context, configYAML []byte) error

func (*DockerRelayer) Exec

func (*DockerRelayer) ExecBin

func (r *DockerRelayer) ExecBin(ctx context.Context, rep ibc.RelayerExecReporter, command string, params ...interface{}) ibc.RelayerExecResult

func (*DockerRelayer) Flush

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

func (*DockerRelayer) GetKeystore

func (r *DockerRelayer) GetKeystore(chain string, wallet ibc.Wallet) ([]byte, 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) 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) RestartRelayerContainer

func (r *DockerRelayer) RestartRelayerContainer(ctx context.Context) error

RestartRelayer restarts the relayer with the same paths as before.

func (*DockerRelayer) RestoreKey

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

func (*DockerRelayer) RestoreKeystore

func (r *DockerRelayer) RestoreKeystore(ctx context.Context, keyJSON []byte, chainID string, name 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) error

func (*DockerRelayer) StopRelayer

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

func (*DockerRelayer) StopRelayerContainer

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

RestartRelayer restarts the relayer with the same paths as before.

func (*DockerRelayer) UseDockerNetwork

func (r *DockerRelayer) UseDockerNetwork() bool

func (*DockerRelayer) WriteBlockHeight

func (r *DockerRelayer) WriteBlockHeight(ctx context.Context, chainID string, height uint64) error

WriteBlockHeight writes the block height to the relayer's home directory.

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

	// 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

	// 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

	// The remaining methods produce the command to run inside the container.
	Flush(pathName, channelID, homeDir string) []string
	RestoreKey(chainID, keyName, coinType, mnemonic, homeDir string) []string
	StartRelayer(homeDir string, pathNames ...string) []string
	CreateWallet(keyName, address, mnemonic string) ibc.Wallet

	RelayerCommand(command string, params ...interface{}) []string
}

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