diff --git a/api/poktroll/service/tx.pulsar.go b/api/poktroll/service/tx.pulsar.go index f6fd47f21..bbce384f9 100644 --- a/api/poktroll/service/tx.pulsar.go +++ b/api/poktroll/service/tx.pulsar.go @@ -873,15 +873,15 @@ func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Meth } var ( - md_MsgAddService protoreflect.MessageDescriptor - fd_MsgAddService_address protoreflect.FieldDescriptor - fd_MsgAddService_service protoreflect.FieldDescriptor + md_MsgAddService protoreflect.MessageDescriptor + fd_MsgAddService_owner_address protoreflect.FieldDescriptor + fd_MsgAddService_service protoreflect.FieldDescriptor ) func init() { file_poktroll_service_tx_proto_init() md_MsgAddService = File_poktroll_service_tx_proto.Messages().ByName("MsgAddService") - fd_MsgAddService_address = md_MsgAddService.Fields().ByName("address") + fd_MsgAddService_owner_address = md_MsgAddService.Fields().ByName("owner_address") fd_MsgAddService_service = md_MsgAddService.Fields().ByName("service") } @@ -950,9 +950,9 @@ func (x *fastReflection_MsgAddService) Interface() protoreflect.ProtoMessage { // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_MsgAddService) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Address != "" { - value := protoreflect.ValueOfString(x.Address) - if !f(fd_MsgAddService_address, value) { + if x.OwnerAddress != "" { + value := protoreflect.ValueOfString(x.OwnerAddress) + if !f(fd_MsgAddService_owner_address, value) { return } } @@ -977,8 +977,8 @@ func (x *fastReflection_MsgAddService) Range(f func(protoreflect.FieldDescriptor // a repeated field is populated if it is non-empty. func (x *fastReflection_MsgAddService) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "poktroll.service.MsgAddService.address": - return x.Address != "" + case "poktroll.service.MsgAddService.owner_address": + return x.OwnerAddress != "" case "poktroll.service.MsgAddService.service": return x.Service != nil default: @@ -997,8 +997,8 @@ func (x *fastReflection_MsgAddService) Has(fd protoreflect.FieldDescriptor) bool // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgAddService) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "poktroll.service.MsgAddService.address": - x.Address = "" + case "poktroll.service.MsgAddService.owner_address": + x.OwnerAddress = "" case "poktroll.service.MsgAddService.service": x.Service = nil default: @@ -1017,8 +1017,8 @@ func (x *fastReflection_MsgAddService) Clear(fd protoreflect.FieldDescriptor) { // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_MsgAddService) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "poktroll.service.MsgAddService.address": - value := x.Address + case "poktroll.service.MsgAddService.owner_address": + value := x.OwnerAddress return protoreflect.ValueOfString(value) case "poktroll.service.MsgAddService.service": value := x.Service @@ -1043,8 +1043,8 @@ func (x *fastReflection_MsgAddService) Get(descriptor protoreflect.FieldDescript // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgAddService) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "poktroll.service.MsgAddService.address": - x.Address = value.Interface().(string) + case "poktroll.service.MsgAddService.owner_address": + x.OwnerAddress = value.Interface().(string) case "poktroll.service.MsgAddService.service": x.Service = value.Message().Interface().(*shared.Service) default: @@ -1072,8 +1072,8 @@ func (x *fastReflection_MsgAddService) Mutable(fd protoreflect.FieldDescriptor) x.Service = new(shared.Service) } return protoreflect.ValueOfMessage(x.Service.ProtoReflect()) - case "poktroll.service.MsgAddService.address": - panic(fmt.Errorf("field address of message poktroll.service.MsgAddService is not mutable")) + case "poktroll.service.MsgAddService.owner_address": + panic(fmt.Errorf("field owner_address of message poktroll.service.MsgAddService is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddService")) @@ -1087,7 +1087,7 @@ func (x *fastReflection_MsgAddService) Mutable(fd protoreflect.FieldDescriptor) // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_MsgAddService) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.service.MsgAddService.address": + case "poktroll.service.MsgAddService.owner_address": return protoreflect.ValueOfString("") case "poktroll.service.MsgAddService.service": m := new(shared.Service) @@ -1161,7 +1161,7 @@ func (x *fastReflection_MsgAddService) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - l = len(x.Address) + l = len(x.OwnerAddress) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } @@ -1212,10 +1212,10 @@ func (x *fastReflection_MsgAddService) ProtoMethods() *protoiface.Methods { i-- dAtA[i] = 0x12 } - if len(x.Address) > 0 { - i -= len(x.Address) - copy(dAtA[i:], x.Address) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + if len(x.OwnerAddress) > 0 { + i -= len(x.OwnerAddress) + copy(dAtA[i:], x.OwnerAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.OwnerAddress))) i-- dAtA[i] = 0xa } @@ -1270,7 +1270,7 @@ func (x *fastReflection_MsgAddService) ProtoMethods() *protoiface.Methods { switch fieldNum { case 1: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1298,7 +1298,7 @@ func (x *fastReflection_MsgAddService) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Address = string(dAtA[iNdEx:postIndex]) + x.OwnerAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -1824,8 +1824,8 @@ type MsgAddService struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // The Bech32 address of the service supplier using cosmos' ScalarDescriptor - Service *shared.Service `protobuf:"bytes,2,opt,name=service,proto3" json:"service,omitempty"` // The Service for which the supplier is adding to the network + OwnerAddress string `protobuf:"bytes,1,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty"` // The Bech32 address of the service owner using cosmos' ScalarDescriptor + Service *shared.Service `protobuf:"bytes,2,opt,name=service,proto3" json:"service,omitempty"` // The Service being added to the network } func (x *MsgAddService) Reset() { @@ -1848,9 +1848,9 @@ func (*MsgAddService) Descriptor() ([]byte, []int) { return file_poktroll_service_tx_proto_rawDescGZIP(), []int{2} } -func (x *MsgAddService) GetAddress() string { +func (x *MsgAddService) GetOwnerAddress() string { if x != nil { - return x.Address + return x.OwnerAddress } return "" } @@ -1917,40 +1917,41 @@ var file_poktroll_service_tx_proto_rawDesc = []byte{ 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x8b, 0x01, 0x0a, 0x0d, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 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, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x22, 0x17, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xc2, 0x01, 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, 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, + 0x6e, 0x73, 0x65, 0x22, 0x9c, 0x01, 0x0a, 0x0d, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3d, 0x0a, 0x0d, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, + 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0c, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, + 0x02, 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, 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, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xc2, 0x01, 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, 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, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, - 0xa3, 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, + 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, 0xa3, 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 ( diff --git a/proto/poktroll/service/tx.proto b/proto/poktroll/service/tx.proto index 2cd44a288..77f638d58 100644 --- a/proto/poktroll/service/tx.proto +++ b/proto/poktroll/service/tx.proto @@ -44,9 +44,9 @@ message MsgUpdateParamsResponse {} // permissionless. // TODO_BETA: Add Champions / Sources once its fully defined. message MsgAddService { - option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the service supplier using cosmos' ScalarDescriptor - poktroll.shared.Service service = 2 [(gogoproto.nullable) = false]; // The Service for which the supplier is adding to the network + option (cosmos.msg.v1.signer) = "owner_address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries + string owner_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the service owner using cosmos' ScalarDescriptor + poktroll.shared.Service service = 2 [(gogoproto.nullable) = false]; // The Service being added to the network } message MsgAddServiceResponse {} diff --git a/proto/poktroll/shared/tx.proto b/proto/poktroll/shared/tx.proto index 12f0bd6dd..5c2e4d7df 100644 --- a/proto/poktroll/shared/tx.proto +++ b/proto/poktroll/shared/tx.proto @@ -13,7 +13,7 @@ option go_package = "github.com/pokt-network/poktroll/x/shared/types"; // Msg defines the Msg service. service Msg { option (cosmos.msg.v1.service) = true; - + // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. rpc UpdateParams (MsgUpdateParams) returns (MsgUpdateParamsResponse); @@ -23,12 +23,12 @@ service Msg { message MsgUpdateParams { option (cosmos.msg.v1.signer) = "authority"; option (amino.name) = "poktroll/x/shared/MsgUpdateParams"; - + // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // params defines the module parameters to update. - + // NOTE: All parameters must be supplied. Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } diff --git a/x/service/keeper/msg_server_add_service.go b/x/service/keeper/msg_server_add_service.go index f90457fef..4df23b94b 100644 --- a/x/service/keeper/msg_server_add_service.go +++ b/x/service/keeper/msg_server_add_service.go @@ -41,23 +41,23 @@ func (k msgServer) AddService( foundService, found := k.GetService(ctx, msg.Service.Id) if found { if foundService.OwnerAddress != msg.Service.OwnerAddress { - logger.Error(fmt.Sprintf("Owner address of existing service (%q) does not match the owner address %q", foundService.OwnerAddress, msg.Address)) + logger.Error(fmt.Sprintf("Owner address of existing service (%q) does not match the owner address %q", foundService.OwnerAddress, msg.OwnerAddress)) return nil, types.ErrServiceInvalidOwnerAddress.Wrapf( "existing owner address %q does not match the new owner address %q", foundService.OwnerAddress, msg.Service.OwnerAddress, ) } return nil, types.ErrServiceAlreadyExists.Wrapf( - "TODO: Don't have for updating existing service ID: %s", msg.Service.Id, + "TODO(@adshmh): This is an ephemeral state of the code. Once we s/AddService/UpdateService/g, add the business logic here for updates here.", ) } // Retrieve the address of the actor adding the service; the owner of the service. - serviceOwnerAddr, err := sdk.AccAddressFromBech32(msg.Address) + serviceOwnerAddr, err := sdk.AccAddressFromBech32(msg.OwnerAddress) if err != nil { - logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) + logger.Error(fmt.Sprintf("could not parse address %s", msg.OwnerAddress)) return nil, types.ErrServiceInvalidAddress.Wrapf( - "%s is not in Bech32 format", msg.Address, + "%s is not in Bech32 format", msg.OwnerAddress, ) } diff --git a/x/service/keeper/msg_server_add_service_test.go b/x/service/keeper/msg_server_add_service_test.go index d28c56489..962689710 100644 --- a/x/service/keeper/msg_server_add_service_test.go +++ b/x/service/keeper/msg_server_add_service_test.go @@ -43,8 +43,8 @@ func TestMsgServer_AddService(t *testing.T) { // Add the service to the store _, err := srv.AddService(ctx, &types.MsgAddService{ - Address: oldServiceOwnerAddr, - Service: oldService, + OwnerAddress: oldServiceOwnerAddr, + Service: oldService, }) require.NoError(t, err) @@ -153,9 +153,9 @@ func TestMsgServer_AddService(t *testing.T) { desc: "invalid - insufficient upokt balance", setup: func(t *testing.T) { // Add 999999999 upokt to the account (one less than AddServiceFee) - keepertest.AddAccToAccMapCoins(t, oldServiceOwnerAddr, "upokt", oneUPOKTGreaterThanFee-2) + keepertest.AddAccToAccMapCoins(t, newServiceOwnerAddr, "upokt", oneUPOKTGreaterThanFee-2) }, - address: oldServiceOwnerAddr, + address: newServiceOwnerAddr, service: newService, expectedErr: types.ErrServiceNotEnoughFunds, }, @@ -163,9 +163,9 @@ func TestMsgServer_AddService(t *testing.T) { desc: "invalid - account has exactly AddServiceFee", setup: func(t *testing.T) { // Add the exact fee in upokt to the account - keepertest.AddAccToAccMapCoins(t, oldServiceOwnerAddr, "upokt", types.DefaultAddServiceFee) + keepertest.AddAccToAccMapCoins(t, newServiceOwnerAddr, "upokt", types.DefaultAddServiceFee) }, - address: oldServiceOwnerAddr, + address: newServiceOwnerAddr, service: newService, expectedErr: types.ErrServiceNotEnoughFunds, }, @@ -173,9 +173,9 @@ func TestMsgServer_AddService(t *testing.T) { desc: "invalid - sufficient balance of different denom", setup: func(t *testing.T) { // Adds 10000000001 wrong coins to the account - keepertest.AddAccToAccMapCoins(t, oldServiceOwnerAddr, "wrong", oneUPOKTGreaterThanFee) + keepertest.AddAccToAccMapCoins(t, newServiceOwnerAddr, "not_upokt", oneUPOKTGreaterThanFee) }, - address: oldServiceOwnerAddr, + address: newServiceOwnerAddr, service: newService, expectedErr: types.ErrServiceNotEnoughFunds, }, @@ -186,21 +186,17 @@ func TestMsgServer_AddService(t *testing.T) { service: oldService, expectedErr: types.ErrServiceInvalidOwnerAddress, }, - { - desc: "invalid - service already exists (same service owner)", - setup: func(t *testing.T) {}, - address: oldServiceOwnerAddr, - service: oldService, - expectedErr: types.ErrServiceAlreadyExists, - }, + // { + // desc: "TODO(@adshmh): valid - update compute_units_pre_relay if the owner is correct", + // }, } for _, test := range tests { t.Run(test.desc, func(t *testing.T) { test.setup(t) _, err := srv.AddService(ctx, &types.MsgAddService{ - Address: test.address, - Service: test.service, + OwnerAddress: test.address, + Service: test.service, }) if test.expectedErr != nil { // Using ErrorAs as wrapping the error sometimes gives errors with ErrorIs diff --git a/x/service/simulation/add_service.go b/x/service/simulation/add_service.go index d7647d639..dc9a13c30 100644 --- a/x/service/simulation/add_service.go +++ b/x/service/simulation/add_service.go @@ -20,7 +20,7 @@ func SimulateMsgAddService( ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { simAccount, _ := simtypes.RandomAcc(r, accs) msg := &types.MsgAddService{ - Address: simAccount.Address.String(), + OwnerAddress: simAccount.Address.String(), } // TODO: Handling the AddService simulation diff --git a/x/service/types/message_add_service.go b/x/service/types/message_add_service.go index cbb8c7ad1..09552f4df 100644 --- a/x/service/types/message_add_service.go +++ b/x/service/types/message_add_service.go @@ -16,26 +16,26 @@ const ( var _ sdk.Msg = (*MsgAddService)(nil) -func NewMsgAddService(addr, serviceId, serviceName string, computeUnitsPerRelay uint64) *MsgAddService { +func NewMsgAddService(serviceOwnerAddr, serviceId, serviceName string, computeUnitsPerRelay uint64) *MsgAddService { return &MsgAddService{ - Address: addr, + OwnerAddress: serviceOwnerAddr, Service: sharedtypes.Service{ Id: serviceId, Name: serviceName, ComputeUnitsPerRelay: computeUnitsPerRelay, - OwnerAddress: addr, + OwnerAddress: serviceOwnerAddr, }, } } // ValidateBasic performs basic validation of the message and its fields func (msg *MsgAddService) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(msg.Address); err != nil { - return ErrServiceInvalidAddress.Wrapf("invalid signer address %s; (%v)", msg.Address, err) + if _, err := sdk.AccAddressFromBech32(msg.OwnerAddress); err != nil { + return ErrServiceInvalidAddress.Wrapf("invalid signer address %s; (%v)", msg.OwnerAddress, err) } // Ensure that the signer of the add_service message is the owner of the service. - if msg.Service.OwnerAddress != msg.Address { - return ErrServiceInvalidOwnerAddress.Wrapf("service owner address %q does not match the signer address %q", msg.Service.OwnerAddress, msg.Address) + if msg.Service.OwnerAddress != msg.OwnerAddress { + return ErrServiceInvalidOwnerAddress.Wrapf("service owner address %q does not match the signer address %q", msg.Service.OwnerAddress, msg.OwnerAddress) } // TODO_BETA: Add a validate basic function to the `Service` object if msg.Service.Id == "" { diff --git a/x/service/types/message_add_service_test.go b/x/service/types/message_add_service_test.go index 069114676..fc4a7b107 100644 --- a/x/service/types/message_add_service_test.go +++ b/x/service/types/message_add_service_test.go @@ -19,28 +19,28 @@ func TestMsgAddService_ValidateBasic(t *testing.T) { { desc: "invalid service owner address - no service", msg: MsgAddService{ - Address: "invalid_address", + OwnerAddress: "invalid_address", // Service: intentionally omitted, }, expectedErr: ErrServiceInvalidAddress, }, { desc: "valid service owner address - no service ID", msg: MsgAddService{ - Address: serviceOwnerAddress, - Service: sharedtypes.Service{Name: "service name", OwnerAddress: serviceOwnerAddress}, // ID intentionally omitted + OwnerAddress: serviceOwnerAddress, + Service: sharedtypes.Service{Name: "service name", OwnerAddress: serviceOwnerAddress}, // ID intentionally omitted }, expectedErr: ErrServiceMissingID, }, { desc: "valid service owner address - no service name", msg: MsgAddService{ - Address: serviceOwnerAddress, - Service: sharedtypes.Service{Id: "svc1", OwnerAddress: serviceOwnerAddress}, // Name intentionally omitted + OwnerAddress: serviceOwnerAddress, + Service: sharedtypes.Service{Id: "svc1", OwnerAddress: serviceOwnerAddress}, // Name intentionally omitted }, expectedErr: ErrServiceMissingName, }, { desc: "valid service owner address - zero compute units per relay", msg: MsgAddService{ - Address: serviceOwnerAddress, + OwnerAddress: serviceOwnerAddress, Service: sharedtypes.Service{ Id: "svc1", Name: "service name", @@ -52,7 +52,7 @@ func TestMsgAddService_ValidateBasic(t *testing.T) { }, { desc: "signer address does not equal service owner address", msg: MsgAddService{ - Address: serviceOwnerAddress, + OwnerAddress: serviceOwnerAddress, Service: sharedtypes.Service{ Id: "svc1", Name: "service name", @@ -65,7 +65,7 @@ func TestMsgAddService_ValidateBasic(t *testing.T) { { desc: "valid msg add service", msg: MsgAddService{ - Address: serviceOwnerAddress, + OwnerAddress: serviceOwnerAddress, Service: sharedtypes.Service{ Id: "svc1", Name: "service name", diff --git a/x/service/types/tx.pb.go b/x/service/types/tx.pb.go index 9fed7d7e2..cc1c369db 100644 --- a/x/service/types/tx.pb.go +++ b/x/service/types/tx.pb.go @@ -131,8 +131,8 @@ var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo // permissionless. // TODO_BETA: Add Champions / Sources once its fully defined. type MsgAddService struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - Service types.Service `protobuf:"bytes,2,opt,name=service,proto3" json:"service"` + OwnerAddress string `protobuf:"bytes,1,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty"` + Service types.Service `protobuf:"bytes,2,opt,name=service,proto3" json:"service"` } func (m *MsgAddService) Reset() { *m = MsgAddService{} } @@ -168,9 +168,9 @@ func (m *MsgAddService) XXX_DiscardUnknown() { var xxx_messageInfo_MsgAddService proto.InternalMessageInfo -func (m *MsgAddService) GetAddress() string { +func (m *MsgAddService) GetOwnerAddress() string { if m != nil { - return m.Address + return m.OwnerAddress } return "" } @@ -228,7 +228,7 @@ func init() { func init() { proto.RegisterFile("poktroll/service/tx.proto", fileDescriptor_31ba9559706e649e) } var fileDescriptor_31ba9559706e649e = []byte{ - // 438 bytes of a gzipped FileDescriptorProto + // 447 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2c, 0xc8, 0xcf, 0x2e, 0x29, 0xca, 0xcf, 0xc9, 0xd1, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0x49, 0xe9, 0x41, 0xa5, 0xa4, 0x04, 0x13, 0x73, @@ -244,19 +244,19 @@ var fileDescriptor_31ba9559706e649e = []byte{ 0x21, 0xa1, 0x07, 0xb1, 0xc1, 0x89, 0xf3, 0xc4, 0x3d, 0x79, 0x86, 0x15, 0xcf, 0x37, 0x68, 0x31, 0x06, 0x41, 0xb5, 0x58, 0x99, 0x36, 0x3d, 0xdf, 0xa0, 0x85, 0x30, 0xac, 0xeb, 0xf9, 0x06, 0x2d, 0x25, 0xb8, 0xd3, 0x2b, 0xe0, 0x7e, 0x43, 0x73, 0xab, 0x92, 0x24, 0x97, 0x38, 0x9a, 0x50, 0x50, - 0x6a, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0x52, 0x37, 0x23, 0x17, 0xaf, 0x6f, 0x71, 0xba, 0x63, - 0x4a, 0x4a, 0x30, 0x44, 0xb3, 0x90, 0x11, 0x17, 0x7b, 0x22, 0xc4, 0xf1, 0x04, 0xbd, 0x05, 0x53, - 0x28, 0x64, 0xc1, 0xc5, 0x0e, 0xb5, 0x1b, 0x8b, 0xaf, 0xc0, 0x21, 0xaa, 0x07, 0x35, 0xde, 0x89, - 0x05, 0xe4, 0xab, 0x20, 0x98, 0x72, 0x2b, 0x1e, 0x90, 0x8f, 0x60, 0xe6, 0x28, 0x89, 0x73, 0x89, - 0xa2, 0x38, 0x06, 0xe6, 0x4c, 0xa3, 0x43, 0x8c, 0x5c, 0xcc, 0xbe, 0xc5, 0xe9, 0x42, 0x31, 0x5c, - 0x3c, 0x28, 0xb1, 0xa0, 0x88, 0x19, 0x7a, 0x68, 0x3e, 0x95, 0xd2, 0x24, 0xa8, 0x04, 0x66, 0x8b, - 0x50, 0x18, 0x17, 0x17, 0x52, 0x40, 0xc8, 0x63, 0xd5, 0x88, 0x50, 0x20, 0xa5, 0x4e, 0x40, 0x01, - 0xcc, 0x5c, 0x29, 0xd6, 0x06, 0x50, 0x2c, 0x3a, 0x79, 0x9d, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, - 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, - 0xb1, 0x1c, 0x43, 0x94, 0x41, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, - 0xc8, 0x4c, 0xdd, 0xbc, 0xd4, 0x92, 0xf2, 0xfc, 0xa2, 0x6c, 0x7d, 0x2c, 0x91, 0x5b, 0x52, 0x59, - 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x4e, 0x99, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x57, 0x39, - 0xa8, 0x07, 0x63, 0x03, 0x00, 0x00, + 0x6a, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0xd2, 0x1c, 0x46, 0x2e, 0x5e, 0xdf, 0xe2, 0x74, 0xc7, + 0x94, 0x94, 0x60, 0x88, 0x66, 0x21, 0x5b, 0x2e, 0xde, 0xfc, 0xf2, 0xbc, 0xd4, 0xa2, 0xf8, 0x44, + 0x88, 0x17, 0x08, 0x7a, 0x8e, 0x07, 0xac, 0x1c, 0x2a, 0x26, 0x64, 0xc1, 0xc5, 0x0e, 0x75, 0x06, + 0x16, 0x0f, 0x82, 0x03, 0x57, 0x0f, 0x6a, 0x93, 0x13, 0x0b, 0xc8, 0x83, 0x41, 0x30, 0xe5, 0x56, + 0x42, 0x20, 0xcf, 0xa1, 0xda, 0xad, 0x24, 0xce, 0x25, 0x8a, 0xe2, 0x3a, 0x98, 0xbb, 0x8d, 0x0e, + 0x31, 0x72, 0x31, 0xfb, 0x16, 0xa7, 0x0b, 0xc5, 0x70, 0xf1, 0xa0, 0x44, 0x8b, 0x22, 0x66, 0x70, + 0xa2, 0x79, 0x5d, 0x4a, 0x93, 0xa0, 0x12, 0x98, 0x2d, 0x42, 0x61, 0x5c, 0x5c, 0x48, 0x21, 0x23, + 0x8f, 0x55, 0x23, 0x42, 0x81, 0x94, 0x3a, 0x01, 0x05, 0x30, 0x73, 0xa5, 0x58, 0x1b, 0x40, 0xd1, + 0xea, 0xe4, 0x75, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, + 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x06, 0xe9, 0x99, + 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x20, 0x33, 0x75, 0xf3, 0x52, 0x4b, 0xca, + 0xf3, 0x8b, 0xb2, 0xf5, 0xb1, 0xc4, 0x76, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0xa9, + 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x24, 0x8c, 0x9b, 0xaa, 0x74, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -472,10 +472,10 @@ func (m *MsgAddService) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x12 - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) + if len(m.OwnerAddress) > 0 { + i -= len(m.OwnerAddress) + copy(dAtA[i:], m.OwnerAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.OwnerAddress))) i-- dAtA[i] = 0xa } @@ -546,7 +546,7 @@ func (m *MsgAddService) Size() (n int) { } var l int _ = l - l = len(m.Address) + l = len(m.OwnerAddress) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -766,7 +766,7 @@ func (m *MsgAddService) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -794,7 +794,7 @@ func (m *MsgAddService) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Address = string(dAtA[iNdEx:postIndex]) + m.OwnerAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 {