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

Stellar XDR Types #38

Open
choubacha opened this issue Mar 11, 2018 · 11 comments
Open

Stellar XDR Types #38

choubacha opened this issue Mar 11, 2018 · 11 comments
Projects
Milestone

Comments

@choubacha
Copy link
Owner

They have a set of XDR types here:
https://github.com/stellar/stellar-core/blob/master/src/xdr/Stellar-types.x

We should model them in rust as best as possible and demonstrate the ability to pack and unpack them. The stellar go library has some tests around all xdr here:

https://github.com/stellar/go/tree/master/xdr

I wish they had tests in the core library for it was well ☹️ They also appear to duplicate the xdr files into every repo that they are used in, likely because they use xdrgen.

@choubacha choubacha added this to To do in XDR via automation Mar 11, 2018
@choubacha
Copy link
Owner Author

Can build some XDR here: https://www.stellar.org/laboratory/#txbuilder?network=test

@choubacha choubacha added this to the v0.2.0 milestone Mar 21, 2018
@robertDurst
Copy link
Collaborator

Can confirm we use https://github.com/stellar/xdrgen.

@correlator
Copy link
Collaborator

This is awesome. I just learned today that parts of stellar are built in rust and was curious to know if you all had put something like this together already 👍

@choubacha
Copy link
Owner Author

@robertDurst What does that mean? Can it generate rust code?

@robertDurst
Copy link
Collaborator

@correlator nope, none of our codebase is rust -- at least not until I get good enough to push for change 😁

@kbacha so I talked to one of our devs and this is what we use for xdrgen for various languages -- js, go, and a couple others. This is different than Rust's XDRGEN because that XDRGEN isn't adapted or built for specific encodings or definitions for xdr within the stellar codebase.

I just got the lowdown from one of our devs on how to get started adding rust support https://github.com/stellar/xdrgen and am going to take this on.

@choubacha
Copy link
Owner Author

That's awesome! That's the missing piece and I wasn't getting any feedback on the rust library.

Let me know how I can help, I'm actually coming from a ruby background so working in that library looks pretty easy.

@robertDurst
Copy link
Collaborator

Awesome! I skimmed the code and it looks quite doable -- while I have never written any ruby, this is quite easy to read.

Happy to collaborate, the goal here is to ultimately send a PR here for rust support!

Going to give this a go myself this weekend.

@correlator
Copy link
Collaborator

Work is being done on this branch https://github.com/kbacha/xdrgen/tree/rust

@robertDurst
Copy link
Collaborator

Exciting!

@thorhs
Copy link

thorhs commented Sep 14, 2019

FYI, I have created a crate with generated rust code from the Stellar XDR. I had to hand-modify the XDR input files to get around issues in xdrgen with unnamed unions and structs. I must admit that I have not done in-depth testing, but I have verified the code does decode a CreateAccount transaction correctly. Feel free to comment on the project.

https://github.com/thorhs/rust-stellar-xdr

@choubacha
Copy link
Owner Author

@thorhs Excellent! I'll take a look in a few weeks. I've been on parental leave caring for my new child.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
XDR
  
To do
Development

No branches or pull requests

4 participants