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

Sort out signed/unsigned integers representation on Rust side #43

Closed
akoptelov opened this issue Oct 3, 2023 · 0 comments
Closed

Sort out signed/unsigned integers representation on Rust side #43

akoptelov opened this issue Oct 3, 2023 · 0 comments
Assignees

Comments

@akoptelov
Copy link
Contributor

In Mina, unsigned 32- and 64-bit integers are widely used. Still, it looks like their binprot encoding is based on signed integers represented by the the same bits.

As our Rust types are based on binprot shapes, and that singned-ness is "erased" in the shapes, all integers in Rust are based on signed built-in variants (i32, i64). That causes some confusion when using these types/fields in Rust (see e.g. #38), and also JSON representation is incorrect.

It seems that we should use u32/u64 types as interface types for our unsigned Mina numbers, but keep binprot using i32/i64 respectively (question is, what type should be used for storing?).

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

1 participant