diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index 5e242070c9d..6fd91fd126d 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -343,8 +343,7 @@ Query request for an interchain account address | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `owner_address` | [string](#string) | | Owner address is the owner of the interchain account on the controller chain | -| `connection_id` | [string](#string) | | | +| `counterparty_port_id` | [string](#string) | | Counterparty PortID is the portID on the controller chain | diff --git a/modules/apps/27-interchain-accounts/client/cli/query.go b/modules/apps/27-interchain-accounts/client/cli/query.go index 9945d79bab8..8b26d77dbff 100644 --- a/modules/apps/27-interchain-accounts/client/cli/query.go +++ b/modules/apps/27-interchain-accounts/client/cli/query.go @@ -26,18 +26,17 @@ func GetQueryCmd() *cobra.Command { func GetInterchainAccountCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "address [address] [connection-id]", + Use: "address [counterparty-port-id]", RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err } - ownerAddress := args[0] - connectionId := args[1] + counterpartyPortID := args[0] queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.InterchainAccountAddress(context.Background(), &types.QueryInterchainAccountAddressRequest{OwnerAddress: ownerAddress, ConnectionId: connectionId}) + res, err := queryClient.InterchainAccountAddress(context.Background(), &types.QueryInterchainAccountAddressRequest{CounterpartyPortId: counterpartyPortID}) if err != nil { return err } diff --git a/modules/apps/27-interchain-accounts/keeper/account.go b/modules/apps/27-interchain-accounts/keeper/account.go index 99bc84ce9c9..0cfe330a261 100644 --- a/modules/apps/27-interchain-accounts/keeper/account.go +++ b/modules/apps/27-interchain-accounts/keeper/account.go @@ -17,8 +17,11 @@ import ( // call 04-channel 'ChanOpenInit'. An error is returned if the port identifier is // already in use. Gaining access to interchain accounts whose channels have closed // cannot be done with this function. A regular MsgChanOpenInit must be used. -func (k Keeper) InitInterchainAccount(ctx sdk.Context, connectionId, owner string) error { - portId := k.GeneratePortId(owner, connectionId) +func (k Keeper) InitInterchainAccount(ctx sdk.Context, connectionID, counterpartyConnectionID, owner string) error { + portId, err := types.GeneratePortID(owner, connectionID, counterpartyConnectionID) + if err != nil { + return err + } // check if the port is already bound if k.IsBound(ctx, portId) { @@ -26,12 +29,12 @@ func (k Keeper) InitInterchainAccount(ctx sdk.Context, connectionId, owner strin } portCap := k.portKeeper.BindPort(ctx, portId) - err := k.ClaimCapability(ctx, portCap, host.PortPath(portId)) + err = k.ClaimCapability(ctx, portCap, host.PortPath(portId)) if err != nil { return sdkerrors.Wrap(err, "unable to bind to newly generated portID") } - msg := channeltypes.NewMsgChannelOpenInit(portId, types.Version, channeltypes.ORDERED, []string{connectionId}, types.PortID, types.ModuleName) + msg := channeltypes.NewMsgChannelOpenInit(portId, types.Version, channeltypes.ORDERED, []string{connectionID}, types.PortID, types.ModuleName) handler := k.msgRouter.Handler(msg) if _, err := handler(ctx, msg); err != nil { return err diff --git a/modules/apps/27-interchain-accounts/keeper/account_test.go b/modules/apps/27-interchain-accounts/keeper/account_test.go index 064a9bc6413..3d9cd9bae49 100644 --- a/modules/apps/27-interchain-accounts/keeper/account_test.go +++ b/modules/apps/27-interchain-accounts/keeper/account_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "github.com/cosmos/ibc-go/modules/apps/27-interchain-accounts/types" ibctesting "github.com/cosmos/ibc-go/testing" ) @@ -32,7 +33,8 @@ func (suite *KeeperTestSuite) TestInitInterchainAccount() { */ { "MsgChanOpenInit fails - channel is already active", func() { - portID := suite.chainA.GetSimApp().ICAKeeper.GeneratePortId(owner, path.EndpointA.ConnectionID) + portID, err := types.GeneratePortID(owner, path.EndpointA.ConnectionID, path.EndpointB.ConnectionID) + suite.Require().NoError(err) suite.chainA.GetSimApp().ICAKeeper.SetActiveChannel(suite.chainA.GetContext(), portID, path.EndpointA.ChannelID) }, false, }, @@ -49,7 +51,7 @@ func (suite *KeeperTestSuite) TestInitInterchainAccount() { tc.malleate() // explicitly change fields in channel and testChannel - err = suite.chainA.GetSimApp().ICAKeeper.InitInterchainAccount(suite.chainA.GetContext(), path.EndpointA.ConnectionID, owner) + err = suite.chainA.GetSimApp().ICAKeeper.InitInterchainAccount(suite.chainA.GetContext(), path.EndpointA.ConnectionID, path.EndpointB.ConnectionID, owner) if tc.expPass { suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/keeper/grpc_query.go b/modules/apps/27-interchain-accounts/keeper/grpc_query.go index 9b072d28ef0..fd344e83dd5 100644 --- a/modules/apps/27-interchain-accounts/keeper/grpc_query.go +++ b/modules/apps/27-interchain-accounts/keeper/grpc_query.go @@ -19,14 +19,13 @@ func (k Keeper) InterchainAccountAddress(ctx context.Context, req *types.QueryIn return nil, status.Error(codes.InvalidArgument, "empty request") } - if req.OwnerAddress == "" { - return nil, status.Error(codes.InvalidArgument, "address cannot be empty") + if req.CounterpartyPortId == "" { + return nil, status.Error(codes.InvalidArgument, "counterparty portID cannot be empty") } sdkCtx := sdk.UnwrapSDKContext(ctx) - portId := k.GeneratePortId(req.OwnerAddress, req.ConnectionId) - interchainAccountAddress, err := k.GetInterchainAccountAddress(sdkCtx, portId) + interchainAccountAddress, err := k.GetInterchainAccountAddress(sdkCtx, req.CounterpartyPortId) if err != nil { return nil, err } diff --git a/modules/apps/27-interchain-accounts/keeper/handshake_test.go b/modules/apps/27-interchain-accounts/keeper/handshake_test.go index 4b8a6f005fb..253aff5f5d9 100644 --- a/modules/apps/27-interchain-accounts/keeper/handshake_test.go +++ b/modules/apps/27-interchain-accounts/keeper/handshake_test.go @@ -14,7 +14,6 @@ func (suite *KeeperTestSuite) TestOnChanOpenInit() { channel *channeltypes.Channel path *ibctesting.Path chanCap *capabilitytypes.Capability - err error ) testCases := []struct { @@ -63,7 +62,8 @@ func (suite *KeeperTestSuite) TestOnChanOpenInit() { suite.coordinator.SetupConnections(path) // mock init interchain account - portID := suite.chainA.GetSimApp().ICAKeeper.GeneratePortId("owner", path.EndpointA.ConnectionID) + portID, err := types.GeneratePortID("owner", path.EndpointA.ConnectionID, path.EndpointB.ConnectionID) + suite.Require().NoError(err) portCap := suite.chainA.GetSimApp().IBCKeeper.PortKeeper.BindPort(suite.chainA.GetContext(), portID) suite.chainA.GetSimApp().ICAKeeper.ClaimCapability(suite.chainA.GetContext(), portCap, host.PortPath(portID)) path.EndpointA.ChannelConfig.PortID = portID diff --git a/modules/apps/27-interchain-accounts/keeper/keeper.go b/modules/apps/27-interchain-accounts/keeper/keeper.go index 781a144f6a0..93adf0f9e3f 100644 --- a/modules/apps/27-interchain-accounts/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/keeper/keeper.go @@ -2,7 +2,6 @@ package keeper import ( "fmt" - "strings" baseapp "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" @@ -123,19 +122,6 @@ func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability return k.scopedKeeper.ClaimCapability(ctx, cap, name) } -// Utility function for parsing the connection number from the connection-id -func getConnectionNumber(connectionId string) string { - ss := strings.Split(connectionId, "-") - return ss[len(ss)-1] -} - -func (k Keeper) GeneratePortId(owner, connectionId string) string { - ownerId := strings.TrimSpace(owner) - connectionNumber := getConnectionNumber(connectionId) - portId := types.IcaPrefix + connectionNumber + "-" + ownerId - return portId -} - func (k Keeper) SetActiveChannel(ctx sdk.Context, portId, channelId string) error { store := ctx.KVStore(k.storeKey) diff --git a/modules/apps/27-interchain-accounts/keeper/keeper_test.go b/modules/apps/27-interchain-accounts/keeper/keeper_test.go index a0819dcdf09..3e26679d10b 100644 --- a/modules/apps/27-interchain-accounts/keeper/keeper_test.go +++ b/modules/apps/27-interchain-accounts/keeper/keeper_test.go @@ -41,11 +41,15 @@ func NewICAPath(chainA, chainB *ibctesting.TestChain) *ibctesting.Path { } // InitInterchainAccount is a helper function for starting the channel handshake +// TODO: parse identifiers from events func InitInterchainAccount(endpoint *ibctesting.Endpoint, owner string) error { - portID := endpoint.Chain.GetSimApp().ICAKeeper.GeneratePortId(owner, endpoint.ConnectionID) + portID, err := types.GeneratePortID(owner, endpoint.ConnectionID, endpoint.Counterparty.ConnectionID) + if err != nil { + return err + } channelSequence := endpoint.Chain.App.GetIBCKeeper().ChannelKeeper.GetNextChannelSequence(endpoint.Chain.GetContext()) - if err := endpoint.Chain.GetSimApp().ICAKeeper.InitInterchainAccount(endpoint.Chain.GetContext(), endpoint.ConnectionID, owner); err != nil { + if err := endpoint.Chain.GetSimApp().ICAKeeper.InitInterchainAccount(endpoint.Chain.GetContext(), endpoint.ConnectionID, endpoint.Counterparty.ConnectionID, owner); err != nil { return err } diff --git a/modules/apps/27-interchain-accounts/keeper/relay.go b/modules/apps/27-interchain-accounts/keeper/relay.go index 757a08fe7c3..dad941a7ead 100644 --- a/modules/apps/27-interchain-accounts/keeper/relay.go +++ b/modules/apps/27-interchain-accounts/keeper/relay.go @@ -12,15 +12,16 @@ import ( "github.com/tendermint/tendermint/crypto/tmhash" ) -func (k Keeper) TrySendTx(ctx sdk.Context, accountOwner sdk.AccAddress, connectionId string, data interface{}) ([]byte, error) { - portId := k.GeneratePortId(accountOwner.String(), connectionId) +// TODO: implement middleware functionality, this will allow us to use capabilities to +// manage helper module access to owner addresses they do not have capabilities for +func (k Keeper) TrySendTx(ctx sdk.Context, portID string, data interface{}) ([]byte, error) { // Check for the active channel - activeChannelId, found := k.GetActiveChannel(ctx, portId) + activeChannelId, found := k.GetActiveChannel(ctx, portID) if !found { return nil, types.ErrActiveChannelNotFound } - sourceChannelEnd, found := k.channelKeeper.GetChannel(ctx, portId, activeChannelId) + sourceChannelEnd, found := k.channelKeeper.GetChannel(ctx, portID, activeChannelId) if !found { return []byte{}, sdkerrors.Wrap(channeltypes.ErrChannelNotFound, activeChannelId) } @@ -28,7 +29,7 @@ func (k Keeper) TrySendTx(ctx sdk.Context, accountOwner sdk.AccAddress, connecti destinationPort := sourceChannelEnd.GetCounterparty().GetPortID() destinationChannel := sourceChannelEnd.GetCounterparty().GetChannelID() - return k.createOutgoingPacket(ctx, portId, activeChannelId, destinationPort, destinationChannel, data) + return k.createOutgoingPacket(ctx, portID, activeChannelId, destinationPort, destinationChannel, data) } func (k Keeper) createOutgoingPacket( diff --git a/modules/apps/27-interchain-accounts/types/account.go b/modules/apps/27-interchain-accounts/types/account.go index ebba17dc756..f9f1634fd31 100644 --- a/modules/apps/27-interchain-accounts/types/account.go +++ b/modules/apps/27-interchain-accounts/types/account.go @@ -3,18 +3,46 @@ package types import ( "encoding/json" "fmt" + "strings" yaml "gopkg.in/yaml.v2" crypto "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + + connectiontypes "github.com/cosmos/ibc-go/modules/core/03-connection/types" ) const ( - IcaPrefix string = "ics27-1-" + ICAPrefix string = "ics-27" ) +// GeneratePortID generates the portID for a specific owner +// on the controller chain in the format: +// +// 'ics-27---' +// https://github.com/seantking/ibc/tree/sean/ics-27-updates/spec/app/ics-027-interchain-accounts#registering--controlling-flows +// TODO: update link to spec +func GeneratePortID(owner, connectionID, counterpartyConnectionID string) (string, error) { + ownerID := strings.TrimSpace(owner) + if ownerID == "" { + return "", sdkerrors.Wrap(ErrInvalidOwnerAddress, "owner address cannot be empty") + } + connectionSeq, err := connectiontypes.ParseConnectionSequence(connectionID) + if err != nil { + return "", sdkerrors.Wrap(err, "invalid connection identifier") + } + counterpartyConnectionSeq, err := connectiontypes.ParseConnectionSequence(counterpartyConnectionID) + if err != nil { + return "", sdkerrors.Wrap(err, "invalid counterparty connection identifier") + } + + portID := fmt.Sprintf("%s-%d-%d-%s", ICAPrefix, connectionSeq, counterpartyConnectionSeq, ownerID) + return portID, nil +} + type InterchainAccountI interface { authtypes.AccountI } diff --git a/modules/apps/27-interchain-accounts/types/account_test.go b/modules/apps/27-interchain-accounts/types/account_test.go new file mode 100644 index 00000000000..15bc23eb3e8 --- /dev/null +++ b/modules/apps/27-interchain-accounts/types/account_test.go @@ -0,0 +1,90 @@ +package types_test + +import ( + "testing" + + "github.com/cosmos/ibc-go/modules/apps/27-interchain-accounts/types" + channeltypes "github.com/cosmos/ibc-go/modules/core/04-channel/types" + ibctesting "github.com/cosmos/ibc-go/testing" + "github.com/stretchr/testify/suite" +) + +type TypesTestSuite struct { + suite.Suite + + coordinator *ibctesting.Coordinator + + chainA *ibctesting.TestChain + chainB *ibctesting.TestChain +} + +func (suite *TypesTestSuite) SetupTest() { + suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2) + + suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0)) + suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1)) +} + +func NewICAPath(chainA, chainB *ibctesting.TestChain) *ibctesting.Path { + path := ibctesting.NewPath(chainA, chainB) + path.EndpointA.ChannelConfig.PortID = types.PortID + path.EndpointB.ChannelConfig.PortID = types.PortID + path.EndpointA.ChannelConfig.Order = channeltypes.ORDERED + path.EndpointB.ChannelConfig.Order = channeltypes.ORDERED + path.EndpointA.ChannelConfig.Version = types.Version + path.EndpointB.ChannelConfig.Version = types.Version + + return path +} + +func TestTypesTestSuite(t *testing.T) { + suite.Run(t, new(TypesTestSuite)) +} + +func (suite *TypesTestSuite) TestGeneratePortID() { + var ( + path *ibctesting.Path + owner string + ) + var testCases = []struct { + name string + malleate func() + expValue string + expPass bool + }{ + {"success", func() {}, "ics-27-0-0-owner123", true}, + {"success with non matching connection sequences", func() { + path.EndpointA.ConnectionID = "connection-1" + }, "ics-27-1-0-owner123", true}, + {"invalid owner address", func() { + owner = " " + }, "", false}, + {"invalid connectionID", func() { + path.EndpointA.ConnectionID = "connection" + }, "", false}, + {"invalid counterparty connectionID", func() { + path.EndpointB.ConnectionID = "connection" + }, "", false}, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + suite.SetupTest() // reset + path = NewICAPath(suite.chainA, suite.chainB) + suite.coordinator.Setup(path) + owner = "owner123" // must be explicitly changed + + tc.malleate() + + portID, err := types.GeneratePortID(owner, path.EndpointA.ConnectionID, path.EndpointB.ConnectionID) + if tc.expPass { + suite.Require().NoError(err, tc.name) + suite.Require().Equal(tc.expValue, portID) + } else { + suite.Require().Error(err, tc.name) + suite.Require().Empty(portID) + } + }) + } +} diff --git a/modules/apps/27-interchain-accounts/types/errors.go b/modules/apps/27-interchain-accounts/types/errors.go index 40578c46cee..32425a81071 100644 --- a/modules/apps/27-interchain-accounts/types/errors.go +++ b/modules/apps/27-interchain-accounts/types/errors.go @@ -15,4 +15,5 @@ var ( ErrInterchainAccountAlreadySet = sdkerrors.Register(ModuleName, 9, "Interchain Account is already set") ErrActiveChannelNotFound = sdkerrors.Register(ModuleName, 10, "no active channel for this owner") ErrInvalidVersion = sdkerrors.Register(ModuleName, 11, "invalid interchain accounts version") + ErrInvalidOwnerAddress = sdkerrors.Register(ModuleName, 12, "invalid owner address") ) diff --git a/modules/apps/27-interchain-accounts/types/query.pb.go b/modules/apps/27-interchain-accounts/types/query.pb.go index 56108e7f743..271ba3b4827 100644 --- a/modules/apps/27-interchain-accounts/types/query.pb.go +++ b/modules/apps/27-interchain-accounts/types/query.pb.go @@ -31,9 +31,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Query request for an interchain account address type QueryInterchainAccountAddressRequest struct { - // Owner address is the owner of the interchain account on the controller chain - OwnerAddress string `protobuf:"bytes,1,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty"` - ConnectionId string `protobuf:"bytes,2,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` + // Counterparty PortID is the portID on the controller chain + CounterpartyPortId string `protobuf:"bytes,1,opt,name=counterparty_port_id,json=counterpartyPortId,proto3" json:"counterparty_port_id,omitempty"` } func (m *QueryInterchainAccountAddressRequest) Reset() { *m = QueryInterchainAccountAddressRequest{} } @@ -125,30 +124,29 @@ func init() { } var fileDescriptor_72a16b57c3343764 = []byte{ - // 357 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0x31, 0x4b, 0x33, 0x41, - 0x10, 0xbd, 0xfd, 0xe0, 0x13, 0x5d, 0xb4, 0x39, 0x2c, 0x8e, 0x43, 0x2e, 0x12, 0x15, 0x6d, 0xb2, - 0x4b, 0x12, 0x44, 0x10, 0x9b, 0xa4, 0x4b, 0xa1, 0x60, 0x4a, 0x11, 0xc2, 0xde, 0xde, 0x72, 0x59, - 0x48, 0x76, 0x2e, 0xb7, 0x7b, 0x91, 0xf8, 0x0b, 0x2c, 0xfd, 0x09, 0xf9, 0x1f, 0xd6, 0x82, 0x65, - 0x4a, 0x4b, 0x49, 0x1a, 0x7f, 0x86, 0xdc, 0x6d, 0x48, 0x44, 0x0d, 0xa6, 0xb0, 0x1b, 0x66, 0xde, - 0x9b, 0xf7, 0x76, 0xf6, 0xe1, 0xba, 0x0c, 0x39, 0x65, 0x49, 0xd2, 0x93, 0x9c, 0x19, 0x09, 0x4a, - 0x53, 0xa9, 0x8c, 0x48, 0x79, 0x97, 0x49, 0xd5, 0x61, 0x9c, 0x43, 0xa6, 0x8c, 0xa6, 0xc3, 0x2a, - 0x1d, 0x64, 0x22, 0x1d, 0x91, 0x24, 0x05, 0x03, 0xee, 0xb1, 0x0c, 0x39, 0xf9, 0x4c, 0x22, 0x3f, - 0x90, 0xc8, 0xb0, 0xea, 0xef, 0xc6, 0x10, 0x43, 0xc1, 0xa1, 0x79, 0x65, 0xe9, 0xfe, 0x5e, 0x0c, - 0x10, 0xf7, 0x04, 0x65, 0x89, 0xa4, 0x4c, 0x29, 0x30, 0xf3, 0x25, 0x76, 0x7a, 0xba, 0xae, 0xa3, - 0x79, 0x6d, 0x69, 0xe5, 0x7b, 0x7c, 0x78, 0x9d, 0x5b, 0x6c, 0x2d, 0xc0, 0x0d, 0x3b, 0x6f, 0x44, - 0x51, 0x2a, 0xb4, 0x6e, 0x8b, 0x41, 0x26, 0xb4, 0x71, 0x0f, 0xf0, 0x0e, 0xdc, 0x29, 0x91, 0x76, - 0x98, 0xed, 0x7b, 0x68, 0x1f, 0x9d, 0x6c, 0xb5, 0xb7, 0x8b, 0xe6, 0x1c, 0x9b, 0x83, 0x38, 0x28, - 0x25, 0x78, 0x6e, 0xa0, 0x23, 0x23, 0xef, 0x9f, 0x05, 0x2d, 0x9b, 0xad, 0xe8, 0x7c, 0xf3, 0x61, - 0x5c, 0x72, 0xde, 0xc7, 0x25, 0xa7, 0x2c, 0xf0, 0xd1, 0x2f, 0xda, 0x3a, 0x01, 0xa5, 0x85, 0x7b, - 0x81, 0xfd, 0xef, 0x8f, 0xf9, 0xe2, 0xc4, 0x93, 0x2b, 0xb6, 0xd4, 0x9e, 0x11, 0xfe, 0x5f, 0xe8, - 0xb8, 0x4f, 0x08, 0x7b, 0xab, 0xc4, 0xdc, 0x4b, 0xb2, 0xe6, 0xf7, 0x90, 0x75, 0x0e, 0xe6, 0x5f, - 0xfd, 0xd5, 0x3a, 0x7b, 0x83, 0xb2, 0xd3, 0xbc, 0x7d, 0x99, 0x06, 0x68, 0x32, 0x0d, 0xd0, 0xdb, - 0x34, 0x40, 0x8f, 0xb3, 0xc0, 0x99, 0xcc, 0x02, 0xe7, 0x75, 0x16, 0x38, 0x37, 0xcd, 0x58, 0x9a, - 0x6e, 0x16, 0x12, 0x0e, 0x7d, 0xca, 0x41, 0xf7, 0x41, 0x53, 0x19, 0xf2, 0x4a, 0x0c, 0xb4, 0x0f, - 0x51, 0xd6, 0x13, 0x3a, 0x0f, 0x86, 0xa6, 0xb5, 0xb3, 0xca, 0xd2, 0x42, 0x65, 0x91, 0x09, 0x33, - 0x4a, 0x84, 0x0e, 0x37, 0x8a, 0x3c, 0xd4, 0x3f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xc1, 0x93, 0x84, - 0xc3, 0xda, 0x02, 0x00, 0x00, + // 347 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0x3f, 0x4b, 0x3b, 0x31, + 0x18, 0xbe, 0x0c, 0xbf, 0x1f, 0x9a, 0xf1, 0xe8, 0x50, 0x0e, 0xb9, 0x4a, 0x51, 0x74, 0x69, 0x62, + 0x5b, 0x44, 0x10, 0x97, 0x76, 0xeb, 0xa0, 0x68, 0x47, 0x11, 0x8e, 0x5c, 0x2e, 0x5c, 0x03, 0x6d, + 0xde, 0x34, 0xc9, 0x15, 0xfa, 0x0d, 0x1c, 0xfd, 0x08, 0xfd, 0x1e, 0xce, 0x82, 0x63, 0x47, 0x47, + 0x69, 0x17, 0x3f, 0x86, 0xf4, 0xae, 0xd4, 0x82, 0x16, 0x6f, 0x70, 0x7b, 0xc9, 0xf3, 0x3e, 0x7f, + 0x78, 0x9f, 0xe0, 0xb6, 0x8c, 0x39, 0x65, 0x5a, 0x0f, 0x25, 0x67, 0x4e, 0x82, 0xb2, 0x54, 0x2a, + 0x27, 0x0c, 0x1f, 0x30, 0xa9, 0x22, 0xc6, 0x39, 0x64, 0xca, 0x59, 0x3a, 0x69, 0xd2, 0x71, 0x26, + 0xcc, 0x94, 0x68, 0x03, 0x0e, 0xfc, 0x13, 0x19, 0x73, 0xb2, 0x4d, 0x22, 0x3f, 0x90, 0xc8, 0xa4, + 0x19, 0x54, 0x52, 0x48, 0x21, 0xe7, 0xd0, 0xd5, 0x54, 0xd0, 0x83, 0x83, 0x14, 0x20, 0x1d, 0x0a, + 0xca, 0xb4, 0xa4, 0x4c, 0x29, 0x70, 0x6b, 0x91, 0x02, 0x3d, 0x2f, 0x9b, 0x68, 0x3d, 0x17, 0xb4, + 0x7a, 0x8c, 0x8f, 0xee, 0x56, 0x11, 0x7b, 0x9b, 0xe5, 0x4e, 0x81, 0x77, 0x92, 0xc4, 0x08, 0x6b, + 0xfb, 0x62, 0x9c, 0x09, 0xeb, 0xfc, 0x33, 0x5c, 0xc9, 0x9f, 0x85, 0xd1, 0xcc, 0xb8, 0x69, 0xa4, + 0xc1, 0xb8, 0x48, 0x26, 0x55, 0x74, 0x88, 0x4e, 0xf7, 0xfb, 0xfe, 0x36, 0x76, 0x0b, 0xc6, 0xf5, + 0x92, 0xcb, 0xbd, 0xc7, 0x59, 0xcd, 0xfb, 0x98, 0xd5, 0xbc, 0xba, 0xc0, 0xc7, 0xbf, 0x78, 0x58, + 0x0d, 0xca, 0x0a, 0xff, 0x0a, 0x07, 0xdf, 0x43, 0x47, 0xac, 0xd8, 0x5a, 0x5b, 0x55, 0xe5, 0x0e, + 0x95, 0xd6, 0x0b, 0xc2, 0xff, 0x72, 0x1f, 0xff, 0x19, 0xe1, 0xea, 0x2e, 0x33, 0xff, 0x9a, 0x94, + 0xac, 0x81, 0x94, 0x39, 0x4c, 0x70, 0xf3, 0x57, 0x72, 0xc5, 0x0d, 0xea, 0x5e, 0xf7, 0xe1, 0x75, + 0x11, 0xa2, 0xf9, 0x22, 0x44, 0xef, 0x8b, 0x10, 0x3d, 0x2d, 0x43, 0x6f, 0xbe, 0x0c, 0xbd, 0xb7, + 0x65, 0xe8, 0xdd, 0x77, 0x53, 0xe9, 0x06, 0x59, 0x4c, 0x38, 0x8c, 0x28, 0x07, 0x3b, 0x02, 0x4b, + 0x65, 0xcc, 0x1b, 0x29, 0xd0, 0x11, 0x24, 0xd9, 0x50, 0xd8, 0xd5, 0x07, 0xb0, 0xb4, 0x75, 0xd1, + 0xf8, 0x8a, 0xd0, 0xd8, 0x74, 0xef, 0xa6, 0x5a, 0xd8, 0xf8, 0x7f, 0xde, 0x7b, 0xfb, 0x33, 0x00, + 0x00, 0xff, 0xff, 0x2e, 0x9f, 0x3c, 0xd1, 0xc2, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -253,17 +251,10 @@ func (m *QueryInterchainAccountAddressRequest) MarshalToSizedBuffer(dAtA []byte) _ = i var l int _ = l - if len(m.ConnectionId) > 0 { - i -= len(m.ConnectionId) - copy(dAtA[i:], m.ConnectionId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ConnectionId))) - i-- - dAtA[i] = 0x12 - } - if len(m.OwnerAddress) > 0 { - i -= len(m.OwnerAddress) - copy(dAtA[i:], m.OwnerAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.OwnerAddress))) + if len(m.CounterpartyPortId) > 0 { + i -= len(m.CounterpartyPortId) + copy(dAtA[i:], m.CounterpartyPortId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.CounterpartyPortId))) i-- dAtA[i] = 0xa } @@ -317,11 +308,7 @@ func (m *QueryInterchainAccountAddressRequest) Size() (n int) { } var l int _ = l - l = len(m.OwnerAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.ConnectionId) + l = len(m.CounterpartyPortId) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -378,39 +365,7 @@ func (m *QueryInterchainAccountAddressRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OwnerAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConnectionId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CounterpartyPortId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -438,7 +393,7 @@ func (m *QueryInterchainAccountAddressRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ConnectionId = string(dAtA[iNdEx:postIndex]) + m.CounterpartyPortId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/proto/ibc/applications/interchain_accounts/v1/query.proto b/proto/ibc/applications/interchain_accounts/v1/query.proto index 1787614df32..96232982f09 100644 --- a/proto/ibc/applications/interchain_accounts/v1/query.proto +++ b/proto/ibc/applications/interchain_accounts/v1/query.proto @@ -18,9 +18,8 @@ message QueryInterchainAccountAddressRequest { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - // Owner address is the owner of the interchain account on the controller chain - string owner_address = 1; - string connection_id = 2; + // Counterparty PortID is the portID on the controller chain + string counterparty_port_id = 1; } // Query response for an interchain account address