Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: Protobuf code generation is not consistent with cosmos-sdk #851

Merged
merged 8 commits into from
Sep 5, 2022

Conversation

devashishdxt
Copy link
Collaborator

Solution: Generate proto code using buf with similar configuration as cosmos-sdk

Solution: Generate proto code using buf with similar configuration as cosmos-sdk
@devashishdxt devashishdxt requested a review from a team as a code owner September 2, 2022 02:20
Copy link
Contributor

@tomtau tomtau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems the third party Git sub-modules are no longer needed after this (the needed protobuf definitions are fetched via buf?)? so could they be removed?

@@ -0,0 +1,19 @@
# This module represents the "proto" root.
version: v1
name: buf.build/crypto-org-chain/chain-main
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this name/url gives 404 -- do we need to register it on buf.build?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, for releases, we can perhaps specify an action to do it: https://docs.buf.build/ci-cd/github-actions

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created #852

@codecov
Copy link

codecov bot commented Sep 2, 2022

Codecov Report

Merging #851 (eb72988) into master (a3ec407) will increase coverage by 0.51%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master     #851      +/-   ##
==========================================
+ Coverage   18.36%   18.88%   +0.51%     
==========================================
  Files          96       92       -4     
  Lines       12361    11896     -465     
==========================================
- Hits         2270     2246      -24     
+ Misses       9596     9168     -428     
+ Partials      495      482      -13     
Flag Coverage Δ
integration_tests 16.57% <0.00%> (-0.06%) ⬇️
unit_tests 6.89% <0.00%> (-2.81%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
x/icaauth/types/query.pb.gw.go 0.00% <0.00%> (ø)
x/icaauth/types/tx.pb.go 0.80% <ø> (ø)
x/nft/types/query.pb.gw.go 0.22% <0.00%> (+0.06%) ⬆️
x/supply/types/query.pb.gw.go 1.06% <0.00%> (-0.08%) ⬇️
app/export.go 0.00% <0.00%> (ø)
app/test_helpers.go 0.00% <0.00%> (ø)
x/icaauth/types/params.pb.go 1.20% <0.00%> (ø)
app/docs/statik/statik.go
x/nft/client/rest/rest.go
x/nft/client/rest/tx.go
... and 11 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@devashishdxt
Copy link
Collaborator Author

it seems the third party Git sub-modules are no longer needed after this (the needed protobuf definitions are fetched via buf?)? so could they be removed?

They're still needed for swagger documentation.

@yihuang
Copy link
Collaborator

yihuang commented Sep 2, 2022

Shall we update the config.json too? similar to https://github.com/crypto-org-chain/cronos/pull/677/files#diff-b8ef6a5786bfd5df3147645f82844be943e1fe6d68de3b6b4681a941e077b8d7
The legacy APIs are removed.

--grpc-gateway_out=logtostderr=true,allow_colon_final_segments=true:. \
$(find "${dir}" -maxdepth 1 -name '*.proto')

for file in $(find "${dir}" -maxdepth 1 -name '*.proto'); do
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SC2044: For loops over find output are fragile. Use find -exec or a while read loop.


ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

$(find "${dir}" -maxdepth 1 -name '*.proto')

for file in $(find "${dir}" -maxdepth 1 -name '*.proto'); do
if grep "option go_package" $file &> /dev/null ; then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬 3 similar findings have been found in this PR


SC2086: Double quote to prevent globbing and word splitting.


🔎 Expand here to view all instances of this finding
File Path Line Number
scripts/protocgen.sh 28
scripts/protoc-swagger-gen.sh 13
scripts/protoc-swagger-gen.sh 14

Visit the Lift Web Console to find more details in your report.


ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

@devashishdxt
Copy link
Collaborator Author

Shall we update the config.json too? similar to https://github.com/crypto-org-chain/cronos/pull/677/files#diff-b8ef6a5786bfd5df3147645f82844be943e1fe6d68de3b6b4681a941e077b8d7 The legacy APIs are removed.

Done

@yihuang
Copy link
Collaborator

yihuang commented Sep 2, 2022

Shall we update the config.json too? similar to https://github.com/crypto-org-chain/cronos/pull/677/files#diff-b8ef6a5786bfd5df3147645f82844be943e1fe6d68de3b6b4681a941e077b8d7 The legacy APIs are removed.

Done

you need to regenerate the swagger to make it up to date.

@devashishdxt
Copy link
Collaborator Author

Shall we update the config.json too? similar to https://github.com/crypto-org-chain/cronos/pull/677/files#diff-b8ef6a5786bfd5df3147645f82844be943e1fe6d68de3b6b4681a941e077b8d7 The legacy APIs are removed.

Done

you need to regenerate the swagger to make it up to date.

done

@yihuang
Copy link
Collaborator

yihuang commented Sep 2, 2022

Shall we update the config.json too? similar to https://github.com/crypto-org-chain/cronos/pull/677/files#diff-b8ef6a5786bfd5df3147645f82844be943e1fe6d68de3b6b4681a941e077b8d7 The legacy APIs are removed.

Done

you need to regenerate the swagger to make it up to date.

done

and statik needs to be updated too ;D

@devashishdxt
Copy link
Collaborator Author

and statik needs to be updated too ;D

Done

Copy link
Collaborator

@yihuang yihuang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@devashishdxt devashishdxt merged commit 83212f4 into crypto-org-chain:master Sep 5, 2022
@devashishdxt devashishdxt deleted the proto-gen-fix branch September 5, 2022 03:18
devashishdxt added a commit to devashishdxt/chain-main that referenced this pull request Sep 23, 2022
…rypto-org-chain#851)

* Problem: Protobuf code generation is not consistent with cosmos-sdk

Solution: Generate proto code using buf with similar configuration as cosmos-sdk

* update config.json

* Regenerate swagger.yaml

* Update statik.go

* Update gomod2nix.toml

* Generate gomod2nix.toml

* update statik.go
tomtau pushed a commit that referenced this pull request Sep 23, 2022
…851)

* Problem: Protobuf code generation is not consistent with cosmos-sdk

Solution: Generate proto code using buf with similar configuration as cosmos-sdk

* update config.json

* Regenerate swagger.yaml

* Update statik.go

* Update gomod2nix.toml

* Generate gomod2nix.toml

* update statik.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants