Documentation
¶
Index ¶
- Constants
- Variables
- func CommitBlock(chain *ibcgotesting.TestChain, res *abci.ResponseFinalizeBlock)
- func CreateChannels(coord *ibctesting.Coordinator, path *Path)
- func CreateConnections(coord *ibctesting.Coordinator, path *Path)
- func SendMsgs(chain *ibcgotesting.TestChain, feeAmt int64, msgs ...sdk.Msg) (*abci.ExecTxResult, error)
- func SetBech32Prefix(prefix string)
- func SetupClients(coord *ibctesting.Coordinator, path *Path)
- func SetupConnections(coord *ibctesting.Coordinator, path *Path)
- func SetupPath(coord *ibctesting.Coordinator, path *Path)
- func SignAndDeliver(tb testing.TB, ctx context.Context, txCfg client.TxConfig, ...) (*abci.ResponseFinalizeBlock, error)
- func VoteAndCheckProposalStatus(endpoint *Endpoint, proposalID uint64) error
- type Endpoint
- func (endpoint *Endpoint) AcknowledgePacket(packet channeltypes.Packet, ack []byte) error
- func (endpoint *Endpoint) ChanCloseInit() error
- func (endpoint *Endpoint) ChanOpenAck() error
- func (endpoint *Endpoint) ChanOpenConfirm() error
- func (endpoint *Endpoint) ChanOpenInit() error
- func (endpoint *Endpoint) ChanOpenTry() error
- func (endpoint *Endpoint) ChanUpgradeAck() error
- func (endpoint *Endpoint) ChanUpgradeCancel() error
- func (endpoint *Endpoint) ChanUpgradeConfirm() error
- func (endpoint *Endpoint) ChanUpgradeInit() error
- func (endpoint *Endpoint) ChanUpgradeOpen() error
- func (endpoint *Endpoint) ChanUpgradeTimeout() error
- func (endpoint *Endpoint) ChanUpgradeTry() error
- func (endpoint *Endpoint) ConnOpenAck() error
- func (endpoint *Endpoint) ConnOpenConfirm() error
- func (endpoint *Endpoint) ConnOpenInit() error
- func (endpoint *Endpoint) ConnOpenTry() error
- func (endpoint *Endpoint) CreateClient() (err error)
- func (endpoint *Endpoint) GetChannel() channeltypes.Channel
- func (endpoint *Endpoint) GetChannelUpgrade() channeltypes.Upgrade
- func (endpoint *Endpoint) GetClientState() exported.ClientState
- func (endpoint *Endpoint) GetConnection() connectiontypes.ConnectionEnd
- func (endpoint *Endpoint) GetConsensusState(height exported.Height) exported.ConsensusState
- func (endpoint *Endpoint) GetProposedUpgrade() channeltypes.Upgrade
- func (endpoint *Endpoint) QueryChannelUpgradeProof() ([]byte, []byte, clienttypes.Height)
- func (endpoint *Endpoint) QueryClientStateProof() (exported.ClientState, []byte)
- func (endpoint *Endpoint) QueryConnectionHandshakeProof() (clientState exported.ClientState, clientProof, consensusProof []byte, ...)
- func (endpoint *Endpoint) QueryProof(key []byte) ([]byte, clienttypes.Height)
- func (endpoint *Endpoint) QueryProofAtHeight(key []byte, height uint64) ([]byte, clienttypes.Height)
- func (endpoint *Endpoint) RecvPacket(packet channeltypes.Packet) error
- func (endpoint *Endpoint) RecvPacketWithResult(packet channeltypes.Packet) (*abci.ExecTxResult, error)
- func (endpoint *Endpoint) SendPacket(timeoutHeight clienttypes.Height, timeoutTimestamp uint64, data []byte) (uint64, error)
- func (endpoint *Endpoint) SetChannel(channel channeltypes.Channel)
- func (endpoint *Endpoint) SetChannelCounterpartyUpgrade(upgrade channeltypes.Upgrade)
- func (endpoint *Endpoint) SetChannelState(state channeltypes.State) error
- func (endpoint *Endpoint) SetChannelUpgrade(upgrade channeltypes.Upgrade)
- func (endpoint *Endpoint) SetClientState(clientState exported.ClientState)
- func (endpoint *Endpoint) SetConnection(connection connectiontypes.ConnectionEnd)
- func (endpoint *Endpoint) SetConsensusState(consensusState exported.ConsensusState, height exported.Height)
- func (endpoint *Endpoint) TimeoutOnClose(packet channeltypes.Packet) error
- func (endpoint *Endpoint) TimeoutPacket(packet channeltypes.Packet) error
- func (endpoint *Endpoint) UpdateClient() (err error)
- func (endpoint *Endpoint) UpgradeChain() error
- func (endpoint *Endpoint) WriteAcknowledgement(ack exported.Acknowledgement, packet exported.PacketI) error
- type Path
Constants ¶
const DefaultFeeAmt = int64(150_000_000_000_000_000) // 0.15 ISLM
Variables ¶
var ChainIDPrefix = "haqq_"
ChainIDPrefix defines the default chain ID prefix for Haqq Network test chains
Functions ¶
func CommitBlock ¶ added in v1.9.0
func CommitBlock(chain *ibcgotesting.TestChain, res *abci.ResponseFinalizeBlock)
func CreateChannels ¶
func CreateChannels(coord *ibctesting.Coordinator, 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 CreateConnections ¶
func CreateConnections(coord *ibctesting.Coordinator, 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 SendMsgs ¶
func SendMsgs(chain *ibcgotesting.TestChain, feeAmt int64, msgs ...sdk.Msg) (*abci.ExecTxResult, error)
SendMsgs delivers a transaction through the application. It updates the senders sequence number and updates the TestChain's headers. It returns the result and error if one occurred.
func SetBech32Prefix ¶ added in v1.9.0
func SetBech32Prefix(prefix string)
SetBech32Prefix reset bech32 prefix
func SetupClients ¶
func SetupClients(coord *ibctesting.Coordinator, path *Path)
SetupClients is a helper function to create clients on both chains. It assumes the caller does not anticipate any errors.
func SetupConnections ¶
func SetupConnections(coord *ibctesting.Coordinator, path *Path)
SetupConnections 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.
func SetupPath ¶
func SetupPath(coord *ibctesting.Coordinator, path *Path)
SetupPath 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 SignAndDeliver ¶
func SignAndDeliver( tb testing.TB, ctx context.Context, txCfg client.TxConfig, app *baseapp.BaseApp, msgs []sdk.Msg, fee sdk.Coins, chainID string, accNums, accSeqs []uint64, _ bool, blockTime time.Time, nextValHash []byte, priv ...cryptotypes.PrivKey, ) (*abci.ResponseFinalizeBlock, error)
SignAndDeliver signs and delivers a transaction. No simulation occurs as the ibc testing package causes checkState and deliverState to diverge in block time.
CONTRACT: BeginBlock must be called before this function. Is a customization of IBC-go function that allows to modify the fee denom and amount IBC-go implementation: https://github.com/cosmos/ibc-go/blob/d34cef7e075dda1a24a0a3e9b6d3eff406cc606c/testing/simapp/test_helpers.go#L332-L364
func VoteAndCheckProposalStatus ¶ added in v1.9.0
VoteAndCheckProposalStatus votes on a gov proposal, checks if the proposal has passed, and returns an error if it has not with the failure reason.
Types ¶
type Endpoint ¶
type Endpoint struct {
Chain *ibcgotesting.TestChain
Counterparty *Endpoint
ClientID string
ConnectionID string
ChannelID string
ClientConfig ibcgotesting.ClientConfig
ConnectionConfig *ibcgotesting.ConnectionConfig
ChannelConfig *ibcgotesting.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 *ibcgotesting.TestChain) *Endpoint
NewDefaultEndpoint constructs a new endpoint using default values. CONTRACT: the counterparty endpoitn must be set by the caller.
func NewEndpoint ¶
func NewEndpoint( chain *ibcgotesting.TestChain, clientConfig ibcgotesting.ClientConfig, connectionConfig *ibcgotesting.ConnectionConfig, channelConfig *ibcgotesting.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(packet channeltypes.Packet, ack []byte) error
AcknowledgePacket sends a MsgAcknowledgement to the channel associated with the endpoint.
func (*Endpoint) ChanCloseInit ¶
ChanCloseInit will construct and execute a MsgChannelCloseInit on the associated endpoint.
NOTE: does not work with ibc-transfer module
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) ChanUpgradeAck ¶ added in v1.9.0
ChanUpgradeAck sends a MsgChannelUpgradeAck to the associated endpoint.
func (*Endpoint) ChanUpgradeCancel ¶ added in v1.9.0
ChanUpgradeCancel sends a MsgChannelUpgradeCancel to the associated endpoint.
func (*Endpoint) ChanUpgradeConfirm ¶ added in v1.9.0
ChanUpgradeConfirm sends a MsgChannelUpgradeConfirm to the associated endpoint.
func (*Endpoint) ChanUpgradeInit ¶ added in v1.9.0
ChanUpgradeInit sends a MsgChannelUpgradeInit on the associated endpoint. A default upgrade proposal is used with overrides from the ProposedUpgrade in the channel config, and submitted via governance proposal
func (*Endpoint) ChanUpgradeOpen ¶ added in v1.9.0
ChanUpgradeOpen sends a MsgChannelUpgradeOpen to the associated endpoint.
func (*Endpoint) ChanUpgradeTimeout ¶ added in v1.9.0
ChanUpgradeTimeout sends a MsgChannelUpgradeTimeout to the associated endpoint.
func (*Endpoint) ChanUpgradeTry ¶ added in v1.9.0
ChanUpgradeTry sends a MsgChannelUpgradeTry 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) GetChannel ¶
func (endpoint *Endpoint) GetChannel() channeltypes.Channel
GetChannel retrieves an IBC Channel for the endpoint. The channel is expected to exist otherwise testing will fail.
func (*Endpoint) GetChannelUpgrade ¶ added in v1.9.0
func (endpoint *Endpoint) GetChannelUpgrade() channeltypes.Upgrade
GetChannelUpgrade retrieves an IBC Channel Upgrade for the endpoint. The upgrade is expected to exist otherwise testing will fail.
func (*Endpoint) GetClientState ¶
func (endpoint *Endpoint) GetClientState() exported.ClientState
GetClientState retrieves the Client State for this endpoint. The client state is expected to exist otherwise testing will fail.
func (*Endpoint) GetConnection ¶
func (endpoint *Endpoint) GetConnection() connectiontypes.ConnectionEnd
GetConnection retrieves an IBC Connection for the endpoint. The connection is expected to exist otherwise testing will fail.
func (*Endpoint) GetConsensusState ¶
func (endpoint *Endpoint) GetConsensusState(height exported.Height) exported.ConsensusState
GetConsensusState retrieves the Consensus State for this endpoint at the provided height. The consensus state is expected to exist otherwise testing will fail.
func (*Endpoint) GetProposedUpgrade ¶ added in v1.9.0
func (endpoint *Endpoint) GetProposedUpgrade() channeltypes.Upgrade
GetProposedUpgrade returns a valid upgrade which can be used for UpgradeInit and UpgradeTry. By default, the endpoint's existing channel fields will be used for the upgrade fields and a sane default timeout will be used by querying the counterparty's latest height. If any non-empty values are specified in the ChannelConfig's ProposedUpgrade, those values will be used in the returned upgrade.
func (*Endpoint) QueryChannelUpgradeProof ¶ added in v1.9.0
func (endpoint *Endpoint) QueryChannelUpgradeProof() ([]byte, []byte, clienttypes.Height)
QueryChannelUpgradeProof returns all the proofs necessary to execute UpgradeTry/UpgradeAck/UpgradeOpen. It returns the proof for the channel on the endpoint's chain, the proof for the upgrade attempt on the endpoint's chain, and the height at which the proof was queried.
func (*Endpoint) QueryClientStateProof ¶
func (endpoint *Endpoint) QueryClientStateProof() (exported.ClientState, []byte)
QueryClientStateProof performs and abci query for a client stat associated with this endpoint and returns the ClientState along with the proof.
func (*Endpoint) QueryConnectionHandshakeProof ¶
func (endpoint *Endpoint) QueryConnectionHandshakeProof() ( clientState exported.ClientState, clientProof, consensusProof []byte, consensusHeight clienttypes.Height, connectionProof []byte, proofHeight clienttypes.Height, )
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) QueryProof ¶
func (endpoint *Endpoint) QueryProof(key []byte) ([]byte, clienttypes.Height)
QueryProof queries proof associated with this endpoint using the latest client state height on the counterparty chain.
func (*Endpoint) QueryProofAtHeight ¶
func (endpoint *Endpoint) QueryProofAtHeight(key []byte, height uint64) ([]byte, clienttypes.Height)
QueryProofAtHeight queries proof associated with this endpoint using the proof height provided
func (*Endpoint) RecvPacket ¶
func (endpoint *Endpoint) RecvPacket(packet channeltypes.Packet) error
RecvPacket receives a packet on the associated endpoint. The counterparty client is updated.
func (*Endpoint) RecvPacketWithResult ¶
func (endpoint *Endpoint) RecvPacketWithResult(packet channeltypes.Packet) (*abci.ExecTxResult, error)
RecvPacketWithResult receives a packet on the associated endpoint and the result of the transaction is returned. The counterparty client is updated.
func (*Endpoint) SendPacket ¶
func (endpoint *Endpoint) SendPacket( timeoutHeight clienttypes.Height, timeoutTimestamp uint64, data []byte, ) (uint64, error)
SendPacket sends a packet through the channel keeper using the associated endpoint The counterparty client is updated so proofs can be sent to the counterparty chain. The packet sequence generated for the packet to be sent is returned. An error is returned if one occurs.
func (*Endpoint) SetChannel ¶
func (endpoint *Endpoint) SetChannel(channel channeltypes.Channel)
SetChannel sets the channel for this endpoint.
func (*Endpoint) SetChannelCounterpartyUpgrade ¶ added in v1.9.0
func (endpoint *Endpoint) SetChannelCounterpartyUpgrade(upgrade channeltypes.Upgrade)
SetChannelCounterpartyUpgrade sets the channel counterparty upgrade for this endpoint.
func (*Endpoint) SetChannelState ¶ added in v1.9.0
func (endpoint *Endpoint) SetChannelState(state channeltypes.State) error
SetChannelState sets a channel state
func (*Endpoint) SetChannelUpgrade ¶ added in v1.9.0
func (endpoint *Endpoint) SetChannelUpgrade(upgrade channeltypes.Upgrade)
SetChannelUpgrade sets the channel upgrade for this endpoint.
func (*Endpoint) SetClientState ¶
func (endpoint *Endpoint) SetClientState(clientState exported.ClientState)
SetClientState sets the client state for this endpoint.
func (*Endpoint) SetConnection ¶
func (endpoint *Endpoint) SetConnection(connection connectiontypes.ConnectionEnd)
SetConnection sets the connection for this endpoint.
func (*Endpoint) SetConsensusState ¶
func (endpoint *Endpoint) SetConsensusState(consensusState exported.ConsensusState, height exported.Height)
SetConsensusState sets the consensus state for this endpoint.
func (*Endpoint) TimeoutOnClose ¶
func (endpoint *Endpoint) TimeoutOnClose(packet channeltypes.Packet) error
TimeoutOnClose sends a MsgTimeoutOnClose to the channel associated with the endpoint.
func (*Endpoint) TimeoutPacket ¶
func (endpoint *Endpoint) TimeoutPacket(packet channeltypes.Packet) error
TimeoutPacket sends a MsgTimeout to the channel associated with the endpoint.
func (*Endpoint) UpdateClient ¶
UpdateClient updates the IBC client associated with the endpoint.
func (*Endpoint) UpgradeChain ¶ added in v1.9.0
UpgradeChain will upgrade a chain's chainID to the next revision number. It will also update the counterparty client. TODO: implement actual upgrade chain functionality via scheduling an upgrade and upgrading the client via MsgUpgradeClient see reference https://github.com/cosmos/ibc-go/pull/1169
func (*Endpoint) WriteAcknowledgement ¶
func (endpoint *Endpoint) WriteAcknowledgement(ack exported.Acknowledgement, packet exported.PacketI) error
WriteAcknowledgement writes an acknowledgement on the channel associated with the endpoint. The counterparty client is updated.
type Path ¶
Path contains two endpoints representing two chains connected over IBC
func NewPath ¶
func NewPath(chainA, chainB *ibcgotesting.TestChain) *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.
func NewTransferPath ¶
func NewTransferPath(chainA, chainB *ibcgotesting.TestChain) *Path
NewTransferPath constructs a new path between each chain suitable for use with the transfer module.
func (*Path) RelayPacket ¶
func (path *Path) RelayPacket(packet channeltypes.Packet) error
RelayPacket attempts to relay the packet first on EndpointA and then on EndpointB if EndpointA does not contain a packet commitment for that packet. An error is returned if a relay step fails or the packet commitment does not exist on either endpoint.
func (*Path) RelayPacketWithResults ¶ added in v1.9.0
func (path *Path) RelayPacketWithResults(packet channeltypes.Packet) (*abci.ExecTxResult, []byte, error)
RelayPacketWithResults attempts to relay the packet first on EndpointA and then on EndpointB if EndpointA does not contain a packet commitment for that packet. The function returns: - The result of the packet receive transaction. - The acknowledgement written on the receiving chain. - An error if a relay step fails or the packet commitment does not exist on either endpoint.
func (*Path) SetChannelOrdered ¶
func (path *Path) SetChannelOrdered()
SetChannelOrdered sets the channel order for both endpoints to ORDERED.