Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChainConfig ¶
type ChainConfig struct {
// Chain type, e.g. cosmos.
Type string `yaml:"type"`
// Chain name, e.g. cosmoshub.
Name string `yaml:"name"`
// Chain ID, e.g. cosmoshub-4
ChainID string `yaml:"chain-id"`
// Docker images required for running chain nodes.
Images []DockerImage `yaml:"images"`
// Binary to execute for the chain node daemon.
Bin string `yaml:"bin"`
// Bech32 prefix for chain addresses, e.g. cosmos.
Bech32Prefix string `yaml:"bech32-prefix"`
// Denomination of native currency, e.g. uatom.
Denom string `yaml:"denom"`
// Coin type
CoinType string `default:"118" yaml:"coin-type"`
// Minimum gas prices for sending transactions, in native currency denom.
GasPrices string `yaml:"gas-prices"`
// Adjustment multiplier for gas fees.
GasAdjustment float64 `yaml:"gas-adjustment"`
// Trusting period of the chain.
TrustingPeriod string `yaml:"trusting-period"`
// Do not use docker host mount.
NoHostMount bool `yaml:"no-host-mount"`
// When true, will skip validator gentx flow
SkipGenTx bool
// When provided, will run before performing gentx and genesis file creation steps for validators.
PreGenesis func(ChainConfig) error
// When provided, genesis file contents will be altered before sharing for genesis.
ModifyGenesis func(ChainConfig, []byte) ([]byte, error)
// Override config parameters for files at filepath.
ConfigFileOverrides map[string]any
}
ChainConfig defines the chain parameters requires to run an interchaintest testnet for a chain.
type DockerImage ¶
type DockerImage struct {
Repository string `yaml:"repository"`
Version string `yaml:"version"`
UidGid string `yaml:"uid-gid"`
}
func (DockerImage) Ref ¶
func (i DockerImage) Ref() string
Ref returns the reference to use when e.g. creating a container.
type NopRelayerExecReporter ¶
type NopRelayerExecReporter struct{}
NopRelayerExecReporter is a no-op RelayerExecReporter.
type Relayer ¶
type Relayer interface {
// restore a mnemonic to be used as a relayer wallet for a chain
RestoreKey(ctx context.Context, rep RelayerExecReporter, cfg ChainConfig, keyName, mnemonic string) error
// GetWallet returns a Wallet for that relayer on the given chain and a boolean indicating if it was found.
GetWallet(chainID string) (Wallet, bool)
// After configuration is initialized, begin relaying.
// This method is intended to create a background worker that runs the relayer.
// You must call StopRelayer to cleanly stop the relaying.
StartRelayer(ctx context.Context, rep RelayerExecReporter, environ []string) error
// StopRelayer stops a relayer that started work through StartRelayer.
StopRelayer(ctx context.Context, rep RelayerExecReporter) error
// Exec runs an arbitrary relayer command.
// If the Relayer implementation runs in Docker,
// whether the invoked command is run in a one-off container or execing into an already running container
// is an implementation detail.
//
// "env" are environment variables in the format "MY_ENV_VAR=value"
Exec(ctx context.Context, rep RelayerExecReporter, cmd []string, env []string) RelayerExecResult
ExecBin(ctx context.Context, rep RelayerExecReporter, command string, params ...interface{}) RelayerExecResult
HomeDir() string
RestartRelayerContainer(context.Context) error
StopRelayerContainer(context.Context, RelayerExecReporter) error
WriteBlockHeight(context.Context, string, uint64) error
GetKeystore(chain string, wallet Wallet) ([]byte, error)
RestoreKeystore(ctx context.Context, keyJSON []byte, chainID string, name string) error
CreateConfig(ctx context.Context, configYAML []byte) error
}
type RelayerConfig ¶
type RelayerExecReporter ¶
type RelayerExecReporter interface {
TrackRelayerExec(
containerName string,
command []string,
stdout, stderr string,
exitCode int,
startedAt, finishedAt time.Time,
err error,
)
}
ExecReporter is the interface of a narrow type returned by testreporter.RelayerExecReporter. This avoids a direct dependency on the testreporter package, and it avoids the relayer needing to be aware of a *testing.T.
type RelayerExecResult ¶
type RelayerExecResult struct {
// Err is only set when there is a failure to execute.
// A successful execution that exits non-zero will have a nil Err
// and an appropriate ExitCode.
Err error
ExitCode int
Stdout, Stderr []byte
}
RelyaerExecResult holds the details of a call to Relayer.Exec.
type RelayerMap ¶
RelayerMap is a mapping from test names to a relayer set for that test.
func (RelayerMap) AddRelayer ¶
func (r RelayerMap) AddRelayer(testName string, relayer Relayer, chainID string)
AddRelayer adds the given relayer to the relayer set for the given test name.
func (RelayerMap) ContainsRelayer ¶
func (r RelayerMap) ContainsRelayer(testName string, wallet Wallet) bool
containsRelayer returns true if the given relayer is in the relayer set for the given test name.