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

int64 Precision Issues #20

Open
patrick-ogrady opened this issue Jun 25, 2020 · 1 comment
Open

int64 Precision Issues #20

patrick-ogrady opened this issue Jun 25, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@patrick-ogrady
Copy link
Contributor

patrick-ogrady commented Jun 25, 2020

Is your feature request related to a problem? Please describe.
Some blockchain teams have noted that precision may be lost for int64 numbers in some clients (like JS) if a number greater than 2^53 is populated since JSON defines numbers as float64.

Example (BlockIdentifier): https://github.com/coinbase/rosetta-specifications/blob/439b881859b0982bb6baf34a9666db1018d419f9/models/BlockIdentifier.yaml#L22-L27

Describe the solution you'd like
Unfortunately, int64 is highest precision number type you can specify in OpenAPI (also not possible to use uint64). To remedy this issue, we would need to encode all int64 numbers as string.

Fortunately, this issue only will affect BlockIdentifer.Index and Block.Timestamp as all other "number-like" values that could come close to 2^53 are already encoded as strings (ex: Amount.Value). Operation.Index (which is also encoded in int64) shouldn't run into this issue as it is relative to the Transaction where an Operation is present in, not a global index.

@patrick-ogrady patrick-ogrady added the bug Something isn't working label Jun 25, 2020
@patrick-ogrady patrick-ogrady changed the title Change all int64 integers to string int64 Precision Issues Jun 25, 2020
@Steph380
Copy link

I'm not really sure but it is returning the sat value incorrect that all but please help fix thank you

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

No branches or pull requests

2 participants