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

Replace UniformRand by CryptoRng + R #36

Open
6 tasks
vlopes11 opened this issue Aug 25, 2021 · 1 comment
Open
6 tasks

Replace UniformRand by CryptoRng + R #36

vlopes11 opened this issue Aug 25, 2021 · 1 comment

Comments

@vlopes11
Copy link
Member

Summary

UniformRand can be replaced by the providers in rand to reduce code complexity

Problem Definition

The base field types need to implement Standard: Distribution<T> as RNG requirement. Example:

https://github.com/arkworks-rs/algebra/blob/master/ec/src/models/short_weierstrass_jacobian.rs#L351-L363

This is superseded by CryptoRng that wraps cryptographic requirements without requiring concrete implementations in T.

Proposal

  • Replace UniformRand by RngCore + CryptoRng
  • Deprecate UniformRand

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@Pratyush
Copy link
Member

To add a little bit of context, we're evaluating whether we can/should replace UniformRand by methods on traits (eg: Field::rand or Commitment::sample_randomness). The upside is that we can reduce our custom randomness infrastructure, which makes it so that users have one less interface to worry about.

The downside is that we can longer say something like T: UniformRand in trait bounds, and the rand infrastructure would require us to do something like Standard: Distribution<T>, which can be a bit more clunky. Fortunately, in most cases, T is a Field or a Curve or a Polynomial, so we can just move the rand function to those traits. (Indeed, in the UnivariatePolynomials we already have a custom rand function that takes as input the degree of the sampled polynomial.)

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

No branches or pull requests

2 participants