diff --git a/docs/api/proto-docs.md b/docs/api/proto-docs.md index 78f51ca7..efc9e890 100644 --- a/docs/api/proto-docs.md +++ b/docs/api/proto-docs.md @@ -2225,6 +2225,7 @@ Msg defines the bond Msg service. | `bond_id` | [string](#string) | | | | `laconic_id` | [string](#string) | | | | `x500` | [X500](#vulcanize.nameservice.v1beta1.X500) | | | +| `type` | [string](#string) | | | @@ -2243,6 +2244,7 @@ Msg defines the bond Msg service. | `repo_registration_record_cid` | [string](#string) | | | | `build_atrifact_cid` | [string](#string) | | | | `TLS_cert_cid` | [string](#string) | | | +| `type` | [string](#string) | | | diff --git a/proto/vulcanize/nameservice/v1beta1/attributes.proto b/proto/vulcanize/nameservice/v1beta1/attributes.proto index 46a4e94b..524ca3f8 100644 --- a/proto/vulcanize/nameservice/v1beta1/attributes.proto +++ b/proto/vulcanize/nameservice/v1beta1/attributes.proto @@ -9,6 +9,7 @@ message ServiceProviderRegistration { string bond_id = 1 [(gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""]; string laconic_id = 2 [(gogoproto.moretags) = "json:\"laconicId\" yaml:\"laconicId\""]; X500 x500 = 3 [(gogoproto.moretags) = "json:\"x500\" yaml:\"x500\""]; + string type = 4 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""]; } message X500 { @@ -26,4 +27,5 @@ message WebsiteRegistrationRecord { [(gogoproto.moretags) = "json:\"repoRegistrationRecordCID\" yaml:\"repoRegistrationRecordCID\""]; string build_atrifact_cid = 3 [(gogoproto.moretags) = "json:\"buildArtifactCID\" yaml:\"buildArtifactCID\""]; string TLS_cert_cid = 4 [(gogoproto.moretags) = "json:\"TLSCertCID\" yaml:\"TLSCertCID\""]; + string type = 5 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""]; } \ No newline at end of file diff --git a/x/nameservice/keeper/keeper.go b/x/nameservice/keeper/keeper.go index 67ab9c25..f689a690 100644 --- a/x/nameservice/keeper/keeper.go +++ b/x/nameservice/keeper/keeper.go @@ -2,6 +2,7 @@ package keeper import ( "bytes" + "encoding/json" "fmt" "sort" "time" @@ -45,6 +46,8 @@ var ( // PrefixBondIDToAuthoritiesIndex is the prefix for the Bond ID -> [Authority] index. PrefixBondIDToAuthoritiesIndex = []byte{0x06} + PrefixAttributesIndex = []byte{0x07} + // PrefixExpiryTimeToRecordsIndex is the prefix for the Expiry Time -> [Record] index. PrefixExpiryTimeToRecordsIndex = []byte{0x10} @@ -233,6 +236,11 @@ func (k Keeper) processRecord(ctx sdk.Context, record *types.RecordType, isRenew return err } k.PutRecord(ctx, recordObj) + + if err := k.ProcessAttributes(ctx, *record); err != nil { + return err + } + k.InsertRecordExpiryQueue(ctx, recordObj) // Renewal doesn't change the name and bond indexes. @@ -250,6 +258,68 @@ func (k Keeper) PutRecord(ctx sdk.Context, record types.Record) { k.updateBlockChangeSetForRecord(ctx, record.Id) } +func (k Keeper) ProcessAttributes(ctx sdk.Context, record types.RecordType) error { + + switch record.Attributes["type"] { + case "ServiceProviderRegistration": + { + for key, val := range record.Attributes { + if key == "x500" { + for x500Key, x500Val := range val.(map[string]string) { + indexKey := GetAttributesIndexKey(fmt.Sprintf("x500%s", x500Key), x500Val) + if err := k.SetAttributeMapping(ctx, indexKey, record.Id); err != nil { + return err + } + } + } else { + indexKey := GetAttributesIndexKey(key, val) + if err := k.SetAttributeMapping(ctx, indexKey, record.Id); err != nil { + return err + } + } + } + } + case "WebsiteRegistrationRecord": + { + for key, val := range record.Attributes { + indexKey := GetAttributesIndexKey(key, val) + if err := k.SetAttributeMapping(ctx, indexKey, record.Id); err != nil { + return err + } + } + } + default: + return fmt.Errorf("unsupported record type %s", record.Attributes["type"]) + } + + return nil +} + +func GetAttributesIndexKey(key string, value interface{}) []byte { + keyString := fmt.Sprintf("%s%s", key, value) + return append(PrefixAttributesIndex, []byte(keyString)...) +} + +func (k Keeper) SetAttributeMapping(ctx sdk.Context, key []byte, recordId string) error { + store := ctx.KVStore(k.storeKey) + var recordIds []string + if store.Has(key) { + err := json.Unmarshal(store.Get(key), &recordIds) + if err != nil { + return fmt.Errorf("cannot unmarshal byte array, error, %w", err) + } + } else { + recordIds = []string{} + } + recordIds = append(recordIds, recordId) + bz, err := json.Marshal(recordIds) + if err != nil { + return fmt.Errorf("cannot marshal string array, error, %w", err) + } + store.Set(key, bz) + return nil +} + // AddBondToRecordIndexEntry adds the Bond ID -> [Record] index entry. func (k Keeper) AddBondToRecordIndexEntry(ctx sdk.Context, bondID string, id string) { store := ctx.KVStore(k.storeKey) diff --git a/x/nameservice/types/attributes.pb.go b/x/nameservice/types/attributes.pb.go index ce31c8e3..b25af8c0 100644 --- a/x/nameservice/types/attributes.pb.go +++ b/x/nameservice/types/attributes.pb.go @@ -27,6 +27,7 @@ type ServiceProviderRegistration struct { BondId string `protobuf:"bytes,1,opt,name=bond_id,json=bondId,proto3" json:"bond_id,omitempty" json:"bondId" yaml:"bondId"` LaconicId string `protobuf:"bytes,2,opt,name=laconic_id,json=laconicId,proto3" json:"laconic_id,omitempty" json:"laconicId" yaml:"laconicId"` X500 *X500 `protobuf:"bytes,3,opt,name=x500,proto3" json:"x500,omitempty" json:"x500" yaml:"x500"` + Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty" json:"type" yaml:"type"` } func (m *ServiceProviderRegistration) Reset() { *m = ServiceProviderRegistration{} } @@ -83,6 +84,13 @@ func (m *ServiceProviderRegistration) GetX500() *X500 { return nil } +func (m *ServiceProviderRegistration) GetType() string { + if m != nil { + return m.Type + } + return "" +} + type X500 struct { CommonName string `protobuf:"bytes,1,opt,name=common_name,json=commonName,proto3" json:"common_name,omitempty" json:"commonName" yaml:"commonName"` OrganizationUnit string `protobuf:"bytes,2,opt,name=organization_unit,json=organizationUnit,proto3" json:"organization_unit,omitempty" json:"organizationUnit" yaml:"organizationUnit"` @@ -172,6 +180,7 @@ type WebsiteRegistrationRecord struct { RepoRegistrationRecordCid string `protobuf:"bytes,2,opt,name=repo_registration_record_cid,json=repoRegistrationRecordCid,proto3" json:"repo_registration_record_cid,omitempty" json:"repoRegistrationRecordCID" yaml:"repoRegistrationRecordCID"` BuildAtrifactCid string `protobuf:"bytes,3,opt,name=build_atrifact_cid,json=buildAtrifactCid,proto3" json:"build_atrifact_cid,omitempty" json:"buildArtifactCID" yaml:"buildArtifactCID"` TLSCertCid string `protobuf:"bytes,4,opt,name=TLS_cert_cid,json=TLSCertCid,proto3" json:"TLS_cert_cid,omitempty" json:"TLSCertCID" yaml:"TLSCertCID"` + Type string `protobuf:"bytes,5,opt,name=type,proto3" json:"type,omitempty" json:"type" yaml:"type"` } func (m *WebsiteRegistrationRecord) Reset() { *m = WebsiteRegistrationRecord{} } @@ -235,6 +244,13 @@ func (m *WebsiteRegistrationRecord) GetTLSCertCid() string { return "" } +func (m *WebsiteRegistrationRecord) GetType() string { + if m != nil { + return m.Type + } + return "" +} + func init() { proto.RegisterType((*ServiceProviderRegistration)(nil), "vulcanize.nameservice.v1beta1.ServiceProviderRegistration") proto.RegisterType((*X500)(nil), "vulcanize.nameservice.v1beta1.X500") @@ -246,46 +262,48 @@ func init() { } var fileDescriptor_7f2d1895d048a86a = []byte{ - // 621 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x94, 0x5f, 0x4f, 0xd4, 0x4c, - 0x14, 0xc6, 0x29, 0xbb, 0x2f, 0x84, 0x81, 0x37, 0xc1, 0x46, 0x23, 0x88, 0xb4, 0xb0, 0xc4, 0x40, - 0x42, 0x6c, 0x17, 0x09, 0x89, 0xd1, 0x2b, 0xfe, 0x98, 0xb8, 0x09, 0x31, 0x64, 0xc0, 0x68, 0xbc, - 0xa9, 0xd3, 0xe9, 0xb8, 0x8e, 0x69, 0x3b, 0x64, 0x3a, 0xdd, 0xb0, 0x7e, 0x00, 0xaf, 0xfd, 0x58, - 0x5e, 0x72, 0xe9, 0x55, 0x63, 0xe0, 0xca, 0xdb, 0xfa, 0x01, 0x34, 0x33, 0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 0x87, 0x5f, 0x2e, 0x0b, 0xf7, 0x81, 0xc6, 0xe6, - 0x3c, 0xae, 0x91, 0x32, 0x84, 0xd2, 0x65, 0x7f, 0xb3, 0xc0, 0x63, 0x4e, 0xce, 0x59, 0xc0, 0x0d, - 0x50, 0xc0, 0x15, 0x29, 0xc0, 0xa3, 0x2d, 0x7f, 0x55, 0x16, 0xee, 0xbe, 0xc6, 0x48, 0x77, 0x73, - 0xea, 0x61, 0xef, 0xa8, 0x86, 0xdf, 0x6e, 0x80, 0xcb, 0xb7, 0xd4, 0x68, 0x64, 0x23, 0x60, 0x87, - 0x39, 0x8d, 0xa3, 0x00, 0x09, 0x4e, 0x3f, 0x21, 0x2c, 0xd4, 0xf4, 0xc6, 0x2e, 0x28, 0xcf, 0x3e, - 0x17, 0xca, 0x62, 0x0c, 0x6d, 0xe8, 0x70, 0x51, 0x4b, 0x15, 0x4d, 0x8e, 0xe8, 0x81, 0x85, 0xb3, - 0xe3, 0xd3, 0x00, 0x13, 0xae, 0xe1, 0xed, 0xc9, 0xbf, 0xc6, 0xd9, 0xf1, 0xe9, 0x21, 0xe1, 0x26, - 0xd6, 0x50, 0x20, 0xa8, 0x13, 0x1a, 0x1d, 0xf4, 0x7e, 0x5c, 0x39, 0xd6, 0xe5, 0x95, 0x63, 0xfd, - 0xba, 0x72, 0xac, 0xef, 0xd7, 0xce, 0xd4, 0xe5, 0xb5, 0x33, 0xf5, 0xf3, 0xda, 0x99, 0xfa, 0xe0, - 0xf7, 0xa9, 0xf8, 0x9c, 0x87, 0x1e, 0x66, 0x89, 0x8f, 0x09, 0xc7, 0x4f, 0x29, 0xf3, 0xab, 0xff, - 0x7e, 0xe4, 0x5f, 0xdc, 0xf8, 0xec, 0x89, 0xe1, 0x39, 0xc9, 0xc2, 0x19, 0xf5, 0xd5, 0xda, 0xfd, - 0x17, 0x00, 0x00, 0xff, 0xff, 0x11, 0xd8, 0xec, 0xb9, 0x1c, 0x05, 0x00, 0x00, + // 647 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0x4f, 0x4f, 0xd4, 0x4e, + 0x18, 0xc7, 0x29, 0xbb, 0x40, 0x18, 0xf8, 0x25, 0xfc, 0x1a, 0x8d, 0x8b, 0xc8, 0x16, 0x96, 0x18, + 0x48, 0x88, 0xed, 0x22, 0x21, 0x31, 0x7a, 0xe2, 0x8f, 0x89, 0x9b, 0x10, 0x43, 0x06, 0x8c, 0xc6, + 0x4b, 0x9d, 0x4e, 0xc7, 0x75, 0x4c, 0xb7, 0x43, 0xa6, 0xd3, 0x0d, 0xeb, 0x0b, 0xf0, 0xec, 0x8b, + 0xf0, 0x05, 0xf8, 0x32, 0x3c, 0x72, 0xf4, 0xd4, 0x18, 0x38, 0x79, 0xed, 0x2b, 0x30, 0x33, 0xd3, + 0x76, 0x87, 0x6d, 0x20, 0xde, 0x9e, 0xf9, 0x3e, 0xdf, 0xe7, 0xf3, 0xcc, 0x7f, 0xe0, 0x0e, 0xd3, + 0x08, 0xa3, 0x98, 0x7e, 0x21, 0x5e, 0x8c, 0x06, 0x24, 0x21, 0x7c, 0x48, 0x31, 0xf1, 0x86, 0x3b, + 0x01, 0x11, 0x68, 0xc7, 0x43, 0x42, 0x70, 0x1a, 0xa4, 0x82, 0x24, 0xee, 0x39, 0x67, 0x82, 0xd9, + 0xab, 0x95, 0xdf, 0x35, 0xfc, 0x6e, 0xe1, 0x7f, 0x78, 0xaf, 0xcf, 0xfa, 0x4c, 0x39, 0x3d, 0x19, + 0xe9, 0xa2, 0xce, 0xf7, 0x69, 0xb0, 0x72, 0xaa, 0x9d, 0x27, 0x9c, 0x0d, 0x69, 0x48, 0x38, 0x24, + 0x7d, 0x9a, 0x08, 0x8e, 0x04, 0x65, 0xb1, 0xfd, 0x0c, 0xcc, 0x05, 0x2c, 0x0e, 0x7d, 0x1a, 0xb6, + 0xac, 0x35, 0x6b, 0x6b, 0xf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d, 0x66, 0x07, 0xb5, 0x86, 0x13, + 0xf0, 0x5f, 0xc4, 0x30, 0x8a, 0xa8, 0x18, 0x69, 0xba, 0xde, 0xd0, 0xed, 0x3c, 0x73, 0x36, 0x8b, + 0x63, 0x2e, 0xd2, 0x26, 0xf9, 0x86, 0x06, 0x17, 0xcd, 0xa1, 0xbc, 0x35, 0x89, 0x40, 0x82, 0x68, + 0xdc, 0xcc, 0xe4, 0xad, 0x51, 0x39, 0x93, 0x35, 0x16, 0xe0, 0x7c, 0x15, 0xdb, 0x2f, 0xc0, 0x1c, + 0x66, 0x69, 0x2c, 0xf8, 0xa8, 0x35, 0xab, 0x10, 0xeb, 0x79, 0xe6, 0xac, 0x96, 0x27, 0xa4, 0x12, + 0xe3, 0xe3, 0xd1, 0x43, 0x58, 0x56, 0x74, 0x7e, 0x34, 0xc0, 0xf2, 0x5b, 0x12, 0x24, 0x54, 0x10, + 0xf3, 0x29, 0x40, 0x82, 0x19, 0x0f, 0xed, 0x6d, 0xd0, 0x48, 0x79, 0x54, 0x1c, 0xfc, 0x72, 0x9e, + 0x39, 0xf7, 0x35, 0x36, 0xe5, 0x51, 0x89, 0x94, 0x21, 0x94, 0x2e, 0xfb, 0xab, 0x05, 0x1e, 0x71, + 0x72, 0xce, 0x7c, 0x6e, 0x80, 0x7c, 0xae, 0x48, 0x3e, 0xae, 0x9e, 0xc5, 0xcb, 0x3c, 0x73, 0xf6, + 0x35, 0x46, 0xba, 0xeb, 0x5d, 0x0f, 0x7b, 0x47, 0x25, 0xfc, 0x76, 0x03, 0x5c, 0xbe, 0x25, 0x47, + 0x43, 0x1b, 0x01, 0x3b, 0x48, 0x69, 0x14, 0xfa, 0x48, 0x70, 0xfa, 0x11, 0x61, 0xa1, 0xba, 0xd7, + 0xee, 0x82, 0xf2, 0xec, 0x73, 0xa1, 0x2c, 0x46, 0xd3, 0x9a, 0x0e, 0x97, 0xb4, 0x54, 0xd0, 0x64, + 0x8b, 0x1e, 0x58, 0x3c, 0x3b, 0x3e, 0xf5, 0x31, 0xe1, 0x1a, 0xde, 0x9c, 0x7c, 0x1a, 0x67, 0xc7, + 0xa7, 0x87, 0x84, 0x9b, 0x58, 0x43, 0x81, 0xa0, 0x1c, 0xd0, 0xb0, 0x7a, 0x9e, 0x33, 0xff, 0xf8, + 0x3c, 0x0f, 0x7a, 0x3f, 0xaf, 0xda, 0xd6, 0xe5, 0x55, 0xdb, 0xfa, 0x7d, 0xd5, 0xb6, 0xbe, 0x5d, + 0xb7, 0xa7, 0x2e, 0xaf, 0xdb, 0x53, 0xbf, 0xae, 0xdb, 0x53, 0xef, 0xbd, 0x3e, 0x15, 0x9f, 0xd2, + 0xc0, 0xc5, 0x6c, 0xe0, 0x61, 0xc2, 0xf1, 0x13, 0xca, 0xbc, 0xe2, 0x77, 0x09, 0xbd, 0x8b, 0x1b, + 0x1f, 0xab, 0x24, 0x25, 0xc1, 0xac, 0xfa, 0x17, 0x77, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x54, + 0x64, 0xed, 0xc7, 0x7e, 0x05, 0x00, 0x00, } func (m *ServiceProviderRegistration) Marshal() (dAtA []byte, err error) { @@ -308,6 +326,13 @@ func (m *ServiceProviderRegistration) MarshalToSizedBuffer(dAtA []byte) (int, er _ = i var l int _ = l + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintAttributes(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0x22 + } if m.X500 != nil { { size, err := m.X500.MarshalToSizedBuffer(dAtA[:i]) @@ -422,6 +447,13 @@ func (m *WebsiteRegistrationRecord) MarshalToSizedBuffer(dAtA []byte) (int, erro _ = i var l int _ = l + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintAttributes(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0x2a + } if len(m.TLSCertCid) > 0 { i -= len(m.TLSCertCid) copy(dAtA[i:], m.TLSCertCid) @@ -482,6 +514,10 @@ func (m *ServiceProviderRegistration) Size() (n int) { l = m.X500.Size() n += 1 + l + sovAttributes(uint64(l)) } + l = len(m.Type) + if l > 0 { + n += 1 + l + sovAttributes(uint64(l)) + } return n } @@ -540,6 +576,10 @@ func (m *WebsiteRegistrationRecord) Size() (n int) { if l > 0 { n += 1 + l + sovAttributes(uint64(l)) } + l = len(m.Type) + if l > 0 { + n += 1 + l + sovAttributes(uint64(l)) + } return n } @@ -678,6 +718,38 @@ func (m *ServiceProviderRegistration) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributes + } + 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 ErrInvalidLengthAttributes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAttributes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Type = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipAttributes(dAtA[iNdEx:]) @@ -1098,6 +1170,38 @@ func (m *WebsiteRegistrationRecord) Unmarshal(dAtA []byte) error { } m.TLSCertCid = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAttributes + } + 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 ErrInvalidLengthAttributes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAttributes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Type = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipAttributes(dAtA[iNdEx:])