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 uint64's with LEB128 #587

Closed
phritz opened this issue Jun 21, 2018 · 0 comments
Closed

encode uint64's with LEB128 #587

phritz opened this issue Jun 21, 2018 · 0 comments
Assignees
Milestone

Comments

@phritz
Copy link
Contributor

phritz commented Jun 21, 2018

As part of #340 we introduced the ability to encode big ints in LEB128, and we converted the places we use big ints to ues it. We haven't yet gotten to the point of encoding uint64 values that we store as LEB128. Storing them as LEB128 means they can grow without bound. The specific places that need to be converted are at least:

  • the uint64 fields on Block
  • Actor.Nonce

To convert I think we have to introduce a new type Uint64 uint64 in types and a custom atlas entry that uses leb128.From/ToUint64 to do the en/decoding. I started down that route and only had to add a few type conversions but hit an issue with dag_daemon_test where the json encoding for the new Uint64 type wasn't playing nice with cbor (or something). I'm going to try to get to it before i disappear for 2 weeks but if not i might ask someone to pick this up so we can close 340 out.

BTW the reason we need to introduce a new type is because that's how refmt works: it can do exactly one mapping for named types (meaning you can't add a mapping directly for uint64).

@phritz phritz self-assigned this Jun 22, 2018
@mishmosh mishmosh added this to the Sprint 16 milestone Jun 26, 2018
phritz added a commit that referenced this issue Jul 11, 2018
Fixes #587

In which we convert the uint64's to a new type, Uint64 which we teach refmt to serialize in LEB128. Why you may ask does this PR marshal Uint64 to json as a string instead of a number? See #599
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

2 participants