-
Notifications
You must be signed in to change notification settings - Fork 372
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
feat(stdlibs): add encoding
, encoding/{base32,binary,csv}
#1290
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1290 +/- ##
==========================================
- Coverage 55.91% 47.06% -8.85%
==========================================
Files 420 373 -47
Lines 65415 61910 -3505
==========================================
- Hits 36578 29140 -7438
- Misses 25977 30383 +4406
+ Partials 2860 2387 -473 ☔ View full report in Codecov by Sentry. |
converting to draft for now, mark as ready when it's done :) full implementation of encoding/binary requires reflection; not sure what category I put it into but if you just do varint it should be good 👍 |
@thehowl Thanks! I'll trying to finishing |
don't forget to update the docs/ folder, thank you. |
@moul don't worry, I'll update together when it's done. |
encoding
, encoding/{base32,binary,csv}
encoding
, encoding/{base32,binary,csv}
encoding
, encoding/{base32,binary,csv}
@notJoon please fix tests :) ( if you need any help ping me on signal |
@thehowl And now it's all fixed. encoding package also ready to go 👍 |
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 made a bunch of gymnastics to try as much as possible to copy over tests and code from the Go stdlib, with some decent amount of success.
I put some fixes in to base32, made varint be 1:1 with the go stdlibs. I also worked a bunch on the csv package, but for now I'm giving up on continuing the fixes.
You're welcome to pick up where I left off. (If you don't, I'll probably pick it up some other day.) Use the following command from gnovm
to do tests:
go test tests/*.go -run "TestPackages/(encoding)/csv" -v
I'll add this command to the meta stdlibs issue.
Thank you for your efforts!
A very simple ID generation package, designed to be used in combination with `avl.Tree`s to push values in order. The name was originally `seqid` (sequential IDs), but after saying it a few times I realised it was close to "squid" and probably would be more fun if I named it that way ;) There's another piece of functionality that I want to add, which is a way to create simple base32-encoded IDs. This depends on #1290. These would also guarantee alphabetical ordering, so a list of them can be easily sorted and you'd get it in the same order they were created. They would likely be 13 characters long, but I'm also thinking of making a compact version which works from [0,2^35) which is 7 chracters, and then smoothly transitions over to the 13 characters version when the ID is reached. (I've experience with both base64 and base32 encoded IDs as 64-bit numbers, as I used both systems. The advantage of base32 is that it makes IDs case insensitive, all the while being at most 13 bytes instead of 11 for base64.) In GnoChess, we used simple sequential IDs combined with [`zeroPad9`](https://github.com/gnolang/gnochess/blob/7e841191a4a0a94c0d46bc977458bd6b757eab5e/realm/chess.gno#L287-L296) to create IDs which were both readable and sortable. I want to make a more "canonical" solution to this which does not have a upper limit at 1 billion entries.
@thehowl What's the status on this PR? |
@zivkovicmilos current status: some tests still failing, need to investigate and finish them up; putting this back in draft for now |
WIP
encoding
encoding/base32
encoding/binary
encoding/csv
: Due to thereflect
does not implemented yet, skippedfuzz
encoding/asn1
: better afterreflection
related to: