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

Impossible to migrate to Ignite > 0.25: Generate proto-go fails if a message includes option (cosmos_proto.implements_interface) #3298

Closed
martin-village opened this issue Dec 15, 2022 · 3 comments
Assignees
Labels
type:bug Something isn't working
Milestone

Comments

@martin-village
Copy link

Describe the bug
Starting from ignite v0.25, any protobuf file containing option (cosmos_proto.implements_interface) makes ignite generate proto-go to fail.

In my project, I have been relying on some standard cosmos protobuf types: eg. importing some types from group (like GroupInfo), with

import "cosmos/group/v1/types.proto";

This has worked perfectly up until Ignite 0.24.2. Starting from 0.25 (and the latest version), simply trying to import this file causes the protobuf generation error to fail with the following error:

panic: interfacetype only supports messages with exactly one oneof declaration

This error is raised in the Generate function in the interfacetype package from github.com/regen-network/cosmos-proto

I have singled out that if a message contains option (cosmos_proto.implements_interface), generation fails (see the "to reproduce" section below)

This is pretty tough for me because it prevents me from upgrading ignite to the latest version which includes a few important security fixes.

To reproduce
Using the latest version of Ignite-cli, import any proto file which has a message containing option (cosmos_proto.implements_interface) = "something", like

import "cosmos/group/v1/types.proto";

or directly include a message like

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "google/protobuf/any.proto";

message DummyObject {
  option (gogoproto.goproto_getters)  = false;
  option (gogoproto.goproto_stringer) = false;
  option (gogoproto.equal)            = false;

  option (cosmos_proto.implements_interface) = "AccountI";

  string              address        = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
  google.protobuf.Any pub_key        = 2 [(gogoproto.jsontag) = "public_key,omitempty"];
  uint64              account_number = 3;
  uint64              sequence       = 4;
}

What version are you using?
Ignite CLI version: v0.25.2
Ignite CLI build date: 2022-11-21T18:08:22Z
Ignite CLI source hash: 8888014
Cosmos SDK version: v0.46.6
Your OS: darwin
Your arch: arm64
Your Node.js version: v16.17.1
Your go version: go version go1.18.4 darwin/arm64
Your uname -a: Darwin -MacBook-Pro.local 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct 9 20:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000 arm64
Your cwd: /Users/
/village/villaged
Is on Gitpod: false

@Pantani
Copy link
Collaborator

Pantani commented Oct 19, 2023

@martin-village, the problem persists? Can you try the last version? The protobuf generation changed and fixed this problem. If you still have a problem you can open the issue again

@Pantani Pantani closed this as completed Oct 19, 2023
@Pantani Pantani self-assigned this Oct 19, 2023
@Pantani Pantani moved this from Backlog to Done in Ignite CLI Masterboard Oct 19, 2023
@Pantani Pantani modified the milestones: v0.29, v0.28 Nov 7, 2023
@williamchong
Copy link

@martin-village, the problem persists? Can you try the last version? The protobuf generation changed and fixed this problem. If you still have a problem you can open the issue again

Would you please clarify if I am working on a 0.46 sdk chain and don't want to make an sdk upgrade, what are my options to make this proto generation work?

@Pantani
Copy link
Collaborator

Pantani commented Nov 14, 2023

You can use an old version of the Ignite:

https://github.com/ignite/cli#cosmos-sdk-compatibility

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

No branches or pull requests

3 participants