Updates snarkVM to 0.0.5, updates rand usage

This commit is contained in:
howardwu 2021-02-25 08:56:20 -08:00
parent 2fb9d364d5
commit be398437c6
13 changed files with 340 additions and 474 deletions

648
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" version = "1.2.2"
[dependencies.snarkvm-algorithms] [dependencies.snarkvm-algorithms]
version = "0.0.4" version = "0.0.5"
default-features = false default-features = false
[dependencies.snarkvm-curves] [dependencies.snarkvm-curves]
version = "0.0.4" version = "0.0.5"
default-features = false default-features = false
[dependencies.snarkvm-errors] [dependencies.snarkvm-errors]
version = "0.0.4" version = "0.0.5"
default-features = false default-features = false
[dependencies.snarkvm-gadgets] [dependencies.snarkvm-gadgets]
version = "0.0.4" version = "0.0.5"
default-features = false default-features = false
[dependencies.snarkvm-models] [dependencies.snarkvm-models]
version = "0.0.4" version = "0.0.5"
default-features = false default-features = false
[dependencies.snarkvm-utilities] [dependencies.snarkvm-utilities]
version = "0.0.4" version = "0.0.5"
[dependencies.anyhow] [dependencies.anyhow]
version = "1.0" version = "1.0"
@ -120,7 +120,7 @@ version = "4.0.15"
version = "0.3" version = "0.3"
[dependencies.rand] [dependencies.rand]
version = "0.7" version = "0.8"
[dependencies.rand_core] [dependencies.rand_core]
version = "0.6.2" version = "0.6.2"

View File

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

View File

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

View File

@ -18,22 +18,22 @@ license = "GPL-3.0"
edition = "2018" edition = "2018"
[dependencies.snarkvm-errors] [dependencies.snarkvm-errors]
version = "0.0.4" version = "0.0.5"
default-features = false default-features = false
[dependencies.snarkvm-models] [dependencies.snarkvm-models]
version = "0.0.4" version = "0.0.5"
default-features = false default-features = false
[dependencies.snarkvm-utilities] [dependencies.snarkvm-utilities]
version = "0.0.4" version = "0.0.5"
[dependencies.rand] [dependencies.rand]
version = "0.7" version = "0.8"
default-features = false default-features = false
[dependencies.rand_xorshift] [dependencies.rand_xorshift]
version = "0.2" version = "0.3"
default-features = false default-features = false
[dependencies.thiserror] [dependencies.thiserror]
@ -42,6 +42,9 @@ version = "1.0"
[dev-dependencies.criterion] [dev-dependencies.criterion]
version = "0.3" version = "0.3"
[dev-dependencies.rand_core]
version = "0.6.2"
[[bench]] [[bench]]
name = "integer_arithmetic" name = "integer_arithmetic"
path = "benches/integer_arithmetic.rs" 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 rand_xorshift::XorShiftRng;
use std::i128; use std::i128;
@ -238,8 +239,8 @@ fn test_int128_mul_constants() {
let max = i64::MAX as i128; let max = i64::MAX as i128;
let min = i64::MIN as i128; let min = i64::MIN as i128;
let a: i128 = rng.gen_range(min, max); let a: i128 = rng.gen_range(min..max);
let b: i128 = rng.gen_range(min, max); let b: i128 = rng.gen_range(min..max);
let expected = match a.checked_mul(b) { let expected = match a.checked_mul(b) {
Some(valid) => valid, Some(valid) => valid,
@ -267,8 +268,8 @@ fn test_int128_mul() {
let max = i64::MAX as i128; let max = i64::MAX as i128;
let min = i64::MIN as i128; let min = i64::MIN as i128;
let a: i128 = rng.gen_range(min, max); let a: i128 = rng.gen_range(min..max);
let b: i128 = rng.gen_range(min, max); let b: i128 = rng.gen_range(min..max);
let expected = match a.checked_mul(b) { let expected = match a.checked_mul(b) {
Some(valid) => valid, 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 rand_xorshift::XorShiftRng;
use std::i16; use std::i16;
@ -238,8 +239,8 @@ fn test_int16_mul_constants() {
let max = i8::MAX as i16; let max = i8::MAX as i16;
let min = i8::MIN as i16; let min = i8::MIN as i16;
let a: i16 = rng.gen_range(min, max); let a: i16 = rng.gen_range(min..max);
let b: i16 = rng.gen_range(min, max); let b: i16 = rng.gen_range(min..max);
let expected = match a.checked_mul(b) { let expected = match a.checked_mul(b) {
Some(valid) => valid, Some(valid) => valid,
@ -267,8 +268,8 @@ fn test_int16_mul() {
let max = i8::MAX as i16; let max = i8::MAX as i16;
let min = i8::MIN as i16; let min = i8::MIN as i16;
let a: i16 = rng.gen_range(min, max); let a: i16 = rng.gen_range(min..max);
let b: i16 = rng.gen_range(min, max); let b: i16 = rng.gen_range(min..max);
let expected = match a.checked_mul(b) { let expected = match a.checked_mul(b) {
Some(valid) => valid, Some(valid) => valid,
@ -366,8 +367,8 @@ fn test_int16_pow_constants() {
for _ in 0..10 { for _ in 0..10 {
let mut cs = TestConstraintSystem::<Fr>::new(); let mut cs = TestConstraintSystem::<Fr>::new();
let a: i16 = rng.gen_range(-16, 16); let a: i16 = rng.gen_range(-16..16);
let b: i16 = rng.gen_range(-4, 4); let b: i16 = rng.gen_range(-4..4);
let expected = match a.checked_pow(b as u32) { let expected = match a.checked_pow(b as u32) {
Some(valid) => valid, Some(valid) => valid,
@ -392,8 +393,8 @@ fn test_int16_pow() {
for _ in 0..3 { for _ in 0..3 {
let mut cs = TestConstraintSystem::<Fr>::new(); let mut cs = TestConstraintSystem::<Fr>::new();
let a: i16 = rng.gen_range(-16, 16); let a: i16 = rng.gen_range(-16..16);
let b: i16 = rng.gen_range(-4, 4); let b: i16 = rng.gen_range(-4..4);
let expected = match a.checked_pow(b as u32) { let expected = match a.checked_pow(b as u32) {
Some(valid) => valid, 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 rand_xorshift::XorShiftRng;
use std::i32; use std::i32;
@ -238,8 +239,8 @@ fn test_int32_mul_constants() {
let max = i16::MAX as i32; let max = i16::MAX as i32;
let min = i16::MIN as i32; let min = i16::MIN as i32;
let a: i32 = rng.gen_range(min, max); let a: i32 = rng.gen_range(min..max);
let b: i32 = rng.gen_range(min, max); let b: i32 = rng.gen_range(min..max);
let expected = match a.checked_mul(b) { let expected = match a.checked_mul(b) {
Some(valid) => valid, Some(valid) => valid,
@ -267,8 +268,8 @@ fn test_int32_mul() {
let max = i16::MAX as i32; let max = i16::MAX as i32;
let min = i16::MIN as i32; let min = i16::MIN as i32;
let a: i32 = rng.gen_range(min, max); let a: i32 = rng.gen_range(min..max);
let b: i32 = rng.gen_range(min, max); let b: i32 = rng.gen_range(min..max);
let expected = match a.checked_mul(b) { let expected = match a.checked_mul(b) {
Some(valid) => valid, Some(valid) => valid,
@ -367,8 +368,8 @@ fn test_int32_pow_constants() {
for _ in 0..3 { for _ in 0..3 {
let mut cs = TestConstraintSystem::<Fr>::new(); let mut cs = TestConstraintSystem::<Fr>::new();
let a: i32 = rng.gen_range(-16, 16); let a: i32 = rng.gen_range(-16..16);
let b: i32 = rng.gen_range(-8, 8); let b: i32 = rng.gen_range(-8..8);
let expected = match a.checked_pow(b as u32) { let expected = match a.checked_pow(b as u32) {
Some(valid) => valid, Some(valid) => valid,
@ -394,8 +395,8 @@ fn test_int32_pow() {
for _ in 0..3 { for _ in 0..3 {
let mut cs = TestConstraintSystem::<Fr>::new(); let mut cs = TestConstraintSystem::<Fr>::new();
let a: i32 = rng.gen_range(-16, 16); let a: i32 = rng.gen_range(-16..16);
let b: i32 = rng.gen_range(-8, 8); let b: i32 = rng.gen_range(-8..8);
let expected = match a.checked_pow(b as u32) { let expected = match a.checked_pow(b as u32) {
Some(valid) => valid, 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 rand_xorshift::XorShiftRng;
use std::i64; use std::i64;
@ -238,8 +239,8 @@ fn test_int64_mul_constants() {
let max = i32::MAX as i64; let max = i32::MAX as i64;
let min = i32::MIN as i64; let min = i32::MIN as i64;
let a: i64 = rng.gen_range(min, max); let a: i64 = rng.gen_range(min..max);
let b: i64 = rng.gen_range(min, max); let b: i64 = rng.gen_range(min..max);
let expected = match a.checked_mul(b) { let expected = match a.checked_mul(b) {
Some(valid) => valid, Some(valid) => valid,
@ -267,8 +268,8 @@ fn test_int64_mul() {
let max = i32::MAX as i64; let max = i32::MAX as i64;
let min = i32::MIN as i64; let min = i32::MIN as i64;
let a: i64 = rng.gen_range(min, max); let a: i64 = rng.gen_range(min..max);
let b: i64 = rng.gen_range(min, max); let b: i64 = rng.gen_range(min..max);
let expected = match a.checked_mul(b) { let expected = match a.checked_mul(b) {
Some(valid) => valid, Some(valid) => valid,
@ -366,8 +367,8 @@ fn test_int64_pow_constants() {
let mut cs = TestConstraintSystem::<Fr>::new(); let mut cs = TestConstraintSystem::<Fr>::new();
let a: i64 = rng.gen_range(-16, 16); let a: i64 = rng.gen_range(-16..16);
let b: i64 = rng.gen_range(-12, 12); let b: i64 = rng.gen_range(-12..12);
let expected = a.checked_pow(b as u32).unwrap(); let expected = a.checked_pow(b as u32).unwrap();
@ -388,8 +389,8 @@ fn test_int64_pow() {
let mut cs = TestConstraintSystem::<Fr>::new(); let mut cs = TestConstraintSystem::<Fr>::new();
let a: i64 = rng.gen_range(-16, 16); let a: i64 = rng.gen_range(-16..16);
let b: i64 = rng.gen_range(-12, 12); let b: i64 = rng.gen_range(-12..12);
let expected = a.checked_pow(b as u32).unwrap(); 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 rand_xorshift::XorShiftRng;
use std::i8; use std::i8;
@ -360,8 +361,8 @@ fn test_int8_pow_constants() {
for _ in 0..100 { for _ in 0..100 {
let mut cs = TestConstraintSystem::<Fr>::new(); let mut cs = TestConstraintSystem::<Fr>::new();
let a: i8 = rng.gen_range(-4, 4); let a: i8 = rng.gen_range(-4..4);
let b: i8 = rng.gen_range(-4, 4); let b: i8 = rng.gen_range(-4..4);
let expected = match a.checked_pow(b as u32) { let expected = match a.checked_pow(b as u32) {
Some(valid) => valid, Some(valid) => valid,
@ -386,8 +387,8 @@ fn test_int8_pow() {
for _ in 0..10 { for _ in 0..10 {
let mut cs = TestConstraintSystem::<Fr>::new(); let mut cs = TestConstraintSystem::<Fr>::new();
let a: i8 = rng.gen_range(-4, 4); let a: i8 = rng.gen_range(-4..4);
let b: i8 = rng.gen_range(-4, 4); let b: i8 = rng.gen_range(-4..4);
let expected = match a.checked_pow(b as u32) { let expected = match a.checked_pow(b as u32) {
Some(valid) => valid, Some(valid) => valid,

View File

@ -26,44 +26,47 @@ path = "../ast"
version = "1.2.2" version = "1.2.2"
[dependencies.snarkvm-algorithms] [dependencies.snarkvm-algorithms]
version = "0.0.4" version = "0.0.5"
default-features = false default-features = false
[dependencies.snarkvm-curves] [dependencies.snarkvm-curves]
version = "0.0.4" version = "0.0.5"
default-features = false default-features = false
[dependencies.snarkvm-dpc] [dependencies.snarkvm-dpc]
version = "0.0.4" version = "0.0.5"
default-features = false default-features = false
[dependencies.snarkvm-errors] [dependencies.snarkvm-errors]
version = "0.0.4" version = "0.0.5"
default-features = false default-features = false
[dependencies.snarkvm-models] [dependencies.snarkvm-models]
version = "0.0.4" version = "0.0.5"
default-features = false default-features = false
[dependencies.snarkvm-objects] [dependencies.snarkvm-objects]
version = "0.0.4" version = "0.0.5"
default-features = false default-features = false
[dependencies.snarkvm-utilities] [dependencies.snarkvm-utilities]
version = "0.0.4" version = "0.0.5"
[dependencies.indexmap] [dependencies.indexmap]
version = "1.6.1" version = "1.6.1"
features = [ "serde-1" ] features = [ "serde-1" ]
[dependencies.rand] [dependencies.rand]
version = "0.7" version = "0.8"
[dependencies.rand_xorshift] [dependencies.rand_xorshift]
version = "0.2" version = "0.3"
[dependencies.thiserror] [dependencies.thiserror]
version = "1.0" version = "1.0"
[dev-dependencies.snarkvm-storage] [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_objects::Account;
use snarkvm_utilities::{bytes::ToBytes, to_bytes}; use snarkvm_utilities::{bytes::ToBytes, to_bytes};
use rand::{Rng, SeedableRng}; use rand::Rng;
use rand_core::SeedableRng;
use rand_xorshift::XorShiftRng; use rand_xorshift::XorShiftRng;
use snarkvm_models::dpc::DPCScheme; use snarkvm_models::dpc::DPCScheme;
use snarkvm_storage::Ledger; use snarkvm_storage::Ledger;

View File

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