From 45e9c969fd81a437770cdb7ccfb7144e7a72d935 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Mon, 22 Feb 2021 21:56:57 +0100 Subject: [PATCH 1/5] Consolidating codec.go registrations. Moving Acknowledgement result/error to its own file --- docs/core/proto-docs.md | 24 +- .../ibc/core/channel/v1/acknowledgement.proto | 19 + proto/ibc/core/channel/v1/channel.proto | 15 - .../core/04-channel/types/acknowledgement.go | 50 ++ .../04-channel/types/acknowledgement.pb.go | 461 ++++++++++++++++++ .../04-channel/types/acknowledgement_test.go | 63 +++ x/ibc/core/04-channel/types/channel.go | 45 -- x/ibc/core/04-channel/types/channel.pb.go | 424 +++------------- x/ibc/core/04-channel/types/channel_test.go | 60 --- x/ibc/core/04-channel/types/codec.go | 13 +- 10 files changed, 671 insertions(+), 503 deletions(-) create mode 100644 proto/ibc/core/channel/v1/acknowledgement.proto create mode 100644 x/ibc/core/04-channel/types/acknowledgement.go create mode 100644 x/ibc/core/04-channel/types/acknowledgement.pb.go create mode 100644 x/ibc/core/04-channel/types/acknowledgement_test.go diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 6cd751f026bb..87c27002fd0e 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -574,8 +574,10 @@ - [Msg](#ibc.applications.transfer.v1.Msg) -- [ibc/core/channel/v1/channel.proto](#ibc/core/channel/v1/channel.proto) +- [ibc/core/channel/v1/acknowledgement.proto](#ibc/core/channel/v1/acknowledgement.proto) - [Acknowledgement](#ibc.core.channel.v1.Acknowledgement) + +- [ibc/core/channel/v1/channel.proto](#ibc/core/channel/v1/channel.proto) - [Channel](#ibc.core.channel.v1.Channel) - [Counterparty](#ibc.core.channel.v1.Counterparty) - [IdentifiedChannel](#ibc.core.channel.v1.IdentifiedChannel) @@ -8230,10 +8232,10 @@ Msg defines the ibc/transfer Msg service. - +

Top

-## ibc/core/channel/v1/channel.proto +## ibc/core/channel/v1/acknowledgement.proto @@ -8258,6 +8260,22 @@ https://github.com/cosmos/ics/tree/master/spec/ics-004-channel-and-packet-semant + + + + + + + + + + + +

Top

+ +## ibc/core/channel/v1/channel.proto + + diff --git a/proto/ibc/core/channel/v1/acknowledgement.proto b/proto/ibc/core/channel/v1/acknowledgement.proto new file mode 100644 index 000000000000..de38543b7a72 --- /dev/null +++ b/proto/ibc/core/channel/v1/acknowledgement.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; +package ibc.core.channel.v1; + +option go_package = "github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/types"; + +// Acknowledgement is the recommended acknowledgement format to be used by +// app-specific protocols. +// NOTE: The field numbers 21 and 22 were explicitly chosen to avoid accidental +// conflicts with other protobuf message formats used for acknowledgements. +// The first byte of any message with this format will be the non-ASCII values +// `0xaa` (result) or `0xb2` (error). Implemented as defined by ICS: +// https://github.com/cosmos/ics/tree/master/spec/ics-004-channel-and-packet-semantics#acknowledgement-envelope +message Acknowledgement { + // response contains either a result or an error and must be non-empty + oneof response { + bytes result = 21; + string error = 22; + } +} diff --git a/proto/ibc/core/channel/v1/channel.proto b/proto/ibc/core/channel/v1/channel.proto index 302a48068953..ecd860a6b34a 100644 --- a/proto/ibc/core/channel/v1/channel.proto +++ b/proto/ibc/core/channel/v1/channel.proto @@ -130,18 +130,3 @@ message PacketState { // embedded data that represents packet state. bytes data = 4; } - -// Acknowledgement is the recommended acknowledgement format to be used by -// app-specific protocols. -// NOTE: The field numbers 21 and 22 were explicitly chosen to avoid accidental -// conflicts with other protobuf message formats used for acknowledgements. -// The first byte of any message with this format will be the non-ASCII values -// `0xaa` (result) or `0xb2` (error). Implemented as defined by ICS: -// https://github.com/cosmos/ics/tree/master/spec/ics-004-channel-and-packet-semantics#acknowledgement-envelope -message Acknowledgement { - // response contains either a result or an error and must be non-empty - oneof response { - bytes result = 21; - string error = 22; - } -} diff --git a/x/ibc/core/04-channel/types/acknowledgement.go b/x/ibc/core/04-channel/types/acknowledgement.go new file mode 100644 index 000000000000..a3f677ab4410 --- /dev/null +++ b/x/ibc/core/04-channel/types/acknowledgement.go @@ -0,0 +1,50 @@ +package types + +import ( + "strings" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +// NewResultAcknowledgement returns a new instance of Acknowledgement using an Acknowledgement_Result +// type in the Response field. +func NewResultAcknowledgement(result []byte) Acknowledgement { + return Acknowledgement{ + Response: &Acknowledgement_Result{ + Result: result, + }, + } +} + +// NewErrorAcknowledgement returns a new instance of Acknowledgement using an Acknowledgement_Error +// type in the Response field. +func NewErrorAcknowledgement(err string) Acknowledgement { + return Acknowledgement{ + Response: &Acknowledgement_Error{ + Error: err, + }, + } +} + +// GetBytes is a helper for serialising acknowledgements +func (ack Acknowledgement) GetBytes() []byte { + return sdk.MustSortJSON(SubModuleCdc.MustMarshalJSON(&ack)) +} + +// ValidateBasic performs a basic validation of the acknowledgement +func (ack Acknowledgement) ValidateBasic() error { + switch resp := ack.Response.(type) { + case *Acknowledgement_Result: + if len(resp.Result) == 0 { + return sdkerrors.Wrap(ErrInvalidAcknowledgement, "acknowledgement result cannot be empty") + } + case *Acknowledgement_Error: + if strings.TrimSpace(resp.Error) == "" { + return sdkerrors.Wrap(ErrInvalidAcknowledgement, "acknowledgement error cannot be empty") + } + default: + return sdkerrors.Wrapf(ErrInvalidAcknowledgement, "unsupported acknowledgement response field type %T", resp) + } + return nil +} diff --git a/x/ibc/core/04-channel/types/acknowledgement.pb.go b/x/ibc/core/04-channel/types/acknowledgement.pb.go new file mode 100644 index 000000000000..110ebeb66a60 --- /dev/null +++ b/x/ibc/core/04-channel/types/acknowledgement.pb.go @@ -0,0 +1,461 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: ibc/core/channel/v1/acknowledgement.proto + +package types + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Acknowledgement is the recommended acknowledgement format to be used by +// app-specific protocols. +// NOTE: The field numbers 21 and 22 were explicitly chosen to avoid accidental +// conflicts with other protobuf message formats used for acknowledgements. +// The first byte of any message with this format will be the non-ASCII values +// `0xaa` (result) or `0xb2` (error). Implemented as defined by ICS: +// https://github.com/cosmos/ics/tree/master/spec/ics-004-channel-and-packet-semantics#acknowledgement-envelope +type Acknowledgement struct { + // response contains either a result or an error and must be non-empty + // + // Types that are valid to be assigned to Response: + // *Acknowledgement_Result + // *Acknowledgement_Error + Response isAcknowledgement_Response `protobuf_oneof:"response"` +} + +func (m *Acknowledgement) Reset() { *m = Acknowledgement{} } +func (m *Acknowledgement) String() string { return proto.CompactTextString(m) } +func (*Acknowledgement) ProtoMessage() {} +func (*Acknowledgement) Descriptor() ([]byte, []int) { + return fileDescriptor_b7a0c7822358a6cd, []int{0} +} +func (m *Acknowledgement) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Acknowledgement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Acknowledgement.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 *Acknowledgement) XXX_Merge(src proto.Message) { + xxx_messageInfo_Acknowledgement.Merge(m, src) +} +func (m *Acknowledgement) XXX_Size() int { + return m.Size() +} +func (m *Acknowledgement) XXX_DiscardUnknown() { + xxx_messageInfo_Acknowledgement.DiscardUnknown(m) +} + +var xxx_messageInfo_Acknowledgement proto.InternalMessageInfo + +type isAcknowledgement_Response interface { + isAcknowledgement_Response() + MarshalTo([]byte) (int, error) + Size() int +} + +type Acknowledgement_Result struct { + Result []byte `protobuf:"bytes,21,opt,name=result,proto3,oneof" json:"result,omitempty"` +} +type Acknowledgement_Error struct { + Error string `protobuf:"bytes,22,opt,name=error,proto3,oneof" json:"error,omitempty"` +} + +func (*Acknowledgement_Result) isAcknowledgement_Response() {} +func (*Acknowledgement_Error) isAcknowledgement_Response() {} + +func (m *Acknowledgement) GetResponse() isAcknowledgement_Response { + if m != nil { + return m.Response + } + return nil +} + +func (m *Acknowledgement) GetResult() []byte { + if x, ok := m.GetResponse().(*Acknowledgement_Result); ok { + return x.Result + } + return nil +} + +func (m *Acknowledgement) GetError() string { + if x, ok := m.GetResponse().(*Acknowledgement_Error); ok { + return x.Error + } + return "" +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Acknowledgement) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*Acknowledgement_Result)(nil), + (*Acknowledgement_Error)(nil), + } +} + +func init() { + proto.RegisterType((*Acknowledgement)(nil), "ibc.core.channel.v1.Acknowledgement") +} + +func init() { + proto.RegisterFile("ibc/core/channel/v1/acknowledgement.proto", fileDescriptor_b7a0c7822358a6cd) +} + +var fileDescriptor_b7a0c7822358a6cd = []byte{ + // 214 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xcc, 0x4c, 0x4a, 0xd6, + 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0xce, 0x48, 0xcc, 0xcb, 0x4b, 0xcd, 0xd1, 0x2f, 0x33, 0xd4, + 0x4f, 0x4c, 0xce, 0xce, 0xcb, 0x2f, 0xcf, 0x49, 0x4d, 0x49, 0x4f, 0xcd, 0x4d, 0xcd, 0x2b, 0xd1, + 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0xce, 0x4c, 0x4a, 0xd6, 0x03, 0x29, 0xd5, 0x83, 0x2a, + 0xd5, 0x2b, 0x33, 0x54, 0xf2, 0xe7, 0xe2, 0x77, 0x44, 0x55, 0x2d, 0x24, 0xc1, 0xc5, 0x56, 0x94, + 0x5a, 0x5c, 0x9a, 0x53, 0x22, 0x21, 0xaa, 0xc0, 0xa8, 0xc1, 0xe3, 0xc1, 0x10, 0x04, 0xe5, 0x0b, + 0x89, 0x71, 0xb1, 0xa6, 0x16, 0x15, 0xe5, 0x17, 0x49, 0x88, 0x29, 0x30, 0x6a, 0x70, 0x7a, 0x30, + 0x04, 0x41, 0xb8, 0x4e, 0x5c, 0x5c, 0x1c, 0x45, 0xa9, 0xc5, 0x05, 0xf9, 0x79, 0xc5, 0xa9, 0x4e, + 0x41, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, + 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x65, 0x91, 0x9e, 0x59, 0x92, + 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x9f, 0x9c, 0x5f, 0x9c, 0x9b, 0x5f, 0x0c, 0xa5, 0x74, + 0x8b, 0x53, 0xb2, 0xf5, 0x2b, 0xf4, 0xe1, 0x3e, 0x31, 0x30, 0xd1, 0x85, 0x79, 0xa6, 0xa4, 0xb2, + 0x20, 0xb5, 0x38, 0x89, 0x0d, 0xec, 0x01, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x09, + 0x8f, 0xb3, 0xed, 0x00, 0x00, 0x00, +} + +func (m *Acknowledgement) 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 *Acknowledgement) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Acknowledgement) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Response != nil { + { + size := m.Response.Size() + i -= size + if _, err := m.Response.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *Acknowledgement_Result) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Acknowledgement_Result) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Result != nil { + i -= len(m.Result) + copy(dAtA[i:], m.Result) + i = encodeVarintAcknowledgement(dAtA, i, uint64(len(m.Result))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xaa + } + return len(dAtA) - i, nil +} +func (m *Acknowledgement_Error) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Acknowledgement_Error) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.Error) + copy(dAtA[i:], m.Error) + i = encodeVarintAcknowledgement(dAtA, i, uint64(len(m.Error))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xb2 + return len(dAtA) - i, nil +} +func encodeVarintAcknowledgement(dAtA []byte, offset int, v uint64) int { + offset -= sovAcknowledgement(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Acknowledgement) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Response != nil { + n += m.Response.Size() + } + return n +} + +func (m *Acknowledgement_Result) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Result != nil { + l = len(m.Result) + n += 2 + l + sovAcknowledgement(uint64(l)) + } + return n +} +func (m *Acknowledgement_Error) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Error) + n += 2 + l + sovAcknowledgement(uint64(l)) + return n +} + +func sovAcknowledgement(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozAcknowledgement(x uint64) (n int) { + return sovAcknowledgement(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Acknowledgement) 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 ErrIntOverflowAcknowledgement + } + 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: Acknowledgement: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Acknowledgement: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 21: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAcknowledgement + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthAcknowledgement + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthAcknowledgement + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := make([]byte, postIndex-iNdEx) + copy(v, dAtA[iNdEx:postIndex]) + m.Response = &Acknowledgement_Result{v} + iNdEx = postIndex + case 22: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAcknowledgement + } + 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 ErrInvalidLengthAcknowledgement + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAcknowledgement + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Response = &Acknowledgement_Error{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAcknowledgement(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAcknowledgement + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipAcknowledgement(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAcknowledgement + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAcknowledgement + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAcknowledgement + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthAcknowledgement + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupAcknowledgement + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthAcknowledgement + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthAcknowledgement = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowAcknowledgement = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupAcknowledgement = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ibc/core/04-channel/types/acknowledgement_test.go b/x/ibc/core/04-channel/types/acknowledgement_test.go new file mode 100644 index 000000000000..58074dd7bde5 --- /dev/null +++ b/x/ibc/core/04-channel/types/acknowledgement_test.go @@ -0,0 +1,63 @@ +package types_test + +import "github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/types" + +// tests acknowledgement.ValidateBasic and acknowledgement.GetBytes +func (suite TypesTestSuite) TestAcknowledgement() { + testCases := []struct { + name string + ack types.Acknowledgement + expPass bool + }{ + { + "valid successful ack", + types.NewResultAcknowledgement([]byte("success")), + true, + }, + { + "valid failed ack", + types.NewErrorAcknowledgement("error"), + true, + }, + { + "empty successful ack", + types.NewResultAcknowledgement([]byte{}), + false, + }, + { + "empty faied ack", + types.NewErrorAcknowledgement(" "), + false, + }, + { + "nil response", + types.Acknowledgement{ + Response: nil, + }, + false, + }, + } + + for _, tc := range testCases { + tc := tc + + suite.Run(tc.name, func() { + suite.SetupTest() + + err := tc.ack.ValidateBasic() + + if tc.expPass { + suite.Require().NoError(err) + } else { + suite.Require().Error(err) + } + + // expect all acks to be able to be marshaled + suite.NotPanics(func() { + bz := tc.ack.GetBytes() + suite.Require().NotNil(bz) + }) + }) + } + +} diff --git a/x/ibc/core/04-channel/types/channel.go b/x/ibc/core/04-channel/types/channel.go index 8513a8123df8..b808a220b303 100644 --- a/x/ibc/core/04-channel/types/channel.go +++ b/x/ibc/core/04-channel/types/channel.go @@ -1,9 +1,6 @@ package types import ( - "strings" - - sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" host "github.com/cosmos/cosmos-sdk/x/ibc/core/24-host" "github.com/cosmos/cosmos-sdk/x/ibc/core/exported" @@ -128,45 +125,3 @@ func (ic IdentifiedChannel) ValidateBasic() error { channel := NewChannel(ic.State, ic.Ordering, ic.Counterparty, ic.ConnectionHops, ic.Version) return channel.ValidateBasic() } - -// NewResultAcknowledgement returns a new instance of Acknowledgement using an Acknowledgement_Result -// type in the Response field. -func NewResultAcknowledgement(result []byte) Acknowledgement { - return Acknowledgement{ - Response: &Acknowledgement_Result{ - Result: result, - }, - } -} - -// NewErrorAcknowledgement returns a new instance of Acknowledgement using an Acknowledgement_Error -// type in the Response field. -func NewErrorAcknowledgement(err string) Acknowledgement { - return Acknowledgement{ - Response: &Acknowledgement_Error{ - Error: err, - }, - } -} - -// GetBytes is a helper for serialising acknowledgements -func (ack Acknowledgement) GetBytes() []byte { - return sdk.MustSortJSON(SubModuleCdc.MustMarshalJSON(&ack)) -} - -// ValidateBasic performs a basic validation of the acknowledgement -func (ack Acknowledgement) ValidateBasic() error { - switch resp := ack.Response.(type) { - case *Acknowledgement_Result: - if len(resp.Result) == 0 { - return sdkerrors.Wrap(ErrInvalidAcknowledgement, "acknowledgement result cannot be empty") - } - case *Acknowledgement_Error: - if strings.TrimSpace(resp.Error) == "" { - return sdkerrors.Wrap(ErrInvalidAcknowledgement, "acknowledgement error cannot be empty") - } - default: - return sdkerrors.Wrapf(ErrInvalidAcknowledgement, "unsupported acknowledgement response field type %T", resp) - } - return nil -} diff --git a/x/ibc/core/04-channel/types/channel.pb.go b/x/ibc/core/04-channel/types/channel.pb.go index 1384a150d578..b5c71e81d354 100644 --- a/x/ibc/core/04-channel/types/channel.pb.go +++ b/x/ibc/core/04-channel/types/channel.pb.go @@ -347,100 +347,6 @@ func (m *PacketState) XXX_DiscardUnknown() { var xxx_messageInfo_PacketState proto.InternalMessageInfo -// Acknowledgement is the recommended acknowledgement format to be used by -// app-specific protocols. -// NOTE: The field numbers 21 and 22 were explicitly chosen to avoid accidental -// conflicts with other protobuf message formats used for acknowledgements. -// The first byte of any message with this format will be the non-ASCII values -// `0xaa` (result) or `0xb2` (error). Implemented as defined by ICS: -// https://github.com/cosmos/ics/tree/master/spec/ics-004-channel-and-packet-semantics#acknowledgement-envelope -type Acknowledgement struct { - // response contains either a result or an error and must be non-empty - // - // Types that are valid to be assigned to Response: - // *Acknowledgement_Result - // *Acknowledgement_Error - Response isAcknowledgement_Response `protobuf_oneof:"response"` -} - -func (m *Acknowledgement) Reset() { *m = Acknowledgement{} } -func (m *Acknowledgement) String() string { return proto.CompactTextString(m) } -func (*Acknowledgement) ProtoMessage() {} -func (*Acknowledgement) Descriptor() ([]byte, []int) { - return fileDescriptor_c3a07336710636a0, []int{5} -} -func (m *Acknowledgement) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Acknowledgement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Acknowledgement.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 *Acknowledgement) XXX_Merge(src proto.Message) { - xxx_messageInfo_Acknowledgement.Merge(m, src) -} -func (m *Acknowledgement) XXX_Size() int { - return m.Size() -} -func (m *Acknowledgement) XXX_DiscardUnknown() { - xxx_messageInfo_Acknowledgement.DiscardUnknown(m) -} - -var xxx_messageInfo_Acknowledgement proto.InternalMessageInfo - -type isAcknowledgement_Response interface { - isAcknowledgement_Response() - MarshalTo([]byte) (int, error) - Size() int -} - -type Acknowledgement_Result struct { - Result []byte `protobuf:"bytes,21,opt,name=result,proto3,oneof" json:"result,omitempty"` -} -type Acknowledgement_Error struct { - Error string `protobuf:"bytes,22,opt,name=error,proto3,oneof" json:"error,omitempty"` -} - -func (*Acknowledgement_Result) isAcknowledgement_Response() {} -func (*Acknowledgement_Error) isAcknowledgement_Response() {} - -func (m *Acknowledgement) GetResponse() isAcknowledgement_Response { - if m != nil { - return m.Response - } - return nil -} - -func (m *Acknowledgement) GetResult() []byte { - if x, ok := m.GetResponse().(*Acknowledgement_Result); ok { - return x.Result - } - return nil -} - -func (m *Acknowledgement) GetError() string { - if x, ok := m.GetResponse().(*Acknowledgement_Error); ok { - return x.Error - } - return "" -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*Acknowledgement) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*Acknowledgement_Result)(nil), - (*Acknowledgement_Error)(nil), - } -} - func init() { proto.RegisterEnum("ibc.core.channel.v1.State", State_name, State_value) proto.RegisterEnum("ibc.core.channel.v1.Order", Order_name, Order_value) @@ -449,70 +355,66 @@ func init() { proto.RegisterType((*Counterparty)(nil), "ibc.core.channel.v1.Counterparty") proto.RegisterType((*Packet)(nil), "ibc.core.channel.v1.Packet") proto.RegisterType((*PacketState)(nil), "ibc.core.channel.v1.PacketState") - proto.RegisterType((*Acknowledgement)(nil), "ibc.core.channel.v1.Acknowledgement") } func init() { proto.RegisterFile("ibc/core/channel/v1/channel.proto", fileDescriptor_c3a07336710636a0) } var fileDescriptor_c3a07336710636a0 = []byte{ - // 904 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x55, 0xcb, 0x6e, 0xdb, 0x46, - 0x14, 0x15, 0x25, 0xea, 0x75, 0x65, 0xc9, 0xf2, 0xa4, 0x56, 0x58, 0x36, 0x11, 0x15, 0xa2, 0x0b, - 0x23, 0x45, 0xa4, 0x38, 0x0d, 0xda, 0x22, 0xab, 0x5a, 0x8f, 0xc0, 0x44, 0x03, 0xc9, 0xa0, 0xe4, - 0x45, 0xb3, 0x51, 0x65, 0x72, 0x2a, 0x11, 0x96, 0x38, 0x2a, 0x39, 0xb2, 0xeb, 0x3f, 0x08, 0xb4, - 0xea, 0x0f, 0x08, 0x28, 0x50, 0xb4, 0xbf, 0xd0, 0x5f, 0xc8, 0x32,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0xdb, 0x6a, 0x16, 0x25, 0x35, 0x3f, 0x5f, 0x54, 0xb2, 0x2b, 0x20, 0x2c, 0x98, - 0x6b, 0x22, 0x85, 0x28, 0x58, 0x98, 0x3c, 0x71, 0xdd, 0x7c, 0x7b, 0x5d, 0x96, 0xde, 0x5d, 0x97, - 0xa5, 0xbf, 0xaf, 0xcb, 0xd2, 0x2f, 0x37, 0xe5, 0xd8, 0xbb, 0x9b, 0x72, 0xec, 0xaf, 0x9b, 0x72, - 0xec, 0xf5, 0x37, 0x43, 0x87, 0x8e, 0x66, 0x67, 0x55, 0x8b, 0x4c, 0x6a, 0x16, 0xf1, 0x27, 0xc4, - 0x17, 0x9f, 0x27, 0xbe, 0x7d, 0x5e, 0xfb, 0xb9, 0xb6, 0x7a, 0x93, 0x9f, 0x3e, 0x7f, 0x12, 0x3d, - 0xf2, 0xf4, 0x6a, 0x8a, 0xfd, 0xb3, 0x14, 0x7b, 0x94, 0xbf, 0xfc, 0x2f, 0x00, 0x00, 0xff, 0xff, - 0xd7, 0x33, 0x69, 0x35, 0x05, 0x08, 0x00, 0x00, + // 853 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x55, 0xcf, 0x8e, 0xda, 0x46, + 0x18, 0xc7, 0xe0, 0x85, 0x65, 0x58, 0x58, 0x76, 0xd2, 0x6c, 0x5c, 0x37, 0xb1, 0x1d, 0xab, 0x87, + 0x55, 0xaa, 0x40, 0x36, 0x8d, 0xda, 0x2a, 0xa7, 0x06, 0x70, 0x14, 0xab, 0x11, 0xac, 0x06, 0xf6, + 0xd0, 0x5c, 0xa8, 0xd7, 0x9e, 0x82, 0x95, 0xc5, 0x43, 0xed, 0x61, 0xd3, 0x7d, 0x83, 0x88, 0x53, + 0x5f, 0x00, 0xa9, 0x52, 0xd5, 0xbe, 0x42, 0x5f, 0x21, 0xc7, 0x1c, 0x7b, 0xb2, 0xaa, 0xdd,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0x74, 0x49, 0x34, 0x21, 0x91, 0xf8, 0xdc, 0x8f, + 0xbc, 0x97, 0xcd, 0x9f, 0x9b, 0xab, 0x27, 0xf4, 0xc1, 0xa3, 0xfb, 0xe9, 0x9b, 0x4c, 0x2f, 0xa7, + 0x38, 0x3a, 0x2b, 0xb2, 0x37, 0xf4, 0xcb, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x9b, 0xa4, 0x46, + 0xd5, 0xb4, 0x07, 0x00, 0x00, } func (m *Channel) Marshal() (dAtA []byte, err error) { @@ -811,72 +713,6 @@ func (m *PacketState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Acknowledgement) 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 *Acknowledgement) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Acknowledgement) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Response != nil { - { - size := m.Response.Size() - i -= size - if _, err := m.Response.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *Acknowledgement_Result) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Acknowledgement_Result) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Result != nil { - i -= len(m.Result) - copy(dAtA[i:], m.Result) - i = encodeVarintChannel(dAtA, i, uint64(len(m.Result))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xaa - } - return len(dAtA) - i, nil -} -func (m *Acknowledgement_Error) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Acknowledgement_Error) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - i -= len(m.Error) - copy(dAtA[i:], m.Error) - i = encodeVarintChannel(dAtA, i, uint64(len(m.Error))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xb2 - return len(dAtA) - i, nil -} func encodeVarintChannel(dAtA []byte, offset int, v uint64) int { offset -= sovChannel(v) base := offset @@ -1028,41 +864,6 @@ func (m *PacketState) Size() (n int) { return n } -func (m *Acknowledgement) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Response != nil { - n += m.Response.Size() - } - return n -} - -func (m *Acknowledgement_Result) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Result != nil { - l = len(m.Result) - n += 2 + l + sovChannel(uint64(l)) - } - return n -} -func (m *Acknowledgement_Error) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Error) - n += 2 + l + sovChannel(uint64(l)) - return n -} - func sovChannel(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2067,121 +1868,6 @@ func (m *PacketState) Unmarshal(dAtA []byte) error { } return nil } -func (m *Acknowledgement) 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 ErrIntOverflowChannel - } - 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: Acknowledgement: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Acknowledgement: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 21: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowChannel - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthChannel - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthChannel - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := make([]byte, postIndex-iNdEx) - copy(v, dAtA[iNdEx:postIndex]) - m.Response = &Acknowledgement_Result{v} - iNdEx = postIndex - case 22: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowChannel - } - 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 ErrInvalidLengthChannel - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthChannel - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Response = &Acknowledgement_Error{string(dAtA[iNdEx:postIndex])} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipChannel(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthChannel - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipChannel(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ibc/core/04-channel/types/channel_test.go b/x/ibc/core/04-channel/types/channel_test.go index 30fee4443b2e..a53304972ef5 100644 --- a/x/ibc/core/04-channel/types/channel_test.go +++ b/x/ibc/core/04-channel/types/channel_test.go @@ -57,63 +57,3 @@ func TestCounterpartyValidateBasic(t *testing.T) { } } } - -// tests acknowledgement.ValidateBasic and acknowledgement.GetBytes -func (suite TypesTestSuite) TestAcknowledgement() { - testCases := []struct { - name string - ack types.Acknowledgement - expPass bool - }{ - { - "valid successful ack", - types.NewResultAcknowledgement([]byte("success")), - true, - }, - { - "valid failed ack", - types.NewErrorAcknowledgement("error"), - true, - }, - { - "empty successful ack", - types.NewResultAcknowledgement([]byte{}), - false, - }, - { - "empty faied ack", - types.NewErrorAcknowledgement(" "), - false, - }, - { - "nil response", - types.Acknowledgement{ - Response: nil, - }, - false, - }, - } - - for _, tc := range testCases { - tc := tc - - suite.Run(tc.name, func() { - suite.SetupTest() - - err := tc.ack.ValidateBasic() - - if tc.expPass { - suite.Require().NoError(err) - } else { - suite.Require().Error(err) - } - - // expect all acks to be able to be marshaled - suite.NotPanics(func() { - bz := tc.ack.GetBytes() - suite.Require().NotNil(bz) - }) - }) - } - -} diff --git a/x/ibc/core/04-channel/types/codec.go b/x/ibc/core/04-channel/types/codec.go index a74f0a7fc9c0..cfe0110264cb 100644 --- a/x/ibc/core/04-channel/types/codec.go +++ b/x/ibc/core/04-channel/types/codec.go @@ -14,25 +14,16 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { registry.RegisterInterface( "ibc.core.channel.v1.ChannelI", (*exported.ChannelI)(nil), + &Channel{}, ) registry.RegisterInterface( "ibc.core.channel.v1.CounterpartyChannelI", (*exported.CounterpartyChannelI)(nil), + &Counterparty{}, ) registry.RegisterInterface( "ibc.core.channel.v1.PacketI", (*exported.PacketI)(nil), - ) - registry.RegisterImplementations( - (*exported.ChannelI)(nil), - &Channel{}, - ) - registry.RegisterImplementations( - (*exported.CounterpartyChannelI)(nil), - &Counterparty{}, - ) - registry.RegisterImplementations( - (*exported.PacketI)(nil), &Packet{}, ) registry.RegisterImplementations( From 2a2cae8cd920e30ff1274fcceaa16930865c2e2c Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Tue, 23 Feb 2021 11:31:59 +0100 Subject: [PATCH 2/5] Updating CHANGELOG.md with #7949 improvement as requested --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11ef49af3134..0487e8a5e968 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements * (x/auth) [\#8522](https://github.com/cosmos/cosmos-sdk/pull/8522) Allow to query all stored accounts +* (x/ibc) [\#7949](https://github.com/cosmos/cosmos-sdk/issues/7949) Message `Acknowledgement` has been moved from channel.proto to acknowledgement.proto ### Bug Fixes From 3d6912d36d0156172fb899026e4d1f454b6a7927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colin=20Axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 1 Mar 2021 13:17:09 +0100 Subject: [PATCH 3/5] revert removing acknowledgement proto to its own file --- docs/core/proto-docs.md | 24 +- .../ibc/core/channel/v1/acknowledgement.proto | 19 - proto/ibc/core/channel/v1/channel.proto | 15 + x/ibc/core/04-channel/types/channel.pb.go | 424 +++++++++++++++--- 4 files changed, 387 insertions(+), 95 deletions(-) delete mode 100644 proto/ibc/core/channel/v1/acknowledgement.proto diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 9249d174e7c1..10e309d9e24a 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -574,10 +574,8 @@ - [Msg](#ibc.applications.transfer.v1.Msg) -- [ibc/core/channel/v1/acknowledgement.proto](#ibc/core/channel/v1/acknowledgement.proto) - - [Acknowledgement](#ibc.core.channel.v1.Acknowledgement) - - [ibc/core/channel/v1/channel.proto](#ibc/core/channel/v1/channel.proto) + - [Acknowledgement](#ibc.core.channel.v1.Acknowledgement) - [Channel](#ibc.core.channel.v1.Channel) - [Counterparty](#ibc.core.channel.v1.Counterparty) - [IdentifiedChannel](#ibc.core.channel.v1.IdentifiedChannel) @@ -8234,10 +8232,10 @@ Msg defines the ibc/transfer Msg service. - +

Top

-## ibc/core/channel/v1/acknowledgement.proto +## ibc/core/channel/v1/channel.proto @@ -8262,22 +8260,6 @@ https://github.com/cosmos/ics/tree/master/spec/ics-004-channel-and-packet-semant - - - - - - - - - - - -

Top

- -## ibc/core/channel/v1/channel.proto - - diff --git a/proto/ibc/core/channel/v1/acknowledgement.proto b/proto/ibc/core/channel/v1/acknowledgement.proto deleted file mode 100644 index de38543b7a72..000000000000 --- a/proto/ibc/core/channel/v1/acknowledgement.proto +++ /dev/null @@ -1,19 +0,0 @@ -syntax = "proto3"; -package ibc.core.channel.v1; - -option go_package = "github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/types"; - -// Acknowledgement is the recommended acknowledgement format to be used by -// app-specific protocols. -// NOTE: The field numbers 21 and 22 were explicitly chosen to avoid accidental -// conflicts with other protobuf message formats used for acknowledgements. -// The first byte of any message with this format will be the non-ASCII values -// `0xaa` (result) or `0xb2` (error). Implemented as defined by ICS: -// https://github.com/cosmos/ics/tree/master/spec/ics-004-channel-and-packet-semantics#acknowledgement-envelope -message Acknowledgement { - // response contains either a result or an error and must be non-empty - oneof response { - bytes result = 21; - string error = 22; - } -} diff --git a/proto/ibc/core/channel/v1/channel.proto b/proto/ibc/core/channel/v1/channel.proto index ecd860a6b34a..302a48068953 100644 --- a/proto/ibc/core/channel/v1/channel.proto +++ b/proto/ibc/core/channel/v1/channel.proto @@ -130,3 +130,18 @@ message PacketState { // embedded data that represents packet state. bytes data = 4; } + +// Acknowledgement is the recommended acknowledgement format to be used by +// app-specific protocols. +// NOTE: The field numbers 21 and 22 were explicitly chosen to avoid accidental +// conflicts with other protobuf message formats used for acknowledgements. +// The first byte of any message with this format will be the non-ASCII values +// `0xaa` (result) or `0xb2` (error). Implemented as defined by ICS: +// https://github.com/cosmos/ics/tree/master/spec/ics-004-channel-and-packet-semantics#acknowledgement-envelope +message Acknowledgement { + // response contains either a result or an error and must be non-empty + oneof response { + bytes result = 21; + string error = 22; + } +} diff --git a/x/ibc/core/04-channel/types/channel.pb.go b/x/ibc/core/04-channel/types/channel.pb.go index b5c71e81d354..1384a150d578 100644 --- a/x/ibc/core/04-channel/types/channel.pb.go +++ b/x/ibc/core/04-channel/types/channel.pb.go @@ -347,6 +347,100 @@ func (m *PacketState) XXX_DiscardUnknown() { var xxx_messageInfo_PacketState proto.InternalMessageInfo +// Acknowledgement is the recommended acknowledgement format to be used by +// app-specific protocols. +// NOTE: The field numbers 21 and 22 were explicitly chosen to avoid accidental +// conflicts with other protobuf message formats used for acknowledgements. +// The first byte of any message with this format will be the non-ASCII values +// `0xaa` (result) or `0xb2` (error). Implemented as defined by ICS: +// https://github.com/cosmos/ics/tree/master/spec/ics-004-channel-and-packet-semantics#acknowledgement-envelope +type Acknowledgement struct { + // response contains either a result or an error and must be non-empty + // + // Types that are valid to be assigned to Response: + // *Acknowledgement_Result + // *Acknowledgement_Error + Response isAcknowledgement_Response `protobuf_oneof:"response"` +} + +func (m *Acknowledgement) Reset() { *m = Acknowledgement{} } +func (m *Acknowledgement) String() string { return proto.CompactTextString(m) } +func (*Acknowledgement) ProtoMessage() {} +func (*Acknowledgement) Descriptor() ([]byte, []int) { + return fileDescriptor_c3a07336710636a0, []int{5} +} +func (m *Acknowledgement) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Acknowledgement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Acknowledgement.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 *Acknowledgement) XXX_Merge(src proto.Message) { + xxx_messageInfo_Acknowledgement.Merge(m, src) +} +func (m *Acknowledgement) XXX_Size() int { + return m.Size() +} +func (m *Acknowledgement) XXX_DiscardUnknown() { + xxx_messageInfo_Acknowledgement.DiscardUnknown(m) +} + +var xxx_messageInfo_Acknowledgement proto.InternalMessageInfo + +type isAcknowledgement_Response interface { + isAcknowledgement_Response() + MarshalTo([]byte) (int, error) + Size() int +} + +type Acknowledgement_Result struct { + Result []byte `protobuf:"bytes,21,opt,name=result,proto3,oneof" json:"result,omitempty"` +} +type Acknowledgement_Error struct { + Error string `protobuf:"bytes,22,opt,name=error,proto3,oneof" json:"error,omitempty"` +} + +func (*Acknowledgement_Result) isAcknowledgement_Response() {} +func (*Acknowledgement_Error) isAcknowledgement_Response() {} + +func (m *Acknowledgement) GetResponse() isAcknowledgement_Response { + if m != nil { + return m.Response + } + return nil +} + +func (m *Acknowledgement) GetResult() []byte { + if x, ok := m.GetResponse().(*Acknowledgement_Result); ok { + return x.Result + } + return nil +} + +func (m *Acknowledgement) GetError() string { + if x, ok := m.GetResponse().(*Acknowledgement_Error); ok { + return x.Error + } + return "" +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Acknowledgement) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*Acknowledgement_Result)(nil), + (*Acknowledgement_Error)(nil), + } +} + func init() { proto.RegisterEnum("ibc.core.channel.v1.State", State_name, State_value) proto.RegisterEnum("ibc.core.channel.v1.Order", Order_name, Order_value) @@ -355,66 +449,70 @@ func init() { proto.RegisterType((*Counterparty)(nil), "ibc.core.channel.v1.Counterparty") proto.RegisterType((*Packet)(nil), "ibc.core.channel.v1.Packet") proto.RegisterType((*PacketState)(nil), "ibc.core.channel.v1.PacketState") + proto.RegisterType((*Acknowledgement)(nil), "ibc.core.channel.v1.Acknowledgement") } func init() { proto.RegisterFile("ibc/core/channel/v1/channel.proto", fileDescriptor_c3a07336710636a0) } var fileDescriptor_c3a07336710636a0 = []byte{ - // 853 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x55, 0xcf, 0x8e, 0xda, 0x46, - 0x18, 0xc7, 0xe0, 0x85, 0x65, 0x58, 0x58, 0x76, 0xd2, 0x6c, 0x5c, 0x37, 0xb1, 0x1d, 0xab, 0x87, - 0x55, 0xaa, 0x40, 0x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, 0x49, 0x15, - 0xa2, 0x60, 0x61, 0xf2, 0xc4, 0x2d, 0xf4, 0xe6, 0x4a, 0x93, 0xde, 0x5e, 0x69, 0xd2, 0xdf, 0x57, - 0x9a, 0xf4, 0xcb, 0xb5, 0x96, 0x7b, 0x7b, 0xad, 0xe5, 0xfe, 0xba, 0xd6, 0x72, 0x2f, 0xbe, 0x19, - 0xf9, 0x74, 0x3c, 0x3b, 0x6b, 0xb8, 0x64, 0xd2, 0x74, 0x49, 0x34, 0x21, 0x91, 0xf8, 0xdc, 0x8f, - 0xbc, 0x97, 0xcd, 0x9f, 0x9b, 0xab, 0x27, 0xf4, 0xc1, 0xa3, 0xfb, 0xe9, 0x9b, 0x4c, 0x2f, 0xa7, - 0x38, 0x3a, 0x2b, 0xb2, 0x37, 0xf4, 0xcb, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x9b, 0xa4, 0x46, - 0xd5, 0xb4, 0x07, 0x00, 0x00, + // 904 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x55, 0xcb, 0x6e, 0xdb, 0x46, + 0x14, 0x15, 0x25, 0xea, 0x75, 0x65, 0xc9, 0xf2, 0xa4, 0x56, 0x58, 0x36, 0x11, 0x15, 0xa2, 0x0b, + 0x23, 0x45, 0xa4, 0x38, 0x0d, 0xda, 0x22, 0xab, 0x5a, 0x8f, 0xc0, 0x44, 0x03, 0xc9, 0xa0, 0xe4, + 0x45, 0xb3, 0x51, 0x65, 0x72, 0x2a, 0x11, 0x96, 0x38, 0x2a, 0x39, 0xb2, 0xeb, 0x3f, 0x08, 0xb4, + 0xea, 0x0f, 0x08, 0x28, 0x50, 0xb4, 0xbf, 0xd0, 0x5f, 0xc8, 0x32, 0xcb, 0xae, 0x88, 0xc2, 0x5e, + 0x74, 0xaf, 0x1f, 0x68, 0xc1, 0x99, 0xa1, 0x1e, 0x4e, 0xe0, 0x65, 0x57,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58, 0x98, 0x3c, 0x71, 0xdd, 0x7c, 0x7b, 0x5d, 0x96, 0xde, 0x5d, 0x97, + 0xa5, 0xbf, 0xaf, 0xcb, 0xd2, 0x2f, 0x37, 0xe5, 0xd8, 0xbb, 0x9b, 0x72, 0xec, 0xaf, 0x9b, 0x72, + 0xec, 0xf5, 0x37, 0x43, 0x87, 0x8e, 0x66, 0x67, 0x55, 0x8b, 0x4c, 0x6a, 0x16, 0xf1, 0x27, 0xc4, + 0x17, 0x9f, 0x27, 0xbe, 0x7d, 0x5e, 0xfb, 0xb9, 0xb6, 0x7a, 0x93, 0x9f, 0x3e, 0x7f, 0x12, 0x3d, + 0xf2, 0xf4, 0x6a, 0x8a, 0xfd, 0xb3, 0x14, 0x7b, 0x94, 0xbf, 0xfc, 0x2f, 0x00, 0x00, 0xff, 0xff, + 0xd7, 0x33, 0x69, 0x35, 0x05, 0x08, 0x00, 0x00, } func (m *Channel) Marshal() (dAtA []byte, err error) { @@ -713,6 +811,72 @@ func (m *PacketState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *Acknowledgement) 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 *Acknowledgement) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Acknowledgement) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Response != nil { + { + size := m.Response.Size() + i -= size + if _, err := m.Response.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *Acknowledgement_Result) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Acknowledgement_Result) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Result != nil { + i -= len(m.Result) + copy(dAtA[i:], m.Result) + i = encodeVarintChannel(dAtA, i, uint64(len(m.Result))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xaa + } + return len(dAtA) - i, nil +} +func (m *Acknowledgement_Error) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Acknowledgement_Error) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.Error) + copy(dAtA[i:], m.Error) + i = encodeVarintChannel(dAtA, i, uint64(len(m.Error))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xb2 + return len(dAtA) - i, nil +} func encodeVarintChannel(dAtA []byte, offset int, v uint64) int { offset -= sovChannel(v) base := offset @@ -864,6 +1028,41 @@ func (m *PacketState) Size() (n int) { return n } +func (m *Acknowledgement) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Response != nil { + n += m.Response.Size() + } + return n +} + +func (m *Acknowledgement_Result) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Result != nil { + l = len(m.Result) + n += 2 + l + sovChannel(uint64(l)) + } + return n +} +func (m *Acknowledgement_Error) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Error) + n += 2 + l + sovChannel(uint64(l)) + return n +} + func sovChannel(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1868,6 +2067,121 @@ func (m *PacketState) Unmarshal(dAtA []byte) error { } return nil } +func (m *Acknowledgement) 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 ErrIntOverflowChannel + } + 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: Acknowledgement: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Acknowledgement: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 21: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowChannel + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthChannel + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthChannel + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := make([]byte, postIndex-iNdEx) + copy(v, dAtA[iNdEx:postIndex]) + m.Response = &Acknowledgement_Result{v} + iNdEx = postIndex + case 22: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowChannel + } + 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 ErrInvalidLengthChannel + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthChannel + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Response = &Acknowledgement_Error{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipChannel(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthChannel + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipChannel(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From 4e660dbc5fef0b89c9a195286b904c33b805d736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colin=20Axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 1 Mar 2021 13:18:11 +0100 Subject: [PATCH 4/5] update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fadb4c4a1ba..90f89efa72c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,7 +65,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/bank) [\#8614](https://github.com/cosmos/cosmos-sdk/issues/8614) Add `Name` and `Symbol` fields to denom metadata * (x/auth) [\#8522](https://github.com/cosmos/cosmos-sdk/pull/8522) Allow to query all stored accounts -* (x/ibc) [\#7949](https://github.com/cosmos/cosmos-sdk/issues/7949) Message `Acknowledgement` has been moved from channel.proto to acknowledgement.proto +* (x/ibc) [\#7949](https://github.com/cosmos/cosmos-sdk/issues/7949) Standardized channel `Acknowledgement` moved to its own file. Codec registration redundancy removed. * (crypto/types) [\#8600](https://github.com/cosmos/cosmos-sdk/pull/8600) `CompactBitArray`: optimize the `NumTrueBitsBefore` method and add an `Equal` method. * (store/cachekv), (x/bank/types) [\#8719](https://github.com/cosmos/cosmos-sdk/pull/8719) algorithmically fix pathologically slow code From ba666f48692a8047d8c54659bfe4c2cde06a694a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colin=20Axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 1 Mar 2021 13:20:46 +0100 Subject: [PATCH 5/5] remove unnecessary pb.go file --- .../04-channel/types/acknowledgement.pb.go | 461 ------------------ 1 file changed, 461 deletions(-) delete mode 100644 x/ibc/core/04-channel/types/acknowledgement.pb.go diff --git a/x/ibc/core/04-channel/types/acknowledgement.pb.go b/x/ibc/core/04-channel/types/acknowledgement.pb.go deleted file mode 100644 index 110ebeb66a60..000000000000 --- a/x/ibc/core/04-channel/types/acknowledgement.pb.go +++ /dev/null @@ -1,461 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: ibc/core/channel/v1/acknowledgement.proto - -package types - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Acknowledgement is the recommended acknowledgement format to be used by -// app-specific protocols. -// NOTE: The field numbers 21 and 22 were explicitly chosen to avoid accidental -// conflicts with other protobuf message formats used for acknowledgements. -// The first byte of any message with this format will be the non-ASCII values -// `0xaa` (result) or `0xb2` (error). Implemented as defined by ICS: -// https://github.com/cosmos/ics/tree/master/spec/ics-004-channel-and-packet-semantics#acknowledgement-envelope -type Acknowledgement struct { - // response contains either a result or an error and must be non-empty - // - // Types that are valid to be assigned to Response: - // *Acknowledgement_Result - // *Acknowledgement_Error - Response isAcknowledgement_Response `protobuf_oneof:"response"` -} - -func (m *Acknowledgement) Reset() { *m = Acknowledgement{} } -func (m *Acknowledgement) String() string { return proto.CompactTextString(m) } -func (*Acknowledgement) ProtoMessage() {} -func (*Acknowledgement) Descriptor() ([]byte, []int) { - return fileDescriptor_b7a0c7822358a6cd, []int{0} -} -func (m *Acknowledgement) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Acknowledgement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Acknowledgement.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 *Acknowledgement) XXX_Merge(src proto.Message) { - xxx_messageInfo_Acknowledgement.Merge(m, src) -} -func (m *Acknowledgement) XXX_Size() int { - return m.Size() -} -func (m *Acknowledgement) XXX_DiscardUnknown() { - xxx_messageInfo_Acknowledgement.DiscardUnknown(m) -} - -var xxx_messageInfo_Acknowledgement proto.InternalMessageInfo - -type isAcknowledgement_Response interface { - isAcknowledgement_Response() - MarshalTo([]byte) (int, error) - Size() int -} - -type Acknowledgement_Result struct { - Result []byte `protobuf:"bytes,21,opt,name=result,proto3,oneof" json:"result,omitempty"` -} -type Acknowledgement_Error struct { - Error string `protobuf:"bytes,22,opt,name=error,proto3,oneof" json:"error,omitempty"` -} - -func (*Acknowledgement_Result) isAcknowledgement_Response() {} -func (*Acknowledgement_Error) isAcknowledgement_Response() {} - -func (m *Acknowledgement) GetResponse() isAcknowledgement_Response { - if m != nil { - return m.Response - } - return nil -} - -func (m *Acknowledgement) GetResult() []byte { - if x, ok := m.GetResponse().(*Acknowledgement_Result); ok { - return x.Result - } - return nil -} - -func (m *Acknowledgement) GetError() string { - if x, ok := m.GetResponse().(*Acknowledgement_Error); ok { - return x.Error - } - return "" -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*Acknowledgement) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*Acknowledgement_Result)(nil), - (*Acknowledgement_Error)(nil), - } -} - -func init() { - proto.RegisterType((*Acknowledgement)(nil), "ibc.core.channel.v1.Acknowledgement") -} - -func init() { - proto.RegisterFile("ibc/core/channel/v1/acknowledgement.proto", fileDescriptor_b7a0c7822358a6cd) -} - -var fileDescriptor_b7a0c7822358a6cd = []byte{ - // 214 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xcc, 0x4c, 0x4a, 0xd6, - 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0xce, 0x48, 0xcc, 0xcb, 0x4b, 0xcd, 0xd1, 0x2f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x00, 0x00, -} - -func (m *Acknowledgement) 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 *Acknowledgement) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Acknowledgement) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Response != nil { - { - size := m.Response.Size() - i -= size - if _, err := m.Response.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *Acknowledgement_Result) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Acknowledgement_Result) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Result != nil { - i -= len(m.Result) - copy(dAtA[i:], m.Result) - i = encodeVarintAcknowledgement(dAtA, i, uint64(len(m.Result))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xaa - } - return len(dAtA) - i, nil -} -func (m *Acknowledgement_Error) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Acknowledgement_Error) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - i -= len(m.Error) - copy(dAtA[i:], m.Error) - i = encodeVarintAcknowledgement(dAtA, i, uint64(len(m.Error))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xb2 - return len(dAtA) - i, nil -} -func encodeVarintAcknowledgement(dAtA []byte, offset int, v uint64) int { - offset -= sovAcknowledgement(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Acknowledgement) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Response != nil { - n += m.Response.Size() - } - return n -} - -func (m *Acknowledgement_Result) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Result != nil { - l = len(m.Result) - n += 2 + l + sovAcknowledgement(uint64(l)) - } - return n -} -func (m *Acknowledgement_Error) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Error) - n += 2 + l + sovAcknowledgement(uint64(l)) - return n -} - -func sovAcknowledgement(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozAcknowledgement(x uint64) (n int) { - return sovAcknowledgement(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Acknowledgement) 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 ErrIntOverflowAcknowledgement - } - 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: Acknowledgement: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Acknowledgement: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 21: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAcknowledgement - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAcknowledgement - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAcknowledgement - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := make([]byte, postIndex-iNdEx) - copy(v, dAtA[iNdEx:postIndex]) - m.Response = &Acknowledgement_Result{v} - iNdEx = postIndex - case 22: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAcknowledgement - } - 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 ErrInvalidLengthAcknowledgement - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAcknowledgement - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Response = &Acknowledgement_Error{string(dAtA[iNdEx:postIndex])} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAcknowledgement(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAcknowledgement - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipAcknowledgement(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAcknowledgement - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAcknowledgement - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAcknowledgement - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthAcknowledgement - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupAcknowledgement - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthAcknowledgement - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthAcknowledgement = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowAcknowledgement = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupAcknowledgement = fmt.Errorf("proto: unexpected end of group") -)