Election-Tech-Initiative / Election-Tech-Initiative/electionguard-python

🐞 When serializing decrypted spoiled ballots, placeholder selections should be removed

Aperta
#521 4 commenti 0 reazioni 1 assegnatario Rivendicata da @rc-ms Vedi su GitHub
bug
Lingua principale
Python
Stelle
168
Fork
103
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

in **election_record/spoiled_ballots/spoiled_ballot_.json,** decrypted spoiled ballots still contain placeholder selections.

1. this is likely confusing for people examining spoiled ballots to verify they are correctly decrypted.

1. this causes validation 12.B ("An election verifier should also confirm that for each decrypted spoiled ballot, the selections
listed in text match the corresponding text in the ballot coding file.") to fail, eg:

```
***Ballot Selection id (justice-supreme-court-5-placeholder) not contained in contest (justice-supreme-court).
***Ballot Selection id (justice-supreme-court-4-placeholder) not contained in contest (justice-supreme-court).
***Ballot Selection id (referendum-pineapple-2-placeholder) not contained in contest (referendum-pineapple).
***Ballot Selection id (justice-supreme-court-5-placeholder) not contained in contest (justice-supreme-court).
***Ballot Selection id (justice-supreme-court-4-placeholder) not contained in contest (justice-supreme-court).
***Ballot Selection id (justice-supreme-court-5-placeholder) not contained in contest (justice-supreme-court).
***Ballot Selection id (justice-supreme-court-4-placeholder) not contained in contest (justice-supreme-court).
***Ballot Selection id (referendum-pineapple-2-placeholder) not contained in contest (referendum-pineapple).
***Ballot Selection id (justice-supreme-court-5-placeholder) not contained in contest (justice-supreme-court).
***Ballot Selection id (justice-supreme-court-4-placeholder) not contained in contest (justice-supreme-court).
***Ballot Selection id (referendum-pineapple-2-placeholder) not contained in contest (referendum-pineapple).
***Ballot Selection id (justice-supreme-court-5-placeholder) not contained in contest (justice-supreme-court).
***Ballot Selection id (justice-supreme-court-4-placeholder) not contained in contest (justice-supreme-court).
***12.B Spoiled PlaintextTally Names Validation failed.
```

### Expected Behavior

placeholder selections should not appear in decrypted spoiled ballots

### Steps To Reproduce

run TestEndToEndElection
examine election_record/spoiled_ballots/spoiled_ballot_.json

### Environment

```markdown
OS: Ubuntu 20.04
```

### Anything else?

In decrypt_with_shares.py, skip any placeholder selection:

```
def decrypt_contest_with_decryption_shares(
contest: CiphertextContest,
shares: Dict[GuardianId, DecryptionShare],
crypto_extended_base_hash: ElementModQ,
) -> Optional[PlaintextTallyContest]:
plaintext_selections: Dict[SelectionId, PlaintextTallySelection] = {}

for selection in contest.selections
if selection.is_placeholder is True:
continue
...
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.