diff --git a/CHANGELOG.md b/CHANGELOG.md index 46fcdbbb015..a3bf355b598 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,14 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements +<<<<<<< HEAD +======= +* (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. +* (modules/core/04-channel) [\#1160](https://github.com/cosmos/ibc-go/pull/1160) Improve `uint64 -> string` performance in `Logger`. +* (modules/core/04-channel) [\#1232](https://github.com/cosmos/ibc-go/pull/1232) Updating params on `NewPacketId` and moving to bottom of file. +* (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 + +>>>>>>> a187803 (chore : add selected channel version to MsgChanOpenInitResponse and MsgChanOpenTryResponse (#1279)) ### Features ### Bug Fixes diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index b77f0b03620..5b56b7fd873 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -1643,6 +1643,15 @@ is called by a relayer on Chain A. MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type. +<<<<<<< HEAD +======= +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `channel_id` | [string](#string) | | | +| `version` | [string](#string) | | | + + +>>>>>>> a187803 (chore : add selected channel version to MsgChanOpenInitResponse and MsgChanOpenTryResponse (#1279)) @@ -1675,6 +1684,11 @@ on Chain B. MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `version` | [string](#string) | | | + + diff --git a/modules/core/04-channel/keeper/events.go b/modules/core/04-channel/keeper/events.go index e1726e53668..e6507d882ad 100644 --- a/modules/core/04-channel/keeper/events.go +++ b/modules/core/04-channel/keeper/events.go @@ -10,6 +10,124 @@ import ( "github.com/cosmos/ibc-go/v2/modules/core/exported" ) +<<<<<<< HEAD +======= +// EmitChannelOpenInitEvent emits a channel open init event +func EmitChannelOpenInitEvent(ctx sdk.Context, portID string, channelID string, channel types.Channel) { + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeChannelOpenInit, + sdk.NewAttribute(types.AttributeKeyPortID, portID), + sdk.NewAttribute(types.AttributeKeyChannelID, channelID), + sdk.NewAttribute(types.AttributeCounterpartyPortID, channel.Counterparty.PortId), + sdk.NewAttribute(types.AttributeCounterpartyChannelID, channel.Counterparty.ChannelId), + sdk.NewAttribute(types.AttributeKeyConnectionID, channel.ConnectionHops[0]), + sdk.NewAttribute(types.AttributeVersion, channel.Version), + ), + }) + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + ), + }) +} + +// EmitChannelOpenTryEvent emits a channel open try event +func EmitChannelOpenTryEvent(ctx sdk.Context, portID string, channelID string, channel types.Channel) { + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeChannelOpenTry, + sdk.NewAttribute(types.AttributeKeyPortID, portID), + sdk.NewAttribute(types.AttributeKeyChannelID, channelID), + sdk.NewAttribute(types.AttributeCounterpartyPortID, channel.Counterparty.PortId), + sdk.NewAttribute(types.AttributeCounterpartyChannelID, channel.Counterparty.ChannelId), + sdk.NewAttribute(types.AttributeKeyConnectionID, channel.ConnectionHops[0]), + sdk.NewAttribute(types.AttributeVersion, channel.Version), + ), + }) + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + ), + }) +} + +// EmitChannelOpenAckEvent emits a channel open acknowledge event +func EmitChannelOpenAckEvent(ctx sdk.Context, portID string, channelID string, channel types.Channel) { + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeChannelOpenAck, + sdk.NewAttribute(types.AttributeKeyPortID, portID), + sdk.NewAttribute(types.AttributeKeyChannelID, channelID), + sdk.NewAttribute(types.AttributeCounterpartyPortID, channel.Counterparty.PortId), + sdk.NewAttribute(types.AttributeCounterpartyChannelID, channel.Counterparty.ChannelId), + sdk.NewAttribute(types.AttributeKeyConnectionID, channel.ConnectionHops[0]), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + ), + }) +} + +// EmitChannelOpenConfirmEvent emits a channel open confirm event +func EmitChannelOpenConfirmEvent(ctx sdk.Context, portID string, channelID string, channel types.Channel) { + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeChannelOpenConfirm, + sdk.NewAttribute(types.AttributeKeyPortID, portID), + sdk.NewAttribute(types.AttributeKeyChannelID, channelID), + sdk.NewAttribute(types.AttributeCounterpartyPortID, channel.Counterparty.PortId), + sdk.NewAttribute(types.AttributeCounterpartyChannelID, channel.Counterparty.ChannelId), + sdk.NewAttribute(types.AttributeKeyConnectionID, channel.ConnectionHops[0]), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + ), + }) +} + +// EmitChannelCloseInitEvent emits a channel close init event +func EmitChannelCloseInitEvent(ctx sdk.Context, portID string, channelID string, channel types.Channel) { + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeChannelCloseInit, + sdk.NewAttribute(types.AttributeKeyPortID, portID), + sdk.NewAttribute(types.AttributeKeyChannelID, channelID), + sdk.NewAttribute(types.AttributeCounterpartyPortID, channel.Counterparty.PortId), + sdk.NewAttribute(types.AttributeCounterpartyChannelID, channel.Counterparty.ChannelId), + sdk.NewAttribute(types.AttributeKeyConnectionID, channel.ConnectionHops[0]), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + ), + }) +} + +// EmitChannelCloseConfirmEvent emits a channel close confirm event +func EmitChannelCloseConfirmEvent(ctx sdk.Context, portID string, channelID string, channel types.Channel) { + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeChannelCloseConfirm, + sdk.NewAttribute(types.AttributeKeyPortID, portID), + sdk.NewAttribute(types.AttributeKeyChannelID, channelID), + sdk.NewAttribute(types.AttributeCounterpartyPortID, channel.Counterparty.PortId), + sdk.NewAttribute(types.AttributeCounterpartyChannelID, channel.Counterparty.ChannelId), + sdk.NewAttribute(types.AttributeKeyConnectionID, channel.ConnectionHops[0]), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + ), + }) +} + +>>>>>>> a187803 (chore : add selected channel version to MsgChanOpenInitResponse and MsgChanOpenTryResponse (#1279)) // EmitSendPacketEvent emits an event with packet data along with other packet information for relayer // to pick up and relay to other chain func EmitSendPacketEvent(ctx sdk.Context, packet exported.PacketI, channel types.Channel, timeoutHeight exported.Height) { diff --git a/modules/core/04-channel/types/events.go b/modules/core/04-channel/types/events.go index 81c1f38c9bb..35c8ca4b019 100644 --- a/modules/core/04-channel/types/events.go +++ b/modules/core/04-channel/types/events.go @@ -11,6 +11,7 @@ const ( AttributeKeyConnectionID = "connection_id" AttributeKeyPortID = "port_id" AttributeKeyChannelID = "channel_id" + AttributeVersion = "version" AttributeCounterpartyPortID = "counterparty_port_id" AttributeCounterpartyChannelID = "counterparty_channel_id" diff --git a/modules/core/04-channel/types/tx.pb.go b/modules/core/04-channel/types/tx.pb.go index 41d25516508..6253332b3da 100644 --- a/modules/core/04-channel/types/tx.pb.go +++ b/modules/core/04-channel/types/tx.pb.go @@ -72,6 +72,11 @@ var xxx_messageInfo_MsgChannelOpenInit proto.InternalMessageInfo // MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type. type MsgChannelOpenInitResponse struct { +<<<<<<< HEAD +======= + ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` +>>>>>>> a187803 (chore : add selected channel version to MsgChanOpenInitResponse and MsgChanOpenTryResponse (#1279)) } func (m *MsgChannelOpenInitResponse) Reset() { *m = MsgChannelOpenInitResponse{} } @@ -107,6 +112,23 @@ func (m *MsgChannelOpenInitResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgChannelOpenInitResponse proto.InternalMessageInfo +<<<<<<< HEAD +======= +func (m *MsgChannelOpenInitResponse) GetChannelId() string { + if m != nil { + return m.ChannelId + } + return "" +} + +func (m *MsgChannelOpenInitResponse) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +>>>>>>> a187803 (chore : add selected channel version to MsgChanOpenInitResponse and MsgChanOpenTryResponse (#1279)) // MsgChannelOpenInit defines a msg sent by a Relayer to try to open a channel // on Chain B. type MsgChannelOpenTry struct { @@ -156,6 +178,7 @@ var xxx_messageInfo_MsgChannelOpenTry proto.InternalMessageInfo // MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. type MsgChannelOpenTryResponse struct { + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` } func (m *MsgChannelOpenTryResponse) Reset() { *m = MsgChannelOpenTryResponse{} } @@ -191,6 +214,13 @@ func (m *MsgChannelOpenTryResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgChannelOpenTryResponse proto.InternalMessageInfo +func (m *MsgChannelOpenTryResponse) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + // MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to acknowledge // the change of channel state to TRYOPEN on Chain B. type MsgChannelOpenAck struct { @@ -855,6 +885,7 @@ func init() { func init() { proto.RegisterFile("ibc/core/channel/v1/tx.proto", fileDescriptor_bc4637e0ac3fc7b7) } var fileDescriptor_bc4637e0ac3fc7b7 = []byte{ +<<<<<<< HEAD // 1126 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xcd, 0x6e, 0xdb, 0x46, 0x10, 0xd6, 0x8f, 0x2d, 0xdb, 0x63, 0x37, 0xb6, 0x29, 0xff, 0x28, 0x94, 0x2d, 0xba, 0x3c, 0x24, @@ -927,6 +958,90 @@ var fileDescriptor_bc4637e0ac3fc7b7 = []byte{ 0xba, 0xa4, 0xd9, 0xef, 0x60, 0xc3, 0xfd, 0x8d, 0xf4, 0xe0, 0xe4, 0xbe, 0xf7, 0x27, 0xc9, 0x1c, 0xf6, 0xb0, 0xd1, 0xc8, 0xd0, 0xbf, 0x48, 0x0f, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x32, 0xba, 0xc2, 0x9b, 0xd4, 0x12, 0x00, 0x00, +======= + // 1294 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0x4d, 0x6f, 0xe2, 0x56, + 0x17, 0xc6, 0x40, 0x20, 0x39, 0xe4, 0x4d, 0x88, 0x49, 0x32, 0xc4, 0x24, 0x98, 0xd7, 0x8b, 0x49, + 0x94, 0x2a, 0x30, 0x49, 0x66, 0x54, 0x4d, 0x54, 0xa9, 0x0a, 0x94, 0x51, 0xa3, 0x36, 0x1f, 0x32, + 0xa4, 0x52, 0xd3, 0xaa, 0x08, 0xcc, 0x1d, 0x62, 0x01, 0x36, 0xb5, 0x0d, 0x33, 0xfc, 0x83, 0x51, + 0x56, 0xb3, 0x1e, 0x29, 0xd2, 0x54, 0x5d, 0x55, 0x5d, 0x4c, 0x7f, 0xc6, 0x2c, 0x67, 0xd5, 0x56, + 0x5d, 0xa0, 0x2a, 0xd9, 0x74, 0xcd, 0x2f, 0xa8, 0x7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 0x31, + 0x94, 0xe0, 0xdc, 0xb5, 0xe7, 0x72, 0x9e, 0xd4, 0x61, 0x76, 0xf4, 0x10, 0x70, 0xcd, 0x72, 0x04, + 0xe8, 0xbe, 0x78, 0x5d, 0x36, 0xc9, 0x6c, 0xe1, 0xed, 0x45, 0x92, 0x7a, 0x77, 0x91, 0xa4, 0xfe, + 0xbe, 0x48, 0x52, 0x2f, 0x2f, 0x93, 0xbe, 0x77, 0x97, 0x49, 0xdf, 0x9f, 0x97, 0x49, 0xdf, 0xc9, + 0xe3, 0x9a, 0xa8, 0x9d, 0xb6, 0x2b, 0x69, 0x41, 0x6e, 0x66, 0x04, 0x59, 0x6d, 0xca, 0x6a, 0x46, + 0xac, 0x08, 0x1b, 0x35, 0x39, 0xd3, 0xd9, 0xce, 0x34, 0xe5, 0x6a, 0xbb, 0x81, 0x54, 0xe3, 0xc7, + 0xe3, 0x83, 0x87, 0x1b, 0xe6, 0xbf, 0x47, 0xad, 0xdb, 0x42, 0x6a, 0x25, 0x84, 0xff, 0x3b, 0x6e, + 0xff, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x51, 0x2e, 0xf7, 0xe5, 0x06, 0x15, 0x00, 0x00, +>>>>>>> a187803 (chore : add selected channel version to MsgChanOpenInitResponse and MsgChanOpenTryResponse (#1279)) } // Reference imports to suppress errors if they are not otherwise used. @@ -1422,6 +1537,23 @@ func (m *MsgChannelOpenInitResponse) MarshalToSizedBuffer(dAtA []byte) (int, err _ = i var l int _ = l +<<<<<<< HEAD +======= + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintTx(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0x12 + } + if len(m.ChannelId) > 0 { + i -= len(m.ChannelId) + copy(dAtA[i:], m.ChannelId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ChannelId))) + i-- + dAtA[i] = 0xa + } +>>>>>>> a187803 (chore : add selected channel version to MsgChanOpenInitResponse and MsgChanOpenTryResponse (#1279)) return len(dAtA) - i, nil } @@ -1523,6 +1655,13 @@ func (m *MsgChannelOpenTryResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro _ = i var l int _ = l + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintTx(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } @@ -2239,6 +2378,17 @@ func (m *MsgChannelOpenInitResponse) Size() (n int) { } var l int _ = l +<<<<<<< HEAD +======= + l = len(m.ChannelId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Version) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } +>>>>>>> a187803 (chore : add selected channel version to MsgChanOpenInitResponse and MsgChanOpenTryResponse (#1279)) return n } @@ -2281,6 +2431,10 @@ func (m *MsgChannelOpenTryResponse) Size() (n int) { } var l int _ = l + l = len(m.Version) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -2746,6 +2900,73 @@ func (m *MsgChannelOpenInitResponse) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: MsgChannelOpenInitResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { +<<<<<<< HEAD +======= + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex +>>>>>>> a187803 (chore : add selected channel version to MsgChanOpenInitResponse and MsgChanOpenTryResponse (#1279)) default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3074,6 +3295,38 @@ func (m *MsgChannelOpenTryResponse) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: MsgChannelOpenTryResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 326e9ce9721..495a64c7394 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -289,7 +289,14 @@ func (k Keeper) ChannelOpenInit(goCtx context.Context, msg *channeltypes.MsgChan ), }) +<<<<<<< HEAD return &channeltypes.MsgChannelOpenInitResponse{}, nil +======= + return &channeltypes.MsgChannelOpenInitResponse{ + ChannelId: channelID, + Version: msg.Channel.Version, + }, nil +>>>>>>> a187803 (chore : add selected channel version to MsgChanOpenInitResponse and MsgChanOpenTryResponse (#1279)) } // ChannelOpenTry defines a rpc handler method for MsgChannelOpenTry. @@ -325,7 +332,9 @@ func (k Keeper) ChannelOpenTry(goCtx context.Context, msg *channeltypes.MsgChann ), }) - return &channeltypes.MsgChannelOpenTryResponse{}, nil + return &channeltypes.MsgChannelOpenTryResponse{ + Version: version, + }, nil } // ChannelOpenAck defines a rpc handler method for MsgChannelOpenAck. diff --git a/proto/ibc/core/channel/v1/tx.proto b/proto/ibc/core/channel/v1/tx.proto index dab45080ff3..8dc0bcf59a9 100644 --- a/proto/ibc/core/channel/v1/tx.proto +++ b/proto/ibc/core/channel/v1/tx.proto @@ -54,7 +54,14 @@ message MsgChannelOpenInit { } // MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type. +<<<<<<< HEAD message MsgChannelOpenInitResponse {} +======= +message MsgChannelOpenInitResponse { + string channel_id = 1 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string version = 2; +} +>>>>>>> a187803 (chore : add selected channel version to MsgChanOpenInitResponse and MsgChanOpenTryResponse (#1279)) // MsgChannelOpenInit defines a msg sent by a Relayer to try to open a channel // on Chain B. @@ -75,7 +82,9 @@ message MsgChannelOpenTry { } // MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. -message MsgChannelOpenTryResponse {} +message MsgChannelOpenTryResponse { + string version = 1; +} // MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to acknowledge // the change of channel state to TRYOPEN on Chain B.