Skip to content

Disable Rand Dependency When Feature Unused #57

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ash-burnt
Copy link

@ash-burnt ash-burnt commented Feb 26, 2025

Description

The rand and getrandom libraries are a particular nuisance when trying to compile Rust to certain architectures, like wasm.

This PR sets the rand dependency to optional, meaning it will not enter the dependency tree when features don't call for it, and should allow wasm compilation to complete


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (master)
  • Linked to Github issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Wrote unit tests
  • Updated relevant documentation in the code
  • Added a relevant changelog entry to the Pending section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

@Pratyush
Copy link
Member

Hi, can you switch it so that maybe we keep rand, but basically avoid getrandom, if that's the offending dependency?

I think you can do this by changing rand to have no-default-features set, and then selectively enabling the std_rng feature?

@ash-burnt
Copy link
Author

ash-burnt commented Mar 21, 2025

This keeps rand, just sets it as an optional dependency if none of the features need it. If you don't have a feature using it, it won't get pulled in and won't cause issues

Most dependencies should be optional, this is an irk across most of the arkworks tools. For something like verification only, we still end up pulling in most of the unused dependencies

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