Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Document and check that selection ids are unique across all contests. #241

Open
1 task done
JohnLCaron opened this issue Mar 2, 2022 · 0 comments
Open
1 task done
Labels
enhancement New feature or request question Further information is requested

Comments

@JohnLCaron
Copy link
Collaborator

Is there an existing issue for this?

  • I have searched the existing issues

Suggestion

Its not obvious whether selection ids must be unique only within contests or across contests.

In decryption_share, we search across all shares, all contests, all selections, and match on the selection_id

def get_shares_for_selection(
    selection_id: str,
    shares: Dict[GuardianId, DecryptionShare],
) -> Dict[GuardianId, Tuple[ElementModP, CiphertextDecryptionSelection]]:
    """
    Get all of the cast shares for a specific selection
    """
    selections: Dict[GuardianId, Tuple[ElementModP, CiphertextDecryptionSelection]] = {}
    for share in shares.values():
        for contest in share.contests.values():
            for selection in contest.selections.values():
                if selection.object_id == selection_id:
                    selections[share.guardian_id] = (share.public_key, selection)

    return selections

So this implies that selection_ids must be unique across all contests. If you didnt enforce that, likely there would be a verification failure. I think it would only fail when there are missing guardians, so it might be easy to miss in testing.

We could change that code to check both the contest id and the selection id, or just document and verify that selection ids are unique in the entire election manifest.

Possible Implementation

No response

Anything else?

No response

@JohnLCaron JohnLCaron added enhancement New feature or request triage Waiting to be triaged labels Mar 2, 2022
@keithrfung keithrfung added question Further information is requested and removed triage Waiting to be triaged labels May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants