Migrate remaining crates to rand 0.5
This commit is contained in:
parent
6149166ccb
commit
ccf75c39c1
|
@ -328,7 +328,7 @@ dependencies = [
|
|||
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pairing 0.14.2",
|
||||
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sapling-crypto 0.0.1",
|
||||
"zcash_primitives 0.0.0",
|
||||
"zcash_proofs 0.0.0",
|
||||
|
@ -576,7 +576,7 @@ version = "0.0.0"
|
|||
dependencies = [
|
||||
"bech32 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pairing 0.14.2",
|
||||
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sapling-crypto 0.0.1",
|
||||
"zcash_primitives 0.0.0",
|
||||
]
|
||||
|
@ -608,7 +608,7 @@ dependencies = [
|
|||
"byteorder 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ff 0.4.0",
|
||||
"pairing 0.14.2",
|
||||
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sapling-crypto 0.0.1",
|
||||
"zcash_primitives 0.0.0",
|
||||
]
|
||||
|
|
|
@ -22,7 +22,7 @@ libc = "0.2"
|
|||
pairing = { path = "../pairing" }
|
||||
lazy_static = "1"
|
||||
byteorder = "1"
|
||||
rand = "0.4"
|
||||
rand = "0.5"
|
||||
sapling-crypto = { path = "../sapling-crypto" }
|
||||
zcash_primitives = { path = "../zcash_primitives" }
|
||||
zcash_proofs = { path = "../zcash_proofs" }
|
||||
|
|
|
@ -13,4 +13,4 @@ sapling-crypto = { path = "../sapling-crypto" }
|
|||
zcash_primitives = { path = "../zcash_primitives" }
|
||||
|
||||
[dev-dependencies]
|
||||
rand = "0.4"
|
||||
rand = "0.5"
|
||||
|
|
|
@ -112,7 +112,10 @@ pub fn decode_extended_full_viewing_key(
|
|||
/// };
|
||||
/// use zcash_primitives::JUBJUB;
|
||||
///
|
||||
/// let rng = &mut XorShiftRng::from_seed([0x3dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
||||
/// let rng = &mut XorShiftRng::from_seed([
|
||||
/// 0x59, 0x62, 0xbe, 0x3d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06,
|
||||
/// 0xbc, 0xe5,
|
||||
/// ]);
|
||||
///
|
||||
/// let pa = PaymentAddress {
|
||||
/// diversifier: Diversifier([0u8; 11]),
|
||||
|
@ -121,7 +124,7 @@ pub fn decode_extended_full_viewing_key(
|
|||
///
|
||||
/// assert_eq!(
|
||||
/// encode_payment_address(HRP_SAPLING_PAYMENT_ADDRESS, &pa),
|
||||
/// "ztestsapling1qqqqqqqqqqqqqqqqqqxrrfaccydp867g6zg7ne5ht37z38jtfyw0ygmp0ja6hhf07twjq6awtaj",
|
||||
/// "ztestsapling1qqqqqqqqqqqqqqqqqrjq05nyfku05msvu49mawhg6kr0wwljahypwyk2h88z6975u563j0ym7pe",
|
||||
/// );
|
||||
/// ```
|
||||
pub fn encode_payment_address(hrp: &str, addr: &PaymentAddress<Bls12>) -> String {
|
||||
|
@ -148,7 +151,10 @@ pub fn encode_payment_address(hrp: &str, addr: &PaymentAddress<Bls12>) -> String
|
|||
/// };
|
||||
/// use zcash_primitives::JUBJUB;
|
||||
///
|
||||
/// let rng = &mut XorShiftRng::from_seed([0x3dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
||||
/// let rng = &mut XorShiftRng::from_seed([
|
||||
/// 0x59, 0x62, 0xbe, 0x3d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06,
|
||||
/// 0xbc, 0xe5,
|
||||
/// ]);
|
||||
///
|
||||
/// let pa = PaymentAddress {
|
||||
/// diversifier: Diversifier([0u8; 11]),
|
||||
|
@ -158,7 +164,7 @@ pub fn encode_payment_address(hrp: &str, addr: &PaymentAddress<Bls12>) -> String
|
|||
/// assert_eq!(
|
||||
/// decode_payment_address(
|
||||
/// HRP_SAPLING_PAYMENT_ADDRESS,
|
||||
/// "ztestsapling1qqqqqqqqqqqqqqqqqqxrrfaccydp867g6zg7ne5ht37z38jtfyw0ygmp0ja6hhf07twjq6awtaj",
|
||||
/// "ztestsapling1qqqqqqqqqqqqqqqqqrjq05nyfku05msvu49mawhg6kr0wwljahypwyk2h88z6975u563j0ym7pe",
|
||||
/// ),
|
||||
/// Ok(Some(pa)),
|
||||
/// );
|
||||
|
@ -194,7 +200,10 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn payment_address() {
|
||||
let rng = &mut XorShiftRng::from_seed([0x3dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
||||
let rng = &mut XorShiftRng::from_seed([
|
||||
0x59, 0x62, 0xbe, 0x3d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06,
|
||||
0xbc, 0xe5,
|
||||
]);
|
||||
|
||||
let addr = PaymentAddress {
|
||||
diversifier: Diversifier([0u8; 11]),
|
||||
|
@ -202,9 +211,9 @@ mod tests {
|
|||
};
|
||||
|
||||
let encoded_main =
|
||||
"zs1qqqqqqqqqqqqqqqqqqxrrfaccydp867g6zg7ne5ht37z38jtfyw0ygmp0ja6hhf07twjqj2ug6x";
|
||||
"zs1qqqqqqqqqqqqqqqqqrjq05nyfku05msvu49mawhg6kr0wwljahypwyk2h88z6975u563j8nfaxd";
|
||||
let encoded_test =
|
||||
"ztestsapling1qqqqqqqqqqqqqqqqqqxrrfaccydp867g6zg7ne5ht37z38jtfyw0ygmp0ja6hhf07twjq6awtaj";
|
||||
"ztestsapling1qqqqqqqqqqqqqqqqqrjq05nyfku05msvu49mawhg6kr0wwljahypwyk2h88z6975u563j0ym7pe";
|
||||
|
||||
assert_eq!(
|
||||
encode_payment_address(constants::mainnet::HRP_SAPLING_PAYMENT_ADDRESS, &addr),
|
||||
|
@ -235,7 +244,10 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn invalid_diversifier() {
|
||||
let rng = &mut XorShiftRng::from_seed([0x3dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
||||
let rng = &mut XorShiftRng::from_seed([
|
||||
0x59, 0x62, 0xbe, 0x3d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06,
|
||||
0xbc, 0xe5,
|
||||
]);
|
||||
|
||||
let addr = PaymentAddress {
|
||||
diversifier: Diversifier([1u8; 11]),
|
||||
|
|
|
@ -11,6 +11,6 @@ blake2b_simd = "0.5"
|
|||
byteorder = "1"
|
||||
ff = { path = "../ff" }
|
||||
pairing = { path = "../pairing" }
|
||||
rand = "0.4"
|
||||
rand = "0.5"
|
||||
sapling-crypto = { path = "../sapling-crypto" }
|
||||
zcash_primitives = { path = "../zcash_primitives" }
|
||||
|
|
|
@ -3,7 +3,7 @@ use bellman::groth16::{
|
|||
};
|
||||
use ff::Field;
|
||||
use pairing::bls12_381::{Bls12, Fr};
|
||||
use rand::{OsRng, Rand};
|
||||
use rand::OsRng;
|
||||
use sapling_crypto::{
|
||||
circuit::{
|
||||
multipack,
|
||||
|
@ -59,7 +59,7 @@ impl SaplingProvingContext {
|
|||
let mut rng = OsRng::new().expect("should be able to construct RNG");
|
||||
|
||||
// We create the randomness of the value commitment
|
||||
let rcv = Fs::rand(&mut rng);
|
||||
let rcv = Fs::random(&mut rng);
|
||||
|
||||
// Accumulate the value commitment randomness in the context
|
||||
{
|
||||
|
@ -194,7 +194,7 @@ impl SaplingProvingContext {
|
|||
// We construct ephemeral randomness for the value commitment. This
|
||||
// randomness is not given back to the caller, but the synthetic
|
||||
// blinding factor `bsk` is accumulated in the context.
|
||||
let rcv = Fs::rand(&mut rng);
|
||||
let rcv = Fs::random(&mut rng);
|
||||
|
||||
// Accumulate the value commitment randomness in the context
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue