Skip to content

Commit

Permalink
Merge branch 'main' into carlos/2119-add-grpc-for-02-client-params
Browse files Browse the repository at this point in the history
  • Loading branch information
crodriguezvega authored Oct 28, 2022
2 parents 21ab9ce + 8290d8c commit 2256385
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 34 deletions.
5 changes: 3 additions & 2 deletions e2e/tests/interchain_accounts/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/gogo/protobuf/proto"

"github.com/cosmos/ibc-go/e2e/testconfig"
"github.com/cosmos/ibc-go/e2e/testsuite"
Expand Down Expand Up @@ -107,7 +108,7 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_SuccessfulTransfer() {
banktypes.RegisterInterfaces(cfg.InterfaceRegistry)
cdc := codec.NewProtoCodec(cfg.InterfaceRegistry)

bz, err := icatypes.SerializeCosmosTx(cdc, []sdk.Msg{msgSend})
bz, err := icatypes.SerializeCosmosTx(cdc, []proto.Message{msgSend})
s.Require().NoError(err)

packetData := icatypes.InterchainAccountPacketData{
Expand Down Expand Up @@ -202,7 +203,7 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_FailedTransfer_InsufficientF
banktypes.RegisterInterfaces(cfg.InterfaceRegistry)
cdc := codec.NewProtoCodec(cfg.InterfaceRegistry)

bz, err := icatypes.SerializeCosmosTx(cdc, []sdk.Msg{msgSend})
bz, err := icatypes.SerializeCosmosTx(cdc, []proto.Message{msgSend})
s.Require().NoError(err)

packetData := icatypes.InterchainAccountPacketData{
Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/interchain_accounts/groups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
grouptypes "github.com/cosmos/cosmos-sdk/x/group"
"github.com/gogo/protobuf/proto"
ibctest "github.com/strangelove-ventures/ibctest/v6"
"github.com/strangelove-ventures/ibctest/v6/ibc"
"github.com/strangelove-ventures/ibctest/v6/test"
Expand Down Expand Up @@ -107,7 +108,6 @@ func (s *InterchainAccountsGroupsTestSuite) TestInterchainAccountsGroupsIntegrat
txResp, err := s.BroadcastMessages(ctx, chainA, chainAWallet, msgCreateGroupWithPolicy)
s.Require().NoError(err)
s.AssertValidTxResponse(txResp)

})

t.Run("submit proposal for MsgRegisterInterchainAccount", func(t *testing.T) {
Expand Down Expand Up @@ -169,7 +169,7 @@ func (s *InterchainAccountsGroupsTestSuite) TestInterchainAccountsGroupsIntegrat
banktypes.RegisterInterfaces(cfg.InterfaceRegistry)
cdc := codec.NewProtoCodec(cfg.InterfaceRegistry)

bz, err := icatypes.SerializeCosmosTx(cdc, []sdk.Msg{msgBankSend})
bz, err := icatypes.SerializeCosmosTx(cdc, []proto.Message{msgBankSend})
s.Require().NoError(err)

packetData := icatypes.InterchainAccountPacketData{
Expand Down
5 changes: 3 additions & 2 deletions e2e/tests/interchain_accounts/incentivized_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/gogo/protobuf/proto"
ibctest "github.com/strangelove-ventures/ibctest/v6"
"github.com/strangelove-ventures/ibctest/v6/chain/cosmos"
"github.com/strangelove-ventures/ibctest/v6/ibc"
Expand Down Expand Up @@ -155,7 +156,7 @@ func (s *IncentivizedInterchainAccountsTestSuite) TestMsgSendTx_SuccessfulBankSe
banktypes.RegisterInterfaces(cfg.InterfaceRegistry)
cdc := codec.NewProtoCodec(cfg.InterfaceRegistry)

bz, err := icatypes.SerializeCosmosTx(cdc, []sdk.Msg{msgSend})
bz, err := icatypes.SerializeCosmosTx(cdc, []proto.Message{msgSend})
s.Require().NoError(err)

packetData := icatypes.InterchainAccountPacketData{
Expand Down Expand Up @@ -330,7 +331,7 @@ func (s *IncentivizedInterchainAccountsTestSuite) TestMsgSendTx_FailedBankSend_I
banktypes.RegisterInterfaces(cfg.InterfaceRegistry)
cdc := codec.NewProtoCodec(cfg.InterfaceRegistry)

bz, err := icatypes.SerializeCosmosTx(cdc, []sdk.Msg{msgSend})
bz, err := icatypes.SerializeCosmosTx(cdc, []proto.Message{msgSend})
s.Require().NoError(err)

packetData := icatypes.InterchainAccountPacketData{
Expand Down
57 changes: 29 additions & 28 deletions testing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,33 +213,33 @@ To initialize the clients, connections, and channels for a path we can call the
Here is a basic example of the testing package being used to simulate IBC functionality:

```go
path := ibctesting.NewPath(suite.chainA, suite.chainB) // clientID, connectionID, channelID empty
suite.coordinator.Setup(path) // clientID, connectionID, channelID filled
suite.Require().Equal("07-tendermint-0", path.EndpointA.ClientID)
suite.Require().Equal("connection-0", path.EndpointA.ClientID)
suite.Require().Equal("channel-0", path.EndpointA.ClientID)
path := ibctesting.NewPath(suite.chainA, suite.chainB) // clientID, connectionID, channelID empty
suite.coordinator.Setup(path) // clientID, connectionID, channelID filled
suite.Require().Equal("07-tendermint-0", path.EndpointA.ClientID)
suite.Require().Equal("connection-0", path.EndpointA.ClientID)
suite.Require().Equal("channel-0", path.EndpointA.ClientID)

// create packet 1
packet1 := NewPacket() // NewPacket would construct your packet
// send on endpointA
sequence, err := path.EndpointA.SendPacket(timeoutHeight1, timeoutTimestamp1, packet1Data)

// send on endpointA
path.EndpointA.SendPacket(packet1)
// create packet 1
packet1 := NewPacket() // NewPacket would construct your packet

// receive on endpointB
path.EndpointB.RecvPacket(packet1)
// receive on endpointB
path.EndpointB.RecvPacket(packet1)

// acknowledge the receipt of the packet
path.EndpointA.AcknowledgePacket(packet1, ack)
// acknowledge the receipt of the packet
path.EndpointA.AcknowledgePacket(packet1, ack)

// we can also relay
packet2 := NewPacket()
// we can also relay
sequence, err := path.EndpointA.SendPacket(timeoutHeight2, timeoutTimestamp2, packet2Data)

path.EndpointA.SendPacket(packet2)
packet2 := NewPacket()

path.Relay(packet2, expectedAck)
path.Relay(packet2, expectedAck)

// if needed we can update our clients
path.EndpointB.UpdateClient()
// if needed we can update our clients
path.EndpointB.UpdateClient()
```

### Transfer Testing Example
Expand Down Expand Up @@ -300,9 +300,9 @@ The portID and scoped keeper for the `MockIBCApp` should be set within `MockIBCA

For example, if one wanted to test that the base application cannot affect the outcome of the `OnChanOpenTry` callback, the mock module base application callback could be updated as such:
```go
mockModule.IBCApp.OnChanOpenTry = func(ctx sdk.Context, portID, channelID, version string) error {
return fmt.Errorf("mock base app must not be called for OnChanOpenTry")
}
mockModule.IBCApp.OnChanOpenTry = func(ctx sdk.Context, portID, channelID, version string) error {
return fmt.Errorf("mock base app must not be called for OnChanOpenTry")
}
```

Using a mock module as a base application in a middleware stack may require adding the module to your `SimApp`.
Expand All @@ -311,10 +311,11 @@ sits at the top of middleware stack will need to be accessed via a public field

This might look like:
```go
suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnChanOpenInit = func(ctx sdk.Context, order channeltypes.Order, connectionHops []string,
portID, channelID string, chanCap *capabilitytypes.Capability,
counterparty channeltypes.Counterparty, version string,
) error {
return fmt.Errorf("mock ica auth fails")
}
suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnChanOpenInit = func(
ctx sdk.Context, order channeltypes.Order, connectionHops []string,
portID, channelID string, chanCap *capabilitytypes.Capability,
counterparty channeltypes.Counterparty, version string,
) error {
return fmt.Errorf("mock ica auth fails")
}
```

0 comments on commit 2256385

Please sign in to comment.