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

Int128 support #306

Closed
jaekwon opened this issue Dec 14, 2017 · 3 comments
Closed

Int128 support #306

jaekwon opened this issue Dec 14, 2017 · 3 comments

Comments

@jaekwon
Copy link
Contributor

jaekwon commented Dec 14, 2017

W/ 240M atoms and 8 decimal places, we brush up on 2^53, which is the limit for javascript precise arithmetic without going to big-int libraries. That lead to a discussion of whether we should support > 2^53 tokens per coin, and whether we should support 2^64, or even 2^128 or 2^256. (actually 2^63-1, 2^127-1, and 2^255-1 respectively due to signing).

Benefits of Int128:

  • We'd be forced to use custom operators, so we can panic upon overflow/underflow.
  • It wouldn't be hard to convert to Int64 if we wanted it.

Downsides of Int128:

  • Every IBC receiver would need to start supporting Int128 potentially, forever.
  • It's slower, or takes more bytes to store in the worst case. The slowness argument is probably not a big deal due to Merkle tree operations and signature proofs taking so much longer, but bandwidth and storage, perhaps?
@jaekwon
Copy link
Contributor Author

jaekwon commented Dec 14, 2017

It might even make sense to create a Uint128/64 that panics or errors instead of overflowing or going below 0. It has semantic meaning that this number can't be negative, and it just reduces lines of code where we'd have to check for < 0.

(One reason why uint* sucks is because they underflow to a high number. That's why we use int* for numbers we'll do arithmetic on).

@rigelrozanski
Copy link
Contributor

We could just impose a hard limit the amount atoms that could be in an account, If you've got a crazy amount of atoms, you'll just need multiple accounts

@cwgoes
Copy link
Contributor

cwgoes commented Jun 5, 2018

Closing in favor of #977.

@cwgoes cwgoes closed this as completed Jun 5, 2018
gibson042 pushed a commit to gibson042/cosmos-sdk that referenced this issue Apr 12, 2024
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

3 participants