Skip to content

Commit 47695e1

Browse files
committed
fix doc tests
1 parent 8e2263a commit 47695e1

File tree

1 file changed

+8
-12
lines changed
  • rust/catalyst-voting/src

1 file changed

+8
-12
lines changed

rust/catalyst-voting/src/lib.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! ```rust
44
//! use catalyst_voting::{
55
//! decrypt_tally, encrypt_vote, generate_tally_proof, tally, verify_tally_proof,
6-
//! DecryptionTallySetup, EncryptionRandomness, SecretKey, Vote,
6+
//! DecryptionTallySetup, SecretKey, Vote,
77
//! };
88
//!
99
//! struct Voter {
@@ -13,7 +13,7 @@
1313
//!
1414
//! let mut rng = rand_core::OsRng;
1515
//! let voting_options = 3;
16-
//! let election_secret_key = SecretKey::generate(&mut rng);
16+
//! let election_secret_key = SecretKey::random(&mut rng);
1717
//! let election_public_key = election_secret_key.public_key();
1818
//!
1919
//! let voter_1 = Voter {
@@ -35,16 +35,12 @@
3535
//! let vote_2 = Vote::new(voter_2.choice, voting_options).unwrap();
3636
//! let vote_3 = Vote::new(voter_3.choice, voting_options).unwrap();
3737
//!
38-
//! let voter_1_randomness = EncryptionRandomness::generate(&mut rng, voting_options);
39-
//! let voter_2_randomness = EncryptionRandomness::generate(&mut rng, voting_options);
40-
//! let voter_3_randomness = EncryptionRandomness::generate(&mut rng, voting_options);
41-
//!
42-
//! let encrypted_vote_1 =
43-
//! encrypt_vote(&vote_1, &election_public_key, &voter_1_randomness).unwrap();
44-
//! let encrypted_vote_2 =
45-
//! encrypt_vote(&vote_2, &election_public_key, &voter_2_randomness).unwrap();
46-
//! let encrypted_vote_3 =
47-
//! encrypt_vote(&vote_3, &election_public_key, &voter_3_randomness).unwrap();
38+
//! let (encrypted_vote_1, voter_randomness_1) =
39+
//! encrypt_vote(&vote_1, &election_public_key, &mut rng);
40+
//! let (encrypted_vote_2, voter_randomness_2) =
41+
//! encrypt_vote(&vote_2, &election_public_key, &mut rng);
42+
//! let (encrypted_vote_3, voter_randomness_3) =
43+
//! encrypt_vote(&vote_3, &election_public_key, &mut rng);
4844
//! let encrypted_votes = vec![encrypted_vote_1, encrypted_vote_2, encrypted_vote_3];
4945
//!
5046
//! let encrypted_tallies: Vec<_> = (0..voting_options)

0 commit comments

Comments
 (0)