Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions voting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -98,8 +98,8 @@ Argument::Account(
```
Byte 0-7: Anchor discriminator
Byte 8: bump
Byte 9-40: yes_count ciphertext (Enc<Mxe, u64>)
Byte 41-72: no_count ciphertext (Enc<Mxe, u64>)
Byte 9-40: yes ciphertext (Enc<Mxe, u64>)
Byte 41-72: no ciphertext (Enc<Mxe, u64>)
Byte 73+: other fields...
```

Expand All @@ -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
Expand Down Expand Up @@ -156,7 +156,7 @@ The program restricts result revelation to the poll authority:
```rust
pub fn reveal_result(votes: Enc<Mxe, VoteStats>) -> bool {
let votes = votes.to_arcis();
(votes.yes_count > votes.no_count).reveal() // Only reveal comparison
(votes.yes > votes.no).reveal() // Only reveal comparison
}
```

Expand Down
Loading