From 2e986c4d5ea95ccf39b9b9aafab7f0a7579762aa Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Thu, 19 Jan 2023 13:05:56 +0530 Subject: [PATCH] fix serviceproviderrecord name --- .../examples/service_provider_example.yml | 2 +- .../examples/service_provider_example.yml | 2 +- x/registry/keeper/grpc_query_test.go | 2 +- x/registry/keeper/keeper.go | 2 +- x/registry/types/codec.go | 46 ++++++++++++++++++- x/registry/types/types.go | 8 ++-- 6 files changed, 52 insertions(+), 10 deletions(-) diff --git a/x/registry/client/testutil/examples/service_provider_example.yml b/x/registry/client/testutil/examples/service_provider_example.yml index 87ea35ca..741cc5ea 100644 --- a/x/registry/client/testutil/examples/service_provider_example.yml +++ b/x/registry/client/testutil/examples/service_provider_example.yml @@ -1,6 +1,6 @@ record: - type: ServiceProviderRegistration + type: ServiceProviderRecord bond_id: madeUpBondID laconic_id: madeUpLaconicID version: 1.0.0 diff --git a/x/registry/helpers/examples/service_provider_example.yml b/x/registry/helpers/examples/service_provider_example.yml index 87ea35ca..741cc5ea 100644 --- a/x/registry/helpers/examples/service_provider_example.yml +++ b/x/registry/helpers/examples/service_provider_example.yml @@ -1,6 +1,6 @@ record: - type: ServiceProviderRegistration + type: ServiceProviderRecord bond_id: madeUpBondID laconic_id: madeUpLaconicID version: 1.0.0 diff --git a/x/registry/keeper/grpc_query_test.go b/x/registry/keeper/grpc_query_test.go index d0d0ef42..85cad6a1 100644 --- a/x/registry/keeper/grpc_query_test.go +++ b/x/registry/keeper/grpc_query_test.go @@ -87,7 +87,7 @@ func (suite *KeeperTestSuite) TestGrpcGetRecordLists() { 1, }, { - "Filter with attributes ServiceProviderRegistration", + "Filter with attributes ServiceProviderRecord", ®istrytypes.QueryListRecordsRequest{ Attributes: []*registrytypes.QueryListRecordsRequest_KeyValueInput{ { diff --git a/x/registry/keeper/keeper.go b/x/registry/keeper/keeper.go index e7891658..665e5d18 100644 --- a/x/registry/keeper/keeper.go +++ b/x/registry/keeper/keeper.go @@ -317,7 +317,7 @@ func (k Keeper) PutRecord(ctx sdk.Context, record types.Record) { func (k Keeper) ProcessAttributes(ctx sdk.Context, record types.RecordType) error { switch record.Attributes["type"] { - case "ServiceProviderRegistration": + case "ServiceProviderRecord": { // #nosec G705 for key := range record.Attributes { diff --git a/x/registry/types/codec.go b/x/registry/types/codec.go index 1a9dd50e..b154eaea 100644 --- a/x/registry/types/codec.go +++ b/x/registry/types/codec.go @@ -40,9 +40,9 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { ) registry.RegisterInterface( - "vulcanize.registry.v1beta1.ServiceProvideRegistration", + "vulcanize.registry.v1beta1.ServiceProviderRecord", (*Attributes)(nil), - &ServiceProviderRegistration{}, + &ServiceProviderRecord{}, ) registry.RegisterInterface( @@ -50,6 +50,48 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { (*Attributes)(nil), &WebsiteRegistrationRecord{}, ) + + registry.RegisterInterface( + "vulcanize.registry.v1beta1.GitRepository", + (*Attributes)(nil), + &GitRepository{}, + ) + + registry.RegisterInterface( + "vulcanize.registry.v1beta1.Binary", + (*Attributes)(nil), + &Binary{}, + ) + + registry.RegisterInterface( + "vulcanize.registry.v1beta1.DockerImage", + (*Attributes)(nil), + &DockerImage{}, + ) + + registry.RegisterInterface( + "vulcanize.registry.v1beta1.WatcherRegistrationRecord", + (*Attributes)(nil), + &WatcherRegistrationRecord{}, + ) + + registry.RegisterInterface( + "vulcanize.registry.v1beta1.ResponderContract", + (*Attributes)(nil), + &ResponderContract{}, + ) + + registry.RegisterInterface( + "vulcanize.registry.v1beta1.JSPackage", + (*Attributes)(nil), + &JSPackage{}, + ) + + registry.RegisterInterface( + "vulcanize.registry.v1beta1.ChainRegistrationRecord", + (*Attributes)(nil), + &ChainRegistrationRecord{}, + ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/registry/types/types.go b/x/registry/types/types.go index 69f770f2..ab3f740c 100644 --- a/x/registry/types/types.go +++ b/x/registry/types/types.go @@ -50,9 +50,9 @@ func payLoadAttributes(recordPayLoad map[string]interface{}) (*codectypes.Any, e bz := helpers.MarshalMapToJSONBytes(recordPayLoad) switch recordType.(string) { - case "ServiceProviderRegistration": + case "ServiceProviderRecord": { - var attributes ServiceProviderRegistration + var attributes ServiceProviderRecord err := json.Unmarshal(bz, &attributes) if err != nil { return &codectypes.Any{}, err @@ -114,9 +114,9 @@ func GetJSONBytesFromAny(any codectypes.Any) ([]byte, error) { var bz []byte s := strings.Split(any.TypeUrl, ".") switch s[len(s)-1] { - case "ServiceProviderRegistration": + case "ServiceProviderRecord": { - var attributes ServiceProviderRegistration + var attributes ServiceProviderRecord err := proto.Unmarshal(any.Value, &attributes) if err != nil { panic("Proto unmarshal error")