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

If it's the first batch ensure zero tally commitment #277

Conversation

corydickson
Copy link
Contributor

Fixes #269

@corydickson corydickson requested a review from weijiekoh August 30, 2021 22:32
@corydickson corydickson force-pushed the tally-votes-circuit-initialize branch from 79d6629 to ff1040a Compare September 2, 2021 04:03
// -----------------------------------------------------------------------
// Tally the new results
component resultCalc[numVoteOptions];
for (var i = 0; i < numVoteOptions; i ++) {
resultCalc[i] = CalculateTotal(batchSize + 1);
resultCalc[i].nums[batchSize] <== currentResults[i];
resultCalc[i].nums[batchSize] <== currentResults[i] * isFirstBatch.out;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use iz.out instead?

If we multiply by isFirstBatch.out, and it's the first batch, the result is currentResults[i] * 1, but for subsequent batches, it ends up being currentResults[i] * 0.

@@ -273,7 +276,7 @@ template ResultCommitmentVerifier(voteOptionTreeDepth) {
// Compute the root of the new results
component newResultsRoot = QuinCheckRoot(voteOptionTreeDepth);
for (var i = 0; i < numVoteOptions; i ++) {
newResultsRoot.leaves[i] <== newResults[i];
newResultsRoot.leaves[i] <== newResults[i] * iz.out;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this change should be made. Let's discuss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants