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

feat(p/int256): int256 #1848

Merged
merged 21 commits into from
Mar 29, 2024
Merged

feat(p/int256): int256 #1848

merged 21 commits into from
Mar 29, 2024

Conversation

r3v4s
Copy link
Contributor

@r3v4s r3v4s commented Mar 27, 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

gno test metrics

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
Contributors' checklist...
  • [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
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • Added references to related issues and PRs
  • Provided any useful hints for running manual tests
  • [TODO] Added new benchmarks to generated graphs, if any. More info here.

@github-actions github-actions bot added the 🧾 package/realm Tag used for new Realms or Packages. label Mar 27, 2024
Copy link

codecov bot commented Mar 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 47.54%. Comparing base (eb36ec9) to head (ca21938).
Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1848      +/-   ##
==========================================
+ Coverage   44.86%   47.54%   +2.67%     
==========================================
  Files         459      388      -71     
  Lines       67625    61279    -6346     
==========================================
- Hits        30339    29133    -1206     
+ Misses      34745    29707    -5038     
+ Partials     2541     2439     -102     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@r3v4s
Copy link
Contributor Author

r3v4s commented Mar 28, 2024

CI fails because this pr doesn't includes uint256
It will be fine when #1778 get merge into master

@r3v4s r3v4s marked this pull request as ready for review March 28, 2024 04:17
@r3v4s r3v4s requested review from a team as code owners March 28, 2024 04:17
@zivkovicmilos zivkovicmilos self-requested a review March 28, 2024 08:23
@zivkovicmilos
Copy link
Member

@r3v4s please merge master into this branch, since we added #1778

Copy link
Member

@zivkovicmilos zivkovicmilos left a comment

Choose a reason for hiding this comment

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

Looks good 💯

I've left comments relating to adding more unit tests, and refactoring the README.
Otherwise, I think we should be good to go 🚀

Please merge master into this branch and make sure the tests are passing locally 🙏

examples/gno.land/p/demo/int256/README.md Outdated Show resolved Hide resolved
examples/gno.land/p/demo/int256/int256.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/int256/gno.mod Outdated Show resolved Hide resolved
examples/gno.land/p/demo/int256/conversion_test.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/int256/conversion_test.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/int256/arithmetic.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/int256/absolute.gno Show resolved Hide resolved
@r3v4s r3v4s marked this pull request as draft March 29, 2024 06:37
@r3v4s r3v4s marked this pull request as ready for review March 29, 2024 06:58
@zivkovicmilos zivkovicmilos merged commit 8ae1e7f into gnolang:master Mar 29, 2024
187 of 188 checks passed
@notJoon notJoon deleted the int256 branch March 29, 2024 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧾 package/realm Tag used for new Realms or Packages.
Projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants