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

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

Open
#521 4 comments 0 reactions 1 assignee Claimed by @rc-ms View on GitHub
bug
Dominant language
Python
Stars
168
Forks
103
PR merge metrics
No merged PRs in 30d

Description

### 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
...
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.