Skip to content

Commit

Permalink
Poseidon version of SnapDeals
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
  • Loading branch information
Jakub Sztandera committed Dec 7, 2021
1 parent 5527615 commit 1406940
Show file tree
Hide file tree
Showing 7 changed files with 1,027 additions and 128 deletions.
22 changes: 22 additions & 0 deletions storage-proofs-update/src/challenges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,28 @@ impl Challenges {
challenges_remaining: challenge_count,
}
}

pub fn new_poseidon(sector_nodes: usize, comm_r_new: TreeRDomain) -> Self {
let repeats = partition_count(sector_nodes);

let challenge_bit_len = sector_nodes.trailing_zeros() as usize;
let random_bits_per_challenge = challenge_bit_len;
let challenges_per_digest = Fr::CAPACITY as usize / random_bits_per_challenge;

let challenge_count = challenge_count(sector_nodes) * repeats;
let digest_index_all_partitions = 0;

Challenges {
comm_r_new,
partition_bits: 0,
random_bits_per_challenge,
challenges_per_digest,
digest_index_all_partitions,
i: 0,
digest_bits: Vec::with_capacity(Fr::NUM_BITS as usize),
challenges_remaining: challenge_count,
}
}
}

impl Iterator for Challenges {
Expand Down
Loading

0 comments on commit 1406940

Please sign in to comment.