coordinator

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AmountOfDummyChains = 2

Functions

This section is empty.

Types

type Coordinator

type Coordinator interface {
	// IncrementTime iterates through all the TestChain's and increments their current header time
	// by 5 seconds.
	IncrementTime()
	// UpdateTime updates all clocks for the TestChains to the current global time.
	UpdateTime()
	// UpdateTimeForChain updates the clock for a specific chain.
	UpdateTimeForChain(chainID string)
	// GetChain returns the TestChain for a given chainID.
	GetChain(chainID string) ibcchain.Chain
	// GetDummyChainsIds returns the chainIDs for all dummy chains.
	GetDummyChainsIds() []string
	// SetDefaultSignerForChain sets the default signer for the chain with the given chainID.
	SetDefaultSignerForChain(chainID string, priv cryptotypes.PrivKey, acc authtypes.AccountI)
	// Setup constructs a TM client, connection, and channel on both chains provided. It will
	// fail if any error occurs. The clientID's, TestConnections, and TestChannels are returned
	// for both chains. The channels created are connected to the ibc-transfer application.
	Setup(src, dst string) IBCConnection
	// CommitNBlocks commits n blocks on the chain with the given chainID.
	CommitNBlocks(chainID string, n uint64) error
	// CommitAll commits 1 blocks on all chains within the coordinator.
	CommitAll() error
}

Coordinator is the interface that defines the methods that are used to coordinate the execution of the IBC relayer.

type Endpoint

type Endpoint struct {
	ChainID      string
	ClientID     string
	ConnectionID string
	ChannelID    string
	PortID       string
}

Endpoint defines the identifiers for a chain's client, connection, and channel.

type IBCConnection

type IBCConnection struct {
	EndpointA Endpoint
	EndpointB Endpoint
}

IBCConnection defines the connection between two chains.

type IntegrationCoordinator

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

IntegrationCoordinator is a testing struct which contains N TestChain's. It handles keeping all chains in sync with regards to time. NOTE: When using the coordinator, it is important to commit blocks through the coordinator and not through the network interface directly. This is because the coordinator does not keep the context in sync with the network interface.

func NewIntegrationCoordinator

func NewIntegrationCoordinator(t *testing.T, preConfiguredChains []network.Network) *IntegrationCoordinator

NewIntegrationCoordinator returns a new IntegrationCoordinator with N TestChain's.

func (*IntegrationCoordinator) CommitAll

func (c *IntegrationCoordinator) CommitAll() error

CommitAll commits n blocks on the chain with the given chainID.

func (*IntegrationCoordinator) CommitNBlocks

func (c *IntegrationCoordinator) CommitNBlocks(chainID string, n uint64) error

CommitNBlocks commits n blocks on the chain with the given chainID.

func (*IntegrationCoordinator) GetChain

func (c *IntegrationCoordinator) GetChain(chainID string) ibcchain.Chain

GetChain returns the TestChain for a given chainID.

func (*IntegrationCoordinator) GetDummyChainsIds

func (c *IntegrationCoordinator) GetDummyChainsIds() []string

GetDummyChainsIds returns the chainIDs for all dummy chains.

func (*IntegrationCoordinator) IncrementTime

func (c *IntegrationCoordinator) IncrementTime()

IncrementTime iterates through all the TestChain's and increments their current header time by 5 seconds.

func (*IntegrationCoordinator) SetDefaultSignerForChain

func (c *IntegrationCoordinator) SetDefaultSignerForChain(chainID string, priv cryptotypes.PrivKey, acc authtypes.AccountI)

SetDefaultSignerForChain sets the default signer for the chain with the given chainID.

func (*IntegrationCoordinator) Setup

Setup constructs a TM client, connection, and channel on both chains provided. It will fail if any error occurs. The clientID's, TestConnections, and TestChannels are returned for both chains. The channels created are connected to the ibc-transfer application.

func (*IntegrationCoordinator) UpdateTime

func (c *IntegrationCoordinator) UpdateTime()

UpdateTime updates all clocks for the TestChains to the current global time.

func (*IntegrationCoordinator) UpdateTimeForChain

func (c *IntegrationCoordinator) UpdateTimeForChain(chainID string)

UpdateTimeForChain updates the clock for a specific chain.

Jump to

Keyboard shortcuts

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