diff --git a/x/registry/keeper/grpc_query_test.go b/x/registry/keeper/grpc_query_test.go index 4e580432..6d5073de 100644 --- a/x/registry/keeper/grpc_query_test.go +++ b/x/registry/keeper/grpc_query_test.go @@ -79,6 +79,24 @@ func (suite *KeeperTestSuite) TestGrpcGetRecordLists() { false, 1, }, + { + "Filter test for key collision (https://git.vdb.to/cerc-io/laconicd/issues/122)", + ®istrytypes.QueryListRecordsRequest{ + Attributes: []*registrytypes.QueryListRecordsRequest_KeyValueInput{ + { + Key: "typ", + Value: ®istrytypes.QueryListRecordsRequest_ValueInput{ + Type: "string", + String_: "eWebsiteRegistrationRecord", + }, + }, + }, + All: true, + }, + true, + false, + 0, + }, { "Filter with attributes ServiceProviderRegistration", ®istrytypes.QueryListRecordsRequest{ @@ -123,7 +141,7 @@ func (suite *KeeperTestSuite) TestGrpcGetRecordLists() { } else { sr.NoError(err) sr.Equal(test.noOfRecords, len(resp.GetRecords())) - if test.createRecords { + if test.createRecords && test.noOfRecords > 0 { recordId = resp.GetRecords()[0].GetId() sr.NotZero(resp.GetRecords()) sr.Equal(resp.GetRecords()[0].GetBondId(), suite.bond.GetId()) diff --git a/x/registry/keeper/keeper.go b/x/registry/keeper/keeper.go index ebeaaa93..f3ec26f1 100644 --- a/x/registry/keeper/keeper.go +++ b/x/registry/keeper/keeper.go @@ -367,7 +367,7 @@ func (k Keeper) ProcessAttributes(ctx sdk.Context, record types.RecordType) erro } func GetAttributesIndexKey(key string, value interface{}) []byte { - keyString := fmt.Sprintf("%s%s", key, value) + keyString := fmt.Sprintf("%s=%s", key, value) return append(PrefixAttributesIndex, []byte(keyString)...) }