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

Errors when re-compiling proto files #11

Closed
5 tasks
ancazamfir opened this issue Apr 6, 2021 · 1 comment
Closed
5 tasks

Errors when re-compiling proto files #11

ancazamfir opened this issue Apr 6, 2021 · 1 comment

Comments

@ancazamfir
Copy link
Collaborator

Crate

ibc-proto

Summary of Bug

ibc-rs doesn't build with the proto commits in proto/src/prost

Version

Steps to Reproduce

  • Clone a new repo, branch master.
  • Get the refpoints from COSMOS_.._COMMIT files:
$ cat proto/src/prost/COSMOS_SDK_COMMIT
21814558eaa47b018018711e5fe16e0b16811fce
cat proto/src/prost/COSMOS_IBC_COMMIT
333c1f338b2a14a1928a6f8ab64c37123c0e97b6
  • clone the proto repos:
$ cd proto-compiler
$ cargo run -- clone --out /tmp/cosmos --sdk-commit 21814558eaa47b018018711e5fe16e0b16811fce --ibc-go-commit 333c1f338b2a14a1928a6f8ab64c37123c0e97b6
  • compile protos:
    cargo run -- compile --sdk /tmp/cosmos/sdk --ibc /tmp/cosmos/ibc --out ../proto/src/prost

  • notice the changes where there shouldn't be any:

$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   ../proto/src/prost/cosmos.upgrade.v1beta1.rs
  • try to build ibc-rs:
$ cd ..
$ cargo build
   Compiling ibc-relayer v0.1.1 (/Users/ancaz/rust/1ibc-rs/relayer)
error[E0432]: unresolved imports `ibc_proto::cosmos::upgrade::v1beta1::QueryCurrentPlanRequest`, `ibc_proto::cosmos::upgrade::v1beta1::QueryUpgradedConsensusStateRequest`
  --> relayer/src/chain/cosmos.rs:47:5
   |
47 |     QueryCurrentPlanRequest, QueryUpgradedConsensusStateRequest,
   |     ^^^^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `QueryUpgradedConsensusStateRequest` in `cosmos::upgrade::v1beta1`
   |     |
   |     no `QueryCurrentPlanRequest` in `cosmos::upgrade::v1beta1`

error[E0433]: failed to resolve: could not find `query_client` in `v1beta1`
   --> relayer/src/chain/cosmos.rs:525:68
    |
525 |                 ibc_proto::cosmos::upgrade::v1beta1::query_client::QueryClient::connect(
    |                                                                    ^^^^^^^^^^^ not found in `ibc_proto::cosmos::upgrade::v1beta1::query_client`
    |

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate milestone (priority) applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@adizere adizere self-assigned this Apr 6, 2021
@adizere
Copy link
Contributor

adizere commented Apr 6, 2021

Some progress on debugging this:

The generated Rust code in cosmos.upgrade.v1beta1.rs is suffering changes because there are two separate .proto files that can be used to generate this code:

  1. upgrade.proto from cosmos-sdk

This .proto is the "good" definition which we want to use in generating our Rust code in cosmos.upgrade.v1beta1.rs

  1. upgrade.proto from ibc-go

This second .proto file is a dependency for client.proto from ibc-go.

So the problem is that our compile.rs script is first generating code from the "good" definition from the sdk, but then in the process of generating client.proto it also compiles the dependency called upgrade.proto from ibc-go, which overwrites the "good" file.

https://github.com/informalsystems/ibc-rs/blob/5b1f409356303bd1180808cc81eb0864ff607ebe/proto-compiler/src/cmd/compile.rs#L34-L35

@hu55a1n1 hu55a1n1 transferred this issue from informalsystems/hermes Sep 29, 2022
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

No branches or pull requests

2 participants