Skip to content

Commit 151a390

Browse files
committed
wip
1 parent 71bb33d commit 151a390

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

rust/catalyst-voting/benches/vote_protocol.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,12 @@ struct Voter {
4040
choice: usize,
4141
}
4242

43+
struct Choices(Vec<usize>);
44+
struct VotingPowers(Vec<u64>);
45+
4346
fn initial_setup() -> (
44-
Vec<usize>,
45-
Vec<u64>,
47+
Choices,
48+
VotingPowers,
4649
ElectionSecretKey,
4750
ElectionPublicKey,
4851
VoterProofCommitment,
@@ -65,8 +68,8 @@ fn initial_setup() -> (
6568
let election_public_key = election_secret_key.public_key();
6669

6770
(
68-
choices,
69-
voting_powers,
71+
Choices(choices),
72+
VotingPowers(voting_powers),
7073
election_secret_key,
7174
election_public_key,
7275
voter_proof_commitment,
@@ -81,6 +84,7 @@ fn vote_protocol_benches(c: &mut Criterion) {
8184
let (choices, voting_powers, election_secret_key, election_public_key, voter_proof_commitment) =
8285
initial_setup();
8386
let votes: Vec<_> = choices
87+
.0
8488
.iter()
8589
.map(|choice| Vote::new(*choice, VOTING_OPTIONS).unwrap())
8690
.collect();
@@ -141,13 +145,13 @@ fn vote_protocol_benches(c: &mut Criterion) {
141145
b.iter(|| {
142146
encrypted_tallies = (0..VOTING_OPTIONS)
143147
.map(|voting_option| {
144-
tally(voting_option, &encrypted_votes, &voting_powers).unwrap()
148+
tally(voting_option, &encrypted_votes, &voting_powers.0).unwrap()
145149
})
146150
.collect();
147151
});
148152
});
149153

150-
let total_voting_power = voting_powers.iter().sum();
154+
let total_voting_power = voting_powers.0.iter().sum();
151155
let mut decryption_tally_setup = None;
152156
group.bench_function("decryption tally setup initialization", |b| {
153157
b.iter(|| {

0 commit comments

Comments
 (0)