Skip to content

OsRng in Plonky2 breaks no-std #1653

@nikitamasych

Description

@nikitamasych

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions