Skip to content

Commit

Permalink
added range Chaum-Pedersen proofs and eliminated placeholders (#761)
Browse files Browse the repository at this point in the history
* added range Chaum-Pedersen proofs and basic unit tests

* added default limit value 1 for range proofs; added remaining unit tests

* temporarily remove outdated make sample-data

* resolved slight typing issues and fixed black formatting

* fixed typos

* changed commitment type to OrderedDict from tuple to prepare for serialization; fixed bug with determining limit of range proofs

* replaced disjunctive CP proofs with range versions in property tests

* amended data type of range proof commitments from list of (ordered) dictionaries to (flattened) list; all tests now pass, and disjunctive Chaum-Pedersen proofs are now unused

* tweaked description referring to range proofs instead of disjunctive

* Corrected and improved ProofUsage enum

* better distinguish the types of Chaum-Pedersen proofs, explicitly referencing the specification for clarity of use

* refactored Chaum-Pedersen proofs to unify parameter organization; removed placeholders

* removed unnecessary calls 0-power of group generator in range Chaum-Pedersen proof

* cherry-pick ed9e8d3 from no-placeholders branch

* enabled cumulative voting; refactored and corrected number_elected and votes_allowed

* added end-to-end integration testing for cumulative voting

* removed placeholders; rebased from old branch

* added cumulative voting system; rebased from old branch

* removed selection_limit attribute from PlaintextBallotContest

* added comment clarifying role of selection limit in ballot property test

* better distinguish the types of Chaum-Pedersen proofs, explicitly referencing the specification for clarity of use

* refactored Chaum-Pedersen proofs to unify parameter organization; removed placeholders

* removed placeholders; rebased from old branch

* enabled cumulative voting; refactored and corrected number_elected and votes_allowed

* added end-to-end integration testing for cumulative voting

* added cumulative voting system; rebased from old branch

* removed selection_limit attribute from PlaintextBallotContest

* added comment clarifying role of selection limit in ballot property test

* resolved merge conflict issues

* fixed merge conflicts

* fixed merge conflicts

* removed selection_limit attribute from PlaintextBallotContest

* amended merge conflict errors; make runs properly now
  • Loading branch information
eionblanc authored Aug 23, 2022
1 parent ebc7828 commit e33e830
Show file tree
Hide file tree
Showing 32 changed files with 1,153 additions and 851 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ environment:
poetry config virtualenvs.in-project true
poetry install
@echo 🚨 Be sure to add poetry to PATH
make fetch-sample-data
# make fetch-sample-data

install:
@echo 🔧 INSTALL
Expand Down
57 changes: 55 additions & 2 deletions data/election_manifest_simple.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@
"vote_variation": "n_of_m",
"electoral_district_id": "jefferson-county",
"name": "Justice of the Supreme Court",
"number_elected": 2,
"votes_allowed": 2
},
{
Expand Down Expand Up @@ -304,8 +303,62 @@
"vote_variation": "one_of_m",
"electoral_district_id": "harrison-township",
"name": "The Pineapple Question",
"number_elected": 1,
"votes_allowed": 1
},
{
"object_id": "official-bagel-style",
"sequence_order": 3,
"ballot_selections": [
{
"object_id": "new-york-style-selection",
"sequence_order": 1,
"candidate_id": "new-york-style"
},
{
"object_id": "montreal-style-selection",
"sequence_order": 2,
"candidate_id": "montreal-style"
},
{
"object_id": "st-louis-style-selection",
"sequence_order": 3,
"candidate_id": "st-louis-style"
},
{
"object_id": "write-in-style-selection",
"sequence_order": 4,
"candidate_id": "write-in-style"
}
],
"ballot_title": {
"text": [
{
"value": "Harrison official bagel style",
"language": "en"
},
{
"value": "Estilo bagel oficial de Harrison",
"language": "es"
}
]
},
"ballot_subtitle": {
"text": [
{
"value": "Please allot up to three points",
"language": "en"
},
{
"value": "Por favor asigne hasta tres puntos",
"language": "es"
}
]
},
"vote_variation": "cumulative",
"electoral_district_id": "harrison-township",
"name": "The Bagel Question",
"votes_allowed": 3,
"votes_allowed_per_selection": 3
}
],
"ballot_styles": [
Expand Down
8 changes: 0 additions & 8 deletions data/manifest-hamilton-general.json
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,6 @@
"sequence_order": 0,
"electoral_district_id": "hamilton-county",
"vote_variation": "one_of_m",
"number_elected": 1,
"votes_allowed": 1,
"name": "President and Vice President of the United States",
"ballot_selections": [
Expand Down Expand Up @@ -1302,7 +1301,6 @@
"sequence_order": 1,
"electoral_district_id": "hamilton-county",
"vote_variation": "one_of_m",
"number_elected": 1,
"votes_allowed": 1,
"name": "Governor of the Commonwealth of Ozark",
"ballot_selections": [
Expand Down Expand Up @@ -1472,7 +1470,6 @@
"sequence_order": 2,
"electoral_district_id": "congress-district-5",
"vote_variation": "one_of_m",
"number_elected": 1,
"votes_allowed": 1,
"name": "Congressional District 5",
"ballot_selections": [
Expand Down Expand Up @@ -1537,7 +1534,6 @@
"sequence_order": 3,
"electoral_district_id": "congress-district-7",
"vote_variation": "one_of_m",
"number_elected": 1,
"votes_allowed": 1,
"name": "Congressional District 7",
"ballot_selections": [
Expand Down Expand Up @@ -1602,7 +1598,6 @@
"sequence_order": 4,
"electoral_district_id": "pismo-beach-school-district-precinct-1",
"vote_variation": "n_of_m",
"number_elected": 3,
"votes_allowed": 3,
"name": "Pismo Beach School Board",
"ballot_selections": [
Expand Down Expand Up @@ -1687,7 +1682,6 @@
"sequence_order": 5,
"electoral_district_id": "somerset-school-district-precinct-1",
"vote_variation": "n_of_m",
"number_elected": 2,
"votes_allowed": 2,
"name": "Somerset School Board",
"ballot_selections": [
Expand Down Expand Up @@ -1762,7 +1756,6 @@
"sequence_order": 6,
"electoral_district_id": "arlington-township-precinct-1",
"vote_variation": "one_of_m",
"number_elected": 1,
"votes_allowed": 1,
"name": "Retain Robert Demergue as Chief Justice?",
"ballot_selections": [
Expand Down Expand Up @@ -1807,7 +1800,6 @@
"sequence_order": 7,
"electoral_district_id": "lacroix-exeter-utility-district",
"vote_variation": "one_of_m",
"number_elected": 1,
"votes_allowed": 1,
"name": "Capital Projects Levy",
"ballot_selections": [
Expand Down
67 changes: 67 additions & 0 deletions data/manifest-min.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"spec_version": "v0.95",
"election_scope_id": "franklin-minimal-referendum-manifest",
"type": "general",
"geopolitical_units": [
{
"object_id": "franklin-county",
"name": "Franklin County",
"type": "municipality"
}
],
"parties": [
{
"object_id": "N/A"
}
],
"candidates": [
{
"object_id": "referendum-pineapple-affirmative"
},
{
"object_id": "referendum-pineapple-negative"
}
],
"contests": [
{
"object_id": "referendum-pineapple",
"name": "Referendum for Banning Pineapple on Pizza",
"sequence_order": 0,
"vote_variation": "one_of_m",
"electoral_district_id": "franklin-county",
"votes_allowed": 1,
"ballot_selections": [
{
"object_id": "referendum-pineapple-affirmative-selection",
"sequence_order": 0,
"candidate_id": "referendum-pineapple-affirmative"
},
{
"object_id": "referendum-pineapple-negative-selection",
"sequence_order": 1,
"candidate_id": "referendum-pineapple-negative"
}
]
}
],
"ballot_styles": [
{
"object_id": "ballot-style-01",
"geopolitical_unit_ids": ["franklin-county"]
}
],
"name": {
"text": [
{
"language": "en",
"value": "Franklin County Minimal General Election March 2020"
},
{
"language": "es",
"value": "Elecciones generales mínimas del condado de Franklin marzo de 2020"
}
]
},
"start_date": "2020-03-01T08:00:00-05:00",
"end_date": "2020-03-03T19:00:00-05:00"
}
95 changes: 94 additions & 1 deletion data/manifest-minimal.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,100 @@
"sequence_order": 0,
"electoral_district_id": "franklin-county",
"vote_variation": "one_of_m",
"number_elected": 1,
"votes_allowed": 1,
"name": "Referendum for Banning Pineapple on Pizza",
"ballot_selections": [
{
"object_id": "referendum-pineapple-affirmative-selection",
"sequence_order": 0,
"candidate_id": "referendum-pineapple-affirmative"
},
{
"object_id": "referendum-pineapple-negative-selection",
"sequence_order": 1,
"candidate_id": "referendum-pineapple-negative"
}
],
"ballot_title": null,
"ballot_subtitle": null
}
],
"ballot_styles": [
{
"object_id": "ballot-style-01",
"geopolitical_unit_ids": [
"franklin-county"
],
"party_ids": null,
"image_uri": null
}
],
"name": {
"text": [
{
"value": "Franklin County Minimal General Election March 2020",
"language": "en"
},
{
"value": "Elecciones generales m\u00ednimas del condado de Franklin marzo de 2020",
"language": "es"
}
]
},
"contact_information": null
}
=======
{
"election_scope_id": "franklin-minimal-referendum-manifest",
"spec_version": "1.0",
"type": "general",
"start_date": "2020-03-01T08:00:00-05:00",
"end_date": "2020-03-03T19:00:00-05:00",
"geopolitical_units": [
{
"object_id": "franklin-county",
"name": "Franklin County",
"type": "municipality",
"contact_information": null
}
],
"parties": [
{
"object_id": "N/A",
"name": {
"text": []
},
"abbreviation": null,
"color": null,
"logo_uri": null
}
],
"candidates": [
{
"object_id": "referendum-pineapple-affirmative",
"name": {
"text": []
},
"party_id": null,
"image_uri": null,
"is_write_in": null
},
{
"object_id": "referendum-pineapple-negative",
"name": {
"text": []
},
"party_id": null,
"image_uri": null,
"is_write_in": null
}
],
"contests": [
{
"object_id": "referendum-pineapple",
"sequence_order": 0,
"electoral_district_id": "franklin-county",
"vote_variation": "one_of_m",
"votes_allowed": 1,
"name": "Referendum for Banning Pineapple on Pizza",
"ballot_selections": [
Expand Down
3 changes: 0 additions & 3 deletions data/manifest-small.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@
"sequence_order": 0,
"electoral_district_id": "franklin-county",
"vote_variation": "one_of_m",
"number_elected": 1,
"votes_allowed": 1,
"name": "Representative to US Congress",
"ballot_selections": [
Expand Down Expand Up @@ -155,7 +154,6 @@
"sequence_order": 1,
"electoral_district_id": "franklin-county",
"vote_variation": "one_of_m",
"number_elected": 1,
"votes_allowed": 1,
"name": "The Pineapple Question",
"ballot_selections": [
Expand All @@ -178,7 +176,6 @@
"sequence_order": 2,
"electoral_district_id": "ozark-school-district",
"vote_variation": "n_of_m",
"number_elected": 2,
"votes_allowed": 2,
"name": "Ozark School Board",
"ballot_selections": [
Expand Down
26 changes: 26 additions & 0 deletions data/plaintext_ballots_simple.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,19 @@
"vote": 1
}
]
},
{
"object_id": "official-bagel-style",
"ballot_selections": [
{
"object_id": "new-york-style-selection",
"vote": 2
},
{
"object_id": "st-louis-style-selection",
"vote": 1
}
]
}
]
},
Expand Down Expand Up @@ -140,6 +153,19 @@
"vote": 1
}
]
},
{
"object_id": "official-bagel-style",
"ballot_selections": [
{
"object_id": "new-york-style-selection",
"vote": 1
},
{
"object_id": "montreal-style-selection",
"vote": 0
}
]
}
]
}
Expand Down
Loading

0 comments on commit e33e830

Please sign in to comment.