Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poseidon version of SnapDeals #1547

Merged
merged 2 commits into from
Jan 28, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
DrPeterVanNostrand marked this conversation as resolved.
Show resolved Hide resolved
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