-
Notifications
You must be signed in to change notification settings - Fork 75
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
rpc: unify all ledger sequence types to uint32 and stop stringyfying integers < 53-bits wide #1097
Conversation
JS handles numbers safely up to Uint32 max is So I think JS will handle uint32's fine. Anything over 53-bit is a problem though. |
This is correct. The XDR uses https://github.com/search?q=repo:stellar/stellar-xdr%20ledgerSeq&type=code I imagine it would be such a heavy lift to change from uint32 to uint64 in the XDR that for a future change like that updating Horizon and Soroban RPC's APIs in support of that would probably be a small job in comparison to everything else. But I also think it's reasonable to have the RPC API use strings for all integers irrespective of their bit size. I just wanted to surface that 32bit and ledger seq would fit if it was preferred to be a number. |
It appears Horizon uses 32-bit for ledger seq too: |
We may have conflated account sequence with ledger sequence: the former needs to be I don't think there's anything wrong with leaving it stringified, but it is not necessary because all languages can handle them being encoded as integers (while JS has issues with values over 53 bits, like Leigh said). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will leave it up to you whether or not we want to keep them JSON-encoded as strings! I'm just glad we are consistent, now.
It think it's cleaner to not stringify them but ... at this point it may cause too much turmoil. @Shaptic you are dealing with downstream tickets nowadays, wdyt? |
@2opremio imo it's all the same: we have to issue a downstream ticket no matter what for at least a single field, so we might as well fix them all while we're there, and the maintainers are all very responsive. |
Alright. Uint32 it is then! |
…integers < 53-bits wide
eb4a116
to
cc68e53
Compare
OK, I changed all ledger sequences types to uint32 and removed the stringification of any field with a width less that 53 bits. I still need to fix the tests though. |
8f8e696
to
af1ac65
Compare
@Shaptic can you please create downstream tickets? I will update the documentation. |
What
Closes #1081
Why
Consistent is good plus it's cleaner to not stringify fields we don't need to (since they can be treated by javascript).
Known limitations
Downstream tickets are needed.