From d747b06ea684b62ce4e7f8534c8fcf387c11957d Mon Sep 17 00:00:00 2001 From: ctrlc03 <93448202+ctrlc03@users.noreply.github.com> Date: Mon, 19 Feb 2024 10:51:10 +0000 Subject: [PATCH] fix(circuits): fix coordinator censoring votes by passing an invalid currentVoteWeight Prevent coordinator censoring a valid second message by passing the currentVoteWeight equal to a value which would result in not enough voice credits in the circuit --- circuits/circom/processMessages.circom | 2 -- circuits/circom/processMessagesNonQv.circom | 2 -- circuits/ts/__tests__/ProcessMessages.test.ts | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/circuits/circom/processMessages.circom b/circuits/circom/processMessages.circom index f2db72eca6..3121b46f47 100644 --- a/circuits/circom/processMessages.circom +++ b/circuits/circom/processMessages.circom @@ -619,8 +619,6 @@ template ProcessOne(stateTreeDepth, voteOptionTreeDepth) { validVoteOptionIndex.in[1] <== maxVoteOptions; // @note pick the correct vote option index based on whether the index is < max vote options - // @todo can probably add one output to messageValidator and take from there - // or maybe we can remove altogther from messageValidator so we don't double check this component cmdVoteOptionIndexMux = Mux1(); cmdVoteOptionIndexMux.s <== validVoteOptionIndex.out; cmdVoteOptionIndexMux.c[0] <== 0; diff --git a/circuits/circom/processMessagesNonQv.circom b/circuits/circom/processMessagesNonQv.circom index 56d44d8e28..190a0c1fdf 100644 --- a/circuits/circom/processMessagesNonQv.circom +++ b/circuits/circom/processMessagesNonQv.circom @@ -541,8 +541,6 @@ template ProcessOneNonQv(stateTreeDepth, voteOptionTreeDepth) { validVoteOptionIndex.in[1] <== maxVoteOptions; // @note pick the correct vote option index based on whether the index is < max vote options - // @todo can probably add one output to messageValidator and take from there - // or maybe we can remove altogther from messageValidator so we don't double check this component cmdVoteOptionIndexMux = Mux1(); cmdVoteOptionIndexMux.s <== validVoteOptionIndex.out; cmdVoteOptionIndexMux.c[0] <== 0; diff --git a/circuits/ts/__tests__/ProcessMessages.test.ts b/circuits/ts/__tests__/ProcessMessages.test.ts index e1b9f6b440..05f3d2f276 100644 --- a/circuits/ts/__tests__/ProcessMessages.test.ts +++ b/circuits/ts/__tests__/ProcessMessages.test.ts @@ -575,7 +575,7 @@ describe("ProcessMessage circuit", function test() { // Second batch is not a full batch const numMessages = messageBatchSize * NUM_BATCHES - 1; - for (let i = 0; i < numMessages; i += 1) { + for (let i = 0; i < 6; i += 1) { const command = new PCommand( BigInt(index), userKeypair.pubKey,