@@ -16,6 +16,7 @@ use wedpr_s_protos::generated::acv::{
1616 SystemParametersStorage , VoteResultStorage , VoteStorage ,
1717} ;
1818
19+ /// Generates a random number as secret key used for making system parameter and counting.
1920pub fn make_counter_secret ( ) -> CounterSecret {
2021 let secret_share = get_random_scalar ( ) ;
2122 CounterSecret {
@@ -25,6 +26,8 @@ pub fn make_counter_secret() -> CounterSecret {
2526 }
2627}
2728
29+ /// Makes share of system parameter using secret key,
30+ /// where system parameter here means global public key.
2831pub fn make_system_parameters_share (
2932 counter_id : & str ,
3033 counter_secret : & CounterSecret ,
@@ -40,6 +43,13 @@ pub fn make_system_parameters_share(
4043 } )
4144}
4245
46+
47+ /// Generates intermediate values and zero-knowledge proof for final count,
48+ /// where the intermediate values is the share of ballots received by each candidate,
49+ /// the zero-knowledge proof is equality relationship proof used to prove that
50+ /// counter's count process is correct, specifically refers to that
51+ /// the secret key counter used in counting is equal to the secret key generated
52+ /// for making system parameter.
4353pub fn count (
4454 counter_id : & str ,
4555 secret : & CounterSecret ,
@@ -88,9 +98,7 @@ pub fn count(
8898 Ok ( request)
8999}
90100
91- // In this function, everyone can check anonymousvoting result by c1 - c2r_sum,
92- // because we already know v and candidates, by using c1 - c2r_sum, we can check
93- // whether vG_1 =? c1 - c2r_sum. pub fn verify_counter(result_pb:
101+ /// Count the value of ballots received by each candidate.
94102pub fn finalize_vote_result (
95103 param : & SystemParametersStorage ,
96104 vote_sum : & VoteStorage ,
0 commit comments