Skip to content

Commit

Permalink
fix: ensure we pass the correct data to add tally results
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrlc03 committed Nov 5, 2024
1 parent 6007edf commit 77028ac
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/contracts/tasks/helpers/Prover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,18 +322,20 @@ export class Prover {
console.log("Submitting results...");

const tallyResults = tallyData.results.tally.map((t) => BigInt(t));
const resultLength = recipients ?? tallyResults.length;

// slice in case we are submitting partial results
const partialResults = tallyResults.slice(0, resultLength);

const [treeDepths] = await Promise.all([this.pollContract.treeDepths()]);

const resultLength = recipients ?? tallyResults.length;
const tallyResultProofs = tallyResults
.slice(0, resultLength)
const tallyResultProofs = partialResults

Check failure on line 332 in packages/contracts/tasks/helpers/Prover.ts

View workflow job for this annotation

GitHub Actions / check (lint:ts)

Replace `⏎······.map((_,·index)·=>·genTreeProof(index,·tallyResults,·Number(treeDepths.voteOptionTreeDepth))` with `.map((_,·index)·=>⏎······genTreeProof(index,·tallyResults,·Number(treeDepths.voteOptionTreeDepth)),⏎····`
.map((_, index) => genTreeProof(index, tallyResults, Number(treeDepths.voteOptionTreeDepth)));

await this.tallyContract
.addTallyResults({
voteOptionIndices: tallyData.results.tally.map((_, index) => index),
tallyResults,
voteOptionIndices: partialResults.map((_, index) => index),
tallyResults: partialResults,
tallyResultProofs,
totalSpent: tallyData.totalSpentVoiceCredits.spent,
totalSpentSalt: tallyData.totalSpentVoiceCredits.salt,
Expand Down

0 comments on commit 77028ac

Please sign in to comment.