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

codegen.rs does not allow for non-messari protos #134

Open
melotik opened this issue Apr 3, 2023 · 1 comment
Open

codegen.rs does not allow for non-messari protos #134

melotik opened this issue Apr 3, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@melotik
Copy link
Contributor

melotik commented Apr 3, 2023

When building a substream project any non-messari protos being used get built in the target/pb/ folder as substreams.entity.v1.rs for example.

Then in the codegen it will build the src/pb.rs file to map the necessary proto definitions to a usable location in our /src folder, but the folder assumes that all target/pb/ files are messari. appended.

Should we be making this assumption?

In the example I am giving, it generates a broken src/pb.rs file that looks like this:

#[rustfmt::skip]
#[path = "../target/pb/messari.entity.v1.rs"]
pub(in crate::pb) mod entity_v1;

pub mod entity {
    pub mod v1 {
        pub use super::super::entity_v1::*;
    }
}

#[rustfmt::skip]
#[path = "../target/pb/messari.erc20.v1.rs"]
pub(in crate::pb) mod erc20_v1;

pub mod erc20 {
    pub mod v1 {
        pub use super::super::erc20_v1::*;
    }
}

Another note: abis are cleaned up during codegen, but proto files are not. Should we also clean the proto autogenerated files each time someone builds a substream?

@melotik melotik added the bug Something isn't working label Apr 3, 2023
@robinbernon
Copy link
Contributor

Yeh I agree with the cleanup - we should add this in. On the subject of the namespacing - I think I remember making the fix in the network PR so perhaps we can make do or make some small changes in the meantime before that PR gets merged?

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

No branches or pull requests

2 participants