Skip to content

Commit e550eba

Browse files
feat: update upstream crates (bellperson, paired, ..) and dependencies
1 parent 330cdf9 commit e550eba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+367
-362
lines changed

fil-proofs-tooling/Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,20 @@ human-size = "0.4"
2222
prettytable-rs = "0.8"
2323
regex = "1.1.6"
2424
commandspec = "0.12.2"
25-
bellperson = ">=0.3.4"
2625
chrono = { version = "0.4.7", features = ["serde"] }
27-
fil-sapling-crypto = "0.1.2"
2826
memmap = "0.7.0"
29-
paired = "0.15.0"
30-
rand = "0.4"
27+
bellperson = "0.4.0"
28+
paired = "0.16.0"
29+
fil-sapling-crypto = "0.2.0"
30+
rand = "0.7"
3131
storage-proofs = { path = "../storage-proofs"}
3232
filecoin-proofs = { path = "../filecoin-proofs"}
3333
tempfile = "3.0.8"
34-
cpu-time = "0.1.0"
34+
cpu-time = "1.0.0"
3535
git2 = "0.10.1"
36-
heim = "0.0.7"
36+
heim = "0.0.8"
3737
futures-preview = "0.3.0-alpha.17"
38-
raw-cpuid = "6.1.0"
38+
raw-cpuid = "7.0.3"
3939
blake2s_simd = "0.5.6"
4040
pretty_env_logger = "0.3.1"
4141
log = "0.4.8"

fil-proofs-tooling/src/bin/benchy/hash_fns.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1+
use bellperson::gadgets::boolean::Boolean;
12
use bellperson::ConstraintSystem;
23
use fil_proofs_tooling::metadata::Metadata;
3-
use fil_sapling_crypto::circuit as scircuit;
4-
use fil_sapling_crypto::circuit::boolean::Boolean;
54
use paired::bls12_381::Bls12;
6-
use rand::{Rng, SeedableRng, XorShiftRng};
5+
use rand::RngCore;
76
use storage_proofs::circuit::pedersen::{pedersen_compression_num, pedersen_md_no_padding};
87
use storage_proofs::circuit::test::TestConstraintSystem;
98
use storage_proofs::crypto;
109
use storage_proofs::crypto::pedersen::JJ_PARAMS;
1110
use storage_proofs::util::{bits_to_bytes, bytes_into_boolean_vec, bytes_into_boolean_vec_be};
1211

1312
fn blake2s_count(bytes: usize) -> Result<Report, failure::Error> {
14-
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
13+
let rng = &mut rand::thread_rng();
1514

1615
let mut cs = TestConstraintSystem::<Bls12>::new();
1716
let mut data = vec![0u8; bytes];
@@ -23,10 +22,11 @@ fn blake2s_count(bytes: usize) -> Result<Report, failure::Error> {
2322
};
2423

2524
let personalization = vec![0u8; 8];
26-
let out: Vec<bool> = scircuit::blake2s::blake2s(&mut cs, &data_bits, &personalization)?
27-
.into_iter()
28-
.map(|b| b.get_value().unwrap())
29-
.collect();
25+
let out: Vec<bool> =
26+
bellperson::gadgets::blake2s::blake2s(&mut cs, &data_bits, &personalization)?
27+
.into_iter()
28+
.map(|b| b.get_value().unwrap())
29+
.collect();
3030

3131
assert!(cs.is_satisfied(), "constraints not satisfied");
3232

@@ -45,7 +45,7 @@ fn blake2s_count(bytes: usize) -> Result<Report, failure::Error> {
4545
}
4646

4747
fn sha256_count(bytes: usize) -> Result<Report, failure::Error> {
48-
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
48+
let mut rng = rand::thread_rng();
4949

5050
let mut cs = TestConstraintSystem::<Bls12>::new();
5151
let mut data = vec![0u8; bytes];
@@ -56,7 +56,7 @@ fn sha256_count(bytes: usize) -> Result<Report, failure::Error> {
5656
bytes_into_boolean_vec_be(&mut cs, Some(data.as_slice()), data.len()).unwrap()
5757
};
5858

59-
let _out: Vec<bool> = scircuit::sha256::sha256(&mut cs, &data_bits)?
59+
let _out: Vec<bool> = bellperson::gadgets::sha256::sha256(&mut cs, &data_bits)?
6060
.into_iter()
6161
.map(|b| b.get_value().unwrap())
6262
.collect();
@@ -71,7 +71,7 @@ fn sha256_count(bytes: usize) -> Result<Report, failure::Error> {
7171
}
7272

7373
fn pedersen_count(bytes: usize) -> Result<Report, failure::Error> {
74-
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
74+
let mut rng = rand::thread_rng();
7575

7676
let mut cs = TestConstraintSystem::<Bls12>::new();
7777
let mut data = vec![0u8; bytes];

fil-proofs-tooling/src/bin/benchy/stacked.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ use log::info;
99
use memmap::MmapMut;
1010
use memmap::MmapOptions;
1111
use paired::bls12_381::Bls12;
12-
use rand::{Rng, SeedableRng, XorShiftRng};
12+
use rand::Rng;
1313

1414
use fil_proofs_tooling::{measure, FuncMeasurement, Metadata};
1515
use storage_proofs::circuit::metric::MetricCS;
1616
use storage_proofs::circuit::stacked::StackedCompound;
1717
use storage_proofs::compound_proof::{self, CompoundProof};
1818
use storage_proofs::crypto::pedersen::JJ_PARAMS;
1919
use storage_proofs::drgraph::*;
20-
use storage_proofs::hasher::{Blake2sHasher, Hasher, PedersenHasher, Sha256Hasher};
20+
use storage_proofs::hasher::{Blake2sHasher, Domain, Hasher, PedersenHasher, Sha256Hasher};
2121
use storage_proofs::porep::PoRep;
2222
use storage_proofs::proof::ProofScheme;
2323
use storage_proofs::stacked::{
@@ -120,10 +120,10 @@ where
120120
let mut total_proving_wall_time = Duration::new(0, 0);
121121
let mut total_proving_cpu_time = Duration::new(0, 0);
122122

123-
let rng = &mut XorShiftRng::from_seed([0x3dbe_6259, 0x8d31_3d76, 0x3237_db17, 0xe5bc_0654]);
123+
let rng = &mut rand::thread_rng();
124124
let nodes = data_size / 32;
125125

126-
let replica_id: H::Domain = rng.gen();
126+
let replica_id = H::Domain::random(rng);
127127
let sp = stacked::SetupParams {
128128
nodes,
129129
degree: BASE_DEGREE,

filecoin-proofs/Cargo.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ readme = "README.md"
1212
storage-proofs = { version = "^0.6", path = "../storage-proofs" }
1313
bitvec = "0.5"
1414
chrono = "0.4"
15-
rand = "0.4"
15+
rand = "0.7"
1616
failure = "0.1"
1717
lazy_static = "1.2"
1818
memmap = "0.7"
@@ -21,16 +21,15 @@ pbr = "1.0"
2121
tempfile = "3"
2222
byteorder = "1"
2323
itertools = "0.8"
24-
serde_cbor = "0.9.0"
24+
serde_cbor = "0.10.2"
2525
serde = { version = "1", features = ["rc", "derive"] }
2626
serde_json = "1.0"
2727
regex = "1"
28-
ff = "0.4.0"
28+
ff = "0.5.0"
2929
blake2b_simd = "0.5"
30-
phase21 = "0.3"
31-
bellperson = ">=0.3.4"
32-
paired = "0.15"
33-
fil-sapling-crypto = "0.1.2"
30+
bellperson = "0.4.0"
31+
paired = "0.16.0"
32+
fil-sapling-crypto = "0.2.0"
3433
clap = "2"
3534
log = "0.4.7"
3635
pretty_env_logger = "0.3.0"
@@ -51,18 +50,19 @@ features = ["default-tls-vendored"]
5150

5251
[dev-dependencies]
5352
gperftools = "0.2"
54-
criterion = "0.2"
53+
criterion = "0.3"
5554
rexpect = "0.3.0"
5655
pretty_env_logger = "0.3.1"
5756
pretty_assertions = "0.6.1"
57+
rand_xorshift = "0.2.0"
5858

5959
[features]
6060
default = ["gpu"]
6161
cpu-profile = []
6262
heap-profile = ["gperftools/heap"]
6363
simd = ["storage-proofs/simd"]
6464
asm = ["storage-proofs/asm"]
65-
gpu = ["storage-proofs/gpu", "bellperson/gpu", "fil-sapling-crypto/gpu", "phase21/gpu"]
65+
gpu = ["storage-proofs/gpu", "bellperson/gpu", "fil-sapling-crypto/gpu"]
6666

6767
[[bench]]
6868
name = "preprocessing"

filecoin-proofs/benches/preprocessing.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ fn preprocessing_benchmark(c: &mut Criterion) {
4343
write_padded_unpadded_bench(tmpfile, data.clone());
4444
})
4545
})
46-
.sample_size(2)
47-
.throughput(|s| Throughput::Bytes(*s as u32))
46+
.sample_size(10)
47+
.throughput(|s| Throughput::Bytes(*s as u64))
4848
.warm_up_time(Duration::from_secs(1)),
4949
);
5050
}

filecoin-proofs/examples/stacked.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ extern crate log;
77

88
use chrono::Utc;
99
use clap::{App, Arg};
10+
use ff::Field;
1011
#[cfg(feature = "heap-profile")]
1112
use gperftools::heap_profiler::HEAP_PROFILER;
1213
#[cfg(feature = "cpu-profile")]
1314
use gperftools::profiler::PROFILER;
1415
use memmap::MmapMut;
1516
use memmap::MmapOptions;
16-
use paired::bls12_381::Bls12;
17-
use rand::{Rng, SeedableRng, XorShiftRng};
17+
use paired::bls12_381::{Bls12, Fr};
18+
use rand::Rng;
1819
use std::fs::{File, OpenOptions};
1920
use std::io::Write;
2021
use std::time::{Duration, Instant};
@@ -29,7 +30,7 @@ use storage_proofs::crypto::pedersen::JJ_PARAMS;
2930
use storage_proofs::drgraph::*;
3031
use storage_proofs::example_helper::prettyb;
3132
use storage_proofs::fr32::fr_into_bytes;
32-
use storage_proofs::hasher::{Blake2sHasher, Hasher, PedersenHasher, Sha256Hasher};
33+
use storage_proofs::hasher::{Blake2sHasher, Domain, Hasher, PedersenHasher, Sha256Hasher};
3334
use storage_proofs::porep::PoRep;
3435
use storage_proofs::proof::ProofScheme;
3536
use storage_proofs::stacked::{
@@ -80,7 +81,8 @@ fn stop_profile() {
8081
fn stop_profile() {}
8182

8283
fn _file_backed_mmap_from_random_bytes(n: usize, use_tmp: bool) -> MmapMut {
83-
let rng = &mut XorShiftRng::from_seed([0x3dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
84+
let rng = &mut rand::thread_rng();
85+
8486
let mut file: File = if use_tmp {
8587
tempfile::tempfile().unwrap()
8688
} else {
@@ -94,7 +96,8 @@ fn _file_backed_mmap_from_random_bytes(n: usize, use_tmp: bool) -> MmapMut {
9496
info!("generating fake data");
9597

9698
for _ in 0..n {
97-
file.write_all(&fr_into_bytes::<Bls12>(&rng.gen())).unwrap();
99+
file.write_all(&fr_into_bytes::<Bls12>(&Fr::random(rng)))
100+
.unwrap();
98101
}
99102

100103
unsafe { MmapOptions::new().map_mut(&file).unwrap() }
@@ -152,7 +155,7 @@ fn do_the_work<H: 'static>(
152155
) where
153156
H: Hasher,
154157
{
155-
let rng = &mut XorShiftRng::from_seed([0x3dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
158+
let rng = &mut rand::thread_rng();
156159

157160
let m = BASE_DEGREE;
158161
let expansion_degree = EXP_DEGREE;
@@ -169,7 +172,7 @@ fn do_the_work<H: 'static>(
169172

170173
let nodes = data_size / 32;
171174

172-
let replica_id: H::Domain = rng.gen();
175+
let replica_id: H::Domain = H::Domain::random(rng);
173176
let sp = stacked::SetupParams {
174177
nodes,
175178
degree: m,

filecoin-proofs/src/api/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ mod tests {
264264
use std::io::{Seek, SeekFrom, Write};
265265

266266
use paired::bls12_381::Bls12;
267-
use rand::{Rng, SeedableRng, XorShiftRng};
267+
use rand::{Rng, SeedableRng};
268+
use rand_xorshift::XorShiftRng;
268269
use storage_proofs::fr32::bytes_into_fr;
269270
use tempfile::NamedTempFile;
270271

@@ -368,7 +369,7 @@ mod tests {
368369
fn test_seal_lifecycle() -> Result<(), failure::Error> {
369370
pretty_env_logger::try_init().ok();
370371

371-
let rng = &mut XorShiftRng::from_seed([0x3dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
372+
let rng = &mut XorShiftRng::from_seed(crate::TEST_SEED);
372373

373374
let sector_size = SECTOR_SIZE_ONE_KIB;
374375

filecoin-proofs/src/bin/paramgen.rs

Lines changed: 0 additions & 51 deletions
This file was deleted.

filecoin-proofs/src/fr32.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,8 @@ mod tests {
10021002
use super::*;
10031003
use itertools::Itertools;
10041004
use paired::bls12_381::Bls12;
1005-
use rand::{Rng, SeedableRng, XorShiftRng};
1005+
use rand::{Rng, SeedableRng};
1006+
use rand_xorshift::XorShiftRng;
10061007
use std::io::Cursor;
10071008
use storage_proofs::fr32::bytes_into_fr;
10081009

@@ -1025,7 +1026,7 @@ mod tests {
10251026
// Length of the data vector we'll be extracting from.
10261027
let len = 20;
10271028

1028-
let rng = &mut XorShiftRng::from_seed([0x3dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
1029+
let rng = &mut XorShiftRng::from_seed(crate::TEST_SEED);
10291030
let data: Vec<u8> = (0..len).map(|_| rng.gen()).collect();
10301031

10311032
// TODO: Evaluate designing a scattered pattered of `pos` and `num_bits`
@@ -1056,7 +1057,7 @@ mod tests {
10561057
#[test]
10571058
fn test_bit_shifts() {
10581059
let len = 5;
1059-
let rng = &mut XorShiftRng::from_seed([0x3dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
1060+
let rng = &mut XorShiftRng::from_seed(crate::TEST_SEED);
10601061

10611062
for amount in 1..8 {
10621063
for left in [true, false].iter() {
@@ -1323,7 +1324,7 @@ mod tests {
13231324
// different lengths of raw data at different offset, check integrity.
13241325
#[test]
13251326
fn test_read_write_padded_offset() {
1326-
let rng = &mut XorShiftRng::from_seed([0x3dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
1327+
let rng = &mut XorShiftRng::from_seed(crate::TEST_SEED);
13271328

13281329
let len = 1016;
13291330
let mut data: Vec<u8> = (0..len).map(|_| rng.gen()).collect();

filecoin-proofs/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,8 @@ pub use types::*;
2727
#[cfg(test)]
2828
#[macro_use]
2929
extern crate pretty_assertions;
30+
31+
#[cfg(test)]
32+
pub(crate) const TEST_SEED: [u8; 16] = [
33+
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc, 0xe5,
34+
];

filecoin-proofs/src/parameters.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ const POST_CHALLENGE_COUNT: usize = 30; // TODO: correct value
1111

1212
const LAYERS: usize = 4; // TODO: 10;
1313

14-
const DRG_SEED: [u32; 7] = [1, 2, 3, 4, 5, 6, 7]; // Arbitrary, need a theory for how to vary this over time.
14+
const DRG_SEED: [u8; 28] = [
15+
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
16+
26, 27,
17+
]; // Arbitrary, need a theory for how to vary this over time.
1518

1619
type PostSetupParams = rational_post::SetupParams;
1720
pub type PostPublicParams = rational_post::PublicParams;

0 commit comments

Comments
 (0)