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

upgrade to rand 0.7? #89

Closed
Silur opened this issue Jul 10, 2019 · 8 comments
Closed

upgrade to rand 0.7? #89

Silur opened this issue Jul 10, 2019 · 8 comments

Comments

@Silur
Copy link

Silur commented Jul 10, 2019

the rand API changed a bit since 0.6 (there's no OsRng::new() anymore). Fortunately nothing breaks if you simply switch the version in Cargo.toml :)

@derReineke
Copy link

I second this. Currently I am also getting the error when trying to compile. In ed25519.rs on line 974: use rand::thread_rng; I am getting the error "no 'thread_rng' in the root". I have a feeling this is due to the rand crate version.

@hdevalence
Copy link
Contributor

This crate depends on rand version 0.6, which includes thread_rng. That error suggests that Cargo is resolving rand to a version which is not 0.6. Can you put the output of cargo tree in a gist and link it here?

@hdevalence
Copy link
Contributor

I can't tell what the problem is without having more information about what versions of all the rand crates are being used, but this seems like other crates also have the same problem, and my suspicion is that the rand crate has broken semver, again.

rust-random/rand#842

@derReineke
Copy link

@Dhole
Copy link

Dhole commented Sep 5, 2019

I have also encountered an issue with the latest rand (0.7). It seems that the following example doesn't work with rand 0.7:

extern crate rand;
extern crate ed25519_dalek;

use rand::Rng;
use rand::rngs::OsRng;
use ed25519_dalek::Keypair;
use ed25519_dalek::Signature;

let mut csprng: OsRng = OsRng::new().unwrap();
let keypair: Keypair = Keypair::generate(&mut csprng);

With the following error:

error[E0277]: the trait bound `rand::rngs::OsRng: rand_core::CryptoRng` is not satisfied
  --> examples/ed25519.rs:12:19
   |
12 |     let keypair = Keypair::generate(&mut csprng);
   |                   ^^^^^^^^^^^^^^^^^ the trait `rand_core::CryptoRng` is not implemented for `rand::rngs::OsRng`
   |
   = note: required by `ed25519_dalek::Keypair::generate`

It seems that the error appears because Keypair::generate expects the trait rand::CryptoRng while rand::rngs::OsRng in rand 0.7 implements the trait rand_core::CryptoRng.
Setting rand to version 0.6 in Cargo.toml solved the issue, but it would be nice to update ed25519-dalek to rand 0.7.

@Silur
Copy link
Author

Silur commented Sep 6, 2019

@Dhole seems like there's is no intention to resolve this because of semver reasons. Best temporal solution is to fork or include the crate locally for a while.

@isislovecruft
Copy link
Member

Hi! Unfortunately, ed25519-dalek cannot update until curve25519-dalek does. Since the latter is a breaking change, it requires releasing a 2.0.0, which we have no plans to do in the short- to medium-term future.

@clintfred
Copy link

In case anyone is look at this in the future, it looks like rand 0.7 is used https://github.com/dalek-cryptography/ed25519-dalek/releases/tag/1.0.0-pre.3

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

6 participants