-
Notifications
You must be signed in to change notification settings - Fork 413
feat(p/uint256): uint256 #1778
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Merged
Merged
feat(p/uint256): uint256 #1778
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1778 +/- ##
==========================================
- Coverage 47.51% 44.82% -2.70%
==========================================
Files 388 459 +71
Lines 61331 67677 +6346
==========================================
+ Hits 29144 30337 +1193
- Misses 29747 34798 +5051
- Partials 2440 2542 +102 ☔ View full report in Codecov by Sentry. |
zivkovicmilos
approved these changes
Mar 29, 2024
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.
Looks great 💯
Thank you for the addition 🙏
zivkovicmilos
pushed a commit
that referenced
this pull request
Mar 29, 2024
This pr implements `int256` package to handle huge numbers in gno. To support this, it uses `uint256` package in its own struct > there is pr to bring holiman's uint256 into gno-vm #1778 origin(go) implementation: https://github.com/mempooler/int256 gnoswap(gno) implementation: [https://github.com/gnoswap-labs/gnoswap/package/big/int256](https://github.com/gnoswap-labs/gnoswap/tree/51439a5b097e6c523cb8a77b1a792b7f7aacb863/packages/big/int256 ) ### gno test metrics ```bash gno test -v=true -print-runtime-metrics=true ./examples/gno.land/p/demo/int256 === RUN TestAbs --- PASS: TestAbs (0.00s) --- runtime: cycle=30.5k imports=3 allocs=797.6k(0.16%) === RUN TestAbsGt --- PASS: TestAbsGt (0.00s) --- runtime: cycle=108.7k imports=3 allocs=2.5M(0.50%) === RUN TestAdd --- PASS: TestAdd (0.00s) --- runtime: cycle=155.2k imports=3 allocs=4.0M(0.79%) === RUN TestSub --- PASS: TestSub (0.00s) --- runtime: cycle=259.1k imports=3 allocs=6.3M(1.26%) === RUN TestMul --- PASS: TestMul (0.00s) --- runtime: cycle=278.4k imports=3 allocs=7.0M(1.39%) === RUN TestDiv --- PASS: TestDiv (0.00s) --- runtime: cycle=307.6k imports=3 allocs=8.1M(1.62%) === RUN TestRem --- PASS: TestRem (0.00s) --- runtime: cycle=342.8k imports=3 allocs=9.5M(1.90%) === RUN TestEq --- PASS: TestEq (0.00s) --- runtime: cycle=422.1k imports=3 allocs=11.3M(2.25%) === RUN TestCmp --- PASS: TestCmp (0.00s) --- runtime: cycle=466.7k imports=3 allocs=12.4M(2.47%) === RUN TestIsZero --- PASS: TestIsZero (0.00s) --- runtime: cycle=471.3k imports=3 allocs=12.6M(2.51%) === RUN TestIsNeg --- PASS: TestIsNeg (0.00s) --- runtime: cycle=476.6k imports=3 allocs=12.8M(2.56%) === RUN TestLt --- PASS: TestLt (0.00s) --- runtime: cycle=522.7k imports=3 allocs=14.0M(2.79%) === RUN TestClone --- PASS: TestClone (0.00s) --- runtime: cycle=565.1k imports=3 allocs=14.9M(2.98%) === RUN TestSetInt64 --- PASS: TestSetInt64 (0.00s) --- runtime: cycle=567.2k imports=3 allocs=15.0M(3.01%) === RUN TestSetUint64 --- PASS: TestSetUint64 (0.00s) --- runtime: cycle=568.3k imports=3 allocs=15.1M(3.02%) === RUN TestUint64 --- PASS: TestUint64 (0.00s) --- runtime: cycle=605.7k imports=3 allocs=16.0M(3.21%) === RUN TestInt64 --- PASS: TestInt64 (0.00s) --- runtime: cycle=624.5k imports=3 allocs=16.5M(3.31%) === RUN TestNeg --- PASS: TestNeg (0.00s) --- runtime: cycle=636.2k imports=3 allocs=16.9M(3.38%) === RUN TestSign --- PASS: TestSign (0.00s) --- runtime: cycle=639.4k imports=3 allocs=17.1M(3.41%) ok ./examples/gno.land/p/demo/int256 0.59s ``` <!-- please provide a detailed description of the changes made in this pull request. --> <details><summary>Contributors' checklist...</summary> - [TODO] Added new tests, or not needed, or not feasible - [ ] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [x] Updated the official documentation or not needed - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [x] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests - [TODO] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md). </details>
18 tasks
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
original code from: https://github.com/holiman/uint256
gnoswap implementation: https://github.com/gnoswap-labs/gnoswap/tree/main/packages/big/uint256
ref: #1698 (comment)
here's the metrics for reference:
cc: @r3v4s @dongwon8247 @mconcat