Skip to content

Commit a187803

Browse files
authored
chore : add selected channel version to MsgChanOpenInitResponse and MsgChanOpenTryResponse (cosmos#1279)
## Description - Add a version field to MsgChannelOpenInitResponse and MsgChannelOpenTryResponse in proto and gen proto - Set the selected channel version in the [MsgChannelOpenInitResponse](https://github.com/notional-labs/ibc-go/blob/ed7a082565fadb9ce27067fa1efb56c23fafc8ef/modules/core/keeper/msg_server.go#L197) and [MsgChannelOpenTryResponse](https://github.com/notional-labs/ibc-go/blob/ed7a082565fadb9ce27067fa1efb56c23fafc8ef/modules/core/keeper/msg_server.go#L237) --- 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. - [ ] Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/ibc-go/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work. - [ ] 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) - [ ] Updated relevant documentation (`docs/`) or specification (`x/<module>/spec/`) - [ ] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code). - [ ] Added a relevant changelog entry to the `Unreleased` section in `CHANGELOG.md` - [ ] Re-reviewed `Files changed` in the Github PR explorer - [ ] Review `Codecov Report` in the comment section below once CI passes closes: cosmos#1204
1 parent 16921d9 commit a187803

File tree

7 files changed

+203
-84
lines changed

7 files changed

+203
-84
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
5050

5151
* (middleware) [\#1022](https://github.com/cosmos/ibc-go/pull/1022) Add `GetAppVersion` to the ICS4Wrapper interface. This function should be used by IBC applications to obtain their own version since the version set in the channel structure may be wrapped many times by middleware.
5252
* (modules/core/04-channel) [\#1160](https://github.com/cosmos/ibc-go/pull/1160) Improve `uint64 -> string` performance in `Logger`.
53-
* (modules/core/04-channel) [\#1232](https://github.com/cosmos/ibc-go/pull/1232) Updating params on `NewPacketId` and moving to bottom of file.
53+
* (modules/core/04-channel) [\#1232](https://github.com/cosmos/ibc-go/pull/1232) Updating params on `NewPacketId` and moving to bottom of file.
54+
* (modules/core/04-channel) [\#1279](https://github.com/cosmos/ibc-go/pull/1279) Add selected channel version to MsgChanOpenInitResponse and MsgChanOpenTryResponse. Emit channel version during OpenInit/OpenTry
5455

5556
### Features
5657

docs/ibc/proto-docs.md

+6
Original file line numberDiff line numberDiff line change
@@ -2809,6 +2809,7 @@ MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type.
28092809
| Field | Type | Label | Description |
28102810
| ----- | ---- | ----- | ----------- |
28112811
| `channel_id` | [string](#string) | | |
2812+
| `version` | [string](#string) | | |
28122813

28132814

28142815

@@ -2844,6 +2845,11 @@ value will be ignored by core IBC.
28442845
MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type.
28452846

28462847

2848+
| Field | Type | Label | Description |
2849+
| ----- | ---- | ----- | ----------- |
2850+
| `version` | [string](#string) | | |
2851+
2852+
28472853

28482854

28492855

modules/core/04-channel/keeper/events.go

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ func EmitChannelOpenInitEvent(ctx sdk.Context, portID string, channelID string,
2020
sdk.NewAttribute(types.AttributeCounterpartyPortID, channel.Counterparty.PortId),
2121
sdk.NewAttribute(types.AttributeCounterpartyChannelID, channel.Counterparty.ChannelId),
2222
sdk.NewAttribute(types.AttributeKeyConnectionID, channel.ConnectionHops[0]),
23+
sdk.NewAttribute(types.AttributeVersion, channel.Version),
2324
),
2425
})
2526

@@ -41,6 +42,7 @@ func EmitChannelOpenTryEvent(ctx sdk.Context, portID string, channelID string, c
4142
sdk.NewAttribute(types.AttributeCounterpartyPortID, channel.Counterparty.PortId),
4243
sdk.NewAttribute(types.AttributeCounterpartyChannelID, channel.Counterparty.ChannelId),
4344
sdk.NewAttribute(types.AttributeKeyConnectionID, channel.ConnectionHops[0]),
45+
sdk.NewAttribute(types.AttributeVersion, channel.Version),
4446
),
4547
})
4648
ctx.EventManager().EmitEvents(sdk.Events{

modules/core/04-channel/types/events.go

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const (
1111
AttributeKeyConnectionID = "connection_id"
1212
AttributeKeyPortID = "port_id"
1313
AttributeKeyChannelID = "channel_id"
14+
AttributeVersion = "version"
1415
AttributeCounterpartyPortID = "counterparty_port_id"
1516
AttributeCounterpartyChannelID = "counterparty_channel_id"
1617

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

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

modules/core/keeper/msg_server.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ func (k Keeper) ChannelOpenInit(goCtx context.Context, msg *channeltypes.MsgChan
194194

195195
return &channeltypes.MsgChannelOpenInitResponse{
196196
ChannelId: channelID,
197+
Version: msg.Channel.Version,
197198
}, nil
198199
}
199200

@@ -232,7 +233,9 @@ func (k Keeper) ChannelOpenTry(goCtx context.Context, msg *channeltypes.MsgChann
232233
// Write channel into state
233234
k.ChannelKeeper.WriteOpenTryChannel(ctx, msg.PortId, channelID, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.Channel.Counterparty, version)
234235

235-
return &channeltypes.MsgChannelOpenTryResponse{}, nil
236+
return &channeltypes.MsgChannelOpenTryResponse{
237+
Version: version,
238+
}, nil
236239
}
237240

238241
// ChannelOpenAck defines a rpc handler method for MsgChannelOpenAck.

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ message MsgChannelOpenInit {
6868
// MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type.
6969
message MsgChannelOpenInitResponse {
7070
string channel_id = 1 [(gogoproto.moretags) = "yaml:\"channel_id\""];
71+
string version = 2;
7172
}
7273

7374
// MsgChannelOpenInit defines a msg sent by a Relayer to try to open a channel
@@ -91,7 +92,9 @@ message MsgChannelOpenTry {
9192
}
9293

9394
// MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type.
94-
message MsgChannelOpenTryResponse {}
95+
message MsgChannelOpenTryResponse {
96+
string version = 1;
97+
}
9598

9699
// MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to acknowledge
97100
// the change of channel state to TRYOPEN on Chain B.

0 commit comments

Comments
 (0)