From 3faf0767598260b01c9d4309ba618329f28a118e Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Thu, 10 Nov 2022 12:10:48 +0530 Subject: [PATCH] fix names and add checks for attributes in tests --- docs/api/proto-docs.md | 2 +- go.mod | 19 ++-- go.sum | 40 +++---- .../nameservice/v1beta1/attributes.proto | 2 +- .../testutil/website_registration_example.yml | 2 +- x/nameservice/keeper/grpc_query_test.go | 33 ++++++ x/nameservice/keeper/keeper.go | 4 +- x/nameservice/types/attributes.pb.go | 104 +++++++++--------- x/nameservice/types/types.go | 6 +- 9 files changed, 124 insertions(+), 88 deletions(-) diff --git a/docs/api/proto-docs.md b/docs/api/proto-docs.md index 0e3d31f3..87a8c973 100644 --- a/docs/api/proto-docs.md +++ b/docs/api/proto-docs.md @@ -2350,7 +2350,7 @@ Msg defines the bond Msg service. | ----- | ---- | ----- | ----------- | | `url` | [string](#string) | | | | `repo_registration_record_cid` | [string](#string) | | | -| `build_atrifact_cid` | [string](#string) | | | +| `build_artifact_cid` | [string](#string) | | | | `tls_cert_cid` | [string](#string) | | | | `type` | [string](#string) | | | diff --git a/go.mod b/go.mod index 5fa50585..82164fe8 100644 --- a/go.mod +++ b/go.mod @@ -42,9 +42,9 @@ require ( github.com/tendermint/tm-db v0.6.7 github.com/tyler-smith/go-bip39 v1.1.0 github.com/vektah/gqlparser/v2 v2.5.1 - golang.org/x/net v0.1.0 + golang.org/x/net v0.2.0 golang.org/x/text v0.4.0 - google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c + google.golang.org/genproto v0.0.0-20221109142239-94d6d90a7d66 google.golang.org/grpc v1.50.1 google.golang.org/protobuf v1.28.1 gopkg.in/yaml.v3 v3.0.1 @@ -53,8 +53,9 @@ require ( require ( cloud.google.com/go v0.105.0 // indirect - cloud.google.com/go/compute v1.10.0 // indirect - cloud.google.com/go/iam v0.6.0 // indirect + cloud.google.com/go/compute v1.12.1 // indirect + cloud.google.com/go/compute/metadata v0.2.1 // indirect + cloud.google.com/go/iam v0.7.0 // indirect cloud.google.com/go/storage v1.27.0 // indirect cosmossdk.io/errors v1.0.0-beta.7 // indirect filippo.io/edwards25519 v1.0.0-rc.1 // indirect @@ -193,14 +194,14 @@ require ( github.com/zondax/hid v0.9.1-0.20220302062450-5552068d2266 // indirect go.etcd.io/bbolt v1.3.6 // indirect go.opencensus.io v0.23.0 // indirect - golang.org/x/crypto v0.1.0 // indirect + golang.org/x/crypto v0.2.0 // indirect golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect - golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0 // indirect - golang.org/x/sys v0.1.0 // indirect - golang.org/x/term v0.1.0 // indirect + golang.org/x/sync v0.1.0 // indirect + golang.org/x/sys v0.2.0 // indirect + golang.org/x/term v0.2.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - google.golang.org/api v0.100.0 // indirect + google.golang.org/api v0.102.0 // indirect google.golang.org/appengine v1.6.7 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect diff --git a/go.sum b/go.sum index 99331509..4fc82b64 100644 --- a/go.sum +++ b/go.sum @@ -28,13 +28,15 @@ cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUM cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm+2xVAli2o= -cloud.google.com/go/compute v1.10.0 h1:aoLIYaA1fX3ywihqpBk2APQKOo20nXsp1GEZQbx5Jk4= -cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= +cloud.google.com/go/compute v1.12.1 h1:gKVJMEyqV5c/UnpzjjQbo3Rjvvqpr9B1DFSbJC4OXr0= +cloud.google.com/go/compute v1.12.1/go.mod h1:e8yNOBcBONZU1vJKCvCoDw/4JQsA0dpM4x/6PIIOocU= +cloud.google.com/go/compute/metadata v0.2.1 h1:efOwf5ymceDhK6PKMnnrTHP4pppY5L22mle96M1yP48= +cloud.google.com/go/compute/metadata v0.2.1/go.mod h1:jgHgmJd2RKBGzXqF5LR2EZMGxBkeanZ9wwa75XHJgOM= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/iam v0.6.0 h1:nsqQC88kT5Iwlm4MeNGTpfMWddp6NB/UOLFTH6m1QfQ= -cloud.google.com/go/iam v0.6.0/go.mod h1:+1AH33ueBne5MzYccyMHtEKqLE4/kJOibtffMHDMFMc= -cloud.google.com/go/longrunning v0.1.1 h1:y50CXG4j0+qvEukslYFBCrzaXX0qpFbBzc3PchSu/LE= +cloud.google.com/go/iam v0.7.0 h1:k4MuwOsS7zGJJ+QfZ5vBK8SgHBAvYN/23BWsiihJ1vs= +cloud.google.com/go/iam v0.7.0/go.mod h1:H5Br8wRaDGNc8XP3keLc4unfUUZeyH3Sfl9XpQEYOeg= +cloud.google.com/go/longrunning v0.3.0 h1:NjljC+FYPV3uh5/OwWT6pVU+doBqMg2x/rZlE+CamDs= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -1157,8 +1159,8 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= -golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= +golang.org/x/crypto v0.2.0 h1:BRXPfhNivWL5Yq0BGQ39a2sW6t44aODpfxkWjYdzewE= +golang.org/x/crypto v0.2.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1259,8 +1261,8 @@ golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= +golang.org/x/net v0.2.0 h1:sZfSu1wtKLGlWI4ZZayP0ck9Y73K1ynO6gqzTdBVdPU= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1286,8 +1288,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0 h1:cu5kTvlzcw1Q5S9f5ip1/cpiB4nXvw1XYzFPGgzLUOY= -golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1376,13 +1378,13 @@ golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.1.0 h1:g6Z6vPFA9dYBAF7DWcH6sCcOntplXsDKcliusYijMlw= -golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.2.0 h1:z85xZCsEl7bi/KwbNADeBYoOP0++7W1ipu+aGnpwzRM= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1494,8 +1496,8 @@ google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz513 google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.100.0 h1:LGUYIrbW9pzYQQ8NWXlaIVkgnfubVBZbMFb9P8TK374= -google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= +google.golang.org/api v0.102.0 h1:JxJl2qQ85fRMPNvlZY/enexbxpCjLwGhZUtgfGeQ51I= +google.golang.org/api v0.102.0/go.mod h1:3VFl6/fzoA+qNuS1N1/VfXY4LjoXN/wzeIp7TweWwGo= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1549,8 +1551,8 @@ google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c h1:QgY/XxIAIeccR+Ca/rDdKubLIU9rcJ3xfy1DC/Wd2Oo= -google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c/go.mod h1:CGI5F/G+E5bKwmfYo09AXuVN4dD894kIKUFmVbP2/Fo= +google.golang.org/genproto v0.0.0-20221109142239-94d6d90a7d66 h1:wx7sJ5GRBQLRcslTNcrTklsHhHevQvxgztW18txbbZM= +google.golang.org/genproto v0.0.0-20221109142239-94d6d90a7d66/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= diff --git a/proto/vulcanize/nameservice/v1beta1/attributes.proto b/proto/vulcanize/nameservice/v1beta1/attributes.proto index a9348d71..0173d81c 100644 --- a/proto/vulcanize/nameservice/v1beta1/attributes.proto +++ b/proto/vulcanize/nameservice/v1beta1/attributes.proto @@ -25,7 +25,7 @@ message WebsiteRegistrationRecord { string url = 1 [(gogoproto.moretags) = "json:\"url\" yaml:\"url\""]; string repo_registration_record_cid = 2 [(gogoproto.moretags) = "json:\"repoRegistrationRecordCID\" yaml:\"repoRegistrationRecordCID\""]; - string build_atrifact_cid = 3 [(gogoproto.moretags) = "json:\"buildArtifactCID\" yaml:\"buildArtifactCID\""]; + string build_artifact_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/client/testutil/website_registration_example.yml b/x/nameservice/client/testutil/website_registration_example.yml index 79c1de6a..fdad1540 100644 --- a/x/nameservice/client/testutil/website_registration_example.yml +++ b/x/nameservice/client/testutil/website_registration_example.yml @@ -3,4 +3,4 @@ record: url: https://cerc.io repo_registration_record_cid: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D build_artifact_cid: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9 - tls_cerc_cid: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR \ No newline at end of file + tls_cert_cid: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR \ No newline at end of file diff --git a/x/nameservice/keeper/grpc_query_test.go b/x/nameservice/keeper/grpc_query_test.go index 4fcaebfa..1600344f 100644 --- a/x/nameservice/keeper/grpc_query_test.go +++ b/x/nameservice/keeper/grpc_query_test.go @@ -6,6 +6,8 @@ import ( "os" "github.com/cerc-io/laconicd/x/nameservice/client/cli" + "github.com/cerc-io/laconicd/x/nameservice/helpers" + "github.com/cerc-io/laconicd/x/nameservice/keeper" nameservicetypes "github.com/cerc-io/laconicd/x/nameservice/types" ) @@ -77,6 +79,24 @@ func (suite *KeeperTestSuite) TestGrpcGetRecordLists() { false, 1, }, + { + "Filter with attributes ServiceProviderRegistration", + &nameservicetypes.QueryListRecordsRequest{ + Attributes: []*nameservicetypes.QueryListRecordsRequest_KeyValueInput{ + { + Key: "x500state_name", + Value: &nameservicetypes.QueryListRecordsRequest_ValueInput{ + Type: "string", + String_: "california", + }, + }, + }, + All: true, + }, + true, + false, + 1, + }, } for _, test := range testCases { suite.Run(fmt.Sprintf("Case %s ", test.msg), func() { @@ -107,6 +127,19 @@ func (suite *KeeperTestSuite) TestGrpcGetRecordLists() { recordId = resp.GetRecords()[0].GetId() sr.NotZero(resp.GetRecords()) sr.Equal(resp.GetRecords()[0].GetBondId(), suite.bond.GetId()) + + for _, record := range resp.GetRecords() { + bz, err := nameservicetypes.GetJSONBytesFromAny(*record.Attributes) + sr.NoError(err) + recAttr := helpers.UnMarshalMapFromJSONBytes(bz) + for _, attr := range test.req.GetAttributes() { + if attr.Key[:4] == "x500" { + sr.Equal(keeper.GetAttributeValue(attr.Value), recAttr["x500"].(map[string]interface{})[attr.Key[4:]]) + } else { + sr.Equal(keeper.GetAttributeValue(attr.Value), recAttr[attr.Key]) + } + } + } } } }) diff --git a/x/nameservice/keeper/keeper.go b/x/nameservice/keeper/keeper.go index 82dc5c94..63abca04 100644 --- a/x/nameservice/keeper/keeper.go +++ b/x/nameservice/keeper/keeper.go @@ -135,7 +135,7 @@ func (k Keeper) ListRecords(ctx sdk.Context) []types.Record { func (k Keeper) RecordsFromAttributes(ctx sdk.Context, attributes []*types.QueryListRecordsRequest_KeyValueInput, all bool) ([]types.Record, error) { resultRecordIds := []string{} for i, attr := range attributes { - val := getAttributeValue(attr.Value) + val := GetAttributeValue(attr.Value) attributeIndex := GetAttributesIndexKey(attr.Key, val) recordIds, err := k.GetAttributeMapping(ctx, attributeIndex) if err != nil { @@ -162,7 +162,7 @@ func (k Keeper) RecordsFromAttributes(ctx sdk.Context, attributes []*types.Query return records, nil } -func getAttributeValue(input *types.QueryListRecordsRequest_ValueInput) interface{} { +func GetAttributeValue(input *types.QueryListRecordsRequest_ValueInput) interface{} { if input.Type == "int" { return input.GetInt() } diff --git a/x/nameservice/types/attributes.pb.go b/x/nameservice/types/attributes.pb.go index 1a44bc0d..f843cdc5 100644 --- a/x/nameservice/types/attributes.pb.go +++ b/x/nameservice/types/attributes.pb.go @@ -178,7 +178,7 @@ func (m *X500) GetCountry() string { type WebsiteRegistrationRecord struct { Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty" json:"url" yaml:"url"` 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"` + BuildArtifactCid string `protobuf:"bytes,3,opt,name=build_artifact_cid,json=buildArtifactCid,proto3" json:"build_artifact_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"` } @@ -230,9 +230,9 @@ func (m *WebsiteRegistrationRecord) GetRepoRegistrationRecordCid() string { return "" } -func (m *WebsiteRegistrationRecord) GetBuildAtrifactCid() string { +func (m *WebsiteRegistrationRecord) GetBuildArtifactCid() string { if m != nil { - return m.BuildAtrifactCid + return m.BuildArtifactCid } return "" } @@ -262,48 +262,48 @@ func init() { } var fileDescriptor_7f2d1895d048a86a = []byte{ - // 647 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0x4d, 0x4f, 0xd4, 0x40, - 0x18, 0xc7, 0x29, 0xbb, 0x40, 0x18, 0x30, 0xc1, 0x46, 0xe3, 0x22, 0xb2, 0x85, 0x25, 0x06, 0x12, - 0x62, 0xbb, 0x48, 0x48, 0x8c, 0x9e, 0x78, 0x31, 0x71, 0x13, 0x63, 0xc8, 0x80, 0xd1, 0x78, 0xa9, - 0xd3, 0xe9, 0xb8, 0x8e, 0xe9, 0x76, 0xc8, 0x74, 0xba, 0x61, 0xfd, 0x00, 0x9e, 0xfd, 0x10, 0x7e, - 0x00, 0x3f, 0x86, 0x47, 0x8e, 0x9e, 0x1a, 0x03, 0x27, 0xaf, 0xfd, 0x04, 0x66, 0x66, 0xda, 0xee, - 0xb0, 0x0d, 0xc4, 0xdb, 0x33, 0xff, 0xe7, 0xff, 0xfc, 0x9e, 0x79, 0x07, 0xee, 0x30, 0x8d, 0x30, - 0x8a, 0xe9, 0x57, 0xe2, 0xc5, 0x68, 0x40, 0x12, 0xc2, 0x87, 0x14, 0x13, 0x6f, 0xb8, 0x13, 0x10, - 0x81, 0x76, 0x3c, 0x24, 0x04, 0xa7, 0x41, 0x2a, 0x48, 0xe2, 0x9e, 0x71, 0x26, 0x98, 0xbd, 0x5a, - 0xf9, 0x5d, 0xc3, 0xef, 0x16, 0xfe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, 0xae, 0x77, 0x3d, 0xec, 0x1d, 0x95, 0xf0, 0x9b, 0x0d, 0x70, 0xf9, 0x86, 0x1c, 0x0d, 0x6d, - 0x04, 0xec, 0x20, 0xa5, 0x51, 0xe8, 0x23, 0xc1, 0xe9, 0x27, 0x84, 0x85, 0xea, 0x5e, 0xbb, 0x0b, - 0xca, 0xb3, 0xcf, 0x85, 0xb2, 0x18, 0x4d, 0x6b, 0x3a, 0x5c, 0xd2, 0x52, 0x41, 0x93, 0x2d, 0x7a, - 0x60, 0x51, 0x44, 0x89, 0x8f, 0x09, 0xd7, 0xf0, 0xe6, 0xe4, 0xd3, 0x38, 0x7d, 0x7d, 0x72, 0x48, - 0xb8, 0x89, 0x35, 0x14, 0x08, 0x44, 0x94, 0xa8, 0x01, 0x0d, 0xab, 0xe7, 0x39, 0xf3, 0x9f, 0xcf, - 0xf3, 0xa0, 0xf7, 0xeb, 0xb2, 0x6d, 0x5d, 0x5c, 0xb6, 0xad, 0x3f, 0x97, 0x6d, 0xeb, 0xfb, 0x55, - 0x7b, 0xea, 0xe2, 0xaa, 0x3d, 0xf5, 0xfb, 0xaa, 0x3d, 0xf5, 0xc1, 0xeb, 0x53, 0xf1, 0x39, 0x0d, - 0x5c, 0xcc, 0x06, 0x1e, 0x26, 0x1c, 0x3f, 0xa1, 0xcc, 0x2b, 0x7e, 0x97, 0xd0, 0x3b, 0xbf, 0xf6, - 0xb1, 0x4a, 0x52, 0x12, 0xcc, 0xaa, 0x7f, 0x71, 0xf7, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe5, - 0x94, 0x12, 0x91, 0x7e, 0x05, 0x00, 0x00, + // 645 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0x4d, 0x4f, 0x14, 0x31, + 0x18, 0xc7, 0x59, 0x76, 0x81, 0x50, 0x30, 0xc1, 0x46, 0xe3, 0x22, 0xb2, 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, 0xa0, + 0xfb, 0xeb, 0xb2, 0x55, 0xbb, 0xb8, 0x6c, 0xd5, 0xfe, 0x5c, 0xb6, 0x6a, 0xdf, 0xaf, 0x5a, 0x53, + 0x17, 0x57, 0xad, 0xa9, 0xdf, 0x57, 0xad, 0xa9, 0x0f, 0x5e, 0x8f, 0xc9, 0xcf, 0x69, 0xe0, 0x12, + 0xde, 0xf7, 0x08, 0x15, 0xe4, 0x09, 0xe3, 0x5e, 0xf1, 0xbb, 0x84, 0xde, 0xf9, 0xd8, 0xc7, 0xaa, + 0x48, 0x49, 0x30, 0xab, 0xff, 0xc5, 0xdd, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x80, 0xa1, 0x70, + 0x3a, 0x7e, 0x05, 0x00, 0x00, } func (m *ServiceProviderRegistration) Marshal() (dAtA []byte, err error) { @@ -461,10 +461,10 @@ func (m *WebsiteRegistrationRecord) MarshalToSizedBuffer(dAtA []byte) (int, erro i-- dAtA[i] = 0x22 } - if len(m.BuildAtrifactCid) > 0 { - i -= len(m.BuildAtrifactCid) - copy(dAtA[i:], m.BuildAtrifactCid) - i = encodeVarintAttributes(dAtA, i, uint64(len(m.BuildAtrifactCid))) + if len(m.BuildArtifactCid) > 0 { + i -= len(m.BuildArtifactCid) + copy(dAtA[i:], m.BuildArtifactCid) + i = encodeVarintAttributes(dAtA, i, uint64(len(m.BuildArtifactCid))) i-- dAtA[i] = 0x1a } @@ -568,7 +568,7 @@ func (m *WebsiteRegistrationRecord) Size() (n int) { if l > 0 { n += 1 + l + sovAttributes(uint64(l)) } - l = len(m.BuildAtrifactCid) + l = len(m.BuildArtifactCid) if l > 0 { n += 1 + l + sovAttributes(uint64(l)) } @@ -1108,7 +1108,7 @@ func (m *WebsiteRegistrationRecord) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BuildAtrifactCid", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BuildArtifactCid", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1136,7 +1136,7 @@ func (m *WebsiteRegistrationRecord) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.BuildAtrifactCid = string(dAtA[iNdEx:postIndex]) + m.BuildArtifactCid = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 2 { diff --git a/x/nameservice/types/types.go b/x/nameservice/types/types.go index 1d95b88b..30a36f19 100644 --- a/x/nameservice/types/types.go +++ b/x/nameservice/types/types.go @@ -77,7 +77,7 @@ func payLoadAttributes(recordPayLoad map[string]interface{}) (*codectypes.Any, e // It will unmarshal with record attributes func (payload Payload) ToReadablePayload() PayloadType { var payloadType PayloadType - bz, err := getJSONBytesFromAny(*payload.Record.Attributes) + bz, err := GetJSONBytesFromAny(*payload.Record.Attributes) if err != nil { panic(err) } @@ -101,7 +101,7 @@ func (r *Record) ToRecordType() RecordType { resourceObj.Owners = r.Owners resourceObj.Names = r.Names - bz, err := getJSONBytesFromAny(*r.Attributes) + bz, err := GetJSONBytesFromAny(*r.Attributes) if err != nil { panic(err) } @@ -110,7 +110,7 @@ func (r *Record) ToRecordType() RecordType { return resourceObj } -func getJSONBytesFromAny(any codectypes.Any) ([]byte, error) { +func GetJSONBytesFromAny(any codectypes.Any) ([]byte, error) { var bz []byte s := strings.Split(any.TypeUrl, ".") switch s[len(s)-1] {