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

Use leb128 encoding for token amounts #571

Merged
merged 0 commits into from
Jun 21, 2018
Merged

Use leb128 encoding for token amounts #571

merged 0 commits into from
Jun 21, 2018

Conversation

phritz
Copy link
Contributor

@phritz phritz commented Jun 19, 2018

This work towards #340.

@phritz phritz requested review from aboodman and acruikshank June 19, 2018 05:51
ta := NewZeroAttoFIL()
_, ok := ta.val.SetString(s, base)
return ta, ok
af := NewZeroAttoFIL()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's gonna be a fun abbreviation

Copy link
Member

@frrist frrist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -52,7 +52,7 @@ func TestAddAsk(t *testing.T) {

result, err := core.ApplyMessage(ctx, st, msg, types.NewBlockHeight(0))
assert.NoError(err)
assert.Equal(types.NewAttoFILFromFIL(0), types.NewAttoFILFromBytes(result.Receipt.Return[0]))
assert.True(big.NewInt(0).Cmp(big.NewInt(0).SetBytes(result.Receipt.Return[0])) == 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we keep this as an Equal check? I like seeing expect: 0 actual: -1 in test failures better than telling me something was false

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -6,6 +6,7 @@ import (
"math/big"

cbor "gx/ipfs/QmRiRJhn427YVuufBEHofLreKWNw7P7BWNq86Sb9kzqdbd/go-ipld-cbor"
leb128 "gx/ipfs/QmSKyB5faguXT4NqbrXpnRXqaVj5DhSm7x9BtzFydBY1UK/go-leb128"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: adding leb128 is redundant (cbor above is as well)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

learn something new every day. my editor wont let me drop the cbor one but it lets me drop the leb128, blame goreturns.

@phritz phritz merged commit 0ea4ea2 into master Jun 21, 2018
@phritz phritz deleted the feat/new-enc branch June 21, 2018 00:11
@mishmosh mishmosh added this to the Sprint 15 milestone Jun 26, 2018
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

Successfully merging this pull request may close these issues.

4 participants