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

Check elements are distinct in simple lottery. #111

Merged
merged 4 commits into from
Jan 8, 2025
Merged
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
2 changes: 2 additions & 0 deletions src/simple_lottery/algorithm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
element_sequence.push(element);
}
if prover_set.len() as u64 >= setup.proof_size {
element_sequence.sort();

Check warning on line 17 in src/simple_lottery/algorithm.rs

View workflow job for this annotation

GitHub Actions / build

used `sort` on primitive type `array`
rrtoledo marked this conversation as resolved.
Show resolved Hide resolved
return Some(Proof { element_sequence });
}
}
Expand All @@ -23,6 +24,7 @@

pub(super) fn verify(setup: &Setup, proof: &Proof) -> bool {
(proof.element_sequence.len() as u64 == setup.proof_size)
&& proof.element_sequence.is_sorted_by(|a, b| a < b)
&& proof
.element_sequence
.iter()
Expand Down
Loading