-
Notifications
You must be signed in to change notification settings - Fork 499
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 in horizon JSON responses #1363
Comments
After auditing the code, I found multiple places where we are using int64 where we might want strings instead.
To fix this issue, I suggest we represent those fields as strings where it makes sense. I have some questions:
@bartekn @ire-and-curses @tomquisel thoughts? |
I think you're right about addressing this issue across the board. And maybe there's even some way to have an automated check that prevents it in the future? I also prefer to handle this as a minor version bump. It'll fix issues for some, and break things for others, so let's do the version bump to protect those who will experience breakage. Will we also need SDK fixes? |
I agree that we should fix this as soon as possible (patch, minor whatever is first) and agree that we should render all int64's as strings for JS. Would be great to check if the change breaks SDKs, if so, we should wait 2 release cycles to give developers time to update the code. |
This will be fix on the next release of horizon. |
Horizon uses int64 for some data types internally that end up in JSON resonses as numbers. One example is the entry
new_seq
in theSequenceBumped
effect (see [1] for an example).Since some int64 numbers cannot be represented as JavaScript numbers (which are 64 bit floating point) there is a risk of potential information loss.
As an example see the last effect in [1]. It is displayed as a bump to sequence number
90071992547409920
in the horizon response. However, the actual effect is a bump to sequence number90071992547409923
. This becomes obvious when looking at the original transaction that created this sequence bump and decoding the XDR: [2].Hence, the horizon response is wrong! The reason is that 90071992547409923 is not a valid JavaScript number and will be coerced to 90071992547409920.
[1] https://horizon-testnet.stellar.org/accounts/GB5L6RL523F72DBU6UEPI4VRPHYRISP46OWOYL2M324NNRVUPV76PQ6B/effects
[2] https://horizon-testnet.stellar.org/transactions/a1dfac3f3a7b6aa753c20f03450c4559cdfc5311e71a71111e42db183cd2711a
The text was updated successfully, but these errors were encountered: