Skip to content

Commit

Permalink
fix: updates required after rebase to master
Browse files Browse the repository at this point in the history
style: clippy updates
style: rust fmt
  • Loading branch information
cryptonemo committed Oct 26, 2021
1 parent c5bc381 commit 241fd49
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 113 deletions.
10 changes: 5 additions & 5 deletions filecoin-proofs/src/api/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ pub fn encode_into<Tree: 'static + MerkleTreeTrait<Hasher = TreeRHasher>>(
tree_r_last_new_config,
<Tree::Hasher as Hasher>::Domain::try_from_bytes(&p_aux.comm_c.into_bytes())?,
<Tree::Hasher as Hasher>::Domain::try_from_bytes(&p_aux.comm_r_last.into_bytes())?,
&new_replica_path,
&new_cache_path,
&sector_key_path,
&sector_key_cache_path,
&staged_data_path,
new_replica_path,
new_cache_path,
sector_key_path,
sector_key_cache_path,
staged_data_path,
usize::from(config.h_select),
)?;

Expand Down
97 changes: 4 additions & 93 deletions filecoin-proofs/tests/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,114 +11,25 @@ use blstrs::{Bls12, Scalar as Fr};
use ff::Field;
use filecoin_hashers::Hasher;
use filecoin_proofs::{
<<<<<<< HEAD
<<<<<<< HEAD
add_piece, aggregate_seal_commit_proofs, clear_cache, compute_comm_d, fauxrep_aux,
generate_fallback_sector_challenges, generate_piece_commitment, generate_single_vanilla_proof,
generate_single_window_post_with_vanilla, generate_window_post,
generate_window_post_with_vanilla, generate_winning_post,
generate_winning_post_sector_challenge, generate_winning_post_with_vanilla,
get_num_partition_for_fallback_post, get_seal_inputs, merge_window_post_partition_proofs,
seal_commit_phase1, seal_commit_phase2, seal_pre_commit_phase1, seal_pre_commit_phase2,
unseal_range, validate_cache_for_commit, validate_cache_for_precommit_phase2,
verify_aggregate_seal_commit_proofs, verify_seal, verify_window_post, verify_winning_post,
Commitment, DefaultTreeDomain, MerkleTreeTrait, PaddedBytesAmount, PieceInfo, PoRepConfig,
PoRepProofPartitions, PoStConfig, PoStType, PrivateReplicaInfo, ProverId, PublicReplicaInfo,
SealCommitOutput, SealPreCommitOutput, SealPreCommitPhase1Output, SectorShape16KiB,
SectorShape2KiB, SectorShape32KiB, SectorShape4KiB, SectorSize, UnpaddedByteIndex,
UnpaddedBytesAmount, POREP_PARTITIONS, SECTOR_SIZE_16_KIB, SECTOR_SIZE_2_KIB,
SECTOR_SIZE_32_KIB, SECTOR_SIZE_4_KIB, WINDOW_POST_CHALLENGE_COUNT, WINDOW_POST_SECTOR_COUNT,
WINNING_POST_CHALLENGE_COUNT, WINNING_POST_SECTOR_COUNT,
=======
add_piece, aggregate_seal_commit_proofs, clear_cache, compare_elements, compute_comm_d,
<<<<<<< HEAD
decode_from, encode_into, fauxrep_aux, generate_fallback_sector_challenges,
<<<<<<< HEAD
generate_piece_commitment, generate_single_vanilla_proof, generate_update_proof,
generate_window_post, generate_window_post_with_vanilla, generate_winning_post,
generate_winning_post_sector_challenge, generate_winning_post_with_vanilla, get_seal_inputs,
remove_encoded_data, seal_commit_phase1, seal_commit_phase2, seal_pre_commit_phase1,
seal_pre_commit_phase2, unseal_range, validate_cache_for_commit,
validate_cache_for_precommit_phase2, verify_aggregate_seal_commit_proofs, verify_seal,
<<<<<<< HEAD
verify_window_post, verify_winning_post, Commitment, DefaultTreeDomain, MerkleTreeTrait,
PaddedBytesAmount, PieceInfo, PoRepConfig, PoRepProofPartitions, PoStConfig, PoStType,
PrivateReplicaInfo, ProverId, PublicReplicaInfo, SealCommitOutput, SealPreCommitOutput,
SealPreCommitPhase1Output, SectorShape16KiB, SectorShape2KiB, SectorShape32KiB,
SectorShape4KiB, SectorSize, UnpaddedByteIndex, UnpaddedBytesAmount, POREP_PARTITIONS,
SECTOR_SIZE_16_KIB, SECTOR_SIZE_2_KIB, SECTOR_SIZE_32_KIB, SECTOR_SIZE_4_KIB,
WINDOW_POST_CHALLENGE_COUNT, WINDOW_POST_SECTOR_COUNT, WINNING_POST_CHALLENGE_COUNT,
<<<<<<< HEAD
WINNING_POST_SECTOR_COUNT,
>>>>>>> 5c046723 (feat: encode/decode/remove_data API with tests)
=======
WINNING_POST_SECTOR_COUNT, HSelect, UpdateProofPartitions,
>>>>>>> db10f80f (feat: add Jake's latest circuit code)
=======
verify_window_post, verify_winning_post, Commitment, DefaultTreeDomain, HSelect,
MerkleTreeTrait, PaddedBytesAmount, PieceInfo, PoRepConfig, PoRepProofPartitions, PoStConfig,
PoStType, PrivateReplicaInfo, ProverId, PublicReplicaInfo, SealCommitOutput,
SealPreCommitOutput, SealPreCommitPhase1Output, SectorShape16KiB, SectorShape2KiB,
SectorShape32KiB, SectorShape4KiB, SectorSize, UnpaddedByteIndex, UnpaddedBytesAmount,
UpdateProofPartitions, POREP_PARTITIONS, SECTOR_SIZE_16_KIB, SECTOR_SIZE_2_KIB,
SECTOR_SIZE_32_KIB, SECTOR_SIZE_4_KIB, WINDOW_POST_CHALLENGE_COUNT, WINDOW_POST_SECTOR_COUNT,
WINNING_POST_CHALLENGE_COUNT, WINNING_POST_SECTOR_COUNT,
>>>>>>> 9389307f (style: cargo fmt)
=======
=======
add_piece, aggregate_seal_commit_proofs, clear_cache, compute_comm_d, decode_from, encode_into,
fauxrep_aux, generate_empty_sector_update_proof, generate_fallback_sector_challenges,
>>>>>>> 1f5042b4 (fix: apply some review feedback)
generate_partition_proofs, generate_piece_commitment, generate_single_partition_proof,
generate_single_vanilla_proof, generate_window_post, generate_window_post_with_vanilla,
generate_winning_post, generate_winning_post_sector_challenge,
generate_winning_post_with_vanilla, get_seal_inputs, remove_encoded_data, seal_commit_phase1,
seal_commit_phase2, seal_pre_commit_phase1, seal_pre_commit_phase2, unseal_range,
validate_cache_for_commit, validate_cache_for_precommit_phase2,
<<<<<<< HEAD
verify_aggregate_seal_commit_proofs, verify_partition_proofs, verify_seal,
=======
decode_from, encode_into, fauxrep_aux, generate_empty_sector_update_proof,
generate_fallback_sector_challenges, generate_partition_proofs, generate_piece_commitment,
generate_single_partition_proof, generate_single_vanilla_proof, generate_window_post,
generate_single_vanilla_proof, generate_single_window_post_with_vanilla, generate_window_post,
generate_window_post_with_vanilla, generate_winning_post,
generate_winning_post_sector_challenge, generate_winning_post_with_vanilla, get_seal_inputs,
generate_winning_post_sector_challenge, generate_winning_post_with_vanilla,
get_num_partition_for_fallback_post, get_seal_inputs, merge_window_post_partition_proofs,
remove_encoded_data, seal_commit_phase1, seal_commit_phase2, seal_pre_commit_phase1,
seal_pre_commit_phase2, unseal_range, validate_cache_for_commit,
validate_cache_for_precommit_phase2, verify_aggregate_seal_commit_proofs,
verify_empty_sector_update_proof, verify_partition_proofs, verify_seal,
>>>>>>> 63296dd3 (feat: add prove and verify API interfaces)
verify_single_partition_proof, verify_window_post, verify_winning_post, Commitment,
DefaultTreeDomain, HSelect, MerkleTreeTrait, PaddedBytesAmount, PieceInfo, PoRepConfig,
PoRepProofPartitions, PoStConfig, PoStType, PrivateReplicaInfo, ProverId, PublicReplicaInfo,
SealCommitOutput, SealPreCommitOutput, SealPreCommitPhase1Output, SectorShape16KiB,
SectorShape2KiB, SectorShape32KiB, SectorShape4KiB, SectorSize, UnpaddedByteIndex,
UnpaddedBytesAmount, UpdateProofPartitions, POREP_PARTITIONS, SECTOR_SIZE_16_KIB,
SECTOR_SIZE_2_KIB, SECTOR_SIZE_32_KIB, SECTOR_SIZE_4_KIB, WINDOW_POST_CHALLENGE_COUNT,
WINDOW_POST_SECTOR_COUNT, WINNING_POST_CHALLENGE_COUNT, WINNING_POST_SECTOR_COUNT,
>>>>>>> de953475 (feat: complete vanilla proving and verify through tests)
=======
verify_aggregate_seal_commit_proofs, verify_empty_sector_update_proof, verify_partition_proofs,
verify_seal, verify_single_partition_proof, verify_window_post, verify_winning_post,
<<<<<<< HEAD
Commitment, DefaultTreeDomain, HSelect, MerkleTreeTrait, PaddedBytesAmount, PieceInfo,
PoRepConfig, PoRepProofPartitions, PoStConfig, PoStType, PrivateReplicaInfo, ProverId,
PublicReplicaInfo, SealCommitOutput, SealPreCommitOutput, SealPreCommitPhase1Output,
SectorShape16KiB, SectorShape2KiB, SectorShape32KiB, SectorShape4KiB, SectorSize,
UnpaddedByteIndex, UnpaddedBytesAmount, UpdateProofPartitions, POREP_PARTITIONS,
SECTOR_SIZE_16_KIB, SECTOR_SIZE_2_KIB, SECTOR_SIZE_32_KIB, SECTOR_SIZE_4_KIB,
WINDOW_POST_CHALLENGE_COUNT, WINDOW_POST_SECTOR_COUNT, WINNING_POST_CHALLENGE_COUNT,
WINNING_POST_SECTOR_COUNT,
>>>>>>> 1f5042b4 (fix: apply some review feedback)
=======
Commitment, DefaultTreeDomain, MerkleTreeTrait, PaddedBytesAmount, PieceInfo, PoRepConfig,
DefaultTreeDomain, MerkleTreeTrait, PaddedBytesAmount, PieceInfo, PoRepConfig,
PoRepProofPartitions, PoStConfig, PoStType, PrivateReplicaInfo, ProverId, PublicReplicaInfo,
SealCommitOutput, SealPreCommitOutput, SealPreCommitPhase1Output, SectorShape16KiB,
SectorShape2KiB, SectorShape32KiB, SectorShape4KiB, SectorSize, SectorUpdateConfig,
UnpaddedByteIndex, UnpaddedBytesAmount, POREP_PARTITIONS, SECTOR_SIZE_16_KIB,
SECTOR_SIZE_2_KIB, SECTOR_SIZE_32_KIB, SECTOR_SIZE_4_KIB, WINDOW_POST_CHALLENGE_COUNT,
WINDOW_POST_SECTOR_COUNT, WINNING_POST_CHALLENGE_COUNT, WINNING_POST_SECTOR_COUNT,
>>>>>>> cd695d8f (fix: apply more feedback)
};
use fr32::bytes_into_fr;
use log::info;
Expand Down
4 changes: 2 additions & 2 deletions storage-proofs-core/src/gadgets/por.rs
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,8 @@ where
let preimg = insert(
&mut cs.namespace(|| format!("merkle proof insert (height={})", height)),
&cur,
insert_index,
siblings,
&insert_index,
&siblings,
)?;
cur = <<Tree::Hasher as Hasher>::Function as HashFunction<
<Tree::Hasher as Hasher>::Domain,
Expand Down
6 changes: 3 additions & 3 deletions storage-proofs-update/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "storage-proofs-update"
version = "10.0.0"
version = "10.1.0"
authors = ["dignifiedquire <me@dignifiedquire.com>"]
description = "Proof of SDR-PoRep CC-Sector Update"
license = "MIT OR Apache-2.0"
Expand All @@ -24,13 +24,13 @@ 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"
blstrs = "0.4.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"
Expand Down
9 changes: 4 additions & 5 deletions storage-proofs-update/src/gadgets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pub fn gen_challenge_bits<CS: ConstraintSystem<Fr>>(
// `digest = H(comm_r_new || digest_index)`
let digest = <PoseidonHasher as Hasher>::Function::hash2_circuit(
cs.namespace(|| format!("digest_{}", j)),
&comm_r_new,
comm_r_new,
&digest_index,
)?;

Expand Down Expand Up @@ -311,7 +311,7 @@ mod tests {
let challenge_count = challenge_count(sector_nodes);

for k in 0..partition_count {
let challenges: Vec<u32> = Challenges::new(sector_nodes, comm_r_new, k).collect();
let challenges = Challenges::new(sector_nodes, comm_r_new, k);

let mut cs = TestConstraintSystem::<Fr>::new();
let comm_r_new =
Expand All @@ -338,8 +338,7 @@ mod tests {
let gadget_constraints = constraints_after - constraints_before;
assert_eq!(gadget_constraints, constraints_expected);

for (c, c_generated_bits) in challenges.into_iter().zip(generated_bits.into_iter())
{
for (c, c_generated_bits) in challenges.zip(generated_bits.into_iter()) {
assert_eq!(c_generated_bits.len(), rand_challenge_bits);
let mut c_circ: u32 = 0;
for (i, bit) in c_generated_bits
Expand Down Expand Up @@ -417,7 +416,7 @@ mod tests {
.enumerate()
.map(|(i, apex_leaf)| {
AllocatedNum::alloc(cs.namespace(|| format!("apex_leaf_{}", i)), || {
Ok(apex_leaf.clone().into())
Ok((*apex_leaf).into())
})
.unwrap()
})
Expand Down
9 changes: 4 additions & 5 deletions storage-proofs-update/src/vanilla.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ pub fn phi(comm_d_new: &TreeDDomain, comm_r_old: &TreeRDomain) -> TreeRDomain {
let comm_d_new: Fr = (*comm_d_new).into();
comm_d_new.into()
};
<TreeRHasher as Hasher>::Function::hash2(&comm_d_new, &comm_r_old)
<TreeRHasher as Hasher>::Function::hash2(&comm_d_new, comm_r_old)
}

// Computes all `2^h` rho values for the given `phi`. Each rho corresponds to one of the `2^h`
Expand All @@ -471,7 +471,7 @@ pub fn rhos(h: usize, phi: &TreeRDomain) -> Vec<Fr> {
(0..1 << h)
.map(|high| {
let high: TreeRDomain = Fr::from(high as u64).into();
<TreeRHasher as Hasher>::Function::hash2(&phi, &high).into()
<TreeRHasher as Hasher>::Function::hash2(phi, &high).into()
})
.collect()
}
Expand Down Expand Up @@ -610,9 +610,8 @@ where

// Re-instantiate TreeD's store for reading apex leafs.
let tree_d_nodes = tree_d_new_config.size.expect("config size failure");
let tree_d_store =
TreeDStore::new_from_disk(tree_d_nodes, tree_d_arity, &tree_d_new_config)
.context("tree_d_store")?;
let tree_d_store = TreeDStore::new_from_disk(tree_d_nodes, tree_d_arity, tree_d_new_config)
.context("tree_d_store")?;
ensure!(
tree_d_nodes == Store::len(&tree_d_store),
"TreeD store size mismatch"
Expand Down

0 comments on commit 241fd49

Please sign in to comment.