Documentation ¶
Index ¶
- Constants
- Variables
- func CreateChannels(coord *ibctesting.Coordinator, path *Path)
- func CreateConnections(coord *ibctesting.Coordinator, path *Path)
- func NewCoordinator(t *testing.T, nEVMChains, mCosmosChains int) *ibctesting.Coordinator
- func NewTestChain(t *testing.T, coord *ibcgotesting.Coordinator, chainID string) *ibcgotesting.TestChain
- func SendMsgs(chain *ibctesting.TestChain, feeAmt int64, msgs ...sdk.Msg) (*sdk.Result, error)
- func SetupClients(coord *ibctesting.Coordinator, path *Path)
- func SetupConnections(coord *ibctesting.Coordinator, path *Path)
- func SetupPath(coord *ibctesting.Coordinator, path *Path)
- func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, ...) ibcgotesting.TestingApp
- func SignAndDeliver(t *testing.T, txCfg client.TxConfig, app *baseapp.BaseApp, msgs []sdk.Msg, ...) (sdk.GasInfo, *sdk.Result, 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) 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) GetClientState() exported.ClientState
- func (endpoint *Endpoint) GetConnection() connectiontypes.ConnectionEnd
- func (endpoint *Endpoint) GetConsensusState(height exported.Height) exported.ConsensusState
- func (endpoint *Endpoint) QueryClientStateProof() (exported.ClientState, []byte)
- func (endpoint *Endpoint) QueryConnectionHandshakeProof() (clientState exported.ClientState, proofClient, proofConsensus []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) (*sdk.Result, error)
- func (endpoint *Endpoint) SendPacket(timeoutHeight clienttypes.Height, timeoutTimestamp uint64, data []byte) (uint64, error)
- func (endpoint *Endpoint) SetChannel(channel channeltypes.Channel)
- func (endpoint *Endpoint) SetChannelClosed() error
- 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) 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_11235-"
ChainIDPrefix defines the default chain ID prefix for Haqq Network test chains
var DefaultTestingAppInit func() (ibcgotesting.TestingApp, map[string]json.RawMessage) = haqqapp.SetupTestingApp
Functions ¶
func CreateChannels ¶
func CreateChannels(coord *ibctesting.Coordinator, path *Path)
CreateChannel 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)
CreateConnection 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 NewCoordinator ¶
func NewCoordinator(t *testing.T, nEVMChains, mCosmosChains int) *ibctesting.Coordinator
NewCoordinator initializes Coordinator with N EVM TestChain's (Haqq apps) and M Cosmos chains (Simulation Apps)
func NewTestChain ¶
func NewTestChain(t *testing.T, coord *ibcgotesting.Coordinator, chainID string) *ibcgotesting.TestChain
NewTestChain initializes a new TestChain instance with a single validator set using a generated private key. It also creates a sender account to be used for delivering transactions.
The first block height is committed to state in order to allow for client creations on counterparty chains. The TestChain will return with a block height starting at 2.
Time management is handled by the Coordinator in order to ensure synchrony between chains. Each update of any chain increments the block header time for all chains by 5 seconds.
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)
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.
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 SetupWithGenesisValSet ¶
func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, chainID string, balances ...banktypes.Balance) ibcgotesting.TestingApp
SetupWithGenesisValSet initializes a new SimApp with a validator set and genesis accounts that also act as delegators. For simplicity, each validator is bonded with a delegation of one consensus engine unit (10^6) in the default token of the simapp from first genesis account. A Nop logger is set in SimApp.
func SignAndDeliver ¶
func SignAndDeliver( t *testing.T, txCfg client.TxConfig, app *baseapp.BaseApp, msgs []sdk.Msg, fee sdk.Coins, chainID string, accNums, accSeqs []uint64, expPass bool, priv ...cryptotypes.PrivKey, ) (sdk.GasInfo, *sdk.Result, 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
Types ¶
type Endpoint ¶
type Endpoint struct { Chain *ibctesting.TestChain Counterparty *Endpoint ClientID string ConnectionID string ChannelID string ClientConfig ibctesting.ClientConfig ConnectionConfig *ibctesting.ConnectionConfig ChannelConfig *ibctesting.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 *ibctesting.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 *ibctesting.TestChain, clientConfig ibctesting.ClientConfig, connectionConfig *ibctesting.ConnectionConfig, channelConfig *ibctesting.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) 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) 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) 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, proofClient, proofConsensus []byte, consensusHeight clienttypes.Height, proofConnection []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 lastest 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 ¶
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) SetChannelClosed ¶
SetChannelClosed sets a channel state to CLOSED.
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) 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 *ibctesting.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
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) SetChannelOrdered ¶
func (path *Path) SetChannelOrdered()
SetChannelOrdered sets the channel order for both endpoints to ORDERED.