Documentation ¶
Index ¶
- Constants
- func GetChainID(index int) string
- type ChannelConfig
- type ClientConfig
- type ConnectionConfig
- type Coordinator
- func (coord *Coordinator) CreateChannels(ctx context.Context, path *Path)
- func (coord *Coordinator) CreateConnections(ctx context.Context, path *Path)
- func (coord Coordinator) GetChain(chainID string) types.TestChainI
- func (coord *Coordinator) Setup(ctx context.Context, path *Path)
- func (coord *Coordinator) SetupClients(ctx context.Context, path *Path)
- func (coord *Coordinator) SetupConnections(ctx context.Context, path *Path)
- type Endpoint
- func (endpoint *Endpoint) AcknowledgePacket(ctx context.Context, packet exported.PacketI, ack []byte) error
- func (endpoint *Endpoint) ChanOpenAck(ctx context.Context) error
- func (endpoint *Endpoint) ChanOpenConfirm(ctx context.Context) error
- func (endpoint *Endpoint) ChanOpenInit(ctx context.Context) error
- func (endpoint *Endpoint) ChanOpenTry(ctx context.Context) error
- func (endpoint *Endpoint) ConnOpenAck(ctx context.Context) error
- func (endpoint *Endpoint) ConnOpenConfirm(ctx context.Context) error
- func (endpoint *Endpoint) ConnOpenInit(ctx context.Context) error
- func (endpoint *Endpoint) ConnOpenTry(ctx context.Context) error
- func (endpoint *Endpoint) CreateClient(ctx context.Context) (err error)
- func (endpoint *Endpoint) QueryAcknowledgePacketProof(packet exported.PacketI, ack []byte) *ibctestingtypes.Proof
- func (endpoint *Endpoint) QueryChannelProof() (*ibctestingtypes.Proof, error)
- func (endpoint *Endpoint) QueryClientProof() ([]byte, *ibctestingtypes.Proof)
- func (endpoint *Endpoint) QueryConnectionHandshakeProof() (clientState []byte, proofClient *ibctestingtypes.Proof, ...)
- func (endpoint *Endpoint) QueryConnectionProof(height exported.Height) (*ibctestingtypes.Proof, error)
- func (endpoint *Endpoint) QueryConsensusProof(consensusHeight exported.Height, proofHeight exported.Height) *ibctestingtypes.Proof
- func (endpoint *Endpoint) QueryPacketProof(packet exported.PacketI) (*ibctestingtypes.Proof, error)
- func (endpoint *Endpoint) QueryProof(key []byte) *ibctestingtypes.Proof
- func (endpoint *Endpoint) QueryProofAtHeight(key []byte, height exported.Height) *ibctestingtypes.Proof
- func (endpoint *Endpoint) RecvPacket(ctx context.Context, packet exported.PacketI) error
- func (endpoint *Endpoint) UpdateClient(ctx context.Context) (err error)
- type MockConfig
- type Path
- type TendermintConfig
- type TrustedEthereumConfig
Constants ¶
const ChainIDPrefix = "testchain"
Variables ¶
This section is empty.
Functions ¶
func GetChainID ¶
GetChainID returns the chainID used for the provided index.
Types ¶
type ChannelConfig ¶
type ChannelConfig struct { PortID string Version string Order types.ChannelOrder }
func NewChannelConfig ¶
func NewChannelConfig() *ChannelConfig
type ClientConfig ¶
type ClientConfig interface {
GetClientType() string
}
type ConnectionConfig ¶
type ConnectionConfig struct { DelayPeriod uint64 Version *connectiontypes.Version }
func NewConnectionConfig ¶
func NewConnectionConfig() *ConnectionConfig
type Coordinator ¶
type Coordinator struct { Chains map[string]types.TestChainI // contains filtered or unexported fields }
func NewCoordinator ¶
func NewCoordinator(t *testing.T, chains ...types.TestChainI) *Coordinator
func (*Coordinator) CreateChannels ¶
func (coord *Coordinator) CreateChannels(ctx context.Context, path *Path)
CreateChannels constructs and executes channel handshake messages in order to create OPEN channels on chainA and chainB. The function expects the channels to be successfully opened otherwise testing will fail.
func (*Coordinator) CreateConnections ¶
func (coord *Coordinator) CreateConnections(ctx context.Context, path *Path)
CreateConnections constructs and executes connection handshake messages in order to create OPEN channels on chainA and chainB. The connection information of for chainA and chainB are returned within a TestConnection struct. The function expects the connections to be successfully opened otherwise testing will fail.
func (Coordinator) GetChain ¶
func (coord Coordinator) GetChain(chainID string) types.TestChainI
func (*Coordinator) Setup ¶
func (coord *Coordinator) Setup(ctx context.Context, path *Path)
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 (*Coordinator) SetupClients ¶
func (coord *Coordinator) SetupClients(ctx context.Context, path *Path)
SetupClients is a helper function to create clients on both Chains. It assumes the caller does not anticipate any errors.
func (*Coordinator) SetupConnections ¶
func (coord *Coordinator) SetupConnections(ctx context.Context, path *Path)
SetupClientConnections is a helper function to create clients and the appropriate connections on both the source and counterparty chain. It assumes the caller does not anticipate any errors.
type Endpoint ¶
type Endpoint struct { Chain ibctestingtypes.TestChainI Counterparty *Endpoint ClientID string ConnectionID string ChannelID string ClientConfig ClientConfig ConnectionConfig *ConnectionConfig ChannelConfig *ChannelConfig }
Endpoint is a which represents a channel endpoint and its associated client and connections. It contains client, connection, and channel configuration parameters. Endpoint functions will utilize the parameters set in the configuration structs when executing IBC messages.
func NewDefaultEndpoint ¶
func NewDefaultEndpoint(chain ibctestingtypes.TestChainI) *Endpoint
NewDefaultEndpoint constructs a new endpoint using default values. CONTRACT: the counterparty endpoint must be set by the caller.
func NewEndpoint ¶
func NewEndpoint( chain *ethereum.TestChain, clientConfig ClientConfig, connectionConfig *ConnectionConfig, channelConfig *ChannelConfig, ) *Endpoint
NewEndpoint constructs a new endpoint without the counterparty. CONTRACT: the counterparty endpoint must be set by the caller.
func (*Endpoint) AcknowledgePacket ¶
func (endpoint *Endpoint) AcknowledgePacket(ctx context.Context, packet exported.PacketI, ack []byte) error
AcknowledgePacket sends a MsgAcknowledgement to the channel associated with the endpoint.
func (*Endpoint) ChanOpenAck ¶
ChanOpenAck will construct and execute a MsgChannelOpenAck on the associated endpoint.
func (*Endpoint) ChanOpenConfirm ¶
ChanOpenConfirm will construct and execute a MsgChannelOpenConfirm on the associated endpoint.
func (*Endpoint) ChanOpenInit ¶
ChanOpenInit will construct and execute a MsgChannelOpenInit on the associated endpoint.
func (*Endpoint) ChanOpenTry ¶
ChanOpenTry will construct and execute a MsgChannelOpenTry on the associated endpoint.
func (*Endpoint) ConnOpenAck ¶
ConnOpenAck will construct and execute a MsgConnectionOpenAck on the associated endpoint.
func (*Endpoint) ConnOpenConfirm ¶
ConnOpenConfirm will construct and execute a MsgConnectionOpenConfirm on the associated endpoint.
func (*Endpoint) ConnOpenInit ¶
ConnOpenInit will construct and execute a MsgConnectionOpenInit on the associated endpoint.
func (*Endpoint) ConnOpenTry ¶
ConnOpenTry will construct and execute a MsgConnectionOpenTry on the associated endpoint.
func (*Endpoint) CreateClient ¶
CreateClient creates an IBC client on the endpoint. It will update the clientID for the endpoint if the message is successfully executed. NOTE: a solo machine client will be created with an empty diversifier.
func (*Endpoint) QueryAcknowledgePacketProof ¶
func (*Endpoint) QueryChannelProof ¶
func (endpoint *Endpoint) QueryChannelProof() (*ibctestingtypes.Proof, error)
func (*Endpoint) QueryClientProof ¶
func (endpoint *Endpoint) QueryClientProof() ([]byte, *ibctestingtypes.Proof)
func (*Endpoint) QueryConnectionHandshakeProof ¶
func (endpoint *Endpoint) QueryConnectionHandshakeProof() ( clientState []byte, proofClient *ibctestingtypes.Proof, proofConsensus *ibctestingtypes.Proof, consensusHeight exported.Height, proofConnection *ibctestingtypes.Proof, )
QueryConnectionHandshakeProof returns all the proofs necessary to execute OpenTry or Open Ack of the connection handshakes. It returns the counterparty client state, proof of the counterparty client state, proof of the counterparty consensus state, the consensus state height, proof of the counterparty connection, and the proof height for all the proofs returned.
func (*Endpoint) QueryConnectionProof ¶
func (*Endpoint) QueryConsensusProof ¶
func (*Endpoint) QueryPacketProof ¶
func (*Endpoint) QueryProof ¶
func (endpoint *Endpoint) QueryProof(key []byte) *ibctestingtypes.Proof
QueryProof queries proof associated with this endpoint using the lastest client state height on the counterparty chain.
func (*Endpoint) QueryProofAtHeight ¶
func (endpoint *Endpoint) QueryProofAtHeight(key []byte, height exported.Height) *ibctestingtypes.Proof
QueryProofAtHeight queries proof associated with this endpoint using the proof height providied
func (*Endpoint) RecvPacket ¶
RecvPacket receives a packet on the associated endpoint. The counterparty client is updated.
type MockConfig ¶
type MockConfig struct { }
func NewMockConfig ¶
func NewMockConfig() *MockConfig
func (*MockConfig) GetClientType ¶
func (cfg *MockConfig) GetClientType() string
type Path ¶
Path contains two endpoints representing two Chains connected over IBC
func NewPath ¶
func NewPath(chainA, chainB types.TestChainI) *Path
NewPath constructs an endpoint for each chain using the default values for the endpoints. Each endpoint is updated to have a pointer to the counterparty endpoint.
type TendermintConfig ¶
type TendermintConfig struct { TrustLevel ibctmtypes.Fraction TrustingPeriod time.Duration UnbondingPeriod time.Duration MaxClockDrift time.Duration AllowUpdateAfterExpiry bool AllowUpdateAfterMisbehaviour bool }
func NewTendermintConfig ¶
func NewTendermintConfig() *TendermintConfig
func (*TendermintConfig) GetClientType ¶
func (tmcfg *TendermintConfig) GetClientType() string
type TrustedEthereumConfig ¶
func NewTrustedEthereumConfig ¶
func NewTrustedEthereumConfig(diversifier string) *TrustedEthereumConfig
func (*TrustedEthereumConfig) GetClientType ¶
func (cfg *TrustedEthereumConfig) GetClientType() string