-
Notifications
You must be signed in to change notification settings - Fork 379
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(p/uint256): uint256 #1778
feat(p/uint256): uint256 #1778
Conversation
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. |
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 🙏
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>
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