Documentation
¶
Index ¶
- Variables
- func CloseChannel(coord *ibctesting.Coordinator, path *ibctesting.Path)
- func NewCoordinator(t *testing.T, n int, opts ...[]wasmkeeper.Option) *ibctesting.Coordinator
- func NewDefaultTestChain(t *testing.T, coord *ibctesting.Coordinator, chainID string, ...) *ibctesting.TestChain
- func NewTestChain(t *testing.T, coord *ibctesting.Coordinator, appFactory ChainAppFactory, ...) *ibctesting.TestChain
- func NewTestChainWithValSet(t *testing.T, coord *ibctesting.Coordinator, appFactory ChainAppFactory, ...) *ibctesting.TestChain
- func ParseAckFromEvents(events []abci.Event) ([]byte, error)
- func ParseChannelIDFromEvents(events []abci.Event) (string, error)
- func ParseChannelVersionFromEvents(events []abci.Event) (string, error)
- func ParsePortIDFromEvents(events []abci.Event) (string, error)
- func RelayAndAckPendingPackets(path *WasmPath) error
- func RelayPacketWithoutAck(path *ibctesting.Path, packet channeltypes.Packet) error
- func TimeoutPendingPackets(coord *ibctesting.Coordinator, path *WasmPath) error
- type ChainAppFactory
- type WasmPath
- type WasmTestApp
- type WasmTestChain
- func (chain *WasmTestChain) AllBalances(acc sdk.AccAddress) sdk.Coins
- func (chain *WasmTestChain) Balance(acc sdk.AccAddress, denom string) sdk.Coin
- func (chain *WasmTestChain) CaptureIBCEvents(result *abci.ExecTxResult)
- func (chain *WasmTestChain) ContractInfo(contractAddr sdk.AccAddress) *types.ContractInfo
- func (chain *WasmTestChain) Fund(addr sdk.AccAddress, amount math.Int)
- func (chain *WasmTestChain) GetTimeoutHeight() clienttypes.Height
- func (chain *WasmTestChain) GetWasmApp() *app.WasmApp
- func (chain *WasmTestChain) InstantiateContract(codeID uint64, initMsg []byte) sdk.AccAddress
- func (chain *WasmTestChain) OverrideSendMsgs(msgs ...sdk.Msg) (*abci.ExecTxResult, error)
- func (chain *WasmTestChain) SeedNewContractInstance() sdk.AccAddress
- func (chain *WasmTestChain) SendNonDefaultSenderMsgs(senderPrivKey cryptotypes.PrivKey, msgs ...sdk.Msg) (*abci.ExecTxResult, error)
- func (chain *WasmTestChain) SmartQuery(contractAddr string, queryMsg, response interface{}) error
- func (chain *WasmTestChain) StoreCode(byteCode []byte) types.MsgStoreCodeResponse
- func (chain *WasmTestChain) StoreCodeFile(filename string) types.MsgStoreCodeResponse
- func (chain *WasmTestChain) UnwrapExecTXResult(r *abci.ExecTxResult, target proto.Message)
Constants ¶
This section is empty.
Variables ¶
var ( TimeIncrement = time.Second * 5 MaxAccounts = 10 )
Functions ¶
func CloseChannel ¶
func CloseChannel(coord *ibctesting.Coordinator, path *ibctesting.Path)
CloseChannel close channel on both sides
func NewCoordinator ¶
func NewCoordinator(t *testing.T, n int, opts ...[]wasmkeeper.Option) *ibctesting.Coordinator
NewCoordinator initializes Coordinator with N TestChain's
func NewDefaultTestChain ¶
func NewDefaultTestChain(t *testing.T, coord *ibctesting.Coordinator, chainID string, opts ...wasmkeeper.Option) *ibctesting.TestChain
NewDefaultTestChain initializes a new test chain with a default of 4 validators Use this function if the tests do not need custom control over the validator set
func NewTestChain ¶
func NewTestChain(t *testing.T, coord *ibctesting.Coordinator, appFactory ChainAppFactory, chainID string, opts ...wasmkeeper.Option) *ibctesting.TestChain
NewTestChain initializes a new test chain with a default of 4 validators Use this function if the tests do not need custom control over the validator set
func NewTestChainWithValSet ¶
func NewTestChainWithValSet(t *testing.T, coord *ibctesting.Coordinator, appFactory ChainAppFactory, chainID string, valSet *cmttypes.ValidatorSet, signers map[string]cmttypes.PrivValidator, opts ...wasmkeeper.Option) *ibctesting.TestChain
NewTestChainWithValSet initializes a new TestChain instance with the given validator set and signer array. It also initializes 10 Sender accounts with a balance of 10000000000000000000 coins of bond denom to use for tests.
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.
NOTE: to use a custom sender privkey and account for testing purposes, replace and modify this constructor function.
CONTRACT: Validator array must be provided in the order expected by Tendermint. i.e. sorted first by power and then lexicographically by address.
func ParseAckFromEvents ¶
ParseAckFromEvents parses events emitted from a MsgRecvPacket and returns the acknowledgement.
func ParseChannelIDFromEvents ¶
ParseChannelIDFromEvents parses events emitted from a MsgChannelOpenInit or MsgChannelOpenTry and returns the channel identifier.
func RelayAndAckPendingPackets ¶
RelayAndAckPendingPackets sends pending packages from path.EndpointA to the counterparty chain and acks
func RelayPacketWithoutAck ¶
func RelayPacketWithoutAck(path *ibctesting.Path, packet channeltypes.Packet) error
RelayPacketWithoutAck 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. In contrast to RelayPacket, this function does not acknowledge the packet and expects it to have no acknowledgement yet. It is useful for testing async acknowledgement.
func TimeoutPendingPackets ¶
func TimeoutPendingPackets(coord *ibctesting.Coordinator, path *WasmPath) error
TimeoutPendingPackets returns the package to source chain to let the IBC app revert any operation. from A to B
Types ¶
type ChainAppFactory ¶
type ChainAppFactory func(t *testing.T, valSet *cmttypes.ValidatorSet, genAccs []authtypes.GenesisAccount, chainID string, opts []wasmkeeper.Option, balances ...banktypes.Balance) WasmTestApp
ChainAppFactory abstract factory method that usually implemented by app.SetupWithGenesisValSet
type WasmPath ¶
type WasmPath struct { ibctesting.Path // contains filtered or unexported fields }
func NewWasmPath ¶
func NewWasmPath(chainA, chainB *WasmTestChain) *WasmPath
type WasmTestApp ¶
func DefaultWasmAppFactory ¶
func DefaultWasmAppFactory(t *testing.T, valSet *cmttypes.ValidatorSet, genAccs []authtypes.GenesisAccount, chainID string, opts []wasmkeeper.Option, balances ...banktypes.Balance) WasmTestApp
DefaultWasmAppFactory instantiates and sets up the default wasmd app
func (WasmTestApp) GetTxConfig ¶
func (app WasmTestApp) GetTxConfig() client.TxConfig
type WasmTestChain ¶
type WasmTestChain struct { *ibctesting.TestChain PendingSendPackets *[]channeltypes.Packet }
func NewWasmTestChain ¶
func NewWasmTestChain(chain *ibctesting.TestChain) *WasmTestChain
func (*WasmTestChain) AllBalances ¶
func (chain *WasmTestChain) AllBalances(acc sdk.AccAddress) sdk.Coins
func (*WasmTestChain) Balance ¶
func (chain *WasmTestChain) Balance(acc sdk.AccAddress, denom string) sdk.Coin
func (*WasmTestChain) CaptureIBCEvents ¶
func (chain *WasmTestChain) CaptureIBCEvents(result *abci.ExecTxResult)
func (*WasmTestChain) ContractInfo ¶
func (chain *WasmTestChain) ContractInfo(contractAddr sdk.AccAddress) *types.ContractInfo
func (*WasmTestChain) Fund ¶
func (chain *WasmTestChain) Fund(addr sdk.AccAddress, amount math.Int)
Fund an address with the given amount in default denom
func (*WasmTestChain) GetTimeoutHeight ¶
func (chain *WasmTestChain) GetTimeoutHeight() clienttypes.Height
GetTimeoutHeight is a convenience function which returns a IBC packet timeout height to be used for testing. It returns the current IBC height + 100 blocks
func (*WasmTestChain) GetWasmApp ¶
func (chain *WasmTestChain) GetWasmApp() *app.WasmApp
func (*WasmTestChain) InstantiateContract ¶
func (chain *WasmTestChain) InstantiateContract(codeID uint64, initMsg []byte) sdk.AccAddress
func (*WasmTestChain) OverrideSendMsgs ¶
func (chain *WasmTestChain) OverrideSendMsgs(msgs ...sdk.Msg) (*abci.ExecTxResult, error)
func (*WasmTestChain) SeedNewContractInstance ¶
func (chain *WasmTestChain) SeedNewContractInstance() sdk.AccAddress
SeedNewContractInstance stores some wasm code and instantiates a new contract on this chain. This method can be called to prepare the store with some valid CodeInfo and ContractInfo. The returned Address is the contract address for this instance. Test should make use of this data and/or use NewIBCContractMockWasmEngine for using a contract mock in Go.
func (*WasmTestChain) SendNonDefaultSenderMsgs ¶
func (chain *WasmTestChain) SendNonDefaultSenderMsgs(senderPrivKey cryptotypes.PrivKey, msgs ...sdk.Msg) (*abci.ExecTxResult, error)
SendNonDefaultSenderMsgs is the same as SendMsgs but with a custom signer/account
func (*WasmTestChain) SmartQuery ¶
func (chain *WasmTestChain) SmartQuery(contractAddr string, queryMsg, response interface{}) error
SmartQuery This will serialize the query message and submit it to the contract. The response is parsed into the provided interface. Usage: SmartQuery(addr, QueryMsg{Foo: 1}, &response)
func (*WasmTestChain) StoreCode ¶
func (chain *WasmTestChain) StoreCode(byteCode []byte) types.MsgStoreCodeResponse
func (*WasmTestChain) StoreCodeFile ¶
func (chain *WasmTestChain) StoreCodeFile(filename string) types.MsgStoreCodeResponse
func (*WasmTestChain) UnwrapExecTXResult ¶
func (chain *WasmTestChain) UnwrapExecTXResult(r *abci.ExecTxResult, target proto.Message)
UnwrapExecTXResult is a helper to unpack execution result from proto any type