Skip to content

Commit 0d2b924

Browse files
rigelrozanskimergify-bot
authored and
mergify-bot
committed
Added ChannelId to MsgChannelOpenInitResponse (#848)
## Description added ChannelId to MsgChannelOpenInitResponse this is needed for distribution within interchain security Also my go imports didn't like go metrics so I had to add the go-metrics alias Supersedes: #839 Quote from @AdityaSripal Context for the other folks reviewing: This is a problem in general not just for CCV. But currently, in CCV we want to initiate a transfer channel and know what the channelID is. So if we want to do this as part of third-party module logic, it's currently impossible with the codebase. Since, if you try to use channelKeeper directly you will need portCapability; and a third party module will not have transfer's portCapability. So we have to use the MsgServer, but the response doesn't include the channelID which we need since then we want to send transfer packets over the established channel. So this is going to be an issue for any third-party module that wants to initialize a channel of a different IBC application and then use that channel to send packets over --- Before we can merge this PR, please make sure that all the following items have been checked off. If any of the checklist items are not applicable, please leave them but write a little note why. - [x] Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/ibc-go/blob/master/CONTRIBUTING.md#pr-targeting)) - [x] Linked to Github issue with discussion and accepted design OR link to spec that describes this work. - [x] Code follows the [module structure standards](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules/structure.md). - [ ] Wrote unit and integration [tests](https://github.com/cosmos/ibc-go/blob/master/CONTRIBUTING.md#testing) - [x] Updated relevant documentation (`docs/`) or specification (`x/<module>/spec/`) - [x] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code). - [x] Added a relevant changelog entry to the `Unreleased` section in `CHANGELOG.md` - [x] Re-reviewed `Files changed` in the Github PR explorer - [ ] Review `Codecov Report` in the comment section below once CI passes (cherry picked from commit 7b7eb9f)
1 parent c53829f commit 0d2b924

File tree

5 files changed

+137
-74
lines changed

5 files changed

+137
-74
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
4343

4444
### API Breaking
4545

46+
* (channel( [\#848](https://github.com/cosmos/ibc-go/pull/848) Added `ChannelId` to MsgChannelOpenInitResponse
4647
* (testing( [\#813](https://github.com/cosmos/ibc-go/pull/813) The `ack` argument to the testing function `RelayPacket` has been removed as it is no longer needed.
4748
* (testing) [\#774](https://github.com/cosmos/ibc-go/pull/774) Added `ChainID` arg to `SetupWithGenesisValSet` on the testing app. `Coordinator` generated ChainIDs now starts at index 1
4849
* (transfer) [\#675](https://github.com/cosmos/ibc-go/pull/675) Transfer `NewKeeper` now takes in an ICS4Wrapper. The ICS4Wrapper may be the IBC Channel Keeper when ICS20 is not used in a middleware stack. The ICS4Wrapper is required for applications wishing to connect middleware to ICS20.

docs/ibc/proto-docs.md

+5
Original file line numberDiff line numberDiff line change
@@ -1888,6 +1888,11 @@ is called by a relayer on Chain A.
18881888
MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type.
18891889

18901890

1891+
| Field | Type | Label | Description |
1892+
| ----- | ---- | ----- | ----------- |
1893+
| `channel_id` | [string](#string) | | |
1894+
1895+
18911896

18921897

18931898

modules/core/04-channel/types/tx.pb.go

+123-71
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/core/keeper/msg_server.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ package keeper
33
import (
44
"context"
55

6-
"github.com/armon/go-metrics"
6+
metrics "github.com/armon/go-metrics"
7+
78
"github.com/cosmos/cosmos-sdk/telemetry"
89
sdk "github.com/cosmos/cosmos-sdk/types"
910
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
@@ -191,7 +192,9 @@ func (k Keeper) ChannelOpenInit(goCtx context.Context, msg *channeltypes.MsgChan
191192
// Write channel into state
192193
k.ChannelKeeper.WriteOpenInitChannel(ctx, msg.PortId, channelID, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.Channel.Counterparty, msg.Channel.Version)
193194

194-
return &channeltypes.MsgChannelOpenInitResponse{}, nil
195+
return &channeltypes.MsgChannelOpenInitResponse{
196+
ChannelId: channelID,
197+
}, nil
195198
}
196199

197200
// ChannelOpenTry defines a rpc handler method for MsgChannelOpenTry.

proto/ibc/core/channel/v1/tx.proto

+3-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ message MsgChannelOpenInit {
5454
}
5555

5656
// MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type.
57-
message MsgChannelOpenInitResponse {}
57+
message MsgChannelOpenInitResponse {
58+
string channel_id = 1 [(gogoproto.moretags) = "yaml:\"channel_id\""];
59+
}
5860

5961
// MsgChannelOpenInit defines a msg sent by a Relayer to try to open a channel
6062
// on Chain B. The version field within the Channel field has been deprecated. Its

0 commit comments

Comments
 (0)