From 28cad961a0cbb39a431d0f4c95facc5188805c3c Mon Sep 17 00:00:00 2001 From: giwaov Date: Mon, 23 Feb 2026 12:28:37 +0100 Subject: [PATCH] docs(voting): fix field names in README to match actual code The Voting README incorrectly referenced field names as 'yes_count' and 'no_count', but the actual VoteStats struct in encrypted-ixs/src/lib.rs uses 'yes' and 'no'. This caused confusion for developers trying to follow the documentation examples. Changes: - Updated all references from yes_count to yes - Updated all references from no_count to no - Affects lines: 80, 101-102, 119, 121, 159 Verified against actual code in: - voting/encrypted-ixs/src/lib.rs (struct VoteStats definition) --- voting/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/voting/README.md b/voting/README.md index 3766b37c..7ff00a3b 100644 --- a/voting/README.md +++ b/voting/README.md @@ -77,7 +77,7 @@ pub struct PollAccount { } ``` -**What's stored**: Two encrypted `u64` counters (yes_count, no_count) as raw ciphertexts. +**What's stored**: Two encrypted `u64` counters (yes, no) as raw ciphertexts. ### Reading Encrypted Account Data @@ -98,8 +98,8 @@ Argument::Account( ``` Byte 0-7: Anchor discriminator Byte 8: bump -Byte 9-40: yes_count ciphertext (Enc) -Byte 41-72: no_count ciphertext (Enc) +Byte 9-40: yes ciphertext (Enc) +Byte 41-72: no ciphertext (Enc) Byte 73+: other fields... ``` @@ -116,9 +116,9 @@ pub fn vote( let mut votes = votes.to_arcis(); // Decrypt tallies in MPC if input.vote { - votes.yes_count += 1; // Increment happens inside MPC + votes.yes += 1; // Increment happens inside MPC } else { - votes.no_count += 1; + votes.no += 1; } votes.owner.from_arcis(votes) // Re-encrypt updated tallies @@ -156,7 +156,7 @@ The program restricts result revelation to the poll authority: ```rust pub fn reveal_result(votes: Enc) -> bool { let votes = votes.to_arcis(); - (votes.yes_count > votes.no_count).reveal() // Only reveal comparison + (votes.yes > votes.no).reveal() // Only reveal comparison } ```