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

Importing proto definition of local module results to prefixed module with cosmossdk.io/api #4174

Closed
PanGan21 opened this issue May 31, 2024 · 2 comments · Fixed by #4198
Closed
Assignees
Labels
component:proto type:error Something isn't working
Milestone

Comments

@PanGan21
Copy link

PanGan21 commented May 31, 2024

Describe the bug
When importing a proto definition of a local module to another local module, then the generated .pulsar file the import is prefixed with cosmossdk.io/api.
Ignite cli protobuf generation should allow to import from another local module without prefixing like previous versions of Ignite.

This happened during the migration from v0.27.2 to v0.28.0

To reproduce
Steps to reproduce the behavior:
I made a repository that reproduces this issue: https://github.com/PanGan21/bufrepro
Module modb imports the base.proto from moda. https://github.com/PanGan21/bufrepro/blob/d81839e135226f79457468664065703a3ee6232e/proto/bufrepro/modb/extension.proto#L6
Then after generating proto with ignite it results to the following file which has the prefix:
https://github.com/PanGan21/bufrepro/blob/d81839e135226f79457468664065703a3ee6232e/api/bufrepro/modb/extension.pulsar.go#L5

What version are you using?

Provide the output of the ignite version command.

ignite version
⬆️ Ignite CLI v28.4.0 is available! To upgrade: https://docs.ignite.com/welcome/install#upgradeIgnite CLI version:               v28.0.0
Ignite CLI build date:          2023-12-06T08:52:35Z
Ignite CLI source hash:         936476c9358bcda4a67475ea521f1c4a39759dbe
Ignite CLI config version:      v1
Cosmos SDK version:             v0.50.1
Your OS:                        darwin
Your arch:                      amd64
Your Node.js version:           v21.2.0
Your go version:                go version go1.21.3 darwin/amd64
Your uname -a:                  Darwin panagiotissmbp2.kpn 21.6.0 Darwin Kernel Version 21.6.0: Mon Feb 19 20:24:34 PST 2024; root:xnu-8020.240.18.707.4~1/RELEASE_X86_64 x86_64
@julienrbrt julienrbrt self-assigned this May 31, 2024
@salmad3 salmad3 added type:error Something isn't working component:proto labels May 31, 2024
@salmad3 salmad3 moved this from To Discuss to Todo in Ignite CLI Masterboard May 31, 2024
@salmad3 salmad3 added this to the v29 milestone May 31, 2024
@julienrbrt
Copy link
Member

This bug is valid, and we shouldn't set the default prefix in https://github.com/ignite/cli/blob/main/ignite/templates/app/files/%7B%7BprotoDir%7D%7D/buf.gen.pulsar.yaml#L10.

It looks like we may need some changes in the protos in the SDK and tag another api module.

@julienrbrt
Copy link
Member

julienrbrt commented Jun 20, 2024

I opened a fix, in your own chain you should change the buf.gen.pulsar.yaml as follow:

managed:
  enabled: true
  go_package_prefix:
-   default: cosmossdk.io/api
+   default: <your repo name>/api
 except:
      - buf.build/googleapis/googleapis
      - buf.build/cosmos/gogo-proto
      - buf.build/cosmos/cosmos-proto
    override:
+      buf.build/cosmos/cosmos-sdk: cosmossdk.io/api

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:proto type:error Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants