From 6c762ad2ae0c7a7d1a51c2999cbf349ccfe62061 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Sun, 1 Dec 2024 23:23:34 +0100 Subject: [PATCH] chore: ensure service module msg responses are non-empty --- api/poktroll/service/tx.pulsar.go | 176 +++++++++++++----- proto/poktroll/service/tx.proto | 4 +- x/service/keeper/msg_server_add_service.go | 4 +- .../keeper/msg_server_add_service_test.go | 3 +- x/service/types/tx.pb.go | 135 ++++++++++---- 5 files changed, 240 insertions(+), 82 deletions(-) diff --git a/api/poktroll/service/tx.pulsar.go b/api/poktroll/service/tx.pulsar.go index ae03ea849..f6f3bd757 100644 --- a/api/poktroll/service/tx.pulsar.go +++ b/api/poktroll/service/tx.pulsar.go @@ -2410,12 +2410,14 @@ func (x *fastReflection_MsgAddService) ProtoMethods() *protoiface.Methods { } var ( - md_MsgAddServiceResponse protoreflect.MessageDescriptor + md_MsgAddServiceResponse protoreflect.MessageDescriptor + fd_MsgAddServiceResponse_service protoreflect.FieldDescriptor ) func init() { file_poktroll_service_tx_proto_init() md_MsgAddServiceResponse = File_poktroll_service_tx_proto.Messages().ByName("MsgAddServiceResponse") + fd_MsgAddServiceResponse_service = md_MsgAddServiceResponse.Fields().ByName("service") } var _ protoreflect.Message = (*fastReflection_MsgAddServiceResponse)(nil) @@ -2483,6 +2485,12 @@ func (x *fastReflection_MsgAddServiceResponse) Interface() protoreflect.ProtoMes // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_MsgAddServiceResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Service != nil { + value := protoreflect.ValueOfMessage(x.Service.ProtoReflect()) + if !f(fd_MsgAddServiceResponse_service, value) { + return + } + } } // Has reports whether a field is populated. @@ -2498,6 +2506,8 @@ func (x *fastReflection_MsgAddServiceResponse) Range(f func(protoreflect.FieldDe // a repeated field is populated if it is non-empty. func (x *fastReflection_MsgAddServiceResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { + case "poktroll.service.MsgAddServiceResponse.service": + return x.Service != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddServiceResponse")) @@ -2514,6 +2524,8 @@ func (x *fastReflection_MsgAddServiceResponse) Has(fd protoreflect.FieldDescript // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgAddServiceResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { + case "poktroll.service.MsgAddServiceResponse.service": + x.Service = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddServiceResponse")) @@ -2530,6 +2542,9 @@ func (x *fastReflection_MsgAddServiceResponse) Clear(fd protoreflect.FieldDescri // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_MsgAddServiceResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { + case "poktroll.service.MsgAddServiceResponse.service": + value := x.Service + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddServiceResponse")) @@ -2550,6 +2565,8 @@ func (x *fastReflection_MsgAddServiceResponse) Get(descriptor protoreflect.Field // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgAddServiceResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { + case "poktroll.service.MsgAddServiceResponse.service": + x.Service = value.Message().Interface().(*shared.Service) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddServiceResponse")) @@ -2570,6 +2587,11 @@ func (x *fastReflection_MsgAddServiceResponse) Set(fd protoreflect.FieldDescript // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgAddServiceResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "poktroll.service.MsgAddServiceResponse.service": + if x.Service == nil { + x.Service = new(shared.Service) + } + return protoreflect.ValueOfMessage(x.Service.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddServiceResponse")) @@ -2583,6 +2605,9 @@ func (x *fastReflection_MsgAddServiceResponse) Mutable(fd protoreflect.FieldDesc // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_MsgAddServiceResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "poktroll.service.MsgAddServiceResponse.service": + m := new(shared.Service) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddServiceResponse")) @@ -2652,6 +2677,10 @@ func (x *fastReflection_MsgAddServiceResponse) ProtoMethods() *protoiface.Method var n int var l int _ = l + if x.Service != nil { + l = options.Size(x.Service) + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -2681,6 +2710,20 @@ func (x *fastReflection_MsgAddServiceResponse) ProtoMethods() *protoiface.Method i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.Service != nil { + encoded, err := options.Marshal(x.Service) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) } else { @@ -2730,6 +2773,42 @@ func (x *fastReflection_MsgAddServiceResponse) ProtoMethods() *protoiface.Method return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgAddServiceResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Service", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Service == nil { + x.Service = &shared.Service{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Service); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -3015,6 +3094,8 @@ type MsgAddServiceResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + Service *shared.Service `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` } func (x *MsgAddServiceResponse) Reset() { @@ -3037,6 +3118,13 @@ func (*MsgAddServiceResponse) Descriptor() ([]byte, []int) { return file_poktroll_service_tx_proto_rawDescGZIP(), []int{5} } +func (x *MsgAddServiceResponse) GetService() *shared.Service { + if x != nil { + return x.Service + } + return nil +} + var File_poktroll_service_tx_proto protoreflect.FileDescriptor var file_poktroll_service_tx_proto_rawDesc = []byte{ @@ -3094,38 +3182,41 @@ var file_poktroll_service_tx_proto_rawDesc = []byte{ 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x3a, 0x12, 0x82, 0xe7, 0xb0, 0x2a, 0x0d, 0x6f, 0x77, - 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x17, 0x0a, 0x15, 0x4d, + 0x6e, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x4b, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x9d, 0x02, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x0c, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x21, 0x2e, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, - 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, + 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x32, 0x9d, 0x02, 0x0a, 0x03, 0x4d, 0x73, 0x67, + 0x12, 0x5c, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x12, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, + 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x20, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, + 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x0b, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x20, 0x2e, 0x70, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x28, 0x2e, 0x70, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, - 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x12, 0x1f, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x1a, 0x27, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, - 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xa7, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, - 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, - 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, - 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0a, 0x41, 0x64, 0x64, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x1f, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x64, + 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x1a, 0x27, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x41, + 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xa7, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, + 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xca, 0x02, 0x10, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xe2, + 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3157,17 +3248,18 @@ var file_poktroll_service_tx_proto_depIdxs = []int32{ 7, // 1: poktroll.service.MsgUpdateParam.as_coin:type_name -> cosmos.base.v1beta1.Coin 6, // 2: poktroll.service.MsgUpdateParamResponse.params:type_name -> poktroll.service.Params 8, // 3: poktroll.service.MsgAddService.service:type_name -> poktroll.shared.Service - 0, // 4: poktroll.service.Msg.UpdateParams:input_type -> poktroll.service.MsgUpdateParams - 2, // 5: poktroll.service.Msg.UpdateParam:input_type -> poktroll.service.MsgUpdateParam - 4, // 6: poktroll.service.Msg.AddService:input_type -> poktroll.service.MsgAddService - 1, // 7: poktroll.service.Msg.UpdateParams:output_type -> poktroll.service.MsgUpdateParamsResponse - 3, // 8: poktroll.service.Msg.UpdateParam:output_type -> poktroll.service.MsgUpdateParamResponse - 5, // 9: poktroll.service.Msg.AddService:output_type -> poktroll.service.MsgAddServiceResponse - 7, // [7:10] is the sub-list for method output_type - 4, // [4:7] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name + 8, // 4: poktroll.service.MsgAddServiceResponse.service:type_name -> poktroll.shared.Service + 0, // 5: poktroll.service.Msg.UpdateParams:input_type -> poktroll.service.MsgUpdateParams + 2, // 6: poktroll.service.Msg.UpdateParam:input_type -> poktroll.service.MsgUpdateParam + 4, // 7: poktroll.service.Msg.AddService:input_type -> poktroll.service.MsgAddService + 1, // 8: poktroll.service.Msg.UpdateParams:output_type -> poktroll.service.MsgUpdateParamsResponse + 3, // 9: poktroll.service.Msg.UpdateParam:output_type -> poktroll.service.MsgUpdateParamResponse + 5, // 10: poktroll.service.Msg.AddService:output_type -> poktroll.service.MsgAddServiceResponse + 8, // [8:11] is the sub-list for method output_type + 5, // [5:8] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_poktroll_service_tx_proto_init() } diff --git a/proto/poktroll/service/tx.proto b/proto/poktroll/service/tx.proto index 44bc0c988..e98b70b7f 100644 --- a/proto/poktroll/service/tx.proto +++ b/proto/poktroll/service/tx.proto @@ -72,5 +72,7 @@ message MsgAddService { poktroll.shared.Service service = 2 [(gogoproto.nullable) = false]; // The Service being added to the network } -message MsgAddServiceResponse {} +message MsgAddServiceResponse { + poktroll.shared.Service service = 1; +} diff --git a/x/service/keeper/msg_server_add_service.go b/x/service/keeper/msg_server_add_service.go index 52fe8365e..d52278181 100644 --- a/x/service/keeper/msg_server_add_service.go +++ b/x/service/keeper/msg_server_add_service.go @@ -95,5 +95,7 @@ func (k msgServer) AddService( k.SetService(ctx, msg.Service) isSuccessful = true - return &types.MsgAddServiceResponse{}, nil + return &types.MsgAddServiceResponse{ + Service: &msg.Service, + }, nil } diff --git a/x/service/keeper/msg_server_add_service_test.go b/x/service/keeper/msg_server_add_service_test.go index 48268469b..ce913e568 100644 --- a/x/service/keeper/msg_server_add_service_test.go +++ b/x/service/keeper/msg_server_add_service_test.go @@ -43,11 +43,12 @@ func TestMsgServer_AddService(t *testing.T) { keepertest.AddAccToAccMapCoins(t, oldServiceOwnerAddr, volatile.DenomuPOKT, oneUPOKTGreaterThanFee) // Add the service to the store - _, err := srv.AddService(ctx, &types.MsgAddService{ + addSvcRes, err := srv.AddService(ctx, &types.MsgAddService{ OwnerAddress: oldServiceOwnerAddr, Service: oldService, }) require.NoError(t, err) + require.Equal(t, &oldService, addSvcRes.GetService()) // Validate the service was added serviceFound, found := k.GetService(ctx, oldService.Id) diff --git a/x/service/types/tx.pb.go b/x/service/types/tx.pb.go index 098020211..f35ca432a 100644 --- a/x/service/types/tx.pb.go +++ b/x/service/types/tx.pb.go @@ -301,6 +301,7 @@ func (m *MsgAddService) GetService() types1.Service { } type MsgAddServiceResponse struct { + Service *types1.Service `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` } func (m *MsgAddServiceResponse) Reset() { *m = MsgAddServiceResponse{} } @@ -332,6 +333,13 @@ func (m *MsgAddServiceResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgAddServiceResponse proto.InternalMessageInfo +func (m *MsgAddServiceResponse) GetService() *types1.Service { + if m != nil { + return m.Service + } + return nil +} + func init() { proto.RegisterType((*MsgUpdateParams)(nil), "poktroll.service.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "poktroll.service.MsgUpdateParamsResponse") @@ -344,43 +352,44 @@ func init() { func init() { proto.RegisterFile("poktroll/service/tx.proto", fileDescriptor_31ba9559706e649e) } var fileDescriptor_31ba9559706e649e = []byte{ - // 575 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0xce, 0x95, 0x92, 0xca, 0x97, 0xb6, 0x80, 0x55, 0x48, 0x62, 0x09, 0x27, 0x78, 0x21, 0x44, - 0xaa, 0xdd, 0x14, 0x81, 0x50, 0x10, 0x43, 0xcc, 0x82, 0x90, 0x82, 0x90, 0x2b, 0x90, 0x40, 0x48, - 0xd1, 0x25, 0x3e, 0x39, 0x56, 0x6b, 0x9f, 0xe5, 0xbb, 0xa6, 0xed, 0x86, 0x18, 0x99, 0xf8, 0x03, - 0x60, 0x67, 0xcc, 0xc0, 0x84, 0xc4, 0xde, 0xb1, 0x62, 0xea, 0x54, 0xa1, 0x64, 0x88, 0xc4, 0x5f, - 0x81, 0x7c, 0x3e, 0x27, 0x75, 0x12, 0x61, 0xa9, 0x4b, 0x72, 0xf7, 0xbe, 0xef, 0xfd, 0xf8, 0xde, - 0x7b, 0x67, 0x58, 0x0e, 0xc8, 0x3e, 0x0b, 0xc9, 0xc1, 0x81, 0x41, 0x71, 0x38, 0x70, 0x7b, 0xd8, - 0x60, 0xc7, 0x7a, 0x10, 0x12, 0x46, 0xe4, 0x9b, 0x09, 0xa4, 0x0b, 0x48, 0xb9, 0x85, 0x3c, 0xd7, - 0x27, 0x06, 0xff, 0x8d, 0x49, 0x8a, 0xda, 0x23, 0xd4, 0x23, 0xd4, 0xe8, 0x22, 0x8a, 0x8d, 0x41, - 0xa3, 0x8b, 0x19, 0x6a, 0x18, 0x3d, 0xe2, 0xfa, 0x02, 0x2f, 0x0a, 0xdc, 0xa3, 0x8e, 0x31, 0x68, - 0x44, 0x7f, 0x02, 0x28, 0xc7, 0x40, 0x87, 0xdf, 0x8c, 0xf8, 0x22, 0xa0, 0x2d, 0x87, 0x38, 0x24, - 0xb6, 0x47, 0x27, 0x61, 0xbd, 0xb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 0x6f, 0x2c, 0x79, 0x55, 0xd1, 0xca, 0xd1, 0x6e, 0x9e, 0x7f, 0x12, - 0x1e, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x9f, 0xce, 0x8f, 0xce, 0xfc, 0x04, 0x00, 0x00, + // 585 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xb1, 0x6f, 0xd3, 0x4e, + 0x14, 0xce, 0xf5, 0xd7, 0x5f, 0x2a, 0x5f, 0xda, 0x02, 0x56, 0xa1, 0x89, 0x25, 0x9c, 0xe0, 0x85, + 0x10, 0xa9, 0x76, 0x13, 0x04, 0x42, 0x41, 0x0c, 0x31, 0x0b, 0x02, 0x05, 0x21, 0x57, 0x20, 0x81, + 0x90, 0xa2, 0x4b, 0x7c, 0x72, 0xac, 0xd6, 0x3e, 0xcb, 0x77, 0x4d, 0xdb, 0x0d, 0x31, 0x32, 0xf1, + 0x07, 0xc0, 0xce, 0x98, 0x81, 0x09, 0x89, 0xbd, 0x63, 0xc5, 0xd4, 0xa9, 0x42, 0xc9, 0x10, 0x89, + 0xbf, 0x02, 0xf9, 0x7c, 0x76, 0xea, 0x24, 0x6a, 0x24, 0x96, 0xc4, 0x7e, 0xdf, 0x77, 0xef, 0x7b, + 0xdf, 0x7b, 0xef, 0x0c, 0x4b, 0x01, 0xd9, 0x67, 0x21, 0x39, 0x38, 0x30, 0x28, 0x0e, 0x07, 0x6e, + 0x0f, 0x1b, 0xec, 0x58, 0x0f, 0x42, 0xc2, 0x88, 0x7c, 0x3d, 0x81, 0x74, 0x01, 0x29, 0x37, 0x90, + 0xe7, 0xfa, 0xc4, 0xe0, 0xbf, 0x31, 0x49, 0x51, 0x7b, 0x84, 0x7a, 0x84, 0x1a, 0x5d, 0x44, 0xb1, + 0x31, 0xa8, 0x77, 0x31, 0x43, 0x75, 0xa3, 0x47, 0x5c, 0x5f, 0xe0, 0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, 0x23, 0x15, 0x9c, 0x8f, 0x54, 0xf0, 0x7b, + 0xa4, 0x82, 0xcf, 0x63, 0x35, 0x77, 0x36, 0x56, 0x73, 0xe7, 0x63, 0x35, 0xf7, 0x6e, 0xd7, 0x71, + 0x59, 0xff, 0xb0, 0xab, 0xf7, 0x88, 0x67, 0x44, 0x79, 0x77, 0x7c, 0xcc, 0x8e, 0x48, 0xb8, 0x6f, + 0x2c, 0xb8, 0x89, 0xd1, 0x9a, 0xd2, 0x6e, 0x9e, 0x7f, 0x46, 0xee, 0xff, 0x0d, 0x00, 0x00, 0xff, + 0xff, 0x0b, 0xde, 0x5d, 0x98, 0x30, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -764,6 +773,18 @@ func (m *MsgAddServiceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Service != nil { + { + size, err := m.Service.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } @@ -868,6 +889,10 @@ func (m *MsgAddServiceResponse) Size() (n int) { } var l int _ = l + if m.Service != nil { + l = m.Service.Size() + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -1421,6 +1446,42 @@ func (m *MsgAddServiceResponse) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: MsgAddServiceResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Service", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Service == nil { + m.Service = &types1.Service{} + } + if err := m.Service.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:])