Skip to content
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

OsRng in Plonky2 breaks no-std #1653

Open
NikitaMasych opened this issue Jan 28, 2025 · 0 comments · May be fixed by #1654
Open

OsRng in Plonky2 breaks no-std #1653

NikitaMasych opened this issue Jan 28, 2025 · 0 comments · May be fixed by #1654

Comments

@NikitaMasych
Copy link
Contributor

Hello guys!

Prerequisite

I see in field/src/types.rs following usage:

use rand::rngs::OsRng;

For that, you add dependency as below:

rand = { workspace = true, features = ["getrandom"] }

Problem

I am working on a project, where strict no-std compatibility is required. After adding plonky2 with no default features, it came to my surprise that there was a compilation failure regarding getrandom being dependent on std.

Upon investigating, I discovered, that getrandom does not support my target and, as a result, an error was thrown causing linking to std.

In my specific case, I don't actually need sampling functionality.

Proposed Solution

I suggest adding a feature-flag, where default will remain as it was with OsRng, however, as an opt-in path for projects, as mine, that might not have a need or support for OsRng, seeded solution.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
Status: Backlog
Development

Successfully merging a pull request may close this issue.

1 participant