Giter Club home page Giter Club logo

Comments (15)

tony-iqlusion avatar tony-iqlusion commented on May 28, 2024 2

There's some ongoing discussion about this here: informalsystems/tendermint-rs#654 (comment)

I suggested having a single repo where all of the protobufs could be managed consistently. So yes, I think it'd be a good idea to reuse the same infrastructure we have already for crates like tendermint-proto and cosmos-sdk-proto to be able to generate crates for the protos for other networks.

from cosmos-rust.

tony-iqlusion avatar tony-iqlusion commented on May 28, 2024 1

We could add a new osmosis-proto crate here (which I've gone ahead and registered).

It could be structured similarly to (and dependent on) cosmos-sdk-proto.

It will require modifying proto-build to pull in the protos from https://github.com/osmosis-labs/osmosis/tree/main/proto/osmosis as a git submodule (similar to the other protos)

from cosmos-rust.

tony-iqlusion avatar tony-iqlusion commented on May 28, 2024 1

The MsgProto trait is gone. I assume you're referring to the TypeUrl trait?

If so, yes, that sure would be nice. There's an upstream issue about it on prost here:

tokio-rs/prost#299

from cosmos-rust.

Philipp-Sc avatar Philipp-Sc commented on May 28, 2024

I think this makes a lot of sense. From a technical perspective, what exactly needs to be done to make the main.rs work for osmosis? Just adjust the paths or are blockchain specific customizations needed as well?

from cosmos-rust.

Philipp-Sc avatar Philipp-Sc commented on May 28, 2024

I got the cargo run to finish without errors with added paths for osmosis.

  • '../cosmos-sdk-proto/src/prost/osmosisd'
    What about the process for the lib.rs and cargo.toml do they need to be edited manually, or is there a script for that as well?

from cosmos-rust.

tony-iqlusion avatar tony-iqlusion commented on May 28, 2024

Since Osmosis is a completely separate network, I'd suggest putting its protos in a completely separate crate: osmosis-proto

You can get started by doing cp -r cosmos-sdk-proto osmosis-proto and then editing the files accordingly. You'll also need to add osmosis-proto to the workspace definition in the toplevel Cargo.toml

from cosmos-rust.

tony-iqlusion avatar tony-iqlusion commented on May 28, 2024

@Philipp-Sc I pushed up a branch with some initial boilerplate for an osmosis-proto crate you can use to get started:

https://github.com/cosmos/cosmos-rust/tree/osmosis-proto

See this commit:

bfdf7a1

from cosmos-rust.

Philipp-Sc avatar Philipp-Sc commented on May 28, 2024

thank you, I just separated the code from the cosmos-sdk-proto into osmosis-proto. I tested it with a few queries and it seems to work fine with the Osmosis gRPC endpoint I have.

How Osmosis is setup, the endpoint sometimes return google.protobuf.Any for that I will need to add some handcrafted code, so it can easily be casted into the type it acutally represents.

I will fork the branch you created and try to do a pull request.

from cosmos-rust.

Philipp-Sc avatar Philipp-Sc commented on May 28, 2024

@tony-iqlusion pull request is out #239

Let me know if you like me to make any changes before you merge it.

from cosmos-rust.

Philipp-Sc avatar Philipp-Sc commented on May 28, 2024

@tony-iqlusion I also have some changes for cosmrs, I hope to add them.

Example for tx/msg.rs

#[cfg(feature = "osmosis")]
impl MsgProto for osmosis_proto::osmosis::gamm::v1beta1::Pool {
    const TYPE_URL: &'static str = "/osmosis.gamm.v1beta1.Pool";
}

(this is needed to be able to work with google.protobuf.Any types)

Is cosmrs the right place for this, or do you want me to create a new crate just for osmosis?

from cosmos-rust.

Philipp-Sc avatar Philipp-Sc commented on May 28, 2024

Update:
See added osmosis specific cosmrs customization

I think this is a good way to do it. Let me know if you have any feedback.

Thanks and best regards,
Philipp

from cosmos-rust.

Philipp-Sc avatar Philipp-Sc commented on May 28, 2024

On another note: tx/msg.rs it would be great if the MsgProto implementations get generated by a script if possible. There are many types missing.

from cosmos-rust.

Philipp-Sc avatar Philipp-Sc commented on May 28, 2024

Closing this issue.

from cosmos-rust.

Philipp-Sc avatar Philipp-Sc commented on May 28, 2024

If there was a way to get a list of all the type urls we could write a script to write the matching implementations.
Might be something to look into in the future. For the time being I am okay, with adding the types I need manually.

from cosmos-rust.

tony-iqlusion avatar tony-iqlusion commented on May 28, 2024

It will hopefully get fixed upstream in the next release. There's already a few PRs.

If it really ends up continuing to be an issue we can look at automating it.

from cosmos-rust.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.