704: Updates snarkVM to 0.0.5, updates rand to 0.8 r=collinc97 a=howardwu

<!--
    Thank you for submitting the PR! We appreciate you spending the time to work on these changes.

    Help us understand your motivation by explaining why you decided to make this change.

    Happy contributing!
-->

## Motivation

- Updates snarkVM to 0.0.5
- Updates rand to 0.8
- Updates rand usage of `gen_range` to spread


Co-authored-by: howardwu <howardwu@berkeley.edu>
Co-authored-by: collin <collin.chin@berkeley.edu>
This commit is contained in:
bors[bot] 2021-02-25 17:53:00 +00:00 committed by GitHub
commit e0ad200945
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 352 additions and 475 deletions

661
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -67,27 +67,27 @@ path = "./state"
version = "1.2.2"
[dependencies.snarkvm-algorithms]
version = "0.0.4"
version = "0.0.5"
default-features = false
[dependencies.snarkvm-curves]
version = "0.0.4"
version = "0.0.5"
default-features = false
[dependencies.snarkvm-errors]
version = "0.0.4"
version = "0.0.5"
default-features = false
[dependencies.snarkvm-gadgets]
version = "0.0.4"
version = "0.0.5"
default-features = false
[dependencies.snarkvm-models]
version = "0.0.4"
version = "0.0.5"
default-features = false
[dependencies.snarkvm-utilities]
version = "0.0.4"
version = "0.0.5"
[dependencies.anyhow]
version = "1.0"
@ -120,7 +120,7 @@ version = "4.0.15"
version = "0.3"
[dependencies.rand]
version = "0.7"
version = "0.8"
[dependencies.rand_core]
version = "0.6.2"

View File

@ -50,31 +50,31 @@ path = "../asg"
version = "1.2.2"
[dependencies.snarkvm-curves]
version = "0.0.4"
version = "0.0.5"
default-features = false
[dependencies.snarkvm-dpc]
version = "0.0.4"
version = "0.0.5"
default-features = false
[dependencies.snarkvm-errors]
version = "0.0.4"
version = "0.0.5"
default-features = false
[dependencies.snarkvm-gadgets]
version = "0.0.4"
version = "0.0.5"
default-features = false
[dependencies.snarkvm-models]
version = "0.0.4"
version = "0.0.5"
default-features = false
[dependencies.snarkvm-objects]
version = "0.0.4"
version = "0.0.5"
default-features = false
[dependencies.snarkvm-utilities]
version = "0.0.4"
version = "0.0.5"
[dependencies.bincode]
version = "1.3"
@ -90,11 +90,7 @@ features = [ "serde-1" ]
version = "2.0"
[dependencies.rand]
version = "0.7"
[dependencies.rand_xorshift]
version = "0.2"
default-features = false
version = "0.8"
[dependencies.serde]
version = "1.0"
@ -111,8 +107,15 @@ version = "0.1"
[dev-dependencies.num-bigint]
version = "0.3"
[dev-dependencies.rand_core]
version = "0.6.2"
[dev-dependencies.rand_xorshift]
version = "0.3"
default-features = false
[dev-dependencies.snarkvm-algorithms]
version = "0.0.4"
version = "0.0.5"
default-features = false
[features]

View File

@ -25,7 +25,8 @@ use crate::{
use leo_ast::InputValue;
use leo_input::types::{IntegerType, U8Type, UnsignedIntegerType};
use rand::{Rng, SeedableRng};
use rand::Rng;
use rand_core::SeedableRng;
use rand_xorshift::XorShiftRng;
use snarkvm_algorithms::prf::blake2s::Blake2s as B2SPRF;
use snarkvm_models::algorithms::PRF;

View File

@ -18,22 +18,22 @@ license = "GPL-3.0"
edition = "2018"
[dependencies.snarkvm-errors]
version = "0.0.4"
version = "0.0.5"
default-features = false
[dependencies.snarkvm-models]
version = "0.0.4"
version = "0.0.5"
default-features = false
[dependencies.snarkvm-utilities]
version = "0.0.4"
version = "0.0.5"
[dependencies.rand]
version = "0.7"
version = "0.8"
default-features = false
[dependencies.rand_xorshift]
version = "0.2"
version = "0.3"
default-features = false
[dependencies.thiserror]
@ -42,6 +42,9 @@ version = "1.0"
[dev-dependencies.criterion]
version = "0.3"
[dev-dependencies.rand_core]
version = "0.6.2"
[[bench]]
name = "integer_arithmetic"
path = "benches/integer_arithmetic.rs"

View File

@ -24,7 +24,8 @@ use snarkvm_models::{
},
};
use rand::{Rng, SeedableRng};
use rand::Rng;
use rand_core::SeedableRng;
use rand_xorshift::XorShiftRng;
use std::i128;
@ -238,8 +239,8 @@ fn test_int128_mul_constants() {
let max = i64::MAX as i128;
let min = i64::MIN as i128;
let a: i128 = rng.gen_range(min, max);
let b: i128 = rng.gen_range(min, max);
let a: i128 = rng.gen_range(min..max);
let b: i128 = rng.gen_range(min..max);
let expected = match a.checked_mul(b) {
Some(valid) => valid,
@ -267,8 +268,8 @@ fn test_int128_mul() {
let max = i64::MAX as i128;
let min = i64::MIN as i128;
let a: i128 = rng.gen_range(min, max);
let b: i128 = rng.gen_range(min, max);
let a: i128 = rng.gen_range(min..max);
let b: i128 = rng.gen_range(min..max);
let expected = match a.checked_mul(b) {
Some(valid) => valid,

View File

@ -24,7 +24,8 @@ use snarkvm_models::{
},
};
use rand::{Rng, SeedableRng};
use rand::Rng;
use rand_core::SeedableRng;
use rand_xorshift::XorShiftRng;
use std::i16;
@ -238,8 +239,8 @@ fn test_int16_mul_constants() {
let max = i8::MAX as i16;
let min = i8::MIN as i16;
let a: i16 = rng.gen_range(min, max);
let b: i16 = rng.gen_range(min, max);
let a: i16 = rng.gen_range(min..max);
let b: i16 = rng.gen_range(min..max);
let expected = match a.checked_mul(b) {
Some(valid) => valid,
@ -267,8 +268,8 @@ fn test_int16_mul() {
let max = i8::MAX as i16;
let min = i8::MIN as i16;
let a: i16 = rng.gen_range(min, max);
let b: i16 = rng.gen_range(min, max);
let a: i16 = rng.gen_range(min..max);
let b: i16 = rng.gen_range(min..max);
let expected = match a.checked_mul(b) {
Some(valid) => valid,
@ -366,8 +367,8 @@ fn test_int16_pow_constants() {
for _ in 0..10 {
let mut cs = TestConstraintSystem::<Fr>::new();
let a: i16 = rng.gen_range(-16, 16);
let b: i16 = rng.gen_range(-4, 4);
let a: i16 = rng.gen_range(-16..16);
let b: i16 = rng.gen_range(-4..4);
let expected = match a.checked_pow(b as u32) {
Some(valid) => valid,
@ -392,8 +393,8 @@ fn test_int16_pow() {
for _ in 0..3 {
let mut cs = TestConstraintSystem::<Fr>::new();
let a: i16 = rng.gen_range(-16, 16);
let b: i16 = rng.gen_range(-4, 4);
let a: i16 = rng.gen_range(-16..16);
let b: i16 = rng.gen_range(-4..4);
let expected = match a.checked_pow(b as u32) {
Some(valid) => valid,

View File

@ -24,7 +24,8 @@ use snarkvm_models::{
},
};
use rand::{Rng, SeedableRng};
use rand::Rng;
use rand_core::SeedableRng;
use rand_xorshift::XorShiftRng;
use std::i32;
@ -238,8 +239,8 @@ fn test_int32_mul_constants() {
let max = i16::MAX as i32;
let min = i16::MIN as i32;
let a: i32 = rng.gen_range(min, max);
let b: i32 = rng.gen_range(min, max);
let a: i32 = rng.gen_range(min..max);
let b: i32 = rng.gen_range(min..max);
let expected = match a.checked_mul(b) {
Some(valid) => valid,
@ -267,8 +268,8 @@ fn test_int32_mul() {
let max = i16::MAX as i32;
let min = i16::MIN as i32;
let a: i32 = rng.gen_range(min, max);
let b: i32 = rng.gen_range(min, max);
let a: i32 = rng.gen_range(min..max);
let b: i32 = rng.gen_range(min..max);
let expected = match a.checked_mul(b) {
Some(valid) => valid,
@ -367,8 +368,8 @@ fn test_int32_pow_constants() {
for _ in 0..3 {
let mut cs = TestConstraintSystem::<Fr>::new();
let a: i32 = rng.gen_range(-16, 16);
let b: i32 = rng.gen_range(-8, 8);
let a: i32 = rng.gen_range(-16..16);
let b: i32 = rng.gen_range(-8..8);
let expected = match a.checked_pow(b as u32) {
Some(valid) => valid,
@ -394,8 +395,8 @@ fn test_int32_pow() {
for _ in 0..3 {
let mut cs = TestConstraintSystem::<Fr>::new();
let a: i32 = rng.gen_range(-16, 16);
let b: i32 = rng.gen_range(-8, 8);
let a: i32 = rng.gen_range(-16..16);
let b: i32 = rng.gen_range(-8..8);
let expected = match a.checked_pow(b as u32) {
Some(valid) => valid,

View File

@ -24,7 +24,8 @@ use snarkvm_models::{
},
};
use rand::{Rng, SeedableRng};
use rand::Rng;
use rand_core::SeedableRng;
use rand_xorshift::XorShiftRng;
use std::i64;
@ -238,8 +239,8 @@ fn test_int64_mul_constants() {
let max = i32::MAX as i64;
let min = i32::MIN as i64;
let a: i64 = rng.gen_range(min, max);
let b: i64 = rng.gen_range(min, max);
let a: i64 = rng.gen_range(min..max);
let b: i64 = rng.gen_range(min..max);
let expected = match a.checked_mul(b) {
Some(valid) => valid,
@ -267,8 +268,8 @@ fn test_int64_mul() {
let max = i32::MAX as i64;
let min = i32::MIN as i64;
let a: i64 = rng.gen_range(min, max);
let b: i64 = rng.gen_range(min, max);
let a: i64 = rng.gen_range(min..max);
let b: i64 = rng.gen_range(min..max);
let expected = match a.checked_mul(b) {
Some(valid) => valid,
@ -366,8 +367,8 @@ fn test_int64_pow_constants() {
let mut cs = TestConstraintSystem::<Fr>::new();
let a: i64 = rng.gen_range(-16, 16);
let b: i64 = rng.gen_range(-12, 12);
let a: i64 = rng.gen_range(-16..16);
let b: i64 = rng.gen_range(-12..12);
let expected = a.checked_pow(b as u32).unwrap();
@ -388,8 +389,8 @@ fn test_int64_pow() {
let mut cs = TestConstraintSystem::<Fr>::new();
let a: i64 = rng.gen_range(-16, 16);
let b: i64 = rng.gen_range(-12, 12);
let a: i64 = rng.gen_range(-16..16);
let b: i64 = rng.gen_range(-12..12);
let expected = a.checked_pow(b as u32).unwrap();

View File

@ -24,7 +24,8 @@ use snarkvm_models::{
},
};
use rand::{Rng, SeedableRng};
use rand::Rng;
use rand_core::SeedableRng;
use rand_xorshift::XorShiftRng;
use std::i8;
@ -360,8 +361,8 @@ fn test_int8_pow_constants() {
for _ in 0..100 {
let mut cs = TestConstraintSystem::<Fr>::new();
let a: i8 = rng.gen_range(-4, 4);
let b: i8 = rng.gen_range(-4, 4);
let a: i8 = rng.gen_range(-4..4);
let b: i8 = rng.gen_range(-4..4);
let expected = match a.checked_pow(b as u32) {
Some(valid) => valid,
@ -386,8 +387,8 @@ fn test_int8_pow() {
for _ in 0..10 {
let mut cs = TestConstraintSystem::<Fr>::new();
let a: i8 = rng.gen_range(-4, 4);
let b: i8 = rng.gen_range(-4, 4);
let a: i8 = rng.gen_range(-4..4);
let b: i8 = rng.gen_range(-4..4);
let expected = match a.checked_pow(b as u32) {
Some(valid) => valid,

View File

@ -26,44 +26,47 @@ path = "../ast"
version = "1.2.2"
[dependencies.snarkvm-algorithms]
version = "0.0.4"
version = "0.0.5"
default-features = false
[dependencies.snarkvm-curves]
version = "0.0.4"
version = "0.0.5"
default-features = false
[dependencies.snarkvm-dpc]
version = "0.0.4"
version = "0.0.5"
default-features = false
[dependencies.snarkvm-errors]
version = "0.0.4"
version = "0.0.5"
default-features = false
[dependencies.snarkvm-models]
version = "0.0.4"
version = "0.0.5"
default-features = false
[dependencies.snarkvm-objects]
version = "0.0.4"
version = "0.0.5"
default-features = false
[dependencies.snarkvm-utilities]
version = "0.0.4"
version = "0.0.5"
[dependencies.indexmap]
version = "1.6.1"
features = [ "serde-1" ]
[dependencies.rand]
version = "0.7"
version = "0.8"
[dependencies.rand_xorshift]
version = "0.2"
version = "0.3"
[dependencies.thiserror]
version = "1.0"
[dev-dependencies.snarkvm-storage]
version = "0.0.4"
version = "0.0.5"
[dev-dependencies.rand_core]
version = "0.6.2"

View File

@ -27,7 +27,8 @@ use snarkvm_models::{
use snarkvm_objects::Account;
use snarkvm_utilities::{bytes::ToBytes, to_bytes};
use rand::{Rng, SeedableRng};
use rand::Rng;
use rand_core::SeedableRng;
use rand_xorshift::XorShiftRng;
use snarkvm_models::dpc::DPCScheme;
use snarkvm_storage::Ledger;

View File

@ -20,7 +20,7 @@ use leo_state::verify_record_commitment;
use snarkvm_dpc::base_dpc::instantiated::*;
use rand::SeedableRng;
use rand_core::SeedableRng;
use rand_xorshift::XorShiftRng;
// TODO (Collin): Update input to reflect new parameter ordering.