siv-org / siv

Secure Internet Voting protocol
https://siv.org
Other
12 stars 8 forks source link

Randomize Candidate Order #153

Open dsernst opened 3 months ago

dsernst commented 3 months ago

See https://github.com/npfoss/nap-app/issues/6

————

image
dsernst commented 3 months ago

Copied from https://github.com/npfoss/nap-app/issues/6#issuecomment-2227161202


Implementation notes for self:

First, election admin enables by adding:

"randomize_order": true

to ballot schema, per question.

Documentation

Doesn't need to be programmed into Ballot-Design Wizard for now

MVP v1 Design:

Quick and dirty, but should work.

Slight cons:

  1. Since it happens on the client, every time they refresh the page, they'll see a new order. Maybe disorienting? Could store something more persistent to maintain the order through refreshes.
  2. Possible that lots of voters happen to draw similar orders? So just by luck of the draw certain candidates may get a slight edge over others? Unclear how much of an effect this is, though. And every candidate has an equal chance of it, so still more fair a priori than not randomizing.
    • Maybe interesting if there was some way to more evenly balance this out? But not obvious how, without certain privacy compromises.
  3. Say we did store the generated permutation arrays, to help analyze effect sizes after the fact. Or even better, pre-assigned them for each voter so they're fairly distributed (all candidates would get a similar distribution at different orders). A corollary to the question about effect size is, "how much of hint does knowing a particular voter's rendered order give you about which of the anonymized votes came from them?" If it has little effect, there's little privacy implication, but then why bother recording anyway? If it has a large effect, that's interesting, more reason to nudge people towards randomizing, but then the privacy implications are more important too.

More Advanced v2 Design, to solve almost all of these problems

Instead of generating the permutation array from new random bits, generate it deterministically from a seed of hash(verification_number + question.id).

Benefits:

Cons?

  1. Tad more complex to implement than the MVP Design above.
    • [ ] Need to write the permutationFromSeed() function. Have similar already.
    • [ ] Currently, verification numbers don't get generated until voter makes their first selection. Will need to move to initial page load.
    • [ ] Need to ensure it's still plenty fast. Guessing it should still be imperceptible, but would be good to confirm with measured data.
  2. Doesn't address the potential bad roll for certain candidates. On the flip side, does let us see now if/when that's ever happening, and measure the effect size, all privacy-preserving. And in any case this remains a priori fair. And it's really more of an issue with small # of voters. At large scales (more important elections), the law of large numbers should result in much closer to even distributions.
dsernst commented 3 months ago

v1 done and now deployed. You can see it in action on this new ballot schema: siv.org/election/1721041614121/vote?auth=link.

Because the ballot design first gets loaded from localStorage if available, if you manually refresh the page it reshuffles with a small FOUC. This isn't visible on initial load (how most people will experience the page), only if people refresh.

The v2 design will fix this since it will use a deterministic shuffle based on verification #, but wanted to get something up and out the door.