diff --git a/fil-proofs-param/Cargo.toml b/fil-proofs-param/Cargo.toml index 9e2dbe308..11bd51993 100644 --- a/fil-proofs-param/Cargo.toml +++ b/fil-proofs-param/Cargo.toml @@ -25,7 +25,7 @@ serde = { version = "1.0", features = ["rc", "derive"] } serde_json = "1.0" ff = "0.11.0" blake2b_simd = "0.5" -bellperson = "0.17.0" +bellperson = "0.18.0" log = "0.4.7" fil_logger = "0.1" env_proxy = "0.4" diff --git a/fil-proofs-param/src/bin/paramfetch.rs b/fil-proofs-param/src/bin/paramfetch.rs index d3f7f35a6..25a1f8b02 100644 --- a/fil-proofs-param/src/bin/paramfetch.rs +++ b/fil-proofs-param/src/bin/paramfetch.rs @@ -91,7 +91,7 @@ fn download_ipget(version: &str, verbose: bool) -> Result<()> { ))?; trace!("making GET request: {}", url.as_str()); let client = Client::builder() - .proxy(Proxy::custom(move |url| env_proxy::for_url(&url).to_url())) + .proxy(Proxy::custom(move |url| env_proxy::for_url(url).to_url())) .build()?; let mut resp = client.get(url).send()?; trace!("received GET response"); @@ -162,7 +162,7 @@ fn get_filenames_requiring_download( return true; }; trace!("params file found"); - let calculated_digest = match get_digest_for_file_within_cache(&filename) { + let calculated_digest = match get_digest_for_file_within_cache(filename) { Ok(digest) => digest, Err(e) => { warn!("failed to hash file {}, marking for download", e); diff --git a/fil-proofs-param/tests/paramfetch/mod.rs b/fil-proofs-param/tests/paramfetch/mod.rs index c1269866d..326121af7 100644 --- a/fil-proofs-param/tests/paramfetch/mod.rs +++ b/fil-proofs-param/tests/paramfetch/mod.rs @@ -26,10 +26,7 @@ fn rand_bytes_with_blake2b() -> Result<(Vec, String), FailureError> { io::copy(&mut as_slice, &mut hasher)?; - Ok(( - bytes.iter().cloned().collect(), - hasher.finalize().to_hex()[..32].into(), - )) + Ok((bytes.to_vec(), hasher.finalize().to_hex()[..32].into())) } #[test] diff --git a/fil-proofs-tooling/Cargo.toml b/fil-proofs-tooling/Cargo.toml index c76d98cb6..35cf99654 100644 --- a/fil-proofs-tooling/Cargo.toml +++ b/fil-proofs-tooling/Cargo.toml @@ -25,7 +25,7 @@ regex = "1.3.7" commandspec = "0.12.2" chrono = { version = "0.4.7", features = ["serde"] } memmap = "0.7.0" -bellperson = "0.17.0" +bellperson = "0.18.0" rand = "0.8" tempfile = "3.0.8" cpu-time = "1.0.0" diff --git a/fil-proofs-tooling/src/bin/benchy/prodbench.rs b/fil-proofs-tooling/src/bin/benchy/prodbench.rs index 8605b164a..845118093 100644 --- a/fil-proofs-tooling/src/bin/benchy/prodbench.rs +++ b/fil-proofs-tooling/src/bin/benchy/prodbench.rs @@ -229,7 +229,7 @@ pub fn run( )?; clear_cache::( - &replica_info.private_replica_info.cache_dir_path(), + replica_info.private_replica_info.cache_dir_path(), )?; seal_commit_phase2(cfg, phase1_output, PROVER_ID, *sector_id) diff --git a/fil-proofs-tooling/src/bin/benchy/window_post.rs b/fil-proofs-tooling/src/bin/benchy/window_post.rs index 3df3d21af..223a11d25 100644 --- a/fil-proofs-tooling/src/bin/benchy/window_post.rs +++ b/fil-proofs-tooling/src/bin/benchy/window_post.rs @@ -535,7 +535,7 @@ pub fn run_window_post_bench( &RANDOMNESS, &pub_replica_info, PROVER_ID, - &proof, + proof, ) .unwrap(); let verify_window_post_measurement = measure(|| { @@ -544,7 +544,7 @@ pub fn run_window_post_bench( &RANDOMNESS, &pub_replica_info, PROVER_ID, - &proof, + proof, ) }) .expect("failed to verify window post proof"); diff --git a/fil-proofs-tooling/src/bin/benchy/winning_post.rs b/fil-proofs-tooling/src/bin/benchy/winning_post.rs index ae7d8fa2b..c9eab1532 100644 --- a/fil-proofs-tooling/src/bin/benchy/winning_post.rs +++ b/fil-proofs-tooling/src/bin/benchy/winning_post.rs @@ -95,7 +95,7 @@ pub fn run_fallback_post_bench( &RANDOMNESS, &pub_replica_info[..], PROVER_ID, - &proof, + proof, ) }) .expect("failed to verify winning post proof"); diff --git a/fil-proofs-tooling/src/bin/check_parameters/main.rs b/fil-proofs-tooling/src/bin/check_parameters/main.rs index c8d0c2b50..de24684be 100644 --- a/fil-proofs-tooling/src/bin/check_parameters/main.rs +++ b/fil-proofs-tooling/src/bin/check_parameters/main.rs @@ -32,7 +32,7 @@ fn main() { match matches.subcommand() { ("map", Some(m)) => { let parameter_file_str = value_t!(m, "param", String).expect("param failed"); - run_map(&Path::new(¶meter_file_str)).expect("run_map failed"); + run_map(Path::new(¶meter_file_str)).expect("run_map failed"); } _ => panic!("Unrecognized subcommand"), } diff --git a/fil-proofs-tooling/src/bin/gpu-cpu-test/main.rs b/fil-proofs-tooling/src/bin/gpu-cpu-test/main.rs index 90ae42103..ee3e9cfa1 100644 --- a/fil-proofs-tooling/src/bin/gpu-cpu-test/main.rs +++ b/fil-proofs-tooling/src/bin/gpu-cpu-test/main.rs @@ -94,10 +94,10 @@ fn thread_fun( // already there if gpu_stealing { // Run the actual proof - generate_post_in_priority(&priv_replica_infos); + generate_post_in_priority(priv_replica_infos); } else { // Run the actual proof - generate_post(&priv_replica_infos); + generate_post(priv_replica_infos); } // Waiting for this thread to be killed @@ -186,7 +186,7 @@ fn processes_mode(parallel: u8, gpu_stealing: bool) { // Put each process into it's own scope (the other one is due to the if statement) { let name = "high"; - let child = spawn_process(&name, gpu_stealing); + let child = spawn_process(name, gpu_stealing); children.insert(name.to_string(), child); } diff --git a/fil-proofs-tooling/src/bin/update_tree_r_cache/main.rs b/fil-proofs-tooling/src/bin/update_tree_r_cache/main.rs index 001877282..b0876e7ff 100644 --- a/fil-proofs-tooling/src/bin/update_tree_r_cache/main.rs +++ b/fil-proofs-tooling/src/bin/update_tree_r_cache/main.rs @@ -80,22 +80,22 @@ fn get_tree_r_last_root( } else if is_sector_shape_sub2(sector_size) { let tree_r_last = SectorShapeSub2::from_store_configs_and_replica( base_tree_leafs, - &configs, - &replica_config, + configs, + replica_config, )?; tree_r_last.root() } else if is_sector_shape_sub8(sector_size) { let tree_r_last = SectorShapeSub8::from_store_configs_and_replica( base_tree_leafs, - &configs, - &replica_config, + configs, + replica_config, )?; tree_r_last.root() } else if is_sector_shape_top2(sector_size) { let tree_r_last = SectorShapeTop2::from_sub_tree_store_configs_and_replica( base_tree_leafs, - &configs, - &replica_config, + configs, + replica_config, )?; tree_r_last.root() } else { @@ -190,7 +190,7 @@ fn run_inspect(sector_size: usize, cache: &Path, replica_path: &Path) -> Result< &configs, &replica_config, )?; - let p_aux = get_persistent_aux(&cache)?; + let p_aux = get_persistent_aux(cache)?; println!("CommRLast from p_aux: {:?}", p_aux.comm_r_last); println!( @@ -226,7 +226,7 @@ fn run_verify(sector_size: usize, cache: &Path, replica_path: &Path) -> Result<( let store = LCStore::new_from_disk_with_reader( base_tree_len, OCT_ARITY, - &config, + config, ExternalReader::new_from_config(&replica_config, i)?, )?; cached_base_tree_roots.push(store.last()?); @@ -256,7 +256,7 @@ fn run_verify(sector_size: usize, cache: &Path, replica_path: &Path) -> Result<( create_dir_all(&tmp_path)?; let (rebuilt_tree_r_last_root, rebuilt_base_tree_roots) = - run_rebuild(sector_size, &tmp_path, &replica_path)?; + run_rebuild(sector_size, tmp_path, replica_path)?; remove_dir_all(&tmp_path)?; diff --git a/filecoin-hashers/Cargo.toml b/filecoin-hashers/Cargo.toml index d85f48258..467eaf26a 100644 --- a/filecoin-hashers/Cargo.toml +++ b/filecoin-hashers/Cargo.toml @@ -9,7 +9,7 @@ repository = "https://github.com/filecoin-project/rust-fil-proofs" readme = "README.md" [dependencies] -bellperson = "0.17.0" +bellperson = "0.18.0" blstrs = "0.4.0" generic-array = "0.14.4" merkletree = "0.21.0" @@ -18,7 +18,7 @@ anyhow = "1.0.34" serde = "1.0.117" rand = "0.8.0" -neptune = { version = "5.0.0", optional = true, features = ["arity2", "arity4", "arity8", "arity11", "arity16", "arity24", "arity36"] } +neptune = { version = "5.1.0", optional = true, features = ["arity2", "arity4", "arity8", "arity11", "arity16", "arity24", "arity36"] } lazy_static = { version = "1.4.0", optional = true } blake2s_simd = { version = "0.5.11", optional = true } sha2 = { version = "0.9.2", optional = true } diff --git a/filecoin-hashers/src/poseidon.rs b/filecoin-hashers/src/poseidon.rs index 8653a103a..86c69b30b 100644 --- a/filecoin-hashers/src/poseidon.rs +++ b/filecoin-hashers/src/poseidon.rs @@ -117,7 +117,7 @@ impl Domain for PoseidonDomain { "invalid amount of bytes" ); let mut repr = ::Repr::default(); - repr.copy_from_slice(&raw); + repr.copy_from_slice(raw); Ok(PoseidonDomain(repr)) } @@ -170,7 +170,7 @@ fn shared_hash(data: &[u8]) -> PoseidonDomain { // We could truncate so `bytes_into_frs` cannot fail, then ensure `data` is always `fr_safe`. let preimage = data .chunks(32) - .map(|ref chunk| { + .map(|chunk| { Fr::from_repr_vartime(PoseidonDomain::from_slice(chunk).0).expect("from_repr failure") }) .collect::>(); @@ -181,19 +181,19 @@ fn shared_hash(data: &[u8]) -> PoseidonDomain { fn shared_hash_frs(preimage: &[Fr]) -> Fr { match preimage.len() { 2 => { - let mut p = Poseidon::new_with_preimage(&preimage, &POSEIDON_CONSTANTS_2); + let mut p = Poseidon::new_with_preimage(preimage, &POSEIDON_CONSTANTS_2); p.hash() } 4 => { - let mut p = Poseidon::new_with_preimage(&preimage, &POSEIDON_CONSTANTS_4); + let mut p = Poseidon::new_with_preimage(preimage, &POSEIDON_CONSTANTS_4); p.hash() } 8 => { - let mut p = Poseidon::new_with_preimage(&preimage, &POSEIDON_CONSTANTS_8); + let mut p = Poseidon::new_with_preimage(preimage, &POSEIDON_CONSTANTS_8); p.hash() } 16 => { - let mut p = Poseidon::new_with_preimage(&preimage, &POSEIDON_CONSTANTS_16); + let mut p = Poseidon::new_with_preimage(preimage, &POSEIDON_CONSTANTS_16); p.hash() } @@ -413,11 +413,9 @@ mod tests { let p = t.gen_proof(0).expect("gen_proof failure"); // create a proof for the first value =k Fr::one() assert_eq!(*p.path(), vec![0, 0]); - assert_eq!( - p.validate::() - .expect("failed to validate"), - true - ); + assert!(p + .validate::() + .expect("failed to validate")); } // #[test] diff --git a/filecoin-proofs/Cargo.toml b/filecoin-proofs/Cargo.toml index 5f24103a9..00d35d7ed 100644 --- a/filecoin-proofs/Cargo.toml +++ b/filecoin-proofs/Cargo.toml @@ -23,7 +23,7 @@ serde = { version = "1.0", features = ["rc", "derive"] } serde_json = "1.0" ff = "0.11.0" blake2b_simd = "0.5" -bellperson = "0.17.0" +bellperson = "0.18.0" log = "0.4.7" fil_logger = "0.1" rayon = "1.1.0" diff --git a/filecoin-proofs/src/api/mod.rs b/filecoin-proofs/src/api/mod.rs index 7d0d6a30d..8c6974928 100644 --- a/filecoin-proofs/src/api/mod.rs +++ b/filecoin-proofs/src/api/mod.rs @@ -384,7 +384,7 @@ where let source = BufReader::new(source); let mut target = BufWriter::new(target); - let written_bytes = sum_piece_bytes_with_alignment(&piece_lengths); + let written_bytes = sum_piece_bytes_with_alignment(piece_lengths); let piece_alignment = get_piece_alignment(written_bytes, piece_size); let fr32_reader = Fr32Reader::new(source); @@ -506,7 +506,7 @@ fn verify_store(config: &StoreConfig, arity: usize, required_configs: usize) -> let store_len = config.size.expect("disk store size not configured"); for config in &configs { ensure!( - DiskStore::::is_consistent(store_len, arity, &config,)?, + DiskStore::::is_consistent(store_len, arity, config,)?, "Store is inconsistent: {:?}", StoreConfig::data_path(&config.path, &config.id) ); @@ -516,7 +516,7 @@ fn verify_store(config: &StoreConfig, arity: usize, required_configs: usize) -> DiskStore::::is_consistent( config.size.expect("disk store size not configured"), arity, - &config, + config, )?, "Store is inconsistent: {:?}", store_path @@ -573,7 +573,7 @@ fn verify_level_cache_store(config: &StoreConfig) -> Resu LevelCacheStore::::is_consistent( store_len, Tree::Arity::to_usize(), - &config, + config, )?, "Store is inconsistent: {:?}", StoreConfig::data_path(&config.path, &config.id) @@ -584,7 +584,7 @@ fn verify_level_cache_store(config: &StoreConfig) -> Resu LevelCacheStore::::is_consistent( config.size.expect("disk store size not configured"), Tree::Arity::to_usize(), - &config, + config, )?, "Store is inconsistent: {:?}", store_path diff --git a/filecoin-proofs/src/api/post_util.rs b/filecoin-proofs/src/api/post_util.rs index 1c76fd96e..f3ffbf69a 100644 --- a/filecoin-proofs/src/api/post_util.rs +++ b/filecoin-proofs/src/api/post_util.rs @@ -47,7 +47,7 @@ pub fn clear_caches( info!("clear_caches:start"); for replica in replicas.values() { - clear_cache::(&replica.cache_dir.as_path())?; + clear_cache::(replica.cache_dir.as_path())?; } info!("clear_caches:finish"); @@ -84,7 +84,7 @@ pub fn generate_fallback_sector_challenges( let num_sectors_per_chunk = post_config.sector_count; let partitions = match post_config.typ { PoStType::Window => { - get_partitions_for_window_post(pub_sectors.len(), &post_config).unwrap_or(1) + get_partitions_for_window_post(pub_sectors.len(), post_config).unwrap_or(1) } PoStType::Winning => 1, }; diff --git a/filecoin-proofs/src/api/window_post.rs b/filecoin-proofs/src/api/window_post.rs index 99c1356ed..6707bd835 100644 --- a/filecoin-proofs/src/api/window_post.rs +++ b/filecoin-proofs/src/api/window_post.rs @@ -42,8 +42,8 @@ pub fn generate_window_post_with_vanilla( let prover_id_safe: ::Domain = as_safe_commitment(&prover_id, "prover_id")?; - let vanilla_params = window_post_setup_params(&post_config); - let partitions = get_partitions_for_window_post(vanilla_proofs.len(), &post_config); + let vanilla_params = window_post_setup_params(post_config); + let partitions = get_partitions_for_window_post(vanilla_proofs.len(), post_config); let setup_params = compound_proof::SetupParams { vanilla_params, @@ -55,7 +55,7 @@ pub fn generate_window_post_with_vanilla( let pub_params: compound_proof::PublicParams<'_, FallbackPoSt<'_, Tree>> = FallbackPoStCompound::setup(&setup_params)?; - let groth_params = get_post_params::(&post_config)?; + let groth_params = get_post_params::(post_config)?; let mut pub_sectors = Vec::with_capacity(vanilla_proofs.len()); for vanilla_proof in &vanilla_proofs { @@ -73,7 +73,7 @@ pub fn generate_window_post_with_vanilla( }; let partitioned_proofs = partition_vanilla_proofs( - &post_config, + post_config, &pub_params.vanilla_params, &pub_inputs, partitions, @@ -108,8 +108,8 @@ pub fn generate_window_post( let randomness_safe = as_safe_commitment(randomness, "randomness")?; let prover_id_safe = as_safe_commitment(&prover_id, "prover_id")?; - let vanilla_params = window_post_setup_params(&post_config); - let partitions = get_partitions_for_window_post(replicas.len(), &post_config); + let vanilla_params = window_post_setup_params(post_config); + let partitions = get_partitions_for_window_post(replicas.len(), post_config); let sector_count = vanilla_params.sector_count; let setup_params = compound_proof::SetupParams { @@ -120,7 +120,7 @@ pub fn generate_window_post( let pub_params: compound_proof::PublicParams<'_, FallbackPoSt<'_, Tree>> = FallbackPoStCompound::setup(&setup_params)?; - let groth_params = get_post_params::(&post_config)?; + let groth_params = get_post_params::(post_config)?; let trees: Vec<_> = replicas .iter() @@ -190,8 +190,8 @@ pub fn verify_window_post( let randomness_safe = as_safe_commitment(randomness, "randomness")?; let prover_id_safe = as_safe_commitment(&prover_id, "prover_id")?; - let vanilla_params = window_post_setup_params(&post_config); - let partitions = get_partitions_for_window_post(replicas.len(), &post_config); + let vanilla_params = window_post_setup_params(post_config); + let partitions = get_partitions_for_window_post(replicas.len(), post_config); let setup_params = compound_proof::SetupParams { vanilla_params, @@ -222,7 +222,7 @@ pub fn verify_window_post( }; let is_valid = { - let verifying_key = get_post_verifying_key::(&post_config)?; + let verifying_key = get_post_verifying_key::(post_config)?; let multi_proof = MultiProof::new_from_reader(partitions, proof, &verifying_key)?; FallbackPoStCompound::verify( diff --git a/filecoin-proofs/src/api/winning_post.rs b/filecoin-proofs/src/api/winning_post.rs index c89f9973e..6ab4d91fe 100644 --- a/filecoin-proofs/src/api/winning_post.rs +++ b/filecoin-proofs/src/api/winning_post.rs @@ -46,7 +46,7 @@ pub fn generate_winning_post_with_vanilla( let prover_id_safe: ::Domain = as_safe_commitment(&prover_id, "prover_id")?; - let vanilla_params = winning_post_setup_params(&post_config)?; + let vanilla_params = winning_post_setup_params(post_config)?; let setup_params = compound_proof::SetupParams { vanilla_params, @@ -55,7 +55,7 @@ pub fn generate_winning_post_with_vanilla( }; let pub_params: compound_proof::PublicParams<'_, FallbackPoSt<'_, Tree>> = FallbackPoStCompound::setup(&setup_params)?; - let groth_params = get_post_params::(&post_config)?; + let groth_params = get_post_params::(post_config)?; let mut pub_sectors = Vec::with_capacity(vanilla_proofs.len()); for vanilla_proof in &vanilla_proofs { @@ -74,7 +74,7 @@ pub fn generate_winning_post_with_vanilla( let partitions = pub_params.partitions.unwrap_or(1); let partitioned_proofs = partition_vanilla_proofs( - &post_config, + post_config, &pub_params.vanilla_params, &pub_inputs, partitions, @@ -117,7 +117,7 @@ pub fn generate_winning_post( let prover_id_safe: ::Domain = as_safe_commitment(&prover_id, "prover_id")?; - let vanilla_params = winning_post_setup_params(&post_config)?; + let vanilla_params = winning_post_setup_params(post_config)?; let param_sector_count = vanilla_params.sector_count; let setup_params = compound_proof::SetupParams { @@ -127,7 +127,7 @@ pub fn generate_winning_post( }; let pub_params: compound_proof::PublicParams<'_, FallbackPoSt<'_, Tree>> = FallbackPoStCompound::setup(&setup_params)?; - let groth_params = get_post_params::(&post_config)?; + let groth_params = get_post_params::(post_config)?; let trees = replicas .iter() @@ -245,7 +245,7 @@ pub fn verify_winning_post( let prover_id_safe: ::Domain = as_safe_commitment(&prover_id, "prover_id")?; - let vanilla_params = winning_post_setup_params(&post_config)?; + let vanilla_params = winning_post_setup_params(post_config)?; let param_sector_count = vanilla_params.sector_count; let setup_params = compound_proof::SetupParams { @@ -277,7 +277,7 @@ pub fn verify_winning_post( }; let is_valid = { - let verifying_key = get_post_verifying_key::(&post_config)?; + let verifying_key = get_post_verifying_key::(post_config)?; let single_proof = MultiProof::new_from_reader(None, proof, &verifying_key)?; if single_proof.len() != 1 { diff --git a/filecoin-proofs/src/parameters.rs b/filecoin-proofs/src/parameters.rs index 9e017e90b..bc3a31f9c 100644 --- a/filecoin-proofs/src/parameters.rs +++ b/filecoin-proofs/src/parameters.rs @@ -31,7 +31,7 @@ pub fn public_params( pub fn winning_post_public_params( post_config: &PoStConfig, ) -> Result { - FallbackPoSt::::setup(&winning_post_setup_params(&post_config)?) + FallbackPoSt::::setup(&winning_post_setup_params(post_config)?) } pub fn winning_post_setup_params(post_config: &PoStConfig) -> Result { @@ -62,7 +62,7 @@ pub fn winning_post_setup_params(post_config: &PoStConfig) -> Result( post_config: &PoStConfig, ) -> Result { - FallbackPoSt::::setup(&window_post_setup_params(&post_config)) + FallbackPoSt::::setup(&window_post_setup_params(post_config)) } pub fn window_post_setup_params(post_config: &PoStConfig) -> WindowPostSetupParams { diff --git a/filecoin-proofs/src/pieces.rs b/filecoin-proofs/src/pieces.rs index 0c0fed257..445bd9e45 100644 --- a/filecoin-proofs/src/pieces.rs +++ b/filecoin-proofs/src/pieces.rs @@ -277,7 +277,7 @@ pub fn get_piece_start_byte( piece_bytes: UnpaddedBytesAmount, ) -> UnpaddedByteIndex { // sum up all the bytes taken by the ordered pieces - let last_byte = sum_piece_bytes_with_alignment(&pieces); + let last_byte = sum_piece_bytes_with_alignment(pieces); let alignment = get_piece_alignment(last_byte, piece_bytes); // add only the left padding of the target piece to give the start of that piece's data diff --git a/filecoin-proofs/tests/api.rs b/filecoin-proofs/tests/api.rs index 7d49099e7..de8b9b8a5 100644 --- a/filecoin-proofs/tests/api.rs +++ b/filecoin-proofs/tests/api.rs @@ -1270,7 +1270,7 @@ fn generate_proof( ticket, seed, pre_commit_output.clone(), - &piece_infos, + piece_infos, )?; clear_cache::(cache_dir_path)?; @@ -1340,7 +1340,7 @@ fn unseal( assert_eq!(contents.len(), 508); assert_eq!(&piece_bytes[508..508 + 508], &contents[..]); - let computed_comm_d = compute_comm_d(config.sector_size, &piece_infos)?; + let computed_comm_d = compute_comm_d(config.sector_size, piece_infos)?; assert_eq!( comm_d, computed_comm_d, diff --git a/filecoin-proofs/tests/pieces.rs b/filecoin-proofs/tests/pieces.rs index 59275074c..858af5b1f 100644 --- a/filecoin-proofs/tests/pieces.rs +++ b/filecoin-proofs/tests/pieces.rs @@ -301,7 +301,7 @@ fn test_verify_random_pieces() -> Result<()> { println!("--- {:?} ---", sector_size); for i in 0..100 { println!(" - {} -", i); - let unpadded_sector_size: UnpaddedBytesAmount = sector_size.clone().into(); + let unpadded_sector_size: UnpaddedBytesAmount = (*sector_size).into(); let sector_size = *sector_size; let padded_sector_size: PaddedBytesAmount = sector_size.into(); diff --git a/fr32/Cargo.toml b/fr32/Cargo.toml index 0ced0490d..d2d2d9c62 100644 --- a/fr32/Cargo.toml +++ b/fr32/Cargo.toml @@ -9,7 +9,7 @@ repository = "https://github.com/filecoin-project/rust-fil-proofs" [dependencies] anyhow = "1.0.23" -bellperson = "0.17.0" +bellperson = "0.18.0" byte-slice-cast = "1.0.0" byteorder = "1" ff = "0.11.0" diff --git a/fr32/src/convert.rs b/fr32/src/convert.rs index 3f780e07e..9fdaeef9f 100644 --- a/fr32/src/convert.rs +++ b/fr32/src/convert.rs @@ -57,7 +57,7 @@ mod tests { fn bytes_fr_test(bytes: Fr32Ary, expect_success: bool) { let b = &bytes[..]; - let fr_result = bytes_into_fr(&b); + let fr_result = bytes_into_fr(b); if expect_success { let f = fr_result.expect("Failed to convert bytes to `Fr`"); let b2 = fr_into_bytes(&f); diff --git a/fr32/src/padding.rs b/fr32/src/padding.rs index 30e05ba58..21023b1b3 100644 --- a/fr32/src/padding.rs +++ b/fr32/src/padding.rs @@ -701,7 +701,7 @@ where // stream and the same data in the padded layout are not necessarily // the same (since the added padding bits shift it). let mut recovered = extract_bits_and_shift( - &source, + source, read_pos.total_bits(), bits_to_extract, write_bit_offset, diff --git a/rust-toolchain b/rust-toolchain index ba0a71911..b7921ae87 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.51.0 +1.54.0 diff --git a/sha2raw/src/platform.rs b/sha2raw/src/platform.rs index f27fdd636..8e25f902c 100644 --- a/sha2raw/src/platform.rs +++ b/sha2raw/src/platform.rs @@ -79,8 +79,8 @@ impl Implementation { Platform::Asm => { let mut buffer = [0u8; 64]; for block in blocks.chunks(2) { - buffer[..32].copy_from_slice(&block[0]); - buffer[32..].copy_from_slice(&block[1]); + buffer[..32].copy_from_slice(block[0]); + buffer[32..].copy_from_slice(block[1]); sha2_asm::compress256(state, &[buffer]); } } diff --git a/sha2raw/src/sha256_utils.rs b/sha2raw/src/sha256_utils.rs index 42eab8dc6..3486af4ed 100644 --- a/sha2raw/src/sha256_utils.rs +++ b/sha2raw/src/sha256_utils.rs @@ -288,8 +288,8 @@ pub fn compress256(state: &mut [u32; 8], blocks: &[&[u8]]) { for block in blocks.chunks(2) { assert_eq!(block[0].len(), 32); assert_eq!(block[1].len(), 32); - BE::read_u32_into(&block[0], &mut block_u32[..BLOCK_LEN / 2]); - BE::read_u32_into(&block[1], &mut block_u32[BLOCK_LEN / 2..]); + BE::read_u32_into(block[0], &mut block_u32[..BLOCK_LEN / 2]); + BE::read_u32_into(block[1], &mut block_u32[BLOCK_LEN / 2..]); sha256_digest_block_u32(state, &block_u32); } diff --git a/storage-proofs-core/Cargo.toml b/storage-proofs-core/Cargo.toml index 3fb780a5a..97a3e71c2 100644 --- a/storage-proofs-core/Cargo.toml +++ b/storage-proofs-core/Cargo.toml @@ -31,7 +31,7 @@ blake2b_simd = "0.5" blake2s_simd = "0.5" toml = "0.5" ff = "0.11.0" -bellperson = "0.17.0" +bellperson = "0.18.0" serde_json = "1.0" log = "0.4.7" rand_chacha = "0.3" @@ -39,7 +39,7 @@ hex = "0.4.0" generic-array = "0.14.4" anyhow = "1.0.23" thiserror = "1.0.6" -neptune = { version = "5.0.0", features = ["arity2", "arity4", "arity8", "arity11", "arity16", "arity24", "arity36"] } +neptune = { version = "5.1.0", features = ["arity2", "arity4", "arity8", "arity11", "arity16", "arity24", "arity36"] } cpu-time = { version = "1.0", optional = true } gperftools = { version = "0.2", optional = true } num_cpus = "1.10.1" diff --git a/storage-proofs-core/src/compound_proof.rs b/storage-proofs-core/src/compound_proof.rs index 55639df86..526a0ff0a 100644 --- a/storage-proofs-core/src/compound_proof.rs +++ b/storage-proofs-core/src/compound_proof.rs @@ -90,17 +90,13 @@ where ensure!(partition_count > 0, "There must be partitions"); info!("vanilla_proofs:start"); - let vanilla_proofs = S::prove_all_partitions( - &pub_params.vanilla_params, - &pub_in, - priv_in, - partition_count, - )?; + let vanilla_proofs = + S::prove_all_partitions(&pub_params.vanilla_params, pub_in, priv_in, partition_count)?; info!("vanilla_proofs:finish"); let sanity_check = - S::verify_all_partitions(&pub_params.vanilla_params, &pub_in, &vanilla_proofs)?; + S::verify_all_partitions(&pub_params.vanilla_params, pub_in, &vanilla_proofs)?; ensure!(sanity_check, "sanity check failed"); info!("snark_proof:start"); @@ -169,7 +165,7 @@ where .collect::>()?; let proofs: Vec<_> = multi_proof.circuit_proofs.iter().collect(); - let res = verify_proofs_batch(&pvk, &mut OsRng, &proofs, &inputs)?; + let res = verify_proofs_batch(pvk, &mut OsRng, &proofs, &inputs)?; Ok(res) } @@ -224,7 +220,7 @@ where .flat_map(|m| m.circuit_proofs.iter()) .collect(); - let res = verify_proofs_batch(&pvk, &mut OsRng, &circuit_proofs[..], &inputs)?; + let res = verify_proofs_batch(pvk, &mut OsRng, &circuit_proofs[..], &inputs)?; Ok(res) } @@ -251,10 +247,10 @@ where .enumerate() .map(|(k, vanilla_proof)| { Self::circuit( - &pub_in, + pub_in, C::ComponentPrivateInputs::default(), &vanilla_proof, - &pub_params, + pub_params, Some(k), ) }) @@ -430,7 +426,7 @@ where ); let partitions_are_verified = - S::verify_all_partitions(vanilla_params, &public_inputs, &vanilla_proofs) + S::verify_all_partitions(vanilla_params, public_inputs, &vanilla_proofs) .context("failed to verify partition proofs")?; ensure!(partitions_are_verified, "Vanilla proof didn't verify."); @@ -474,7 +470,7 @@ where ); let partitions_are_verified = - S::verify_all_partitions(vanilla_params, &public_inputs, &vanilla_proofs) + S::verify_all_partitions(vanilla_params, public_inputs, &vanilla_proofs) .context("failed to verify partition proofs")?; ensure!(partitions_are_verified, "Vanilla proof didn't verify."); diff --git a/storage-proofs-core/src/gadgets/constraint.rs b/storage-proofs-core/src/gadgets/constraint.rs index a4de3faa7..aab83b49f 100644 --- a/storage-proofs-core/src/gadgets/constraint.rs +++ b/storage-proofs-core/src/gadgets/constraint.rs @@ -57,7 +57,7 @@ pub fn add>( })?; // a + b = res - sum(&mut cs, || "sum constraint", &a, &b, &res); + sum(&mut cs, || "sum constraint", a, b, &res); Ok(res) } @@ -75,7 +75,7 @@ pub fn sub>( })?; // a - b = res - difference(&mut cs, || "subtraction constraint", &a, &b, &res); + difference(&mut cs, || "subtraction constraint", a, b, &res); Ok(res) } diff --git a/storage-proofs-core/src/gadgets/insertion.rs b/storage-proofs-core/src/gadgets/insertion.rs index 9824b39a4..76f873592 100644 --- a/storage-proofs-core/src/gadgets/insertion.rs +++ b/storage-proofs-core/src/gadgets/insertion.rs @@ -104,12 +104,12 @@ pub fn insert_2>( cs.namespace(|| "binary insert 0"), &bits[0], &elements[0], - &element, + element, )?, pick( cs.namespace(|| "binary insert 1"), &bits[0], - &element, + element, &elements[0], )?, ]) @@ -459,7 +459,7 @@ mod tests { &mut cs, &to_insert.clone(), index_bits.as_slice(), - &elements.as_slice(), + elements.as_slice(), ) .expect("insert failed"); diff --git a/storage-proofs-core/src/gadgets/por.rs b/storage-proofs-core/src/gadgets/por.rs index 102cde1a4..71ccd649d 100644 --- a/storage-proofs-core/src/gadgets/por.rs +++ b/storage-proofs-core/src/gadgets/por.rs @@ -493,8 +493,8 @@ where let inputs = insert( &mut cs.namespace(|| format!("merkle insert, height {}", height)), &cur, - &insert_index, - &siblings, + insert_index, + siblings, )?; cur = <::Function as HashFunction< ::Domain, diff --git a/storage-proofs-core/src/merkle/builders.rs b/storage-proofs-core/src/merkle/builders.rs index 036a192ff..c03e8eb37 100644 --- a/storage-proofs-core/src/merkle/builders.rs +++ b/storage-proofs-core/src/merkle/builders.rs @@ -122,7 +122,7 @@ where "Cannot create LCTree without replica paths" ); let replica_config = replica_config.expect("replica config failure"); - lc_store.set_external_reader(ExternalReader::new_from_config(&replica_config, i)?)?; + lc_store.set_external_reader(ExternalReader::new_from_config(replica_config, i)?)?; } if configs.len() == 1 { @@ -195,7 +195,7 @@ pub fn create_base_merkle_tree( let f = |i| { // TODO Replace `expect()` with `context()` (problem is the parallel iterator) - let d = data_at_node(&data, i).expect("data_at_node math failed"); + let d = data_at_node(data, i).expect("data_at_node math failed"); // TODO/FIXME: This can panic. FOR NOW, let's leave this since we're experimenting with // optimization paths. However, we need to ensure that bad input will not lead to a panic // that isn't caught by the FPS API. @@ -257,7 +257,7 @@ pub fn create_base_lcmerkle_tree io::Result, E: From, { - ensure_parent(&file_path)?; + ensure_parent(file_path)?; f(&mut open_file(file_path)?) } diff --git a/storage-proofs-porep/Cargo.toml b/storage-proofs-porep/Cargo.toml index 2b0d1239e..f00b2be43 100644 --- a/storage-proofs-porep/Cargo.toml +++ b/storage-proofs-porep/Cargo.toml @@ -23,12 +23,12 @@ rayon = "1.0.0" serde = { version = "1.0", features = ["derive"]} serde_json = "1.0" ff = "0.11.0" -bellperson = "0.17.0" +bellperson = "0.18.0" log = "0.4.7" pretty_assertions = "0.6.1" generic-array = "0.14.4" anyhow = "1.0.23" -neptune = { version = "5.0.0", features = ["arity2", "arity4", "arity8", "arity11", "arity16", "arity24", "arity36"] } +neptune = { version = "5.1.0", features = ["arity2", "arity4", "arity8", "arity11", "arity16", "arity24", "arity36"] } num_cpus = "1.10.1" hex = "0.4.2" bincode = "1.1.2" diff --git a/storage-proofs-porep/src/drg/vanilla.rs b/storage-proofs-porep/src/drg/vanilla.rs index 667d12f28..5793de373 100644 --- a/storage-proofs-porep/src/drg/vanilla.rs +++ b/storage-proofs-porep/src/drg/vanilla.rs @@ -485,7 +485,7 @@ where create_base_lcmerkle_tree:: as MerkleTreeTrait>::Arity>( tree_r_last_config, pp.graph.size(), - &data.as_ref(), + data.as_ref(), &replica_config, )?; @@ -511,7 +511,7 @@ where node: usize, _config: Option, ) -> Result<()> { - let block = decode_block(&pp.graph, replica_id, &data, None, node)?; + let block = decode_block(&pp.graph, replica_id, data, None, node)?; let start = node * NODE_SIZE; let end = start + NODE_SIZE; let dest = &mut data[start..end]; @@ -560,8 +560,8 @@ where { let mut parents = vec![0; graph.degree()]; graph.parents(v, &mut parents)?; - let key = graph.create_key(replica_id, v, &parents, &data, exp_parents_data)?; - let node_data = ::Domain::try_from_bytes(&data_at_node(data, v)?)?; + let key = graph.create_key(replica_id, v, &parents, data, exp_parents_data)?; + let node_data = ::Domain::try_from_bytes(data_at_node(data, v)?)?; Ok(encode::decode(*key.as_ref(), node_data)) } diff --git a/storage-proofs-porep/src/stacked/circuit/create_label.rs b/storage-proofs-porep/src/stacked/circuit/create_label.rs index 8a7b9a46d..ae1dbdcd3 100644 --- a/storage-proofs-porep/src/stacked/circuit/create_label.rs +++ b/storage-proofs-porep/src/stacked/circuit/create_label.rs @@ -183,7 +183,7 @@ mod tests { ) .expect("create_label_exp failed"); - let expected_raw = data_at_node(&l1, node).expect("data_at_node failed"); + let expected_raw = data_at_node(l1, node).expect("data_at_node failed"); let expected = bytes_into_fr(expected_raw).expect("bytes_into_fr failed"); assert_eq!( diff --git a/storage-proofs-porep/src/stacked/circuit/params.rs b/storage-proofs-porep/src/stacked/circuit/params.rs index a3bc446d8..696a48454 100644 --- a/storage-proofs-porep/src/stacked/circuit/params.rs +++ b/storage-proofs-porep/src/stacked/circuit/params.rs @@ -95,6 +95,7 @@ impl Proof { /// Circuit synthesis. #[allow(clippy::too_many_arguments)] + #[allow(clippy::branches_sharing_code)] pub fn synthesize>( self, mut cs: CS, diff --git a/storage-proofs-porep/src/stacked/vanilla/cache.rs b/storage-proofs-porep/src/stacked/vanilla/cache.rs index 8bd6bd81b..ca7f99af7 100644 --- a/storage-proofs-porep/src/stacked/vanilla/cache.rs +++ b/storage-proofs-porep/src/stacked/vanilla/cache.rs @@ -210,7 +210,7 @@ impl ParentCache { // although we don't attempt to match it up to anything. This is useful for the case of // generating new additions to the parent cache manifest since a valid digest is required. let (parent_cache_data, verify_cache, is_production, mut digest_hex) = - match get_parent_cache_data(&path) { + match get_parent_cache_data(path) { None => { info!("[open] Parent cache data is not supported in production"); @@ -288,7 +288,7 @@ impl ParentCache { } Ok(ParentCache { - cache: CacheData::open(0, len, &path)?, + cache: CacheData::open(0, len, path)?, path: path.to_path_buf(), num_cache_entries: cache_entries, sector_size: graph.size() * NODE_SIZE, @@ -352,7 +352,7 @@ impl ParentCache { // Check if current entry is part of the official manifest and verify // that what we just generated matches what we expect for this entry // (if found). If not, we're dealing with some kind of test sector. - match get_parent_cache_data(&path) { + match get_parent_cache_data(path) { None => { info!("[generate] Parent cache data is not supported in production"); } @@ -371,7 +371,7 @@ impl ParentCache { })?; Ok(ParentCache { - cache: CacheData::open(0, len, &path)?, + cache: CacheData::open(0, len, path)?, path: path.to_path_buf(), num_cache_entries: cache_entries, sector_size, diff --git a/storage-proofs-porep/src/stacked/vanilla/create_label/mod.rs b/storage-proofs-porep/src/stacked/vanilla/create_label/mod.rs index 9128934c0..856a37676 100644 --- a/storage-proofs-porep/src/stacked/vanilla/create_label/mod.rs +++ b/storage-proofs-porep/src/stacked/vanilla/create_label/mod.rs @@ -23,7 +23,7 @@ pub fn prepare_layers( layers: usize, ) -> Vec { let label_configs = (1..=layers).map(|layer| { - StoreConfig::from_config(&config, CacheKey::label_layer(layer), Some(graph.size())) + StoreConfig::from_config(config, CacheKey::label_layer(layer), Some(graph.size())) }); let mut states = Vec::with_capacity(layers); diff --git a/storage-proofs-porep/src/stacked/vanilla/create_label/multi.rs b/storage-proofs-porep/src/stacked/vanilla/create_label/multi.rs index 526cd3b9d..dc7641e3a 100644 --- a/storage-proofs-porep/src/stacked/vanilla/create_label/multi.rs +++ b/storage-proofs-porep/src/stacked/vanilla/create_label/multi.rs @@ -183,7 +183,7 @@ fn create_label_runner( cur_node, parents_cache, pc, - &layer_labels, + layer_labels, exp_labels, buf, bpm, @@ -489,7 +489,7 @@ pub fn create_labels_for_encoding CacheReader { #[inline] fn get_bufs(&self) -> &[Mmap] { - unsafe { &std::slice::from_raw_parts((*self.bufs.get()).as_ptr(), 2) } + unsafe { std::slice::from_raw_parts((*self.bufs.get()).as_ptr(), 2) } } #[inline] diff --git a/storage-proofs-porep/src/stacked/vanilla/params.rs b/storage-proofs-porep/src/stacked/vanilla/params.rs index 5fc9dffce..bb1b03dc1 100644 --- a/storage-proofs-porep/src/stacked/vanilla/params.rs +++ b/storage-proofs-porep/src/stacked/vanilla/params.rs @@ -411,7 +411,7 @@ impl TemporaryAux { let tree_c_store = DiskStore::<::Domain>::new_from_disk( tree_c_size, Tree::Arity::to_usize(), - &config, + config, ) .context("tree_c")?; // Note: from_data_store requires the base tree leaf count @@ -673,7 +673,7 @@ impl Labels { let store = DiskStore::new_from_disk( label.size.expect("label size failure"), Tree::Arity::to_usize(), - &label, + label, )?; store.read_at(node as usize) }) diff --git a/storage-proofs-porep/src/stacked/vanilla/proof.rs b/storage-proofs-porep/src/stacked/vanilla/proof.rs index c911c6fae..2ba83aba9 100644 --- a/storage-proofs-porep/src/stacked/vanilla/proof.rs +++ b/storage-proofs-porep/src/stacked/vanilla/proof.rs @@ -243,7 +243,7 @@ impl<'a, Tree: 'static + MerkleTreeTrait, G: 'static + Hasher> StackedDrg<'a, Tr { let labeled_node = rcp.c_x.get_node_at_layer(layer)?; assert!( - proof.verify(&pub_inputs.replica_id, &labeled_node), + proof.verify(&pub_inputs.replica_id, labeled_node), "Invalid encoding proof generated at layer {}", layer, ); @@ -695,7 +695,7 @@ impl<'a, Tree: 'static + MerkleTreeTrait, G: 'static + Hasher> StackedDrg<'a, Tr let mut buf = Vec::with_capacity(batch_size * NODE_SIZE); for fr in fr_elements { - buf.extend(fr_into_bytes(&fr)); + buf.extend(fr_into_bytes(fr)); } store .write() @@ -1072,7 +1072,7 @@ impl<'a, Tree: 'static + MerkleTreeTrait, G: 'static + Hasher> StackedDrg<'a, Tr create_lc_tree::>( tree_r_last_config.size.expect("config size failure"), - &configs, + configs, &replica_config, ) } diff --git a/storage-proofs-post/Cargo.toml b/storage-proofs-post/Cargo.toml index b8a9654a9..bac32a587 100644 --- a/storage-proofs-post/Cargo.toml +++ b/storage-proofs-post/Cargo.toml @@ -21,12 +21,12 @@ serde = { version = "1.0", features = ["derive"]} blake2b_simd = "0.5" blake2s_simd = "0.5" ff = "0.11.0" -bellperson = "0.17.0" +bellperson = "0.18.0" log = "0.4.7" hex = "0.4.0" generic-array = "0.14.4" anyhow = "1.0.23" -neptune = { version = "5.0.0", features = ["arity2", "arity4", "arity8", "arity11", "arity16", "arity24", "arity36"] } +neptune = { version = "5.1.0", features = ["arity2", "arity4", "arity8", "arity11", "arity16", "arity24", "arity36"] } num_cpus = "1.10.1" fr32 = { path = "../fr32", version = "^3.0.0", default-features = false } blstrs = "0.4.0" diff --git a/storage-proofs-post/src/election/compound.rs b/storage-proofs-post/src/election/compound.rs index b5136e0da..5e4069d1e 100644 --- a/storage-proofs-post/src/election/compound.rs +++ b/storage-proofs-post/src/election/compound.rs @@ -57,7 +57,7 @@ where for n in 0..pub_params.challenge_count { let challenged_leaf_start = generate_leaf_challenge( - &pub_params, + pub_params, pub_inputs.randomness, pub_inputs.sector_challenge_index, n as u64, diff --git a/storage-proofs-post/src/fallback/compound.rs b/storage-proofs-post/src/fallback/compound.rs index 986ded017..4050ecb7c 100644 --- a/storage-proofs-post/src/fallback/compound.rs +++ b/storage-proofs-post/src/fallback/compound.rs @@ -76,7 +76,7 @@ impl<'a, Tree: 'static + MerkleTreeTrait> let challenged_leaf = generate_leaf_challenge_inner::< ::Domain, >( - challenge_hasher.clone(), &pub_params, challenge_index + challenge_hasher.clone(), pub_params, challenge_index ); let por_pub_inputs = por::PublicInputs {