diff --git a/circuits/ts/__tests__/PollJoining.test.ts b/circuits/ts/__tests__/PollJoining.test.ts index 828d487c5e..677f9c7932 100644 --- a/circuits/ts/__tests__/PollJoining.test.ts +++ b/circuits/ts/__tests__/PollJoining.test.ts @@ -135,8 +135,9 @@ describe("Poll Joining circuit", function test() { pollPubKey, }) as unknown as IPollJoiningInputs; const witness = await circuit.calculateWitness(inputs); - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - await circuit.expectConstraintFail(Array(witness.length).fill(1n)); + + const fakeWitness = Array(witness.length).fill(1n) as bigint[]; + await circuit.expectConstraintFail(fakeWitness); }); it("should fail for improper credits", () => { diff --git a/contracts/ts/genMaciState.ts b/contracts/ts/genMaciState.ts index 6b925b564d..cbd5120261 100644 --- a/contracts/ts/genMaciState.ts +++ b/contracts/ts/genMaciState.ts @@ -142,10 +142,8 @@ export const genMaciStateFromContract = async ( // eslint-disable-next-line no-await-in-loop const publishMessageLogs = await pollContract.queryFilter(pollContract.filters.PublishMessage(), i, toBlock); - const [ - joinPollLogs, - // eslint-disable-next-line no-await-in-loop - ] = await Promise.all([pollContract.queryFilter(pollContract.filters.PollJoined(), i, toBlock)]); + // eslint-disable-next-line no-await-in-loop + const joinPollLogs = await pollContract.queryFilter(pollContract.filters.PollJoined(), i, toBlock); joinPollLogs.forEach((event) => { assert(!!event); diff --git a/contracts/ts/genSignUpTree.ts b/contracts/ts/genSignUpTree.ts index 28adba9756..598c47b795 100644 --- a/contracts/ts/genSignUpTree.ts +++ b/contracts/ts/genSignUpTree.ts @@ -41,10 +41,8 @@ export const genSignUpTree = async ({ // or the end block if it is set const toBlock = i + blocksPerRequest >= lastBlock ? lastBlock : i + blocksPerRequest; - const [ - signUpLogs, - // eslint-disable-next-line no-await-in-loop - ] = await Promise.all([maciContract.queryFilter(maciContract.filters.SignUp(), i, toBlock)]); + // eslint-disable-next-line no-await-in-loop + const signUpLogs = await maciContract.queryFilter(maciContract.filters.SignUp(), i, toBlock); signUpLogs.forEach((event) => { assert(!!event); const pubKeyX = event.args._userPubKeyX; diff --git a/website/versioned_docs/version-v3.0_alpha/core-concepts/key-change.md b/website/versioned_docs/version-v3.0_alpha/core-concepts/key-change.md index 3c2538284e..b9d3a59e8a 100644 --- a/website/versioned_docs/version-v3.0_alpha/core-concepts/key-change.md +++ b/website/versioned_docs/version-v3.0_alpha/core-concepts/key-change.md @@ -195,5 +195,3 @@ We see that is important that we set the final message (the one with the new vot :::info Tests related to key changes have been added to the [core package](https://github.com/privacy-scaling-explorations/maci/blob/dev/core/ts/__tests__/) and to the [cli package](https://github.com/privacy-scaling-explorations/maci/blob/dev/cli/tests/). ::: - - diff --git a/website/versioned_docs/version-v3.0_alpha/core-concepts/maci-messages.md b/website/versioned_docs/version-v3.0_alpha/core-concepts/maci-messages.md index 5fc99442b5..ce3ab4841f 100644 --- a/website/versioned_docs/version-v3.0_alpha/core-concepts/maci-messages.md +++ b/website/versioned_docs/version-v3.0_alpha/core-concepts/maci-messages.md @@ -11,12 +11,12 @@ A command represents an action that a user may take, such as casting a vote in a | Symbol | Name | Size | Description | | ------------ | ----------------------- | ---- | --------------------------------------------------------------------------------------------------- | -| $cm_i$ | Poll state index | 50 | Poll state leaf index where the signing key is located | -| $cm_{p_{x}}$ | Public key x-coordinate | 253 | If no change is necessary this parameter should reflect the current poll public key's x-coordinate | -| $cm_{p_{y}}$ | Public key y-coordinate | 253 | If no change is necessary this parameter should reflect the current poll public key's y-coordinate | +| $cm_i$ | Poll state index | 50 | Poll state leaf index where the signing key is located | +| $cm_{p_{x}}$ | Public key x-coordinate | 253 | If no change is necessary this parameter should reflect the current poll public key's x-coordinate | +| $cm_{p_{y}}$ | Public key y-coordinate | 253 | If no change is necessary this parameter should reflect the current poll public key's y-coordinate | | $cm_{i_{v}}$ | Vote option index | 50 | Option state leaf index of preference to assign the vote for | | $cm_w$ | Voting weight | 50 | Voice credit balance allocation, this is an arbitrary value dependent on a user's available credits | -| $cm_n$ | Nonce | 50 | Poll state leaf's index of actions committed plus one | +| $cm_n$ | Nonce | 50 | Poll state leaf's index of actions committed plus one | | $cm_{id}$ | Poll id | 50 | The poll's identifier to cast in regard to | | $cm_s$ | Salt | 253 | An entropy value to inhibit brute force attacks | diff --git a/website/versioned_docs/version-v3.0_alpha/developers-references/smart-contracts/PollFactory.md b/website/versioned_docs/version-v3.0_alpha/developers-references/smart-contracts/PollFactory.md index 8bcaf4a87c..df95087d4f 100644 --- a/website/versioned_docs/version-v3.0_alpha/developers-references/smart-contracts/PollFactory.md +++ b/website/versioned_docs/version-v3.0_alpha/developers-references/smart-contracts/PollFactory.md @@ -32,4 +32,4 @@ function deploy( pollAddr = address(poll); } -``` \ No newline at end of file +``` diff --git a/website/versioned_docs/version-v3.0_alpha/developers-references/typescript-code/cli.md b/website/versioned_docs/version-v3.0_alpha/developers-references/typescript-code/cli.md index 59104a6de3..ee47dca19d 100644 --- a/website/versioned_docs/version-v3.0_alpha/developers-references/typescript-code/cli.md +++ b/website/versioned_docs/version-v3.0_alpha/developers-references/typescript-code/cli.md @@ -51,10 +51,10 @@ maci-cli --help | `publish` | Publish a new message to a MACI Poll contract | | `timeTravel` | Fast-forward the time (only works for local hardhat testing) | | `extractVkToFile` | Extract verification keys (vKey) from zKey files | -| `signup` | Sign up to a MACI contract -| `joinPoll` | Join to a specific MACI Poll | +| `signup` | Sign up to a MACI contract | +| `joinPoll` | Join to a specific MACI Poll | | `isRegisteredUser` | Checks if user is registered with public key | -| `isJoinedUser` | Checks if user is joined to a poll with poll public key | +| `isJoinedUser` | Checks if user is joined to a poll with poll public key | | `fundWallet` | Fund a wallet with Ether | | `verify` | Verify the results of a poll on-chain | | `genProofs` | Generate the proofs for a poll | diff --git a/website/versioned_docs/version-v3.0_alpha/developers-references/zk-snark-circuits/joinPoll.md b/website/versioned_docs/version-v3.0_alpha/developers-references/zk-snark-circuits/joinPoll.md index d9612b5c0b..965633b28e 100644 --- a/website/versioned_docs/version-v3.0_alpha/developers-references/zk-snark-circuits/joinPoll.md +++ b/website/versioned_docs/version-v3.0_alpha/developers-references/zk-snark-circuits/joinPoll.md @@ -10,6 +10,7 @@ sidebar_position: 5 [**Repo link**](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/core) The [`pollJoining`](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/core/qv/pollJoining.circom) circuit allows the users to prove that they are allowed to join the Poll based on their MACI key. The circuit checks: + - That the Poll joining nullifier nullifier is correctly computed as a hash of a MACI private key associated with a leaf of the MACI state tree. - That the MACI public key, derived from the private key, is included in the MACI state tree - The knowledge of a private key associated with the new poll public key @@ -19,9 +20,9 @@ The nullifier is computed as a Poseidon hash of the user's MACI private key. #### Parameters -| # | Parameter | Description | -| --- | ------------------------ | ---------------------------------------------------- | -| 0 | State tree depth | Allows $(2^{n})$ joins. | +| # | Parameter | Description | +| --- | ---------------- | ----------------------- | +| 0 | State tree depth | Allows $(2^{n})$ joins. | #### Inputs @@ -42,20 +43,20 @@ The nullifier is computed as a Poseidon hash of the user's MACI private key. // Public input hash (nullifier, credits, stateRoot) signal input inputHash; -| Input signal | Description | -| -------------------------------- | --------------------------------------------------------------------------------------- | -| `privKey` | User's MACI private key | -| `pollPrivKey` | The new Poll private key | -| `pollPubKey` | User's MACI private key | -| `stateLeaf` | The value of the leaf associated with the user int the MACI State tree | -| `siblings` | The Merkle path siblings in the MACI State tree | -| `indices` | The Merkle path indices in the MACI State tree | -| `nullifier` | Hash of user's MACI private key | -| `credits` | User's new credit balance in the Poll state leaf | -| `stateRoot` | MACI State tree root -hash | -| `actualStateTreeDepth` | Actual MACI state tree depth (related to Lazy Merkle Tree optimization) | -| `inputHash` | he SHA256 hash of inputs supplied by the contract | +| Input signal | Description | +| ---------------------- | ----------------------------------------------------------------------- | +| `privKey` | User's MACI private key | +| `pollPrivKey` | The new Poll private key | +| `pollPubKey` | User's MACI private key | +| `stateLeaf` | The value of the leaf associated with the user int the MACI State tree | +| `siblings` | The Merkle path siblings in the MACI State tree | +| `indices` | The Merkle path indices in the MACI State tree | +| `nullifier` | Hash of user's MACI private key | +| `credits` | User's new credit balance in the Poll state leaf | +| `stateRoot` | MACI State tree root | +| hash | +| `actualStateTreeDepth` | Actual MACI state tree depth (related to Lazy Merkle Tree optimization) | +| `inputHash` | he SHA256 hash of inputs supplied by the contract | ##### `inputHash` diff --git a/website/versioned_docs/version-v3.0_alpha/developers-references/zk-snark-circuits/processMessages.md b/website/versioned_docs/version-v3.0_alpha/developers-references/zk-snark-circuits/processMessages.md index 00a9170974..55d662b573 100644 --- a/website/versioned_docs/version-v3.0_alpha/developers-references/zk-snark-circuits/processMessages.md +++ b/website/versioned_docs/version-v3.0_alpha/developers-references/zk-snark-circuits/processMessages.md @@ -43,8 +43,8 @@ A version working with non quadratic voting (non-qv) is also [available](https:/ | `msgRoot` | The root of the message tree | | `msgs` | The batch of messages as an array of arrays | | `coordinatorPubKeyHash` | $poseidon_2([cPk_x, cPk_y])$ | -| `inputBatchHash` | The value of $chainHash$ at the beginning of batch | -| `outputBatchHash` | The value of $chainHash$ at the end of batch | +| `inputBatchHash` | The value of $chainHash$ at the beginning of batch | +| `outputBatchHash` | The value of $chainHash$ at the end of batch | | `newSbCommitment` | Described below | | `coordPrivKey` | The coordinator's private key | | `coordPubKey` | The coordinator's public key |