From f2fae7059ad935a7de7d9c04ea85486d9869ca44 Mon Sep 17 00:00:00 2001
From: pinosu <95283998+pinosu@users.noreply.github.com>
Date: Mon, 6 Mar 2023 10:07:07 +0100
Subject: [PATCH 1/2] Return IBC packet sequence number (#1225)
* Return IBC packet sequence number
* Fix review feedbacks
* Remove names to return values in DispatchMsg method
* Fix comments
(cherry picked from commit 4f1c57fc12b65b064ea8b91d69be78602826d12d)
# Conflicts:
# x/wasm/keeper/handler_plugin.go
---
docs/proto/proto-docs.md | 16 +++
proto/cosmwasm/wasm/v1/ibc.proto | 6 +
x/wasm/keeper/handler_plugin.go | 27 +++-
x/wasm/keeper/handler_plugin_test.go | 13 +-
x/wasm/types/ibc.pb.go | 199 ++++++++++++++++++++++++---
5 files changed, 237 insertions(+), 24 deletions(-)
diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md
index 956d953fe1..9c609e8b4a 100644
--- a/docs/proto/proto-docs.md
+++ b/docs/proto/proto-docs.md
@@ -37,6 +37,7 @@
- [cosmwasm/wasm/v1/ibc.proto](#cosmwasm/wasm/v1/ibc.proto)
- [MsgIBCCloseChannel](#cosmwasm.wasm.v1.MsgIBCCloseChannel)
- [MsgIBCSend](#cosmwasm.wasm.v1.MsgIBCSend)
+ - [MsgIBCSendResponse](#cosmwasm.wasm.v1.MsgIBCSendResponse)
- [cosmwasm/wasm/v1/proposal.proto](#cosmwasm/wasm/v1/proposal.proto)
- [AccessConfigUpdate](#cosmwasm.wasm.v1.AccessConfigUpdate)
@@ -573,6 +574,21 @@ MsgIBCSend
+
+
+
+### MsgIBCSendResponse
+MsgIBCSendResponse
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `sequence` | [uint64](#uint64) | | Sequence number of the IBC packet sent |
+
+
+
+
+
diff --git a/proto/cosmwasm/wasm/v1/ibc.proto b/proto/cosmwasm/wasm/v1/ibc.proto
index d880a7078f..feaad2936d 100644
--- a/proto/cosmwasm/wasm/v1/ibc.proto
+++ b/proto/cosmwasm/wasm/v1/ibc.proto
@@ -25,6 +25,12 @@ message MsgIBCSend {
bytes data = 6;
}
+// MsgIBCSendResponse
+message MsgIBCSendResponse {
+ // Sequence number of the IBC packet sent
+ uint64 sequence = 1;
+}
+
// MsgIBCCloseChannel port and channel need to be owned by the contract
message MsgIBCCloseChannel {
string channel = 2 [ (gogoproto.moretags) = "yaml:\"source_channel\"" ];
diff --git a/x/wasm/keeper/handler_plugin.go b/x/wasm/keeper/handler_plugin.go
index cd0fa58067..89f86c600f 100644
--- a/x/wasm/keeper/handler_plugin.go
+++ b/x/wasm/keeper/handler_plugin.go
@@ -151,7 +151,7 @@ func NewIBCRawPacketHandler(chk types.ChannelKeeper, cak types.CapabilityKeeper)
}
// DispatchMsg publishes a raw IBC packet onto the channel.
-func (h IBCRawPacketHandler) DispatchMsg(ctx sdk.Context, _ sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) {
+func (h IBCRawPacketHandler) DispatchMsg(ctx sdk.Context, _ sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) ([]sdk.Event, [][]byte, error) {
if msg.IBC == nil || msg.IBC.SendPacket == nil {
return nil, nil, types.ErrUnknownMsg
}
@@ -167,9 +167,34 @@ func (h IBCRawPacketHandler) DispatchMsg(ctx sdk.Context, _ sdk.AccAddress, cont
if !ok {
return nil, nil, sdkerrors.Wrap(channeltypes.ErrChannelCapabilityNotFound, "module does not own channel capability")
}
+<<<<<<< HEAD
seq, err := h.channelKeeper.SendPacket(ctx, channelCap, contractIBCPortID, contractIBCChannelID, ConvertWasmIBCTimeoutHeightToCosmosHeight(msg.IBC.SendPacket.Timeout.Block), msg.IBC.SendPacket.Timeout.Timestamp, msg.IBC.SendPacket.Data)
moduleLogger(ctx).Debug("ibc packet set", "seq", seq)
return nil, nil, err
+=======
+ packet := channeltypes.NewPacket(
+ msg.IBC.SendPacket.Data,
+ sequence,
+ contractIBCPortID,
+ contractIBCChannelID,
+ channelInfo.Counterparty.PortId,
+ channelInfo.Counterparty.ChannelId,
+ ConvertWasmIBCTimeoutHeightToCosmosHeight(msg.IBC.SendPacket.Timeout.Block),
+ msg.IBC.SendPacket.Timeout.Timestamp,
+ )
+
+ if err := h.channelKeeper.SendPacket(ctx, channelCap, packet); err != nil {
+ return nil, nil, sdkerrors.Wrap(err, "failed to send packet")
+ }
+
+ resp := &types.MsgIBCSendResponse{Sequence: sequence}
+ val, err := resp.Marshal()
+ if err != nil {
+ return nil, nil, sdkerrors.Wrap(err, "failed to marshal IBC send response")
+ }
+
+ return nil, [][]byte{val}, nil
+>>>>>>> 4f1c57f (Return IBC packet sequence number (#1225))
}
var _ Messenger = MessageHandlerFunc(nil)
diff --git a/x/wasm/keeper/handler_plugin_test.go b/x/wasm/keeper/handler_plugin_test.go
index 15e2a275a1..005b7029dc 100644
--- a/x/wasm/keeper/handler_plugin_test.go
+++ b/x/wasm/keeper/handler_plugin_test.go
@@ -303,14 +303,23 @@ func TestIBCRawPacketHandler(t *testing.T) {
capturedPacket = nil
// when
h := NewIBCRawPacketHandler(spec.chanKeeper, spec.capKeeper)
- data, evts, gotErr := h.DispatchMsg(ctx, RandomAccountAddress(t), ibcPort, wasmvmtypes.CosmosMsg{IBC: &wasmvmtypes.IBCMsg{SendPacket: &spec.srcMsg}})
+ evts, data, gotErr := h.DispatchMsg(ctx, RandomAccountAddress(t), ibcPort, wasmvmtypes.CosmosMsg{IBC: &wasmvmtypes.IBCMsg{SendPacket: &spec.srcMsg}})
// then
require.True(t, spec.expErr.Is(gotErr), "exp %v but got %#+v", spec.expErr, gotErr)
if spec.expErr != nil {
return
}
- assert.Nil(t, data)
+
assert.Nil(t, evts)
+ require.NotNil(t, data)
+
+ expMsg := types.MsgIBCSendResponse{Sequence: 1}
+
+ actualMsg := types.MsgIBCSendResponse{}
+ err := actualMsg.Unmarshal(data[0])
+ require.NoError(t, err)
+
+ assert.Equal(t, expMsg, actualMsg)
assert.Equal(t, spec.expPacketSent, capturedPacket)
})
}
diff --git a/x/wasm/types/ibc.pb.go b/x/wasm/types/ibc.pb.go
index d91e5af7e1..0e250491f9 100644
--- a/x/wasm/types/ibc.pb.go
+++ b/x/wasm/types/ibc.pb.go
@@ -79,6 +79,50 @@ func (m *MsgIBCSend) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgIBCSend proto.InternalMessageInfo
+// MsgIBCSendResponse
+type MsgIBCSendResponse struct {
+ // Sequence number of the IBC packet sent
+ Sequence uint64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"`
+}
+
+func (m *MsgIBCSendResponse) Reset() { *m = MsgIBCSendResponse{} }
+func (m *MsgIBCSendResponse) String() string { return proto.CompactTextString(m) }
+func (*MsgIBCSendResponse) ProtoMessage() {}
+func (*MsgIBCSendResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor_af0d1c43ea53c4b9, []int{1}
+}
+
+func (m *MsgIBCSendResponse) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+
+func (m *MsgIBCSendResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_MsgIBCSendResponse.Marshal(b, m, deterministic)
+ } else {
+ b = b[:cap(b)]
+ n, err := m.MarshalToSizedBuffer(b)
+ if err != nil {
+ return nil, err
+ }
+ return b[:n], nil
+ }
+}
+
+func (m *MsgIBCSendResponse) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_MsgIBCSendResponse.Merge(m, src)
+}
+
+func (m *MsgIBCSendResponse) XXX_Size() int {
+ return m.Size()
+}
+
+func (m *MsgIBCSendResponse) XXX_DiscardUnknown() {
+ xxx_messageInfo_MsgIBCSendResponse.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_MsgIBCSendResponse proto.InternalMessageInfo
+
// MsgIBCCloseChannel port and channel need to be owned by the contract
type MsgIBCCloseChannel struct {
Channel string `protobuf:"bytes,2,opt,name=channel,proto3" json:"channel,omitempty" yaml:"source_channel"`
@@ -88,7 +132,7 @@ func (m *MsgIBCCloseChannel) Reset() { *m = MsgIBCCloseChannel{} }
func (m *MsgIBCCloseChannel) String() string { return proto.CompactTextString(m) }
func (*MsgIBCCloseChannel) ProtoMessage() {}
func (*MsgIBCCloseChannel) Descriptor() ([]byte, []int) {
- return fileDescriptor_af0d1c43ea53c4b9, []int{1}
+ return fileDescriptor_af0d1c43ea53c4b9, []int{2}
}
func (m *MsgIBCCloseChannel) XXX_Unmarshal(b []byte) error {
@@ -124,32 +168,35 @@ var xxx_messageInfo_MsgIBCCloseChannel proto.InternalMessageInfo
func init() {
proto.RegisterType((*MsgIBCSend)(nil), "cosmwasm.wasm.v1.MsgIBCSend")
+ proto.RegisterType((*MsgIBCSendResponse)(nil), "cosmwasm.wasm.v1.MsgIBCSendResponse")
proto.RegisterType((*MsgIBCCloseChannel)(nil), "cosmwasm.wasm.v1.MsgIBCCloseChannel")
}
func init() { proto.RegisterFile("cosmwasm/wasm/v1/ibc.proto", fileDescriptor_af0d1c43ea53c4b9) }
var fileDescriptor_af0d1c43ea53c4b9 = []byte{
- // 299 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0xce, 0x2f, 0xce,
- 0x2d, 0x4f, 0x2c, 0xce, 0xd5, 0x07, 0x13, 0x65, 0x86, 0xfa, 0x99, 0x49, 0xc9, 0x7a, 0x05, 0x45,
- 0xf9, 0x25, 0xf9, 0x42, 0x02, 0x30, 0x39, 0x3d, 0x30, 0x51, 0x66, 0x28, 0x25, 0x92, 0x9e, 0x9f,
- 0x9e, 0x0f, 0x96, 0xd4, 0x07, 0xb1, 0x20, 0xea, 0x94, 0x1e, 0x31, 0x72, 0x71, 0xf9, 0x16, 0xa7,
- 0x7b, 0x3a, 0x39, 0x07, 0xa7, 0xe6, 0xa5, 0x08, 0x19, 0x73, 0xb1, 0x27, 0x67, 0x24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e, 0xae, 0xbe, 0x73, 0x7e, 0x71, 0x6e, 0x38, 0x2c, 0x72, 0x52, 0xf4, 0x2b,
- 0x20, 0x91, 0x54, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x0e, 0x7c, 0x63, 0x40, 0x00, 0x00,
- 0x00, 0xff, 0xff, 0x4d, 0x60, 0x95, 0x31, 0xc2, 0x01, 0x00, 0x00,
+ // 329 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x51, 0xc1, 0x4e, 0xf2, 0x40,
+ 0x10, 0xee, 0xfe, 0xe1, 0x47, 0xdd, 0xa8, 0xc1, 0x8d, 0x26, 0x95, 0x98, 0x85, 0xec, 0xc1, 0x70,
+ 0xa2, 0x12, 0x6e, 0x9e, 0x0c, 0xf5, 0x20, 0x07, 0x2f, 0xd5, 0xc4, 0xc4, 0x0b, 0x29, 0x65, 0xd2,
+ 0x36, 0x61, 0xbb, 0x95, 0xdd, 0xa2, 0xbc, 0x85, 0x8f, 0xc5, 0x91, 0xa3, 0x27, 0xa2, 0xe5, 0x0d,
+ 0x78, 0x02, 0xd3, 0xa5, 0x8b, 0x72, 0xf5, 0x32, 0x3b, 0xf3, 0x7d, 0xdf, 0xcc, 0x66, 0xe6, 0xc3,
+ 0xf5, 0x40, 0x48, 0xfe, 0xea, 0x4b, 0xee, 0xe8, 0x30, 0xed, 0x38, 0xf1, 0x30, 0x68, 0xa7, 0x13,
+ 0xa1, 0x04, 0xa9, 0x19, 0xae, 0xad, 0xc3, 0xb4, 0x53, 0x3f, 0x0d, 0x45, 0x28, 0x34, 0xe9, 0x14,
+ 0xd9, 0x46, 0xc7, 0x72, 0x84, 0xf1, 0xbd, 0x0c, 0xfb, 0x3d, 0xf7, 0x01, 0x92, 0x11, 0xe9, 0xe2,
+ 0xbd, 0x20, 0xf2, 0x93, 0x04, 0xc6, 0xf6, 0xbf, 0x26,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 0x7e, 0x07, 0x00, 0x00, 0xff,
+ 0xff, 0x2c, 0xea, 0x36, 0xb0, 0xf4, 0x01, 0x00, 0x00,
}
func (m *MsgIBCSend) Marshal() (dAtA []byte, err error) {
@@ -199,6 +246,34 @@ func (m *MsgIBCSend) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
+func (m *MsgIBCSendResponse) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
+ }
+ return dAtA[:n], nil
+}
+
+func (m *MsgIBCSendResponse) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *MsgIBCSendResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if m.Sequence != 0 {
+ i = encodeVarintIbc(dAtA, i, uint64(m.Sequence))
+ i--
+ dAtA[i] = 0x8
+ }
+ return len(dAtA) - i, nil
+}
+
func (m *MsgIBCCloseChannel) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@@ -264,6 +339,18 @@ func (m *MsgIBCSend) Size() (n int) {
return n
}
+func (m *MsgIBCSendResponse) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.Sequence != 0 {
+ n += 1 + sovIbc(uint64(m.Sequence))
+ }
+ return n
+}
+
func (m *MsgIBCCloseChannel) Size() (n int) {
if m == nil {
return 0
@@ -440,6 +527,76 @@ func (m *MsgIBCSend) Unmarshal(dAtA []byte) error {
return nil
}
+func (m *MsgIBCSendResponse) Unmarshal(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowIbc
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: MsgIBCSendResponse: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: MsgIBCSendResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType)
+ }
+ m.Sequence = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowIbc
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.Sequence |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ default:
+ iNdEx = preIndex
+ skippy, err := skipIbc(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthIbc
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+
func (m *MsgIBCCloseChannel) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
From e6a299b9a90cbd4922e43abf6d2165cd15e7ecc3 Mon Sep 17 00:00:00 2001
From: Alex Peters
Date: Mon, 6 Mar 2023 10:28:44 +0100
Subject: [PATCH 2/2] Fix merge conflict
---
x/wasm/keeper/handler_plugin.go | 20 +-------------------
1 file changed, 1 insertion(+), 19 deletions(-)
diff --git a/x/wasm/keeper/handler_plugin.go b/x/wasm/keeper/handler_plugin.go
index 89f86c600f..fb31af7762 100644
--- a/x/wasm/keeper/handler_plugin.go
+++ b/x/wasm/keeper/handler_plugin.go
@@ -167,34 +167,16 @@ func (h IBCRawPacketHandler) DispatchMsg(ctx sdk.Context, _ sdk.AccAddress, cont
if !ok {
return nil, nil, sdkerrors.Wrap(channeltypes.ErrChannelCapabilityNotFound, "module does not own channel capability")
}
-<<<<<<< HEAD
seq, err := h.channelKeeper.SendPacket(ctx, channelCap, contractIBCPortID, contractIBCChannelID, ConvertWasmIBCTimeoutHeightToCosmosHeight(msg.IBC.SendPacket.Timeout.Block), msg.IBC.SendPacket.Timeout.Timestamp, msg.IBC.SendPacket.Data)
moduleLogger(ctx).Debug("ibc packet set", "seq", seq)
- return nil, nil, err
-=======
- packet := channeltypes.NewPacket(
- msg.IBC.SendPacket.Data,
- sequence,
- contractIBCPortID,
- contractIBCChannelID,
- channelInfo.Counterparty.PortId,
- channelInfo.Counterparty.ChannelId,
- ConvertWasmIBCTimeoutHeightToCosmosHeight(msg.IBC.SendPacket.Timeout.Block),
- msg.IBC.SendPacket.Timeout.Timestamp,
- )
-
- if err := h.channelKeeper.SendPacket(ctx, channelCap, packet); err != nil {
- return nil, nil, sdkerrors.Wrap(err, "failed to send packet")
- }
- resp := &types.MsgIBCSendResponse{Sequence: sequence}
+ resp := &types.MsgIBCSendResponse{Sequence: seq}
val, err := resp.Marshal()
if err != nil {
return nil, nil, sdkerrors.Wrap(err, "failed to marshal IBC send response")
}
return nil, [][]byte{val}, nil
->>>>>>> 4f1c57f (Return IBC packet sequence number (#1225))
}
var _ Messenger = MessageHandlerFunc(nil)