From a130b151f8268448f65d4986af4080c696fe1843 Mon Sep 17 00:00:00 2001 From: jaguarmouse Date: Fri, 15 Sep 2023 16:21:35 +0900 Subject: [PATCH 1/9] fixes sld protobuf --- docs/static/openapi.yml | 66 ++- .../mycel/registry/second_level_domain.proto | 6 +- x/registry/types/second_level_domain.pb.go | 384 ++++-------------- 3 files changed, 113 insertions(+), 343 deletions(-) diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 54dff9cd..359a5cbc 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -50446,12 +50446,11 @@ paths: accessControl: type: object additionalProperties: - type: object - properties: - owner: - type: string - recordEditor: - type: string + type: string + enum: + - OWNER + - RECORD_EDITOR + default: OWNER pagination: type: object properties: @@ -50662,12 +50661,11 @@ paths: accessControl: type: object additionalProperties: - type: object - properties: - owner: - type: string - recordEditor: - type: string + type: string + enum: + - OWNER + - RECORD_EDITOR + default: OWNER default: description: An unexpected error response. schema: @@ -80715,12 +80713,11 @@ definitions: accessControl: type: object additionalProperties: - type: object - properties: - owner: - type: string - recordEditor: - type: string + type: string + enum: + - OWNER + - RECORD_EDITOR + default: OWNER pagination: type: object properties: @@ -81000,12 +80997,11 @@ definitions: accessControl: type: object additionalProperties: - type: object - properties: - owner: - type: string - recordEditor: - type: string + type: string + enum: + - OWNER + - RECORD_EDITOR + default: OWNER mycel.registry.QueryGetTopLevelDomainResponse: type: object properties: @@ -81210,12 +81206,11 @@ definitions: accessControl: type: object additionalProperties: - type: object - properties: - owner: - type: string - recordEditor: - type: string + type: string + enum: + - OWNER + - RECORD_EDITOR + default: OWNER mycel.registry.SubdomainConfig: type: object properties: @@ -81344,12 +81339,11 @@ definitions: NOTE: The amount field is an Int which implements the custom method signatures required by gogoproto. mycel.registry.SubdomainRole: - type: object - properties: - owner: - type: string - recordEditor: - type: string + type: string + enum: + - OWNER + - RECORD_EDITOR + default: OWNER mycel.registry.TopLevelDomain: type: object properties: diff --git a/proto/mycel/registry/second_level_domain.proto b/proto/mycel/registry/second_level_domain.proto index 42f75164..ce5e2d03 100644 --- a/proto/mycel/registry/second_level_domain.proto +++ b/proto/mycel/registry/second_level_domain.proto @@ -17,9 +17,9 @@ message WalletRecord { string value = 2; } -message SubdomainRole { - string owner = 1; - string recordEditor = 2; +enum SubdomainRole { + OWNER = 0; + RECORD_EDITOR = 1; } message SecondLevelDomain { diff --git a/x/registry/types/second_level_domain.pb.go b/x/registry/types/second_level_domain.pb.go index 2b28d220..8255bff8 100644 --- a/x/registry/types/second_level_domain.pb.go +++ b/x/registry/types/second_level_domain.pb.go @@ -22,6 +22,31 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type SubdomainRole int32 + +const ( + SubdomainRole_OWNER SubdomainRole = 0 + SubdomainRole_RECORD_EDITOR SubdomainRole = 1 +) + +var SubdomainRole_name = map[int32]string{ + 0: "OWNER", + 1: "RECORD_EDITOR", +} + +var SubdomainRole_value = map[string]int32{ + "OWNER": 0, + "RECORD_EDITOR": 1, +} + +func (x SubdomainRole) String() string { + return proto.EnumName(SubdomainRole_name, int32(x)) +} + +func (SubdomainRole) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_71a2ae6361ebd509, []int{0} +} + type DnsRecord struct { DnsRecordType DnsRecordType `protobuf:"varint,1,opt,name=dnsRecordType,proto3,enum=mycel.registry.DnsRecordType" json:"dnsRecordType,omitempty"` Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` @@ -126,74 +151,22 @@ func (m *WalletRecord) GetValue() string { return "" } -type SubdomainRole struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - RecordEditor string `protobuf:"bytes,2,opt,name=recordEditor,proto3" json:"recordEditor,omitempty"` -} - -func (m *SubdomainRole) Reset() { *m = SubdomainRole{} } -func (m *SubdomainRole) String() string { return proto.CompactTextString(m) } -func (*SubdomainRole) ProtoMessage() {} -func (*SubdomainRole) Descriptor() ([]byte, []int) { - return fileDescriptor_71a2ae6361ebd509, []int{2} -} -func (m *SubdomainRole) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SubdomainRole) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SubdomainRole.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 *SubdomainRole) XXX_Merge(src proto.Message) { - xxx_messageInfo_SubdomainRole.Merge(m, src) -} -func (m *SubdomainRole) XXX_Size() int { - return m.Size() -} -func (m *SubdomainRole) XXX_DiscardUnknown() { - xxx_messageInfo_SubdomainRole.DiscardUnknown(m) -} - -var xxx_messageInfo_SubdomainRole proto.InternalMessageInfo - -func (m *SubdomainRole) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -func (m *SubdomainRole) GetRecordEditor() string { - if m != nil { - return m.RecordEditor - } - return "" -} - type SecondLevelDomain struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Parent string `protobuf:"bytes,2,opt,name=parent,proto3" json:"parent,omitempty"` - Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"` - ExpirationDate int64 `protobuf:"varint,4,opt,name=expirationDate,proto3" json:"expirationDate,omitempty"` - DnsRecords map[string]*DnsRecord `protobuf:"bytes,5,rep,name=dnsRecords,proto3" json:"dnsRecords,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - WalletRecords map[string]*WalletRecord `protobuf:"bytes,6,rep,name=walletRecords,proto3" json:"walletRecords,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Metadata map[string]string `protobuf:"bytes,7,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - AccessControl map[string]*SubdomainRole `protobuf:"bytes,8,rep,name=accessControl,proto3" json:"accessControl,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Parent string `protobuf:"bytes,2,opt,name=parent,proto3" json:"parent,omitempty"` + Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"` + ExpirationDate int64 `protobuf:"varint,4,opt,name=expirationDate,proto3" json:"expirationDate,omitempty"` + DnsRecords map[string]*DnsRecord `protobuf:"bytes,5,rep,name=dnsRecords,proto3" json:"dnsRecords,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + WalletRecords map[string]*WalletRecord `protobuf:"bytes,6,rep,name=walletRecords,proto3" json:"walletRecords,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Metadata map[string]string `protobuf:"bytes,7,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + AccessControl map[string]SubdomainRole `protobuf:"bytes,8,rep,name=accessControl,proto3" json:"accessControl,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=mycel.registry.SubdomainRole"` } func (m *SecondLevelDomain) Reset() { *m = SecondLevelDomain{} } func (m *SecondLevelDomain) String() string { return proto.CompactTextString(m) } func (*SecondLevelDomain) ProtoMessage() {} func (*SecondLevelDomain) Descriptor() ([]byte, []int) { - return fileDescriptor_71a2ae6361ebd509, []int{3} + return fileDescriptor_71a2ae6361ebd509, []int{2} } func (m *SecondLevelDomain) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -271,7 +244,7 @@ func (m *SecondLevelDomain) GetMetadata() map[string]string { return nil } -func (m *SecondLevelDomain) GetAccessControl() map[string]*SubdomainRole { +func (m *SecondLevelDomain) GetAccessControl() map[string]SubdomainRole { if m != nil { return m.AccessControl } @@ -279,11 +252,11 @@ func (m *SecondLevelDomain) GetAccessControl() map[string]*SubdomainRole { } func init() { + proto.RegisterEnum("mycel.registry.SubdomainRole", SubdomainRole_name, SubdomainRole_value) proto.RegisterType((*DnsRecord)(nil), "mycel.registry.DnsRecord") proto.RegisterType((*WalletRecord)(nil), "mycel.registry.WalletRecord") - proto.RegisterType((*SubdomainRole)(nil), "mycel.registry.SubdomainRole") proto.RegisterType((*SecondLevelDomain)(nil), "mycel.registry.SecondLevelDomain") - proto.RegisterMapType((map[string]*SubdomainRole)(nil), "mycel.registry.SecondLevelDomain.AccessControlEntry") + proto.RegisterMapType((map[string]SubdomainRole)(nil), "mycel.registry.SecondLevelDomain.AccessControlEntry") proto.RegisterMapType((map[string]*DnsRecord)(nil), "mycel.registry.SecondLevelDomain.DnsRecordsEntry") proto.RegisterMapType((map[string]string)(nil), "mycel.registry.SecondLevelDomain.MetadataEntry") proto.RegisterMapType((map[string]*WalletRecord)(nil), "mycel.registry.SecondLevelDomain.WalletRecordsEntry") @@ -294,41 +267,42 @@ func init() { } var fileDescriptor_71a2ae6361ebd509 = []byte{ - // 538 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0x86, 0xe3, 0xa6, 0x0d, 0xcd, 0xb4, 0x09, 0x65, 0x85, 0x90, 0x09, 0x60, 0x42, 0x0e, 0x28, - 0x17, 0x6c, 0x91, 0x72, 0x40, 0x70, 0x82, 0xa6, 0x02, 0x04, 0x54, 0xc2, 0x45, 0x02, 0xf5, 0x40, - 0xb4, 0xb1, 0x87, 0x62, 0xd5, 0xde, 0x8d, 0xd6, 0x9b, 0xa6, 0x7e, 0x0b, 0x5e, 0x84, 0xf7, 0xe0, - 0xd8, 0x23, 0x47, 0x94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x40, 0x96, - 0x73, 0x5a, 0x01, 0xef, 0x15, 0xe1, 0xf7, 0xcb, 0x70, 0x13, 0x62, 0xf2, 0x5f, 0x42, 0xa3, 0x10, - 0xd8, 0x0a, 0xf4, 0xca, 0x5b, 0xa1, 0xc4, 0x03, 0x20, 0xcb, 0xd9, 0xac, 0x20, 0xec, 0x16, 0x87, - 0x5b, 0x7a, 0x03, 0x0a, 0xd7, 0xcb, 0x30, 0x78, 0xfd, 0xf6, 0xf7, 0xd4, 0xb1, 0xce, 0xa7, 0x8e, - 0xf5, 0x77, 0xea, 0x58, 0x3f, 0x67, 0x4e, 0xe5, 0x7c, 0xe6, 0x54, 0xfe, 0xcc, 0x9c, 0xca, 0x91, - 0x7b, 0x1c, 0xc9, 0x1f, 0xe3, 0xa1, 0x1b, 0xf0, 0xc4, 0x53, 0xb4, 0x27, 0x39, 0x21, 0x2f, 0xbc, - 0xb3, 0xc5, 0x43, 0x25, 0xb3, 0x11, 0xa6, 0xc3, 0x9a, 0x7a, 0xa2, 0x76, 0xff, 0x05, 0x00, 0x00, - 0xff, 0xff, 0x91, 0x27, 0xb8, 0x8c, 0x22, 0x05, 0x00, 0x00, + // 550 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0x41, 0x6f, 0xd3, 0x30, + 0x14, 0xc7, 0x9b, 0x75, 0x2b, 0xeb, 0x1b, 0x2d, 0x9d, 0x85, 0x50, 0x28, 0x10, 0xca, 0x0e, 0xa8, + 0x42, 0x5a, 0x22, 0x3a, 0x0e, 0x08, 0x4e, 0xd0, 0x54, 0x80, 0x80, 0x56, 0x78, 0x93, 0x86, 0x76, + 0x20, 0x72, 0x13, 0x33, 0xaa, 0x25, 0x76, 0xe5, 0xb8, 0xeb, 0xf2, 0x2d, 0xf8, 0x22, 0x7c, 0x0f, + 0x8e, 0x3b, 0x72, 0x44, 0xed, 0x17, 0x41, 0x75, 0x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b, 0x08, 0x7b, 0x3a, 0x61, 0xc5, 0x1f, 0x77, 0x7f, 0x32, 0x4c, 0x5f, + 0x14, 0xcc, 0x43, 0xaa, 0x19, 0x3c, 0xdb, 0x85, 0x5a, 0xee, 0x3b, 0x54, 0x85, 0x8d, 0xc1, 0x61, + 0xbf, 0x87, 0x1b, 0x25, 0xb4, 0x0d, 0x35, 0xdc, 0xeb, 0x0e, 0xb0, 0xeb, 0xf5, 0xdc, 0x0f, 0x07, + 0x03, 0xdc, 0x30, 0xde, 0xbe, 0xff, 0x3d, 0xb3, 0x8c, 0xf3, 0x99, 0x65, 0xfc, 0x9d, 0x59, 0xc6, + 0xcf, 0xb9, 0x55, 0x3a, 0x9f, 0x5b, 0xa5, 0x3f, 0x73, 0xab, 0x74, 0x64, 0x1f, 0x8f, 0xe4, 0x8f, + 0xc9, 0xd0, 0xf6, 0x79, 0xe4, 0x28, 0xf3, 0xdd, 0x14, 0x9a, 0x16, 0xce, 0xd9, 0xd5, 0x63, 0x24, + 0x93, 0x31, 0x8d, 0x87, 0x15, 0xf5, 0x0c, 0xed, 0xfd, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x67, 0x92, + 0x56, 0x64, 0x06, 0x05, 0x00, 0x00, } func (m *DnsRecord) Marshal() (dAtA []byte, err error) { @@ -401,43 +375,6 @@ func (m *WalletRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *SubdomainRole) 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 *SubdomainRole) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SubdomainRole) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.RecordEditor) > 0 { - i -= len(m.RecordEditor) - copy(dAtA[i:], m.RecordEditor) - i = encodeVarintSecondLevelDomain(dAtA, i, uint64(len(m.RecordEditor))) - i-- - dAtA[i] = 0x12 - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintSecondLevelDomain(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *SecondLevelDomain) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -462,18 +399,9 @@ func (m *SecondLevelDomain) MarshalToSizedBuffer(dAtA []byte) (int, error) { for k := range m.AccessControl { v := m.AccessControl[k] baseI := i - if v != nil { - { - size, err := v.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSecondLevelDomain(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } + i = encodeVarintSecondLevelDomain(dAtA, i, uint64(v)) + i-- + dAtA[i] = 0x10 i -= len(k) copy(dAtA[i:], k) i = encodeVarintSecondLevelDomain(dAtA, i, uint64(len(k))) @@ -627,23 +555,6 @@ func (m *WalletRecord) Size() (n int) { return n } -func (m *SubdomainRole) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovSecondLevelDomain(uint64(l)) - } - l = len(m.RecordEditor) - if l > 0 { - n += 1 + l + sovSecondLevelDomain(uint64(l)) - } - return n -} - func (m *SecondLevelDomain) Size() (n int) { if m == nil { return 0 @@ -703,12 +614,7 @@ func (m *SecondLevelDomain) Size() (n int) { for k, v := range m.AccessControl { _ = k _ = v - l = 0 - if v != nil { - l = v.Size() - l += 1 + sovSecondLevelDomain(uint64(l)) - } - mapEntrySize := 1 + len(k) + sovSecondLevelDomain(uint64(len(k))) + l + mapEntrySize := 1 + len(k) + sovSecondLevelDomain(uint64(len(k))) + 1 + sovSecondLevelDomain(uint64(v)) n += mapEntrySize + 1 + sovSecondLevelDomain(uint64(mapEntrySize)) } } @@ -923,120 +829,6 @@ func (m *WalletRecord) Unmarshal(dAtA []byte) error { } return nil } -func (m *SubdomainRole) 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 ErrIntOverflowSecondLevelDomain - } - 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: SubdomainRole: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SubdomainRole: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSecondLevelDomain - } - 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 ErrInvalidLengthSecondLevelDomain - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSecondLevelDomain - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RecordEditor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSecondLevelDomain - } - 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 ErrInvalidLengthSecondLevelDomain - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSecondLevelDomain - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RecordEditor = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSecondLevelDomain(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSecondLevelDomain - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *SecondLevelDomain) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1596,10 +1388,10 @@ func (m *SecondLevelDomain) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.AccessControl == nil { - m.AccessControl = make(map[string]*SubdomainRole) + m.AccessControl = make(map[string]SubdomainRole) } var mapkey string - var mapvalue *SubdomainRole + var mapvalue SubdomainRole for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 @@ -1648,7 +1440,6 @@ func (m *SecondLevelDomain) Unmarshal(dAtA []byte) error { mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { - var mapmsglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSecondLevelDomain @@ -1658,26 +1449,11 @@ func (m *SecondLevelDomain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - mapmsglen |= int(b&0x7F) << shift + mapvalue |= SubdomainRole(b&0x7F) << shift if b < 0x80 { break } } - if mapmsglen < 0 { - return ErrInvalidLengthSecondLevelDomain - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return ErrInvalidLengthSecondLevelDomain - } - if postmsgIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = &SubdomainRole{} - if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - iNdEx = postmsgIndex } else { iNdEx = entryPreIndex skippy, err := skipSecondLevelDomain(dAtA[iNdEx:]) From 8d977e49d439c10c42b555e59bc8479abd80ee53 Mon Sep 17 00:00:00 2001 From: jaguarmouse Date: Fri, 15 Sep 2023 16:49:06 +0900 Subject: [PATCH 2/9] fixes role structure --- docs/static/openapi.yml | 72 +++++++++---------- proto/mycel/registry/role.proto | 9 +++ .../mycel/registry/second_level_domain.proto | 8 +-- proto/mycel/registry/top_level_domain.proto | 7 +- 4 files changed, 49 insertions(+), 47 deletions(-) create mode 100644 proto/mycel/registry/role.proto diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 359a5cbc..5174b0d1 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -50067,10 +50067,11 @@ paths: accessControl: type: object additionalProperties: - type: object - properties: - owner: - type: string + type: string + enum: + - OWNER + - EDITOR + default: OWNER pagination: type: object properties: @@ -50275,10 +50276,11 @@ paths: accessControl: type: object additionalProperties: - type: object - properties: - owner: - type: string + type: string + enum: + - OWNER + - EDITOR + default: OWNER default: description: An unexpected error response. schema: @@ -50449,7 +50451,7 @@ paths: type: string enum: - OWNER - - RECORD_EDITOR + - EDITOR default: OWNER pagination: type: object @@ -50664,7 +50666,7 @@ paths: type: string enum: - OWNER - - RECORD_EDITOR + - EDITOR default: OWNER default: description: An unexpected error response. @@ -80484,6 +80486,12 @@ definitions: type: string parent: type: string + mycel.registry.DomainRole: + type: string + enum: + - OWNER + - EDITOR + default: OWNER mycel.registry.Fee: type: object properties: @@ -80716,7 +80724,7 @@ definitions: type: string enum: - OWNER - - RECORD_EDITOR + - EDITOR default: OWNER pagination: type: object @@ -80837,10 +80845,11 @@ definitions: accessControl: type: object additionalProperties: - type: object - properties: - owner: - type: string + type: string + enum: + - OWNER + - EDITOR + default: OWNER pagination: type: object properties: @@ -81000,7 +81009,7 @@ definitions: type: string enum: - OWNER - - RECORD_EDITOR + - EDITOR default: OWNER mycel.registry.QueryGetTopLevelDomainResponse: type: object @@ -81093,10 +81102,11 @@ definitions: accessControl: type: object additionalProperties: - type: object - properties: - owner: - type: string + type: string + enum: + - OWNER + - EDITOR + default: OWNER mycel.registry.QueryIsRegistrableDomainResponse: type: object properties: @@ -81209,7 +81219,7 @@ definitions: type: string enum: - OWNER - - RECORD_EDITOR + - EDITOR default: OWNER mycel.registry.SubdomainConfig: type: object @@ -81338,12 +81348,6 @@ definitions: NOTE: The amount field is an Int which implements the custom method signatures required by gogoproto. - mycel.registry.SubdomainRole: - type: string - enum: - - OWNER - - RECORD_EDITOR - default: OWNER mycel.registry.TopLevelDomain: type: object properties: @@ -81430,15 +81434,11 @@ definitions: accessControl: type: object additionalProperties: - type: object - properties: - owner: - type: string - mycel.registry.TopLevelDomainRole: - type: object - properties: - owner: - type: string + type: string + enum: + - OWNER + - EDITOR + default: OWNER mycel.registry.WalletRecord: type: object properties: diff --git a/proto/mycel/registry/role.proto b/proto/mycel/registry/role.proto new file mode 100644 index 00000000..39ef7420 --- /dev/null +++ b/proto/mycel/registry/role.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; +package mycel.registry; + +option go_package = "github.com/mycel-domain/mycel/x/registry/types"; + +enum DomainRole { + OWNER = 0; + EDITOR = 1; +} \ No newline at end of file diff --git a/proto/mycel/registry/second_level_domain.proto b/proto/mycel/registry/second_level_domain.proto index ce5e2d03..381d7079 100644 --- a/proto/mycel/registry/second_level_domain.proto +++ b/proto/mycel/registry/second_level_domain.proto @@ -3,6 +3,7 @@ package mycel.registry; import "mycel/registry/dns_record.proto"; import "mycel/registry/network_name.proto"; +import "mycel/registry/role.proto"; option go_package = "github.com/mycel-domain/mycel/x/registry/types"; @@ -17,11 +18,6 @@ message WalletRecord { string value = 2; } -enum SubdomainRole { - OWNER = 0; - RECORD_EDITOR = 1; -} - message SecondLevelDomain { string name = 1; string parent = 2; @@ -30,5 +26,5 @@ message SecondLevelDomain { map dnsRecords = 5; map walletRecords = 6; map metadata = 7; - map accessControl = 8; + map accessControl = 8; } diff --git a/proto/mycel/registry/top_level_domain.proto b/proto/mycel/registry/top_level_domain.proto index 5271d933..b48131bf 100644 --- a/proto/mycel/registry/top_level_domain.proto +++ b/proto/mycel/registry/top_level_domain.proto @@ -2,18 +2,15 @@ syntax = "proto3"; package mycel.registry; import "mycel/registry/subdomain_config.proto"; +import "mycel/registry/role.proto"; option go_package = "github.com/mycel-domain/mycel/x/registry/types"; -message TopLevelDomainRole { - string owner = 1; -} - message TopLevelDomain { string name = 1; int64 expirationDate = 2; map metadata = 3; SubdomainConfig subdomainConfig = 4; uint64 subdomainCount = 5; - map accessControl = 6; + map accessControl = 6; } From dc2c14f8f996f74d25ebb05e84c120de8ba12d32 Mon Sep 17 00:00:00 2001 From: jaguarmouse Date: Fri, 15 Sep 2023 16:49:39 +0900 Subject: [PATCH 3/9] adds accesscontrol registration --- ...msg_server_register_second_level_domain.go | 4 + x/registry/types/role.pb.go | 66 ++++ x/registry/types/second_level_domain.pb.go | 108 +++---- x/registry/types/top_level_domain.pb.go | 283 +++--------------- 4 files changed, 151 insertions(+), 310 deletions(-) create mode 100644 x/registry/types/role.pb.go diff --git a/x/registry/keeper/msg_server_register_second_level_domain.go b/x/registry/keeper/msg_server_register_second_level_domain.go index 2299e07f..55cef121 100644 --- a/x/registry/keeper/msg_server_register_second_level_domain.go +++ b/x/registry/keeper/msg_server_register_second_level_domain.go @@ -25,6 +25,9 @@ func (k msgServer) RegisterDomain(goCtx context.Context, msg *types.MsgRegisterD currentTime := ctx.BlockTime() expirationDate := currentTime.AddDate(int(msg.RegistrationPeriodInYear), 0, 0) + accessControl := map[string]types.DomainRole{ + msg.Creator: types.DomainRole_OWNER, + } domain := types.SecondLevelDomain{ Name: msg.Name, @@ -34,6 +37,7 @@ func (k msgServer) RegisterDomain(goCtx context.Context, msg *types.MsgRegisterD DnsRecords: nil, WalletRecords: nil, Metadata: nil, + AccessControl: accessControl, } err = k.Keeper.RegisterDomain(ctx, domain, creatorAddress, msg.RegistrationPeriodInYear) diff --git a/x/registry/types/role.pb.go b/x/registry/types/role.pb.go new file mode 100644 index 00000000..83cb84bc --- /dev/null +++ b/x/registry/types/role.pb.go @@ -0,0 +1,66 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: mycel/registry/role.proto + +package types + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + math "math" +) + +// 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 + +type DomainRole int32 + +const ( + DomainRole_OWNER DomainRole = 0 + DomainRole_EDITOR DomainRole = 1 +) + +var DomainRole_name = map[int32]string{ + 0: "OWNER", + 1: "EDITOR", +} + +var DomainRole_value = map[string]int32{ + "OWNER": 0, + "EDITOR": 1, +} + +func (x DomainRole) String() string { + return proto.EnumName(DomainRole_name, int32(x)) +} + +func (DomainRole) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_ad48edde3cbbc93e, []int{0} +} + +func init() { + proto.RegisterEnum("mycel.registry.DomainRole", DomainRole_name, DomainRole_value) +} + +func init() { proto.RegisterFile("mycel/registry/role.proto", fileDescriptor_ad48edde3cbbc93e) } + +var fileDescriptor_ad48edde3cbbc93e = []byte{ + // 158 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xad, 0x4c, 0x4e, + 0xcd, 0xd1, 0x2f, 0x4a, 0x4d, 0xcf, 0x2c, 0x2e, 0x29, 0xaa, 0xd4, 0x2f, 0xca, 0xcf, 0x49, 0xd5, + 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x03, 0x4b, 0xe9, 0xc1, 0xa4, 0xb4, 0x94, 0xb9, 0xb8, + 0x5c, 0xf2, 0x73, 0x13, 0x33, 0xf3, 0x82, 0xf2, 0x73, 0x52, 0x85, 0x38, 0xb9, 0x58, 0xfd, 0xc3, + 0xfd, 0x5c, 0x83, 0x04, 0x18, 0x84, 0xb8, 0xb8, 0xd8, 0x5c, 0x5d, 0x3c, 0x43, 0xfc, 0x83, 0x04, + 0x18, 0x9d, 0x3c, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, + 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x2f, 0x3d, + 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0x6c, 0xb2, 0x6e, 0x0a, 0xd8, 0x34, + 0x08, 0x47, 0xbf, 0x02, 0xe1, 0x86, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x2b, 0x8c, + 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xc4, 0xa7, 0xd2, 0xb9, 0xa2, 0x00, 0x00, 0x00, +} diff --git a/x/registry/types/second_level_domain.pb.go b/x/registry/types/second_level_domain.pb.go index 8255bff8..6d8ff43f 100644 --- a/x/registry/types/second_level_domain.pb.go +++ b/x/registry/types/second_level_domain.pb.go @@ -22,31 +22,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type SubdomainRole int32 - -const ( - SubdomainRole_OWNER SubdomainRole = 0 - SubdomainRole_RECORD_EDITOR SubdomainRole = 1 -) - -var SubdomainRole_name = map[int32]string{ - 0: "OWNER", - 1: "RECORD_EDITOR", -} - -var SubdomainRole_value = map[string]int32{ - "OWNER": 0, - "RECORD_EDITOR": 1, -} - -func (x SubdomainRole) String() string { - return proto.EnumName(SubdomainRole_name, int32(x)) -} - -func (SubdomainRole) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_71a2ae6361ebd509, []int{0} -} - type DnsRecord struct { DnsRecordType DnsRecordType `protobuf:"varint,1,opt,name=dnsRecordType,proto3,enum=mycel.registry.DnsRecordType" json:"dnsRecordType,omitempty"` Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` @@ -159,7 +134,7 @@ type SecondLevelDomain struct { DnsRecords map[string]*DnsRecord `protobuf:"bytes,5,rep,name=dnsRecords,proto3" json:"dnsRecords,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` WalletRecords map[string]*WalletRecord `protobuf:"bytes,6,rep,name=walletRecords,proto3" json:"walletRecords,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` Metadata map[string]string `protobuf:"bytes,7,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - AccessControl map[string]SubdomainRole `protobuf:"bytes,8,rep,name=accessControl,proto3" json:"accessControl,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=mycel.registry.SubdomainRole"` + AccessControl map[string]DomainRole `protobuf:"bytes,8,rep,name=accessControl,proto3" json:"accessControl,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=mycel.registry.DomainRole"` } func (m *SecondLevelDomain) Reset() { *m = SecondLevelDomain{} } @@ -244,7 +219,7 @@ func (m *SecondLevelDomain) GetMetadata() map[string]string { return nil } -func (m *SecondLevelDomain) GetAccessControl() map[string]SubdomainRole { +func (m *SecondLevelDomain) GetAccessControl() map[string]DomainRole { if m != nil { return m.AccessControl } @@ -252,11 +227,10 @@ func (m *SecondLevelDomain) GetAccessControl() map[string]SubdomainRole { } func init() { - proto.RegisterEnum("mycel.registry.SubdomainRole", SubdomainRole_name, SubdomainRole_value) proto.RegisterType((*DnsRecord)(nil), "mycel.registry.DnsRecord") proto.RegisterType((*WalletRecord)(nil), "mycel.registry.WalletRecord") proto.RegisterType((*SecondLevelDomain)(nil), "mycel.registry.SecondLevelDomain") - proto.RegisterMapType((map[string]SubdomainRole)(nil), "mycel.registry.SecondLevelDomain.AccessControlEntry") + proto.RegisterMapType((map[string]DomainRole)(nil), "mycel.registry.SecondLevelDomain.AccessControlEntry") proto.RegisterMapType((map[string]*DnsRecord)(nil), "mycel.registry.SecondLevelDomain.DnsRecordsEntry") proto.RegisterMapType((map[string]string)(nil), "mycel.registry.SecondLevelDomain.MetadataEntry") proto.RegisterMapType((map[string]*WalletRecord)(nil), "mycel.registry.SecondLevelDomain.WalletRecordsEntry") @@ -267,42 +241,40 @@ func init() { } var fileDescriptor_71a2ae6361ebd509 = []byte{ - // 550 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0x41, 0x6f, 0xd3, 0x30, - 0x14, 0xc7, 0x9b, 0x75, 0x2b, 0xeb, 0x1b, 0x2d, 0x9d, 0x85, 0x50, 0x28, 0x10, 0xca, 0x0e, 0xa8, - 0x42, 0x5a, 0x22, 0x3a, 0x0e, 0x08, 0x4e, 0xd0, 0x54, 0x80, 0x80, 0x56, 0x78, 0x93, 0x86, 0x76, - 0x20, 0x72, 0x13, 0x33, 0xaa, 0x25, 0x76, 0xe5, 0xb8, 0xeb, 0xf2, 0x2d, 0xf8, 0x22, 0x7c, 0x0f, - 0x8e, 0x3b, 0x72, 0x44, 0xed, 0x17, 0x41, 0x75, 0xb2, 0xcd, 0x49, 0x3b, 0x8d, 0x9b, 0x5f, 0xfb, - 0xfe, 0xbf, 0xff, 0xf3, 0xbf, 0xaf, 0x86, 0x76, 0x94, 0xf8, 0x34, 0x74, 0x04, 0x3d, 0x1e, 0xc5, - 0x52, 0x24, 0x4e, 0x4c, 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f, 0x87, 0x1b, 0x25, 0xb4, 0x0d, 0x35, 0xdc, 0xeb, 0x0e, 0xb0, 0xeb, 0xf5, 0xdc, 0x0f, 0x07, - 0x03, 0xdc, 0x30, 0xde, 0xbe, 0xff, 0x3d, 0xb3, 0x8c, 0xf3, 0x99, 0x65, 0xfc, 0x9d, 0x59, 0xc6, - 0xcf, 0xb9, 0x55, 0x3a, 0x9f, 0x5b, 0xa5, 0x3f, 0x73, 0xab, 0x74, 0x64, 0x1f, 0x8f, 0xe4, 0x8f, - 0xc9, 0xd0, 0xf6, 0x79, 0xe4, 0x28, 0xf3, 0xdd, 0x14, 0x9a, 0x16, 0xce, 0xd9, 0xd5, 0x63, 0x24, - 0x93, 0x31, 0x8d, 0x87, 0x15, 0xf5, 0x0c, 0xed, 0xfd, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x67, 0x92, - 0x56, 0x64, 0x06, 0x05, 0x00, 0x00, + // 524 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0x86, 0xeb, 0xa6, 0x0d, 0xcd, 0x96, 0x84, 0xb2, 0x42, 0xc8, 0x0d, 0x60, 0x42, 0x0f, 0xc8, + 0x17, 0x6c, 0x30, 0x1c, 0x10, 0x9c, 0xa0, 0x41, 0x20, 0x01, 0x95, 0x30, 0x48, 0xa0, 0x0a, 0x11, + 0x6d, 0xed, 0xa1, 0x58, 0xb5, 0x77, 0xad, 0xdd, 0x6d, 0x53, 0xbf, 0x05, 0xcf, 0xc1, 0x93, 0x70, + 0xec, 0x91, 0x23, 0x4a, 0x5e, 0x04, 0x79, 0xbd, 0x6d, 0xd7, 0x76, 0xaa, 0x72, 0xdb, 0x49, 0xe6, + 0xff, 0x66, 0xe6, 0xf7, 0x68, 0x90, 0x9b, 0x15, 0x11, 0xa4, 0x3e, 0x87, 0xfd, 0x44, 0x48,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7, 0x3a, 0x99, 0x39, + 0xd6, 0xdf, 0x99, 0x63, 0xfd, 0x9c, 0x3b, 0x4b, 0x27, 0x73, 0x67, 0xe9, 0xcf, 0xdc, 0x59, 0xda, + 0xf5, 0xf6, 0x13, 0xf9, 0xe3, 0x70, 0xcf, 0x8b, 0x58, 0xe6, 0x2b, 0xd4, 0x83, 0xea, 0x56, 0x55, + 0x81, 0x7f, 0x7c, 0x7e, 0x52, 0x64, 0x91, 0x83, 0xd8, 0xeb, 0xaa, 0xa3, 0xf2, 0xf8, 0x5f, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x09, 0x65, 0xa2, 0x01, 0xef, 0x04, 0x00, 0x00, } func (m *DnsRecord) Marshal() (dAtA []byte, err error) { @@ -1388,10 +1360,10 @@ func (m *SecondLevelDomain) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.AccessControl == nil { - m.AccessControl = make(map[string]SubdomainRole) + m.AccessControl = make(map[string]DomainRole) } var mapkey string - var mapvalue SubdomainRole + var mapvalue DomainRole for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 @@ -1449,7 +1421,7 @@ func (m *SecondLevelDomain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - mapvalue |= SubdomainRole(b&0x7F) << shift + mapvalue |= DomainRole(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/registry/types/top_level_domain.pb.go b/x/registry/types/top_level_domain.pb.go index 0769da53..cbebc7ac 100644 --- a/x/registry/types/top_level_domain.pb.go +++ b/x/registry/types/top_level_domain.pb.go @@ -22,64 +22,20 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type TopLevelDomainRole struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` -} - -func (m *TopLevelDomainRole) Reset() { *m = TopLevelDomainRole{} } -func (m *TopLevelDomainRole) String() string { return proto.CompactTextString(m) } -func (*TopLevelDomainRole) ProtoMessage() {} -func (*TopLevelDomainRole) Descriptor() ([]byte, []int) { - return fileDescriptor_0136e389ac8054f7, []int{0} -} -func (m *TopLevelDomainRole) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TopLevelDomainRole) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TopLevelDomainRole.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 *TopLevelDomainRole) XXX_Merge(src proto.Message) { - xxx_messageInfo_TopLevelDomainRole.Merge(m, src) -} -func (m *TopLevelDomainRole) XXX_Size() int { - return m.Size() -} -func (m *TopLevelDomainRole) XXX_DiscardUnknown() { - xxx_messageInfo_TopLevelDomainRole.DiscardUnknown(m) -} - -var xxx_messageInfo_TopLevelDomainRole proto.InternalMessageInfo - -func (m *TopLevelDomainRole) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - type TopLevelDomain struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - ExpirationDate int64 `protobuf:"varint,2,opt,name=expirationDate,proto3" json:"expirationDate,omitempty"` - Metadata map[string]string `protobuf:"bytes,3,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - SubdomainConfig *SubdomainConfig `protobuf:"bytes,4,opt,name=subdomainConfig,proto3" json:"subdomainConfig,omitempty"` - SubdomainCount uint64 `protobuf:"varint,5,opt,name=subdomainCount,proto3" json:"subdomainCount,omitempty"` - AccessControl map[string]*TopLevelDomainRole `protobuf:"bytes,6,rep,name=accessControl,proto3" json:"accessControl,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + ExpirationDate int64 `protobuf:"varint,2,opt,name=expirationDate,proto3" json:"expirationDate,omitempty"` + Metadata map[string]string `protobuf:"bytes,3,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + SubdomainConfig *SubdomainConfig `protobuf:"bytes,4,opt,name=subdomainConfig,proto3" json:"subdomainConfig,omitempty"` + SubdomainCount uint64 `protobuf:"varint,5,opt,name=subdomainCount,proto3" json:"subdomainCount,omitempty"` + AccessControl map[string]DomainRole `protobuf:"bytes,6,rep,name=accessControl,proto3" json:"accessControl,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=mycel.registry.DomainRole"` } func (m *TopLevelDomain) Reset() { *m = TopLevelDomain{} } func (m *TopLevelDomain) String() string { return proto.CompactTextString(m) } func (*TopLevelDomain) ProtoMessage() {} func (*TopLevelDomain) Descriptor() ([]byte, []int) { - return fileDescriptor_0136e389ac8054f7, []int{1} + return fileDescriptor_0136e389ac8054f7, []int{0} } func (m *TopLevelDomain) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -143,7 +99,7 @@ func (m *TopLevelDomain) GetSubdomainCount() uint64 { return 0 } -func (m *TopLevelDomain) GetAccessControl() map[string]*TopLevelDomainRole { +func (m *TopLevelDomain) GetAccessControl() map[string]DomainRole { if m != nil { return m.AccessControl } @@ -151,9 +107,8 @@ func (m *TopLevelDomain) GetAccessControl() map[string]*TopLevelDomainRole { } func init() { - proto.RegisterType((*TopLevelDomainRole)(nil), "mycel.registry.TopLevelDomainRole") proto.RegisterType((*TopLevelDomain)(nil), "mycel.registry.TopLevelDomain") - proto.RegisterMapType((map[string]*TopLevelDomainRole)(nil), "mycel.registry.TopLevelDomain.AccessControlEntry") + proto.RegisterMapType((map[string]DomainRole)(nil), "mycel.registry.TopLevelDomain.AccessControlEntry") proto.RegisterMapType((map[string]string)(nil), "mycel.registry.TopLevelDomain.MetadataEntry") } @@ -162,62 +117,31 @@ func init() { } var fileDescriptor_0136e389ac8054f7 = []byte{ - // 392 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0x41, 0x4b, 0xeb, 0x40, - 0x10, 0xee, 0x36, 0x69, 0x79, 0xdd, 0xd2, 0xbe, 0xc7, 0xf2, 0x0e, 0xa1, 0x87, 0xbc, 0x50, 0x78, - 0x12, 0x44, 0x13, 0xac, 0x97, 0xa2, 0x27, 0x6d, 0x85, 0x0a, 0x7a, 0x89, 0x82, 0xe0, 0xa5, 0x6c, - 0xd3, 0xb5, 0x06, 0x93, 0xdd, 0x90, 0x6c, 0x6a, 0xf3, 0x03, 0xbc, 0xfb, 0xb3, 0x3c, 0xf6, 0xe8, - 0x51, 0xda, 0x3f, 0x22, 0xd9, 0xad, 0x25, 0x89, 0xa2, 0xb7, 0x99, 0xd9, 0xef, 0xfb, 0x66, 0xbe, - 0xd9, 0x81, 0xff, 0x83, 0xd4, 0x25, 0xbe, 0x1d, 0x91, 0x99, 0x17, 0xf3, 0x28, 0xb5, 0x39, 0x0b, - 0xc7, 0x3e, 0x99, 0x13, 0x7f, 0x3c, 0x65, 0x01, 0xf6, 0xa8, 0x15, 0x46, 0x8c, 0x33, 0xd4, 0x16, - 0x30, 0xeb, 0x03, 0xd6, 0x29, 0xd3, 0xe2, 0x64, 0x22, 0xf1, 0x63, 0x97, 0xd1, 0x3b, 0x6f, 0x26, - 0x69, 0xdd, 0x5d, 0x88, 0xae, 0x59, 0x78, 0x91, 0xe9, 0x0d, 0xc5, 0xb3, 0xc3, 0x7c, 0x82, 0xfe, - 0xc2, 0x1a, 0x7b, 0xa4, 0x24, 0xd2, 0x80, 0x01, 0xcc, 0x86, 0x23, 0x93, 0xee, 0x93, 0x0a, 0xdb, - 0x45, 0x30, 0x42, 0x50, 0xa5, 0x38, 0x20, 0x1b, 0x9c, 0x88, 0xd1, 0x0e, 0x6c, 0x93, 0x45, 0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62, 0xb9, 0x2c, 0xb0, 0x85, 0xe4, 0xbe, 0xdc, 0x99, 0x4c, 0xec, 0x45, - 0xee, 0x8a, 0xd3, 0x90, 0xc4, 0x93, 0xba, 0x38, 0xc2, 0xc3, 0xf7, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xbf, 0x03, 0x9b, 0xe0, 0xe4, 0x02, 0x00, 0x00, -} - -func (m *TopLevelDomainRole) 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 *TopLevelDomainRole) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TopLevelDomainRole) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintTopLevelDomain(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil + // 382 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0x41, 0x4b, 0xf3, 0x40, + 0x10, 0xed, 0x36, 0x6d, 0xf9, 0xba, 0xa5, 0xf9, 0x64, 0xf1, 0x10, 0x73, 0x88, 0x41, 0x50, 0x72, + 0xd0, 0x44, 0xeb, 0x45, 0xf4, 0xa4, 0xad, 0x50, 0x41, 0x2f, 0x51, 0x10, 0x44, 0x28, 0xdb, 0x74, + 0xad, 0xc1, 0x24, 0x1b, 0x92, 0x4d, 0x69, 0xfe, 0x85, 0x3f, 0xcb, 0x63, 0x8f, 0x1e, 0xa5, 0xfd, + 0x1d, 0x82, 0x74, 0xb7, 0x96, 0x64, 0x15, 0xbc, 0xed, 0xcc, 0xbe, 0xf7, 0xe6, 0xbd, 0x61, 0xe0, + 0x6e, 0x98, 0x7b, 0x24, 0x70, 0x12, 0x32, 0xf6, 0x53, 0x96, 0xe4, 0x0e, 0xa3, 0xf1, 0x20, 0x20, + 0x13, 0x12, 0x0c, 0x46, 0x34, 0xc4, 0x7e, 0x64, 0xc7, 0x09, 0x65, 0x14, 0xa9, 0x1c, 0x66, 0x7f, + 0xc3, 0x74, 0x99, 0x96, 0x66, 0x43, 0x81, 0x1f, 0x78, 0x34, 0x7a, 0xf2, 0xc7, 0x82, 0xa6, 0x6f, + 0x49, 0xb0, 0x84, 0x06, 0x44, 0x7c, 0xed, 0x7c, 0x2a, 0x50, 0xbd, 0xa3, 0xf1, 0xf5, 0x72, 0x56, + 0x8f, 0x53, 0x11, 0x82, 0xb5, 0x08, 0x87, 0x44, 0x03, 0x26, 0xb0, 0x9a, 0x2e, 0x7f, 0xa3, 0x3d, + 0xa8, 0x92, 0x69, 0xec, 0x27, 0x98, 0xf9, 0x34, 0xea, 0x61, 0x46, 0xb4, 0xaa, 0x09, 0x2c, 0xc5, + 0x95, 0xba, 0xa8, 0x0f, 0xff, 0x85, 0x84, 0xe1, 0x11, 0x66, 0x58, 0x53, 0x4c, 0xc5, 0x6a, 0x75, + 0xf6, 0xed, 0xb2, 0x67, 0xbb, 0x3c, 0xcd, 0xbe, 0x59, 0xc1, 0x2f, 0x23, 0x96, 0xe4, 0xee, 0x9a, + 0x8d, 0xae, 0xe0, 0xff, 0x75, 0x9a, 0x2e, 0x0f, 0xa3, 0xd5, 0x4c, 0x60, 0xb5, 0x3a, 0xdb, 0xb2, + 0xe0, 0x6d, 0x19, 0xe6, 0xca, 0xbc, 0xa5, 0xf9, 0x42, 0x2b, 0x8b, 0x98, 0x56, 0x37, 0x81, 0x55, + 0x73, 0xa5, 0x2e, 0xba, 0x87, 0x6d, 0xec, 0x79, 0x24, 0x4d, 0xbb, 0x34, 0x62, 0x09, 0x0d, 0xb4, + 0x06, 0x4f, 0x70, 0xf4, 0x47, 0x82, 0xf3, 0x22, 0x47, 0xc4, 0x28, 0xeb, 0xe8, 0x67, 0xb0, 0x5d, + 0x8a, 0x89, 0x36, 0xa0, 0xf2, 0x42, 0xf2, 0xd5, 0x86, 0x97, 0x4f, 0xb4, 0x09, 0xeb, 0x13, 0x1c, + 0x64, 0x62, 0xaf, 0x4d, 0x57, 0x14, 0xa7, 0xd5, 0x13, 0xa0, 0x3f, 0x42, 0xf4, 0x73, 0xc2, 0x2f, + 0x0a, 0x87, 0x45, 0x05, 0xb5, 0xa3, 0xcb, 0xae, 0x85, 0x5b, 0x97, 0x06, 0xa4, 0xa0, 0x7e, 0xd1, + 0x7f, 0x9b, 0x1b, 0x60, 0x36, 0x37, 0xc0, 0xc7, 0xdc, 0x00, 0xaf, 0x0b, 0xa3, 0x32, 0x5b, 0x18, + 0x95, 0xf7, 0x85, 0x51, 0x79, 0xb0, 0xc7, 0x3e, 0x7b, 0xce, 0x86, 0xb6, 0x47, 0x43, 0x87, 0x4b, + 0x1d, 0x88, 0x5d, 0x89, 0xc2, 0x99, 0x16, 0x8e, 0x35, 0x8f, 0x49, 0x3a, 0x6c, 0xf0, 0x83, 0x3a, + 0xfe, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x73, 0xeb, 0x71, 0xc7, 0xcb, 0x02, 0x00, 0x00, } func (m *TopLevelDomain) Marshal() (dAtA []byte, err error) { @@ -244,18 +168,9 @@ func (m *TopLevelDomain) MarshalToSizedBuffer(dAtA []byte) (int, error) { for k := range m.AccessControl { v := m.AccessControl[k] baseI := i - if v != nil { - { - size, err := v.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTopLevelDomain(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } + i = encodeVarintTopLevelDomain(dAtA, i, uint64(v)) + i-- + dAtA[i] = 0x10 i -= len(k) copy(dAtA[i:], k) i = encodeVarintTopLevelDomain(dAtA, i, uint64(len(k))) @@ -328,19 +243,6 @@ func encodeVarintTopLevelDomain(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *TopLevelDomainRole) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovTopLevelDomain(uint64(l)) - } - return n -} - func (m *TopLevelDomain) Size() (n int) { if m == nil { return 0 @@ -373,12 +275,7 @@ func (m *TopLevelDomain) Size() (n int) { for k, v := range m.AccessControl { _ = k _ = v - l = 0 - if v != nil { - l = v.Size() - l += 1 + sovTopLevelDomain(uint64(l)) - } - mapEntrySize := 1 + len(k) + sovTopLevelDomain(uint64(len(k))) + l + mapEntrySize := 1 + len(k) + sovTopLevelDomain(uint64(len(k))) + 1 + sovTopLevelDomain(uint64(v)) n += mapEntrySize + 1 + sovTopLevelDomain(uint64(mapEntrySize)) } } @@ -391,88 +288,6 @@ func sovTopLevelDomain(x uint64) (n int) { func sozTopLevelDomain(x uint64) (n int) { return sovTopLevelDomain(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *TopLevelDomainRole) 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 ErrIntOverflowTopLevelDomain - } - 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: TopLevelDomainRole: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TopLevelDomainRole: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTopLevelDomain - } - 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 ErrInvalidLengthTopLevelDomain - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTopLevelDomain - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTopLevelDomain(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTopLevelDomain - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *TopLevelDomain) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -765,10 +580,10 @@ func (m *TopLevelDomain) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.AccessControl == nil { - m.AccessControl = make(map[string]*TopLevelDomainRole) + m.AccessControl = make(map[string]DomainRole) } var mapkey string - var mapvalue *TopLevelDomainRole + var mapvalue DomainRole for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 @@ -817,7 +632,6 @@ func (m *TopLevelDomain) Unmarshal(dAtA []byte) error { mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { - var mapmsglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTopLevelDomain @@ -827,26 +641,11 @@ func (m *TopLevelDomain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - mapmsglen |= int(b&0x7F) << shift + mapvalue |= DomainRole(b&0x7F) << shift if b < 0x80 { break } } - if mapmsglen < 0 { - return ErrInvalidLengthTopLevelDomain - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return ErrInvalidLengthTopLevelDomain - } - if postmsgIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = &TopLevelDomainRole{} - if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - iNdEx = postmsgIndex } else { iNdEx = entryPreIndex skippy, err := skipTopLevelDomain(dAtA[iNdEx:]) From 79cd3e611223be93e3f81e710ad0a4246446fba5 Mon Sep 17 00:00:00 2001 From: jaguarmouse Date: Fri, 15 Sep 2023 17:18:11 +0900 Subject: [PATCH 4/9] fixes role --- docs/static/openapi.yml | 33 +++++++++++++++++++++----------- proto/mycel/registry/role.proto | 5 +++-- x/registry/types/role.pb.go | 34 ++++++++++++++++++--------------- 3 files changed, 44 insertions(+), 28 deletions(-) diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 5174b0d1..0d217127 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -50069,9 +50069,10 @@ paths: additionalProperties: type: string enum: + - NO_ROLE - OWNER - EDITOR - default: OWNER + default: NO_ROLE pagination: type: object properties: @@ -50278,9 +50279,10 @@ paths: additionalProperties: type: string enum: + - NO_ROLE - OWNER - EDITOR - default: OWNER + default: NO_ROLE default: description: An unexpected error response. schema: @@ -50450,9 +50452,10 @@ paths: additionalProperties: type: string enum: + - NO_ROLE - OWNER - EDITOR - default: OWNER + default: NO_ROLE pagination: type: object properties: @@ -50665,9 +50668,10 @@ paths: additionalProperties: type: string enum: + - NO_ROLE - OWNER - EDITOR - default: OWNER + default: NO_ROLE default: description: An unexpected error response. schema: @@ -80489,9 +80493,10 @@ definitions: mycel.registry.DomainRole: type: string enum: + - NO_ROLE - OWNER - EDITOR - default: OWNER + default: NO_ROLE mycel.registry.Fee: type: object properties: @@ -80723,9 +80728,10 @@ definitions: additionalProperties: type: string enum: + - NO_ROLE - OWNER - EDITOR - default: OWNER + default: NO_ROLE pagination: type: object properties: @@ -80847,9 +80853,10 @@ definitions: additionalProperties: type: string enum: + - NO_ROLE - OWNER - EDITOR - default: OWNER + default: NO_ROLE pagination: type: object properties: @@ -81008,9 +81015,10 @@ definitions: additionalProperties: type: string enum: + - NO_ROLE - OWNER - EDITOR - default: OWNER + default: NO_ROLE mycel.registry.QueryGetTopLevelDomainResponse: type: object properties: @@ -81104,9 +81112,10 @@ definitions: additionalProperties: type: string enum: + - NO_ROLE - OWNER - EDITOR - default: OWNER + default: NO_ROLE mycel.registry.QueryIsRegistrableDomainResponse: type: object properties: @@ -81218,9 +81227,10 @@ definitions: additionalProperties: type: string enum: + - NO_ROLE - OWNER - EDITOR - default: OWNER + default: NO_ROLE mycel.registry.SubdomainConfig: type: object properties: @@ -81436,9 +81446,10 @@ definitions: additionalProperties: type: string enum: + - NO_ROLE - OWNER - EDITOR - default: OWNER + default: NO_ROLE mycel.registry.WalletRecord: type: object properties: diff --git a/proto/mycel/registry/role.proto b/proto/mycel/registry/role.proto index 39ef7420..f5f51611 100644 --- a/proto/mycel/registry/role.proto +++ b/proto/mycel/registry/role.proto @@ -4,6 +4,7 @@ package mycel.registry; option go_package = "github.com/mycel-domain/mycel/x/registry/types"; enum DomainRole { - OWNER = 0; - EDITOR = 1; + NO_ROLE = 0; + OWNER = 1; + EDITOR = 2; } \ No newline at end of file diff --git a/x/registry/types/role.pb.go b/x/registry/types/role.pb.go index 83cb84bc..a72fc641 100644 --- a/x/registry/types/role.pb.go +++ b/x/registry/types/role.pb.go @@ -23,18 +23,21 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type DomainRole int32 const ( - DomainRole_OWNER DomainRole = 0 - DomainRole_EDITOR DomainRole = 1 + DomainRole_NO_ROLE DomainRole = 0 + DomainRole_OWNER DomainRole = 1 + DomainRole_EDITOR DomainRole = 2 ) var DomainRole_name = map[int32]string{ - 0: "OWNER", - 1: "EDITOR", + 0: "NO_ROLE", + 1: "OWNER", + 2: "EDITOR", } var DomainRole_value = map[string]int32{ - "OWNER": 0, - "EDITOR": 1, + "NO_ROLE": 0, + "OWNER": 1, + "EDITOR": 2, } func (x DomainRole) String() string { @@ -52,15 +55,16 @@ func init() { func init() { proto.RegisterFile("mycel/registry/role.proto", fileDescriptor_ad48edde3cbbc93e) } var fileDescriptor_ad48edde3cbbc93e = []byte{ - // 158 bytes of a gzipped FileDescriptorProto + // 171 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xad, 0x4c, 0x4e, 0xcd, 0xd1, 0x2f, 0x4a, 0x4d, 0xcf, 0x2c, 0x2e, 0x29, 0xaa, 0xd4, 0x2f, 0xca, 0xcf, 0x49, 0xd5, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x03, 0x4b, 0xe9, 0xc1, 0xa4, 0xb4, 0x94, 0xb9, 0xb8, - 0x5c, 0xf2, 0x73, 0x13, 0x33, 0xf3, 0x82, 0xf2, 0x73, 0x52, 0x85, 0x38, 0xb9, 0x58, 0xfd, 0xc3, - 0xfd, 0x5c, 0x83, 0x04, 0x18, 0x84, 0xb8, 0xb8, 0xd8, 0x5c, 0x5d, 0x3c, 0x43, 0xfc, 0x83, 0x04, - 0x18, 0x9d, 0x3c, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, - 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x2f, 0x3d, - 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0x6c, 0xb2, 0x6e, 0x0a, 0xd8, 0x34, - 0x08, 0x47, 0xbf, 0x02, 0xe1, 0x86, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x2b, 0x8c, - 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xc4, 0xa7, 0xd2, 0xb9, 0xa2, 0x00, 0x00, 0x00, + 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x03, 0x4b, 0xe9, 0xc1, 0xa4, 0xb4, 0x0c, 0xb8, 0xb8, + 0x5c, 0xf2, 0x73, 0x13, 0x33, 0xf3, 0x82, 0xf2, 0x73, 0x52, 0x85, 0xb8, 0xb9, 0xd8, 0xfd, 0xfc, + 0xe3, 0x83, 0xfc, 0x7d, 0x5c, 0x05, 0x18, 0x84, 0x38, 0xb9, 0x58, 0xfd, 0xc3, 0xfd, 0x5c, 0x83, + 0x04, 0x18, 0x85, 0xb8, 0xb8, 0xd8, 0x5c, 0x5d, 0x3c, 0x43, 0xfc, 0x83, 0x04, 0x98, 0x9c, 0x3c, + 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, + 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x2f, 0x3d, 0xb3, 0x24, 0xa3, + 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0x6c, 0x8d, 0x6e, 0x0a, 0xd8, 0x68, 0x08, 0x47, 0xbf, + 0x02, 0xe1, 0xa0, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x93, 0x8c, 0x01, 0x01, 0x00, + 0x00, 0xff, 0xff, 0x1e, 0xc6, 0x68, 0x2a, 0xaf, 0x00, 0x00, 0x00, } From 433904e0e452a5f6d33ad9a187d2266d1fda733f Mon Sep 17 00:00:00 2001 From: jaguarmouse Date: Fri, 15 Sep 2023 18:05:50 +0900 Subject: [PATCH 5/9] adds role check function --- x/registry/keeper/msg_server_update_dns_record.go | 4 ++-- x/registry/keeper/msg_server_update_wallet_record.go | 4 ++-- x/registry/types/errors.go | 2 +- x/registry/types/valdiate_second_level_domain.go | 8 ++++++++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/x/registry/keeper/msg_server_update_dns_record.go b/x/registry/keeper/msg_server_update_dns_record.go index 321022cc..35e7ffec 100644 --- a/x/registry/keeper/msg_server_update_dns_record.go +++ b/x/registry/keeper/msg_server_update_dns_record.go @@ -20,8 +20,8 @@ func (k msgServer) UpdateDnsRecord(goCtx context.Context, msg *types.MsgUpdateDn } // Check if the domain is owned by the creator - if domain.Owner != msg.Creator { - return nil, sdkerrors.Wrapf(errors.New(fmt.Sprintf("%s.%s", msg.Name, msg.Parent)), types.ErrDomainNotOwned.Error()) + if isEditable, roleErr := domain.IsRecordEditable(msg.Creator); !isEditable { + return nil, roleErr } err := domain.UpdateDnsRecord(msg.DnsRecordType, msg.Value) diff --git a/x/registry/keeper/msg_server_update_wallet_record.go b/x/registry/keeper/msg_server_update_wallet_record.go index 71551308..79495a88 100644 --- a/x/registry/keeper/msg_server_update_wallet_record.go +++ b/x/registry/keeper/msg_server_update_wallet_record.go @@ -20,8 +20,8 @@ func (k msgServer) UpdateWalletRecord(goCtx context.Context, msg *types.MsgUpdat } // Check if the domain is owned by the creator - if domain.Owner != msg.Creator { - return nil, sdkerrors.Wrapf(errors.New(fmt.Sprintf("%s.%s", msg.Name, msg.Parent)), types.ErrDomainNotOwned.Error()) + if isEditable, roleErr := domain.IsRecordEditable(msg.Creator); !isEditable { + return nil, roleErr } err := domain.UpdateWalletRecord(msg.WalletRecordType, msg.Value) diff --git a/x/registry/types/errors.go b/x/registry/types/errors.go index 99e273e8..bfc9af51 100644 --- a/x/registry/types/errors.go +++ b/x/registry/types/errors.go @@ -17,7 +17,7 @@ var ( ErrInvalidWalletRecordType = sdkerrors.Register(ModuleName, 1106, "invalid wallet record type") ErrInvalidDnsRecordValue = sdkerrors.Register(ModuleName, 1107, "invalid dns record value") ErrInvalidDnsRecordType = sdkerrors.Register(ModuleName, 1108, "invalid dns record type") - ErrDomainNotOwned = sdkerrors.Register(ModuleName, 1109, "domain not owned by msg creator") + ErrDomainNotEditable = sdkerrors.Register(ModuleName, 1109, "role not pemitted to edit the domain") ErrParentDomainDoesNotExist = sdkerrors.Register(ModuleName, 1110, "parent domain does not exist") ErrParentDomainMustBeEmpty = sdkerrors.Register(ModuleName, 1111, "parent domain must be empty") ErrDomainNotRegistrable = sdkerrors.Register(ModuleName, 1112, "domain is not registrable") diff --git a/x/registry/types/valdiate_second_level_domain.go b/x/registry/types/valdiate_second_level_domain.go index 57ff5419..9a7da75b 100644 --- a/x/registry/types/valdiate_second_level_domain.go +++ b/x/registry/types/valdiate_second_level_domain.go @@ -12,6 +12,14 @@ const ( NamePattern = `-a-z0-9\p{So}\p{Sk}` ) +func (secondLevelDomain SecondLevelDomain) IsRecordEditable(sender string) (isEditable bool, err error) { + if secondLevelDomain.AccessControl[sender] == DomainRole_NO_ROLE { + err = sdkerrors.Wrapf(errors.New(fmt.Sprintf("%s", sender)), ErrDomainNotEditable.Error()) + } + isEditable = secondLevelDomain.AccessControl[sender] == DomainRole_EDITOR || secondLevelDomain.AccessControl[sender] == DomainRole_OWNER + return isEditable, err +} + func (secondLevelDomain SecondLevelDomain) ValidateName() (err error) { regex := regexp.MustCompile(fmt.Sprintf(`(^[%s]+$)`, NamePattern)) if !regex.MatchString(secondLevelDomain.Name) { From 29f584413b04b927d5008f438475c83f190535ad Mon Sep 17 00:00:00 2001 From: jaguarmouse Date: Fri, 15 Sep 2023 18:06:01 +0900 Subject: [PATCH 6/9] adds tests --- .../keeper/msg_server_register_second_level_domain_test.go | 3 ++- x/registry/keeper/msg_server_update_dns_record_test.go | 2 +- x/registry/keeper/msg_server_update_wallet_record_test.go | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/x/registry/keeper/msg_server_register_second_level_domain_test.go b/x/registry/keeper/msg_server_register_second_level_domain_test.go index 1dc8620e..b3fe8e72 100644 --- a/x/registry/keeper/msg_server_register_second_level_domain_test.go +++ b/x/registry/keeper/msg_server_register_second_level_domain_test.go @@ -108,8 +108,9 @@ func (suite *KeeperTestSuite) TestRegisterSecondLevelDomain() { suite.Require().Equal(tc.domainOwnership, domainOwnership) // Evalute if domain is registered - _, found = suite.app.RegistryKeeper.GetTopLevelDomain(suite.ctx, tc.parent) + domain, found := suite.app.RegistryKeeper.GetSecondLevelDomain(suite.ctx, tc.name, tc.parent) suite.Require().True(found) + suite.Require().Equal(domain.AccessControl[tc.creator], types.DomainRole_OWNER) // // Evalute if parent's subdomainCount is increased // parent, found = suite.app.RegistryKeeper.GetTopLevelDomain(suite.ctx, parentsName) diff --git a/x/registry/keeper/msg_server_update_dns_record_test.go b/x/registry/keeper/msg_server_update_dns_record_test.go index 990adbe0..1aee76c4 100644 --- a/x/registry/keeper/msg_server_update_dns_record_test.go +++ b/x/registry/keeper/msg_server_update_dns_record_test.go @@ -63,7 +63,7 @@ func (suite *KeeperTestSuite) TestUpdateDnsRecord() { parent: "cel", dnsRecordType: "A", value: "192.168.0.1", - expErr: sdkerrors.Wrapf(errors.New(fmt.Sprintf("foo.cel")), types.ErrDomainNotOwned.Error()), + expErr: sdkerrors.Wrapf(errors.New(fmt.Sprintf(testutil.Bob)), types.ErrDomainNotEditable.Error()), fn: func() {}, }, } diff --git a/x/registry/keeper/msg_server_update_wallet_record_test.go b/x/registry/keeper/msg_server_update_wallet_record_test.go index 6009a186..a883fd2a 100644 --- a/x/registry/keeper/msg_server_update_wallet_record_test.go +++ b/x/registry/keeper/msg_server_update_wallet_record_test.go @@ -82,7 +82,7 @@ func (suite *KeeperTestSuite) TestUpdateWalletRecord() { parent: "cel", walletRecordType: "ETHEREUM_MAINNET_MAINNET", value: "0x1234567890123456789012345678901234567890", - expErr: sdkerrors.Wrapf(errors.New(fmt.Sprintf("foo.cel")), types.ErrDomainNotOwned.Error()), + expErr: sdkerrors.Wrapf(errors.New(fmt.Sprintf(testutil.Bob)), types.ErrDomainNotEditable.Error()), fn: func() {}, }, } From 7ba566642558699c278c08f9d10e1f778350f74d Mon Sep 17 00:00:00 2001 From: jaguarmouse Date: Fri, 15 Sep 2023 18:49:59 +0900 Subject: [PATCH 7/9] fixes err variable name --- x/registry/keeper/msg_server_update_dns_record.go | 7 ++++--- x/registry/keeper/msg_server_update_wallet_record.go | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/x/registry/keeper/msg_server_update_dns_record.go b/x/registry/keeper/msg_server_update_dns_record.go index 35e7ffec..a822a5ad 100644 --- a/x/registry/keeper/msg_server_update_dns_record.go +++ b/x/registry/keeper/msg_server_update_dns_record.go @@ -20,11 +20,12 @@ func (k msgServer) UpdateDnsRecord(goCtx context.Context, msg *types.MsgUpdateDn } // Check if the domain is owned by the creator - if isEditable, roleErr := domain.IsRecordEditable(msg.Creator); !isEditable { - return nil, roleErr + isEditable, err := domain.IsRecordEditable(msg.Creator) + if !isEditable { + return nil, err } - err := domain.UpdateDnsRecord(msg.DnsRecordType, msg.Value) + err = domain.UpdateDnsRecord(msg.DnsRecordType, msg.Value) if err != nil { return nil, err } diff --git a/x/registry/keeper/msg_server_update_wallet_record.go b/x/registry/keeper/msg_server_update_wallet_record.go index 79495a88..1eeca326 100644 --- a/x/registry/keeper/msg_server_update_wallet_record.go +++ b/x/registry/keeper/msg_server_update_wallet_record.go @@ -20,11 +20,12 @@ func (k msgServer) UpdateWalletRecord(goCtx context.Context, msg *types.MsgUpdat } // Check if the domain is owned by the creator - if isEditable, roleErr := domain.IsRecordEditable(msg.Creator); !isEditable { - return nil, roleErr + isEditable, err := domain.IsRecordEditable(msg.Creator) + if !isEditable { + return nil, err } - err := domain.UpdateWalletRecord(msg.WalletRecordType, msg.Value) + err = domain.UpdateWalletRecord(msg.WalletRecordType, msg.Value) if err != nil { return nil, err } From afa812ea488d01d52b33a498ca126c07b61839bd Mon Sep 17 00:00:00 2001 From: jaguarmouse Date: Fri, 15 Sep 2023 18:50:39 +0900 Subject: [PATCH 8/9] fixes role's type name for client --- x/registry/client/cli/query_second_level_domain_test.go | 2 +- x/registry/client/cli/query_top_level_domain_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/x/registry/client/cli/query_second_level_domain_test.go b/x/registry/client/cli/query_second_level_domain_test.go index 9798c157..d0b02391 100644 --- a/x/registry/client/cli/query_second_level_domain_test.go +++ b/x/registry/client/cli/query_second_level_domain_test.go @@ -34,7 +34,7 @@ func networkWithSecondLevelDomainObjects(t *testing.T, n int) (*network.Network, DnsRecords: make(map[string]*types.DnsRecord), WalletRecords: make(map[string]*types.WalletRecord), Metadata: make(map[string]string), - AccessControl: make(map[string]*types.SubdomainRole), + AccessControl: make(map[string]types.DomainRole), } nullify.Fill(&secondLevelDomain) state.SecondLevelDomains = append(state.SecondLevelDomains, secondLevelDomain) diff --git a/x/registry/client/cli/query_top_level_domain_test.go b/x/registry/client/cli/query_top_level_domain_test.go index b38eedd8..4b93d3f3 100644 --- a/x/registry/client/cli/query_top_level_domain_test.go +++ b/x/registry/client/cli/query_top_level_domain_test.go @@ -27,9 +27,9 @@ func networkWithTopLevelDomainObjects(t *testing.T, n int) (*network.Network, [] state := types.GenesisState{} for i := 0; i < n; i++ { topLevelDomain := types.TopLevelDomain{ - Name: strconv.Itoa(i), + Name: strconv.Itoa(i), Metadata: make(map[string]string), - AccessControl: make(map[string]*types.TopLevelDomainRole), + AccessControl: make(map[string]types.DomainRole), } nullify.Fill(&topLevelDomain) state.TopLevelDomains = append(state.TopLevelDomains, topLevelDomain) From d35ee3e560c9a73395514edb0826e857fd3907e6 Mon Sep 17 00:00:00 2001 From: jaguarmouse Date: Fri, 15 Sep 2023 18:56:35 +0900 Subject: [PATCH 9/9] adds access control registration for TLD --- x/registry/keeper/msg_server_register_top_level_domain.go | 4 ++++ .../keeper/msg_server_register_top_level_domain_test.go | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/x/registry/keeper/msg_server_register_top_level_domain.go b/x/registry/keeper/msg_server_register_top_level_domain.go index c1da39ed..4361d9f5 100644 --- a/x/registry/keeper/msg_server_register_top_level_domain.go +++ b/x/registry/keeper/msg_server_register_top_level_domain.go @@ -25,6 +25,9 @@ func (k msgServer) RegisterTopLevelDomain(goCtx context.Context, msg *types.MsgR currentTime := ctx.BlockTime() expirationDate := currentTime.AddDate(int(msg.RegistrationPeriodInYear), 0, 0) + accessControl := map[string]types.DomainRole{ + msg.Creator: types.DomainRole_OWNER, + } defaultRegistrationConfig := types.GetDefaultSubdomainConfig(3030) domain := types.TopLevelDomain{ @@ -32,6 +35,7 @@ func (k msgServer) RegisterTopLevelDomain(goCtx context.Context, msg *types.MsgR ExpirationDate: expirationDate.UnixNano(), Metadata: nil, SubdomainConfig: &defaultRegistrationConfig, + AccessControl: accessControl, } err = k.Keeper.RegisterTopLevelDomain(ctx, domain, creatorAddress, msg.RegistrationPeriodInYear) diff --git a/x/registry/keeper/msg_server_register_top_level_domain_test.go b/x/registry/keeper/msg_server_register_top_level_domain_test.go index 8b41a322..c7250a72 100644 --- a/x/registry/keeper/msg_server_register_top_level_domain_test.go +++ b/x/registry/keeper/msg_server_register_top_level_domain_test.go @@ -70,8 +70,9 @@ func (suite *KeeperTestSuite) TestRegisterTopLevelDomain() { if tc.expErr == nil { // Evalute if domain is registered - _, found := suite.app.RegistryKeeper.GetTopLevelDomain(suite.ctx, tc.name) + domain, found := suite.app.RegistryKeeper.GetTopLevelDomain(suite.ctx, tc.name) suite.Require().True(found) + suite.Require().Equal(domain.AccessControl[tc.creator], types.DomainRole_OWNER) // Evalute events suite.Require().Nil(err)