MACI Tally Votes Circuit
Parameters
# | Parameter | Description |
---|---|---|
0 | State tree depth | Allows signups. |
1 | State leaf batch depth | Allows users' votes to be processed per batch. |
2 | Vote option tree depth | Allows vote options. |
info
A version working with non quadratic voting (non-qv) is also available. This version is called tallyVotesNonQv
and is to be used when the Poll is not using the quadratic voting feature. Note that by default MACI works with quadratic voting.
Input signals
Input signal | Description |
---|---|
numSignUps | The number of users that signup |
index | Start index of given batch |
sbCommitment | Described below |
currentTallyCommitment | Described below |
newTallyCommitment | Described below |
stateRoot | The root of the state tree after all messages have been applied |
ballotRoot | The root of the ballot tree after all messages have been applied |
sbSalt | The salt used to produce sbCommitment |
ballots | The ballots in the batch being tallied |
ballotPathElements | The Merkle path to each ballot leaf |
votes | The votes in each ballot cast per result |
currentResults | The current tally of votes per vote option |
currentResultsRootSalt | A random value |
currentSpentVoiceCreditSubtotal | The subtotal of voice credits spent across all vote options |
currentSpentVoiceCreditSubtotalSalt | A random value |
currentPerVOSpentVoiceCredits | The voice credits spent on each vote option so far |
currentPerVOSpentVoiceCreditsRootSalt | A random value |
newResultsRootSalt | A random value |
newPerVOSpentVoiceCreditsRootSalt | A random value |
newSpentVoiceCreditSubtotalSalt | A random value |
sbCommitment
The commitment to stateRoot
, ballotRoot
, and sbSalt
:
Proving preimage of sbCommitment
is one out of the several steps required to prove that the votes were tallied correctly. By establishing that the coordinator knows ballotRoot
, the coordinator can (using other parts of the circuit) prove that they know the preimage of the ballot leaves in the batch being tallied.
currentTallyCommitment
and newTallyCommitment
A tally is represented by a tally commitment, which is the hash of:
- : a commitment to the votes per option
- This is the hash of the Merkle root of the votes and a salt , computed as
- : a commitment to the total spent voice credits
- This is the hash of the total spent voice credits and a salt , computed as
- : a commitment to the spent voice credits per vote option
- This is the hash of the Merkle root of the spent voice credits per vote option and a salt , computed as
The tally commitment is computed as such:
Statements that the circuit proves
- That the coordinator knows the preimage of
sbCommitment
- That
index
is less than or equal tonumSignUps
- That each ballot in
ballots
is in a member of the ballot tree with the Merkle rootballotRoot
at indicesbatchStartIndex
tobatchStartIndex + (5 ** intStateTreeDepth)
- That each set of votes (
votes[i]
) has the Merkle root whose value equalsballots[i][1]
- That the tally is valid, which is:
- That the sum of votes per vote option is correct