Skip to content

Replace rug crate with num-bigint #109

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

Closed
wants to merge 6 commits into from
Closed

Conversation

ljoy913
Copy link
Collaborator

@ljoy913 ljoy913 commented Apr 3, 2025

This PR replaces the use of the rug crate in forks/Spartan-t256/circ_fields with num-bigint to remove the dependency on gmp-mpfr-sys.

The rug crate is a wrapper around gmp-mpfr-sys, which in turn wraps the GNU Multiple Precision Arithmetic Library (GMP). While GMP is a high-performance C library for arbitrary-precision arithmetic, it includes CPU-specific assembly code that:

  • Cannot be cleanly compiled to WebAssembly
  • Fails to build on Windows with the x86_64-pc-windows-msvc toolchain due to its reliance on a GNU toolchain during compilation

Changes

  • Replaced rug with num-bigint throughout circ_fields
  • Updated the num-bigint dependency from =0.4.3 to ^0.4 to allow the latest compatible 0.4.x version to be used
    • The minimum required version is 0.4.5, which introduces the modinverse method needed to match functionality previously provided by rug
    • The current latest version is 0.4.6
  • Added a couple of functions to replace rug functionally not present in num-bigint

@ljoy913
Copy link
Collaborator Author

ljoy913 commented Jun 10, 2025

No longer necessary.

@ljoy913 ljoy913 closed this Jun 10, 2025
@ljoy913 ljoy913 deleted the replace-rug-with-num-bigint branch June 10, 2025 01:19
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

Successfully merging this pull request may close these issues.

2 participants