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

encode token amounts in scientific notation #585

Closed
phritz opened this issue Jun 21, 2018 · 1 comment
Closed

encode token amounts in scientific notation #585

phritz opened this issue Jun 21, 2018 · 1 comment
Labels
help wanted Call for participation: More complex than good-first-issue

Comments

@phritz
Copy link
Contributor

phritz commented Jun 21, 2018

Token amounts (AttoFil) are currently encoded as an integer number of units, each of which represents 10**-18 FIL. Since most values aren't going to be that small it makes sense to serialize to scientific notation to save space. Note that this issue does not refer to changing the AttoFil representation which is a big.Int quantity of attofilecoin. This issue refers to changing the serialized format to be a (varint-encoded signficand, uint8 exponent) pair where the value represented is equal to significand * 10 ** exponent units (where each unit is still 10**-18). You basically just clear trailing zeros of the number to be serialized and add them to the exponent (that is, while the quantity mod 10 is 0, divide it by ten and add one to the exponent).

https://docs.google.com/document/d/12xNPzVCPSC2bTv7myxNRoMGx79AqFHQb89LfmRcFpGc/edit#bookmark=id.ufk10xbo7xb

@phritz phritz added the help wanted Call for participation: More complex than good-first-issue label Sep 11, 2018
@dignifiedquire dignifiedquire added a Request for Input/Review help wanted Call for participation: More complex than good-first-issue and removed help wanted Call for participation: More complex than good-first-issue labels Sep 11, 2018
@phritz
Copy link
Contributor Author

phritz commented Mar 27, 2019

if given filecoin-project/specs#131 we are no longer leb128 encoding any integers then we can close this

@anorth anorth closed this as completed Mar 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Call for participation: More complex than good-first-issue
Projects
None yet
Development

No branches or pull requests

4 participants