Skip to content

Commit

Permalink
style(docs): prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
djanluka committed Aug 28, 2024
1 parent 28c6f64 commit 4c5c7d7
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 39 deletions.
5 changes: 3 additions & 2 deletions circuits/ts/__tests__/PollJoining.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down
6 changes: 2 additions & 4 deletions contracts/ts/genMaciState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 2 additions & 4 deletions contracts/ts/genSignUpTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/).
:::


Original file line number Diff line number Diff line change
Expand Up @@ -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 |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ function deploy(

pollAddr = address(poll);
}
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ maci-cli <command> --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 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down

0 comments on commit 4c5c7d7

Please sign in to comment.