Skip to content

Commit 99bbcbb

Browse files
committed
update doc test
1 parent a685602 commit 99bbcbb

File tree

1 file changed

+8
-3
lines changed
  • rust/jormungandr-vote-tx/src

1 file changed

+8
-3
lines changed

rust/jormungandr-vote-tx/src/lib.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
//!
33
//! ```rust
44
//! use catalyst_voting::{
5-
//! crypto::{default_rng, ed25519::PrivateKey},
6-
//! txs::v1::Tx,
5+
//! crypto::{ed25519::PrivateKey, rng::default_rng},
76
//! vote_protocol::committee::ElectionSecretKey,
87
//! };
8+
//! use jormungandr_vote_tx::Tx;
99
//!
1010
//! let vote_plan_id = [0u8; 32];
1111
//! let proposal_index = 0u8;
@@ -14,7 +14,8 @@
1414
//! let choice = 1;
1515
//!
1616
//! let users_private_key = PrivateKey::random(&mut default_rng());
17-
//! let election_public_key = ElectionSecretKey::random_with_default_rng().public_key();
17+
//! let election_secret_key = ElectionSecretKey::random_with_default_rng();
18+
//! let election_public_key = election_secret_key.public_key();
1819
//!
1920
//! let public_tx = Tx::new_public(
2021
//! vote_plan_id,
@@ -25,6 +26,8 @@
2526
//! )
2627
//! .unwrap();
2728
//! public_tx.verify_signature().unwrap();
29+
//! let tx_choice = public_tx.public_choice().unwrap();
30+
//! assert_eq!(tx_choice, choice);
2831
//!
2932
//! let private_tx = Tx::new_private_with_default_rng(
3033
//! vote_plan_id,
@@ -37,6 +40,8 @@
3740
//! .unwrap();
3841
//! private_tx.verify_signature().unwrap();
3942
//! private_tx.verify_proof(&election_public_key).unwrap();
43+
//! let tx_choice = private_tx.private_choice(&election_secret_key).unwrap();
44+
//! assert_eq!(tx_choice, choice);
4045
//! ```
4146
4247
mod decoding;

0 commit comments

Comments
 (0)