We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 48e8926 commit 3fac4a3Copy full SHA for 3fac4a3
encrypted-ixs/src/lib.rs
@@ -44,15 +44,9 @@ mod circuits {
44
let user_choice = choice_ctx.to_arcis();
45
let mut vote_counts = vote_counts_ctx.to_arcis();
46
47
- // Increment appropriate counter based on choice value
48
- // Note: Must use explicit conditionals to avoid information leakage in encrypted circuits
49
- if user_choice.choice == 0 {
50
- vote_counts[0] += 1;
51
- } else if user_choice.choice == 1 {
52
- vote_counts[1] += 1;
53
- } else {
54
- vote_counts[2] += 1;
55
- }
+ // "Arcis automatically converts secret-indexed array access to oblivious operations."
+ // https://docs.arcium.com/developers/arcis/operations
+ vote_counts[user_choice.choice as usize] += 1;
56
57
vote_counts_ctx.owner.from_arcis(vote_counts)
58
}
0 commit comments