@maci-protocol/website 0.0.0-ci.0c66f42 → 0.0.0-ci.1089e9a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docusaurus.config.ts +2 -2
- package/package.json +4 -4
- package/versioned_docs/version-v0.x/quadratic-vote-tallying-circuit.md +16 -16
- package/versioned_docs/version-v3.x/core-concepts/maci-keys.md +1 -1
- package/versioned_docs/version-v3.x/core-concepts/poll-types.md +31 -7
- package/versioned_docs/version-v3.x/core-concepts/polls.md +31 -7
- package/versioned_docs/version-v3.x/core-concepts/spec.md +8 -8
- package/versioned_docs/version-v3.x/core-concepts/workflow.md +1 -1
- package/versioned_docs/version-v3.x/guides/compile-circuits.md +31 -15
- package/versioned_docs/version-v3.x/guides/integrating.md +1 -1
- package/versioned_docs/version-v3.x/guides/testing/testing-in-detail.md +1 -1
- package/versioned_docs/version-v3.x/guides/testing/testing-introduction.md +8 -2
- package/versioned_docs/version-v3.x/guides/troubleshooting.md +6 -6
- package/versioned_docs/version-v3.x/quick-start.md +24 -16
- package/versioned_docs/version-v3.x/resources.md +1 -0
- package/versioned_docs/version-v3.x/security/trusted-setup.md +35 -35
- package/versioned_docs/version-v3.x/supported-networks/deployed-contracts.md +8 -8
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/MACI.md +2 -2
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/MessageProcessor.md +1 -1
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/Params.md +2 -2
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/Poll.md +1 -1
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/PollFactory.md +1 -1
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/Tally.md +2 -2
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/VkRegistry.md +4 -4
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/processMessages.md +7 -3
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/setup.md +3 -3
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/tallyVotes.md +3 -3
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/utilities.md +2 -2
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/zk-snark-circuits.md +3 -3
package/docusaurus.config.ts
CHANGED
|
@@ -46,7 +46,7 @@ async function getConfig(): Promise<Config> {
|
|
|
46
46
|
routeBasePath: "docs/",
|
|
47
47
|
sidebarPath: "./sidebars.ts",
|
|
48
48
|
editUrl: ({ versionDocsDirPath, docPath }) =>
|
|
49
|
-
`${GITHUB_URL}/edit/dev/website/${versionDocsDirPath}/${docPath}`,
|
|
49
|
+
`${GITHUB_URL}/edit/dev/apps/website/${versionDocsDirPath}/${docPath}`,
|
|
50
50
|
remarkPlugins: [remarkMath],
|
|
51
51
|
rehypePlugins: [rehypeKatex],
|
|
52
52
|
includeCurrentVersion: false,
|
|
@@ -59,7 +59,7 @@ async function getConfig(): Promise<Config> {
|
|
|
59
59
|
blog: {
|
|
60
60
|
showReadingTime: true,
|
|
61
61
|
|
|
62
|
-
editUrl: ({ blogDirPath, blogPath }) => `${GITHUB_URL}/edit/dev/website/${blogDirPath}/${blogPath}`,
|
|
62
|
+
editUrl: ({ blogDirPath, blogPath }) => `${GITHUB_URL}/edit/dev/apps/website/${blogDirPath}/${blogPath}`,
|
|
63
63
|
remarkPlugins: [remarkMath],
|
|
64
64
|
rehypePlugins: [rehypeKatex],
|
|
65
65
|
onUntruncatedBlogPosts: "ignore",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maci-protocol/website",
|
|
3
|
-
"version": "0.0.0-ci.
|
|
3
|
+
"version": "0.0.0-ci.1089e9a",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"@docusaurus/module-type-aliases": "^3.7.0",
|
|
42
42
|
"@docusaurus/tsconfig": "^3.7.0",
|
|
43
43
|
"@docusaurus/types": "^3.7.0",
|
|
44
|
-
"@types/node": "^22.15.
|
|
45
|
-
"@types/react": "^19.1.
|
|
44
|
+
"@types/node": "^22.15.17",
|
|
45
|
+
"@types/react": "^19.1.4",
|
|
46
46
|
"ts-node": "^10.9.2",
|
|
47
47
|
"typescript": "^5.8.3"
|
|
48
48
|
},
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"engines": {
|
|
62
62
|
"node": ">=18.0"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "8aec2eaf27f60c225b6fe3781204d8c10d5df581"
|
|
65
65
|
}
|
|
@@ -35,25 +35,25 @@ The MACI contract's `quadraticVoteTally()` function should verify a proof create
|
|
|
35
35
|
|
|
36
36
|
## Inputs
|
|
37
37
|
|
|
38
|
-
| Pseudocode name
|
|
39
|
-
|
|
|
40
|
-
| `fullStateRoot`
|
|
41
|
-
| `fullStateTreeDepth`
|
|
42
|
-
| `
|
|
43
|
-
| `intermediateStateRoot`
|
|
44
|
-
| `intermediatePathElements[k]`
|
|
45
|
-
| `intermediatePathIndex`
|
|
46
|
-
| `currentResults[n]`
|
|
47
|
-
| `currentResultsSalt`
|
|
48
|
-
| `currentResultsCommitment`
|
|
49
|
-
| `newResultsCommitment`
|
|
50
|
-
| `salt`
|
|
51
|
-
| `stateLeaves[m][p]`
|
|
52
|
-
| `voteLeaves[m][n]`
|
|
38
|
+
| Pseudocode name | zk-SNARK input type | Description | Set by |
|
|
39
|
+
| ------------------------------- | ------------------- | ---------------------------------------------------------------------------------------------------------- | ----------- |
|
|
40
|
+
| `fullStateRoot` | Public | The final Merkle root of the state tree | Contract |
|
|
41
|
+
| `fullStateTreeDepth` | Hardcoded | The depth of the state tree | Contract |
|
|
42
|
+
| `tallyProcessingStateTreeDepth` | Hardcoded | The depth of the intermediate state tree | Contract |
|
|
43
|
+
| `intermediateStateRoot` | Public | The intermediate Merkle root generated by the given state leaves | Contract |
|
|
44
|
+
| `intermediatePathElements[k]` | Private | The Merkle path elements from `intermediateStateRoot` to `stateRoot`. | Coordinator |
|
|
45
|
+
| `intermediatePathIndex` | Public | The Merkle path index from `intermediateStateRoot` to `stateRoot`. | Contract |
|
|
46
|
+
| `currentResults[n]` | Private | The vote tally of all prior batches of state leaves | Coordinator |
|
|
47
|
+
| `currentResultsSalt` | Private | A random value to hash with the vote tally for state leaves up to the current batch | Coordinator |
|
|
48
|
+
| `currentResultsCommitment` | Public | The salted commitment of the values in `currentResults` | Contract |
|
|
49
|
+
| `newResultsCommitment` | Public | The salted commitment of the vote tally for this batch of leaves plus the vote tally from `currentResults` | Contract |
|
|
50
|
+
| `salt` | Private | A random value to hash with the culmulate vote tally for this batch of state leaves | Coordinator |
|
|
51
|
+
| `stateLeaves[m][p]` | Private | The batch of leaves of the state tree to tally. | Coordinator |
|
|
52
|
+
| `voteLeaves[m][n]` | Private | The vote leaves for each user in this batch of state leaves. | Coordinator |
|
|
53
53
|
|
|
54
54
|
`n` is the number of options in `voteOptionTree`.
|
|
55
55
|
`m` is the number of state leaves in this batch.
|
|
56
|
-
`k` is `fullStateTreeDepth -
|
|
56
|
+
`k` is `fullStateTreeDepth - tallyProcessingStateTreeDepth`
|
|
57
57
|
`p` is the message length
|
|
58
58
|
|
|
59
59
|
A result commitment is the hash of a Merkle root of all the vote leaves, and a salt. For instance:
|
|
@@ -78,7 +78,7 @@ Serialized, these will look like **macipk.0e5194a54562ea4d440ac6a0049a41d4b600e3
|
|
|
78
78
|
After successfully [installing](/docs/quick-start#installation) MACI, you can easily generate your MACI key pair by running:
|
|
79
79
|
|
|
80
80
|
```bash
|
|
81
|
-
pnpm run
|
|
81
|
+
pnpm run generate-maci-keypair
|
|
82
82
|
```
|
|
83
83
|
|
|
84
84
|
This command will create the necessary public and private keys required for running various MACI operations.
|
|
@@ -5,25 +5,25 @@ sidebar_label: Poll types
|
|
|
5
5
|
sidebar_position: 9
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
MACI allows to conduct polls in both a quadratic voting and non quadratic voting fashion. One should be aware that the only distinction between the two happens when messages are processed and votes tallied. On top of that, the Tally smart contract has been split into two different ones, with the non quadratic voting version one being slightly smaller, due to the need of one less function.
|
|
8
|
+
MACI allows to conduct polls in both a quadratic voting and non quadratic voting fashion. One should be aware that the only distinction between the two happens when messages are processed and votes tallied. On top of that, the Tally smart contract has been split into two different ones, with the non quadratic voting version one being slightly smaller, due to the need of one less function. Additionally, there is a variation of non quadratic voting that allows participants to cast their entire voice credit balance for a single option only.
|
|
9
9
|
|
|
10
10
|
This document will explain how to use each of these options. Hardhat tasks are the currently recommended way to deploy contracts and run polls but you can also use the MACI cli.
|
|
11
11
|
|
|
12
12
|
## Quadratic Voting
|
|
13
13
|
|
|
14
|
-
MACI has always worked with quadratic voting. Users signing up to MACI are assigned a number of voice credits based on certain conditions (enforced by the [initial voice credit proxy contract](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/initialVoiceCreditProxy/
|
|
14
|
+
MACI has always worked with quadratic voting. Users signing up to MACI are assigned a number of voice credits based on certain conditions (enforced by the [initial voice credit proxy contract](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/initialVoiceCreditProxy/ConstantInitialVoiceCreditProxy.sol)), and after each vote, the number of voice credits is reduced by the square of the weight of the vote casted. For instance, if the vote weight is 5, a user must have at least 25 voice credits to cast the vote.
|
|
15
15
|
|
|
16
16
|
To run a poll with quadratic voting, the coordinator must deploy the Poll with the mode set to quadratic voting.
|
|
17
17
|
|
|
18
18
|
### Using Hardhat tasks
|
|
19
19
|
|
|
20
|
-
In the deploy-config.json file set the `
|
|
20
|
+
In the deploy-config.json file set the `mode` value to **qv**.
|
|
21
21
|
|
|
22
22
|
```json
|
|
23
23
|
"Poll": {
|
|
24
24
|
"pollDuration": 604800,
|
|
25
25
|
"coordinatorPublicKey": "macipk",
|
|
26
|
-
"
|
|
26
|
+
"mode": "qv"
|
|
27
27
|
}
|
|
28
28
|
```
|
|
29
29
|
|
|
@@ -37,17 +37,41 @@ pnpm deploy-poll:NETWORK
|
|
|
37
37
|
|
|
38
38
|
The non quadratic voting option is a new feature that has been added to MACI with the v1.2 release. It allows to conduct polls without the quadratic voting mechanism. This means that the number of voice credits is not reduced by the square of the weight of the vote casted. This option is useful for polls where the quadratic voting mechanism is not necessary, and it is also slightly cheaper for coordinators to tally votes, as there are less checks required in the Tally smart contract.
|
|
39
39
|
|
|
40
|
-
To run a poll with non quadratic voting, the coordinator must set the `
|
|
40
|
+
To run a poll with non quadratic voting, the coordinator must set the `mode` parameter to `non-qv` when creating the MACI instance. This will make the MACI instance use the `TallyNonQv` smart contract, which is a smaller version of the `Tally` smart contract, as it does not require the checks for the quadratic voting mechanism.
|
|
41
41
|
|
|
42
42
|
### Using Hardhat tasks
|
|
43
43
|
|
|
44
|
-
In the deploy-config.json file set the `
|
|
44
|
+
In the deploy-config.json file set the `mode` value to **non-qv**.
|
|
45
45
|
|
|
46
46
|
```json
|
|
47
47
|
"Poll": {
|
|
48
48
|
"pollDuration": 604800,
|
|
49
49
|
"coordinatorPublicKey": "macipk",
|
|
50
|
-
"
|
|
50
|
+
"mode": "non-qv"
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Then run the task to create a poll:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pnpm deploy-poll:NETWORK
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Full Credits Voting
|
|
61
|
+
|
|
62
|
+
Full Credits Voting is a new feature introduced in MACI v3. This voting mode disables the quadratic voting mechanism and requires participants to allocate their entire voice credit balance to a single option. Unlike quadratic voting, where the cost of votes increases quadratically with the number of votes cast, Full Credits Voting uses a linear model: participants spend all their available voice credits on one chosen option. No splitting across multiple options is allowed. This option is useful for polls where the quadratic voting mechanism is not necessary and where it's important to ensure voters fully commit to a single choice—eliminating fragmented or spread-out voting behavior. It also offers a slight cost advantage for coordinators, as tallying is more efficient with fewer checks required in the Tally smart contract.
|
|
63
|
+
|
|
64
|
+
To run a poll full credits voting, the coordinator must set the `mode` parameter to `full` when creating the MACI instance. This will make the MACI instance use the `TallyNonQv` smart contract, which is a smaller version of the `Tally` smart contract, as it does not require the checks for the quadratic voting mechanism.
|
|
65
|
+
|
|
66
|
+
### Using Hardhat tasks
|
|
67
|
+
|
|
68
|
+
In the deploy-config.json file set the `mode` value to **full**.
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
"Poll": {
|
|
72
|
+
"pollDuration": 604800,
|
|
73
|
+
"coordinatorPublicKey": "macipk",
|
|
74
|
+
"mode": "full"
|
|
51
75
|
}
|
|
52
76
|
```
|
|
53
77
|
|
|
@@ -11,7 +11,7 @@ Currently, you can configure the following parameters for a poll:
|
|
|
11
11
|
|
|
12
12
|
- Poll duration, in the form of a unix timestamp for start and end times. This allows polls to be scheduled to start at a certain time, and run for a certain amount of time.
|
|
13
13
|
- Vote option - how many vote options are allowed for a poll.
|
|
14
|
-
- Vote mode - quadratic
|
|
14
|
+
- Vote mode - quadratic, non quadratic, full credits voting. One should be aware that the only distinction between them happens when messages are processed and votes tallied.
|
|
15
15
|
- Policy - the Excubiae policy that will be used to gate access to the poll.
|
|
16
16
|
- Initial voice credit proxy - the initial voice credit proxy that will be used to assign voice credits to voters.
|
|
17
17
|
- Relayer - the list of addresses that will be able to relay messages on behalf of other users (for now this is recommended to be the coordinator only)
|
|
@@ -34,19 +34,19 @@ The full configuration for a poll looks like this:
|
|
|
34
34
|
|
|
35
35
|
## Quadratic Voting
|
|
36
36
|
|
|
37
|
-
MACI has always worked with quadratic voting. Users joining a Poll are assigned a number of voice credits based on certain conditions (enforced by the [initial voice credit proxy contract](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/initialVoiceCreditProxy/
|
|
37
|
+
MACI has always worked with quadratic voting. Users joining a Poll are assigned a number of voice credits based on certain conditions (enforced by the [initial voice credit proxy contract](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/initialVoiceCreditProxy/ConstantInitialVoiceCreditProxy.sol)), and after each vote, the number of voice credits is reduced by the square of the weight of the vote casted. For instance, if the vote weight is 5, a user must have at least 25 voice credits to cast the vote.
|
|
38
38
|
|
|
39
39
|
To run a poll with quadratic voting, the coordinator must deploy the Poll with the mode set to quadratic voting.
|
|
40
40
|
|
|
41
41
|
### Using Hardhat tasks
|
|
42
42
|
|
|
43
|
-
In the deploy-config.json file set the `
|
|
43
|
+
In the deploy-config.json file set the `mode` value to **qv**.
|
|
44
44
|
|
|
45
45
|
```json
|
|
46
46
|
"Poll": {
|
|
47
47
|
[...]
|
|
48
48
|
"coordinatorPublicKey": "macipk",
|
|
49
|
-
"
|
|
49
|
+
"mode": "qv"
|
|
50
50
|
}
|
|
51
51
|
```
|
|
52
52
|
|
|
@@ -60,17 +60,41 @@ pnpm deploy-poll:NETWORK
|
|
|
60
60
|
|
|
61
61
|
The non quadratic voting option is a new feature that has been added to MACI with the v1.2 release. It allows to conduct polls without the quadratic voting mechanism. This means that the number of voice credits is not reduced by the square of the weight of the vote casted. This option is useful for polls where the quadratic voting mechanism is not necessary, and it is also slightly cheaper for coordinators to tally votes, as there are less checks required in the Tally smart contract.
|
|
62
62
|
|
|
63
|
-
To run a poll with non quadratic voting, the coordinator must set the `
|
|
63
|
+
To run a poll with non quadratic voting, the coordinator must set the `mode` parameter to `non-qv` when creating the MACI instance.
|
|
64
64
|
|
|
65
65
|
### Using Hardhat tasks
|
|
66
66
|
|
|
67
|
-
In the deploy-config.json file set the `
|
|
67
|
+
In the deploy-config.json file set the `mode` value to **non-qv**.
|
|
68
68
|
|
|
69
69
|
```json
|
|
70
70
|
"Poll": {
|
|
71
71
|
[...]
|
|
72
72
|
"coordinatorPublicKey": "macipk",
|
|
73
|
-
"
|
|
73
|
+
"mode": "non-qv"
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Then run the task to create a poll:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
pnpm deploy-poll:NETWORK
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Full Credits Voting
|
|
84
|
+
|
|
85
|
+
Full Credits Voting is a new feature introduced in MACI v3. This voting mode disables the quadratic voting mechanism and requires participants to allocate their entire voice credit balance to a single option. Unlike quadratic voting, where the cost of votes increases quadratically with the number of votes cast, Full Credits Voting uses a linear model: participants spend all their available voice credits on one chosen option. No splitting across multiple options is allowed. This option is useful for polls where the quadratic voting mechanism is not necessary and where it's important to ensure voters fully commit to a single choice—eliminating fragmented or spread-out voting behavior. It also offers a slight cost advantage for coordinators, as tallying is more efficient with fewer checks required in the Tally smart contract.
|
|
86
|
+
|
|
87
|
+
To run a poll with full credits voting, the coordinator must set the `mode` parameter to `full` when creating the MACI instance.
|
|
88
|
+
|
|
89
|
+
### Using Hardhat tasks
|
|
90
|
+
|
|
91
|
+
In the deploy-config.json file set the `mode` value to **full**.
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
"Poll": {
|
|
95
|
+
[...]
|
|
96
|
+
"coordinatorPublicKey": "macipk",
|
|
97
|
+
"mode": "full"
|
|
74
98
|
}
|
|
75
99
|
```
|
|
76
100
|
|
|
@@ -580,7 +580,7 @@ Please note that MACI requires the coordinator to generate proofs on an x86 mach
|
|
|
580
580
|
|
|
581
581
|
### 6.1. Message processing circuit
|
|
582
582
|
|
|
583
|
-
The message processing circuit, defined in `circuits/circom/
|
|
583
|
+
The message processing circuit, defined in `circuits/circom/coordinator/qv/MessageProcessor.circom`, allows the coordinator to prove that they have correctly applied each message in reverse order, in a consecutive batch of `5 ^ messageBatchDepth` messages to the respective state leaf within the state tree.
|
|
584
584
|
|
|
585
585
|
#### Parameters
|
|
586
586
|
|
|
@@ -747,15 +747,15 @@ The final tally should be:
|
|
|
747
747
|
2. Total voice credits per vote option: `[3, 9, 19, 33, 26]`
|
|
748
748
|
3. Total spent voice credits: `66`
|
|
749
749
|
|
|
750
|
-
The coordinator uses the ballot tallying circuit (`
|
|
750
|
+
The coordinator uses the ballot tallying circuit (`VoteTally.circom`) to generate proofs that they have correctly computed the tally. As there are many ballots to tally, each proof only computes the tally for a batch of ballots. Each proof is chained to the previous one such that each proof is also a proof of knowledge of the preimage of the previous tally commitment.
|
|
751
751
|
|
|
752
752
|
#### Parameters
|
|
753
753
|
|
|
754
|
-
| Parameter
|
|
755
|
-
|
|
|
756
|
-
| `stateTreeDepth`
|
|
757
|
-
| `
|
|
758
|
-
| `voteOptionTreeDepth`
|
|
754
|
+
| Parameter | Description |
|
|
755
|
+
| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
|
|
756
|
+
| `stateTreeDepth` | Depth of the state tree, this value must be equal to `10` |
|
|
757
|
+
| `tallyProcessingStateTreeDepth` | Depth of the intermediate state tree, `5 ** tallyProcessingStateTreeDepth` is the batch size |
|
|
758
|
+
| `voteOptionTreeDepth` | Depth of the vote option tree, this must be the same value passed to the `deployPoll()` contract function of `MACI.sol` |
|
|
759
759
|
|
|
760
760
|
#### Input signals
|
|
761
761
|
|
|
@@ -809,7 +809,7 @@ $\mathsf{poseidon_3}([tc_r, tc_t, tc_p])$
|
|
|
809
809
|
|
|
810
810
|
1. That the coordinator knows the preimage of `sbCommitment` (see above)
|
|
811
811
|
2. That `index` is less than or equal to `totalSignups`
|
|
812
|
-
3. That each ballot in `ballots` is in a member of the ballot tree with the Merkle root `ballotRoot` at indices `batchStartIndex` to `batchStartIndex + (5 **
|
|
812
|
+
3. That each ballot in `ballots` is in a member of the ballot tree with the Merkle root `ballotRoot` at indices `batchStartIndex` to `batchStartIndex + (5 ** tallyProcessingStateTreeDepth)`
|
|
813
813
|
4. That each set of votes (`votes[i]`) has the Merkle root $blt_r$ whose value equals `ballots[i][1]`
|
|
814
814
|
5. That the tally is valid, which is:
|
|
815
815
|
- That the sum of votes per vote option is correct
|
|
@@ -133,7 +133,7 @@ The `MessageProcessor` contract will send the proof to a separate verifier contr
|
|
|
133
133
|
|
|
134
134
|
#### Tally Results
|
|
135
135
|
|
|
136
|
-
Finally, once all messages have been processed, the coordinator tallies the votes of the valid messages (off-chain). The coordinator creates a zk-SNARK proving that the valid messages in the state tree (proved in Process Messages step) contain votes that sum to the given tally result. Then, they call [`Tally.tallyVotes()`](/docs/technical-references/smart-contracts/solidity-docs/Tally#tallyvotes) with a hash of the correct tally results and the zk-SNARK proof. Similarly to the processMessages function, the `tallyVotes` function will send the proof to a verifier contract to ensure that it is valid.
|
|
136
|
+
Finally, once all messages have been processed, the coordinator tallies the votes of the valid messages (off-chain). The coordinator creates a zk-SNARK proving that the valid messages in the state tree (proved in Process Messages step) contain votes that sum to the given tally result. Then, they call [`Tally.tallyVotes()`](/docs/technical-references/smart-contracts/solidity-docs/Tally#tallyvotes) with a hash of the correct tally results and the zk-SNARK proof. Similarly to the `processMessages` function, the `tallyVotes` function will send the proof to a verifier contract to ensure that it is valid.
|
|
137
137
|
|
|
138
138
|
<!-- "hash of the correct tally results" - so are the final results actually put on chain? or just a hash?? -->
|
|
139
139
|
|
|
@@ -77,25 +77,25 @@ Remember that if on a ARM64 chip, you will not be able to compile the c++ witnes
|
|
|
77
77
|
|
|
78
78
|
### Configure circomkit
|
|
79
79
|
|
|
80
|
-
Edit `circuits/circom/circuits` to include the circuits you would like to compile. This comes already configured with the
|
|
80
|
+
Edit `circuits/circom/circuits` to include the circuits you would like to compile. This comes already configured with the main coordinator circuits, in qv, non qv and full credits variants, as well as the client side circuit. The parameters are designed to support testing use cases:
|
|
81
81
|
|
|
82
82
|
```json
|
|
83
83
|
{
|
|
84
84
|
"PollJoining_10_test": {
|
|
85
|
-
"file": "./
|
|
85
|
+
"file": "./voter/PollJoining",
|
|
86
86
|
"template": "PollJoining",
|
|
87
87
|
"params": [10],
|
|
88
88
|
"pubs": ["nullifier", "stateRoot", "pollPublicKey", "pollId"]
|
|
89
89
|
},
|
|
90
90
|
"PollJoined_10_test": {
|
|
91
|
-
"file": "./
|
|
91
|
+
"file": "./voter/PollJoined",
|
|
92
92
|
"template": "PollJoined",
|
|
93
93
|
"params": [10],
|
|
94
94
|
"pubs": ["stateRoot"]
|
|
95
95
|
},
|
|
96
|
-
"
|
|
97
|
-
"file": "./
|
|
98
|
-
"template": "
|
|
96
|
+
"MessageProcessorQv_10-20-2_test": {
|
|
97
|
+
"file": "./coordinator/qv/MessageProcessor",
|
|
98
|
+
"template": "MessageProcessorQv",
|
|
99
99
|
"params": [10, 20, 2],
|
|
100
100
|
"pubs": [
|
|
101
101
|
"totalSignups",
|
|
@@ -109,9 +109,9 @@ Edit `circuits/circom/circuits` to include the circuits you would like to compil
|
|
|
109
109
|
"voteOptions"
|
|
110
110
|
]
|
|
111
111
|
},
|
|
112
|
-
"
|
|
113
|
-
"file": "./
|
|
114
|
-
"template": "
|
|
112
|
+
"MessageProcessorNonQv_10-20-2_test": {
|
|
113
|
+
"file": "./coordinator/non-qv/MessageProcessor",
|
|
114
|
+
"template": "MessageProcessorNonQv",
|
|
115
115
|
"params": [10, 20, 2],
|
|
116
116
|
"pubs": [
|
|
117
117
|
"totalSignups",
|
|
@@ -125,15 +125,31 @@ Edit `circuits/circom/circuits` to include the circuits you would like to compil
|
|
|
125
125
|
"voteOptions"
|
|
126
126
|
]
|
|
127
127
|
},
|
|
128
|
-
"
|
|
129
|
-
"file": "./
|
|
130
|
-
"template": "
|
|
128
|
+
"ProcessMessagesFull_10-20-2_test": {
|
|
129
|
+
"file": "./coordinator/non-qv/MessageProcessor",
|
|
130
|
+
"template": "MessageProcessorFull",
|
|
131
|
+
"params": [10, 20, 2],
|
|
132
|
+
"pubs": [
|
|
133
|
+
"totalSignups",
|
|
134
|
+
"index",
|
|
135
|
+
"batchEndIndex",
|
|
136
|
+
"currentSbCommitment",
|
|
137
|
+
"newSbCommitment",
|
|
138
|
+
"outputBatchHash",
|
|
139
|
+
"actualStateTreeDepth",
|
|
140
|
+
"coordinatorPublicKeyHash",
|
|
141
|
+
"voteOptions"
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
"VoteTallyQv_10-1-2_test": {
|
|
145
|
+
"file": "./coordinator/qv/VoteTally",
|
|
146
|
+
"template": "VoteTallyQv",
|
|
131
147
|
"params": [10, 1, 2],
|
|
132
148
|
"pubs": ["index", "totalSignups", "sbCommitment", "currentTallyCommitment", "newTallyCommitment"]
|
|
133
149
|
},
|
|
134
|
-
"
|
|
135
|
-
"file": "./
|
|
136
|
-
"template": "
|
|
150
|
+
"VoteTallyNonQv_10-1-2_test": {
|
|
151
|
+
"file": "./coordinator/non-qv/VoteTally",
|
|
152
|
+
"template": "VoteTallyNonQv",
|
|
137
153
|
"params": [10, 1, 2],
|
|
138
154
|
"pubs": ["index", "totalSignups", "sbCommitment", "currentTallyCommitment", "newTallyCommitment"]
|
|
139
155
|
}
|
|
@@ -43,7 +43,7 @@ function signUp(PublicKey memory _publicKey, bytes memory _signUpPolicyData) pub
|
|
|
43
43
|
|
|
44
44
|
## InitialVoiceCreditProxy
|
|
45
45
|
|
|
46
|
-
If you'd like to extend the functionality of how votes are distributed among users, you need to
|
|
46
|
+
If you'd like to extend the functionality of how votes are distributed among users, you'll need to build you own initial voice credit proxy contract by following the [IInitialVoiceCreditProxy interface](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/interfaces/IInitialVoiceCreditProxy.sol). You can see our [basic example](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/initialVoiceCreditProxy/ConstantInitialVoiceCreditProxy.sol) how it's implemented for constant distribution.
|
|
47
47
|
|
|
48
48
|
```ts
|
|
49
49
|
contract ConstantInitialVoiceCreditProxy is InitialVoiceCreditProxy {
|
|
@@ -162,7 +162,7 @@ The core package contains a number of tests that are used to verify that the cor
|
|
|
162
162
|
|
|
163
163
|
These tests interact with the crypto and dombinobjs packages, where mock data comes from. Their main goal is to ensure that the core functions work as expected, and that the state is as expected after a series of operations.
|
|
164
164
|
|
|
165
|
-
Currently, there is a blend of e2e and unit tests, where e2e tests are used to verify that the entire MACI local processing works as expected (users signup, publish votes, messages are processed and finally these votes are tallied). Unit tests on the other hand are used to verify that the core functions work as expected, such as `
|
|
165
|
+
Currently, there is a blend of e2e and unit tests, where e2e tests are used to verify that the entire MACI local processing works as expected (users signup, publish votes, messages are processed and finally these votes are tallied). Unit tests on the other hand are used to verify that the core functions work as expected, such as `MessageProcessor` and `VoteTally`. You will find them in separate files, with e2e being [here](https://github.com/privacy-scaling-explorations/maci/blob/dev/core/ts/__tests__/e2e.test.ts) and unit tests in the other files.
|
|
166
166
|
|
|
167
167
|
### Domainobjs/Crypto tests
|
|
168
168
|
|
|
@@ -71,10 +71,10 @@ or download them. Please remember to not use these testing `.zkey` files in prod
|
|
|
71
71
|
|
|
72
72
|
### Download `.zkey` files or the witness generation binaries
|
|
73
73
|
|
|
74
|
-
MACI has two main zk-SNARK circuits, `
|
|
74
|
+
MACI has two main zk-SNARK circuits, `MessageProcessor` and `VoteTally`.
|
|
75
75
|
|
|
76
76
|
:::info
|
|
77
|
-
The `
|
|
77
|
+
The `MessageProcessor` and `VoteTally` circuits are also provided in a non-quadratic voting (non-QV) and in a full credits voting (full) versions. Currently these new versions have not undergone a trusted setup ceremony.
|
|
78
78
|
:::
|
|
79
79
|
|
|
80
80
|
Each circuit is parameterised and there should be one
|
|
@@ -151,6 +151,12 @@ To run e2e tests with normal voting (not quadratic voting):
|
|
|
151
151
|
pnpm run test:e2e-non-qv
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
+
To run e2e tests with full credits voting (full):
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
pnpm run test:e2e-full
|
|
158
|
+
```
|
|
159
|
+
|
|
154
160
|
To run integration tests:
|
|
155
161
|
|
|
156
162
|
```bash
|
|
@@ -11,17 +11,17 @@ sidebar_position: 5
|
|
|
11
11
|
|
|
12
12
|
### Case: missing `.dat` files
|
|
13
13
|
|
|
14
|
-
If your logs look like the following, then make sure you have `
|
|
14
|
+
If your logs look like the following, then make sure you have `MessageProcessorQv_10-2-1-2_test.dat` and `VoteTallyQv_10-1-2_test.dat` files in the same directory as your zkeys:
|
|
15
15
|
|
|
16
16
|
```
|
|
17
17
|
node build/ts/index.js generateProofs -x 0xf204a4Ef082f5c04bB89F7D5E6568B796096735a \
|
|
18
18
|
> -sk macisk.49953af3585856f539d194b46c82f4ed54ec508fb9b882940cbe68bbc57e59e \
|
|
19
19
|
> -o 0 \
|
|
20
20
|
> -r ~/rapidsnark/build/prover \
|
|
21
|
-
> -wp ./zkeys/
|
|
22
|
-
> -wt ./zkeys/
|
|
23
|
-
> -zp ./zkeys/
|
|
24
|
-
> -zt ./zkeys/
|
|
21
|
+
> -wp ./zkeys/MessageProcessorQv_10-2-1-2_test \
|
|
22
|
+
> -wt ./zkeys/VoteTallyQv_10-1-2_test \
|
|
23
|
+
> -zp ./zkeys/MessageProcessorQv_10-2-1-2_test.0.zkey \
|
|
24
|
+
> -zt ./zkeys/VoteTallyQv_10-1-2_test.0.zkey \
|
|
25
25
|
> -t tally.json \
|
|
26
26
|
> -f proofs
|
|
27
27
|
|
|
@@ -36,7 +36,7 @@ terminate called after throwing an instance of 'std::system_error'
|
|
|
36
36
|
Aborted (core dumped)
|
|
37
37
|
|
|
38
38
|
Error: could not generate proof.
|
|
39
|
-
Error: Error executing ./zkeys/
|
|
39
|
+
Error: Error executing ./zkeys/MessageProcessorQv_10-2-1-2_test /tmp/tmp-9904-zG0k8YPTATWB/input.json /tmp/tmp-9904-zG0k8YPTATWB/output.wtns
|
|
40
40
|
at genProof (/home/ubuntu/maci/circuits/ts/index.ts:44:15)
|
|
41
41
|
at /home/ubuntu/maci/cli/ts/generateProofs.ts:339:25
|
|
42
42
|
at step (/home/ubuntu/maci/cli/build/generateProofs.js:33:23)
|
|
@@ -73,7 +73,7 @@ Currently, the ceremony artifacts work with MACI version up to 2.x
|
|
|
73
73
|
In order to run MACI polls, a coordinator is required to publish their MACI public key. You will need to generate a MACI keypair, and treat the private key just as your ethereum private keys. Please store them in a safe place as you won't be able to finish a round if you lose access, or if compromised a bad actor could decrypt the vote and publish them online. You can generate a new key pair using maci-cli by running the following command in the root of the project:
|
|
74
74
|
|
|
75
75
|
```bash
|
|
76
|
-
pnpm run
|
|
76
|
+
pnpm run generate-maci-keypair
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
### Set the .env
|
|
@@ -135,16 +135,16 @@ For testing we suggest using the **FreeForAlPolicy** as it allows anyone to sign
|
|
|
135
135
|
|
|
136
136
|
The VerifyingKeysRegistry hold the verifying keys used to verify the proofs, on the zkeys field we define the path to the zero knowledge artifacts we downloaded in the previous steps.
|
|
137
137
|
|
|
138
|
-
| Property
|
|
139
|
-
|
|
|
140
|
-
| **stateTreeDepth**
|
|
141
|
-
| **
|
|
142
|
-
| **messageTreeDepth**
|
|
143
|
-
| **voteOptionTreeDepth**
|
|
144
|
-
| **messageBatchDepth**
|
|
145
|
-
| **zkeys**
|
|
146
|
-
| **pollJoiningZkey**
|
|
147
|
-
| **pollJoinedZkey**
|
|
138
|
+
| Property | Description |
|
|
139
|
+
| --------------------------------- | ------------------------------------------------------------------------------------ |
|
|
140
|
+
| **stateTreeDepth** | Defines how many users the system supports. |
|
|
141
|
+
| **tallyProcessingStateTreeDepth** | Defines how many ballots can be processed per batch when tallying the results. |
|
|
142
|
+
| **messageTreeDepth** | Defines how many messages (votes) the system supports. |
|
|
143
|
+
| **voteOptionTreeDepth** | Defines how many vote options the system supports. |
|
|
144
|
+
| **messageBatchDepth** | Defines how many messages in a batch can the circuit process. |
|
|
145
|
+
| **zkeys** | Defines the path to the zkey files for QV, Non QV and Full Credits keys. |
|
|
146
|
+
| **pollJoiningZkey** | Defines the zkey to the poll joining circuit which allows to join polls for voting. |
|
|
147
|
+
| **pollJoinedZkey** | Defines the zkey to the poll joined circuit which allows to prove you joined a poll. |
|
|
148
148
|
|
|
149
149
|
:::important
|
|
150
150
|
The recommended values for test keys are: **10-1-2-2-1**. For ceremony keys: **14-5-9-3-2**.
|
|
@@ -203,6 +203,10 @@ As a coordinator, first you need to merge signups and messages (votes). This opt
|
|
|
203
203
|
pnpm merge:[network] --poll [poll-id]
|
|
204
204
|
```
|
|
205
205
|
|
|
206
|
+
:::info
|
|
207
|
+
`poll-id` starts at 0 and increments for each deployed poll
|
|
208
|
+
:::
|
|
209
|
+
|
|
206
210
|
Then you need to generate the proofs for the message processing, and tally calculations. This allows to publish the poll results on-chain and then everyone can verify the results:
|
|
207
211
|
|
|
208
212
|
```bash
|
|
@@ -210,12 +214,16 @@ pnpm run prove:[network] --poll [poll-id] \
|
|
|
210
214
|
--coordinator-private-key [coordinator-maci-private-key] \
|
|
211
215
|
--tally-file ../results/tally.json \
|
|
212
216
|
--output-dir ../results/proofs/ \
|
|
213
|
-
--start-block [block-number]
|
|
217
|
+
--start-block [block-number] \
|
|
214
218
|
--blocks-per-batch [number-of-blocks]
|
|
215
219
|
```
|
|
216
220
|
|
|
217
|
-
:::
|
|
218
|
-
|
|
221
|
+
:::info
|
|
222
|
+
The `--coordinator-private-key` is the one you generated earlier with `pnpm run generate-maci-keypair`.
|
|
223
|
+
|
|
224
|
+
`--start-block` is the block number from which to start looking for events from. You can use the block that you deployed the contracts in.
|
|
225
|
+
|
|
226
|
+
You can reduce the time of the proving by including more blocks per batch with `--blocks-per-batch`, you can try with 500.
|
|
219
227
|
:::
|
|
220
228
|
|
|
221
229
|
#### Submit On-chain
|
|
@@ -224,8 +232,8 @@ Now it's time to submit the poll results on-chain so that everyone can verify th
|
|
|
224
232
|
|
|
225
233
|
```bash
|
|
226
234
|
pnpm submitOnChain:[network] --poll [poll-id] \
|
|
227
|
-
--output-dir proofs/ \
|
|
228
|
-
--tally-file
|
|
235
|
+
--output-dir ../results/proofs/ \
|
|
236
|
+
--tally-file ../results/tally.json
|
|
229
237
|
```
|
|
230
238
|
|
|
231
239
|
### Tally
|
|
@@ -28,6 +28,7 @@ sidebar_position: 13
|
|
|
28
28
|
- [MACI - Starting From Scratch](https://www.youtube.com/watch?v=qVuhWlHnQF0) - Doris Chan 03/2024
|
|
29
29
|
- [MACI Workshop](https://www.youtube.com/watch?v=AimgqnMjG0o) - ctrlc03 04/2024
|
|
30
30
|
- [MACI Starter Kit Demo](https://www.youtube.com/watch?v=pYoBLLtVEoI&t=1s) - Yash 05/2024
|
|
31
|
+
- [The Promise of Blockchain Voting](https://www.youtube.com/watch?v=TQxR7U52ne0) - Sam Richards 06/2024
|
|
31
32
|
- [MACI Tutorial Deploying Contracts and Subgraph](https://www.youtube.com/watch?v=-QA0VB9EUMk) - Crisgarner 09/2024
|
|
32
33
|
- [MACI Tutorial Frontend Deployment 🚀](https://www.youtube.com/watch?v=q0yS8RfwDcw) - Crisgarner 09/2024
|
|
33
34
|
- [Finalizing a MACI Round](https://www.youtube.com/watch?v=nlS3hOC0ljw) - Crisgarner 09/2024
|
|
@@ -49,14 +49,14 @@ pnpm download-zkeys:ceremony
|
|
|
49
49
|
|
|
50
50
|
Here are the **maximum** values supported by these artifacts:
|
|
51
51
|
|
|
52
|
-
**
|
|
52
|
+
**_MessageProcessor_**
|
|
53
53
|
|
|
54
54
|
- users: $2^14 = 16384$
|
|
55
55
|
- votes: $5^9 = 1953125$
|
|
56
56
|
- batch size for proving: $5^2 = 25$
|
|
57
57
|
- vote options: $5^3 = 125$
|
|
58
58
|
|
|
59
|
-
**
|
|
59
|
+
**_VoteTally_**
|
|
60
60
|
|
|
61
61
|
- users (ballots): $2^14 = 16384$
|
|
62
62
|
- batch size for proving: $2^5 = 32$
|
|
@@ -70,14 +70,14 @@ Please note that this ceremony has not started yet. We will inform when it will
|
|
|
70
70
|
|
|
71
71
|
Here are the **maximum** values supported by these artifacts:
|
|
72
72
|
|
|
73
|
-
**
|
|
73
|
+
**_MessageProcessor_**
|
|
74
74
|
|
|
75
75
|
- users: $2^14 = 16384$
|
|
76
76
|
- votes: $5^9 = 1953125$
|
|
77
77
|
- batch size for proving: $5^3 = 125$
|
|
78
78
|
- vote options: $5^3 = 125$
|
|
79
79
|
|
|
80
|
-
**
|
|
80
|
+
**_VoteTally_**
|
|
81
81
|
|
|
82
82
|
- users (ballots): $2^14 = 16384$
|
|
83
83
|
- batch size for proving: $2^7 = 128$
|
|
@@ -101,14 +101,14 @@ download:ceremony-zkeys
|
|
|
101
101
|
|
|
102
102
|
Here are the **maximum** values supported by these artifacts:
|
|
103
103
|
|
|
104
|
-
**
|
|
104
|
+
**_MessageProcessor_**
|
|
105
105
|
|
|
106
106
|
- users: $5^6 = 15625$
|
|
107
107
|
- votes: $5^9 = 1953125$
|
|
108
108
|
- batch size for proving: $5^2 = 25$
|
|
109
109
|
- vote options: $5^3 = 125$
|
|
110
110
|
|
|
111
|
-
**
|
|
111
|
+
**_VoteTally_**
|
|
112
112
|
|
|
113
113
|
- users (ballots): $5^6 = 15625$
|
|
114
114
|
- batch size for proving: $5^2 = 25$
|
|
@@ -118,39 +118,39 @@ For your convenience, here is a list of the artifacts that can be used in produc
|
|
|
118
118
|
|
|
119
119
|
| Artifact | Description | Parameters | Link |
|
|
120
120
|
| -------------------------------------- | -------------------------------------------------------------------------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
121
|
-
|
|
|
121
|
+
| MessageProcessor zKey | The production-ready zKey for the MessageProcessor circuit. | 6-9-2-3 | [processMessages_6-9-2-3_final.zkey](https://maci-v1-2-0-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/MACI-MessageProcessorQv_6-9-2-3/contributions/MACI-MessageProcessorQv_6-9-2-3_final.zkey) |
|
|
122
122
|
| processMessagesNonQv zKey | The production-ready zKey for the processMessagesNonQv circuit. | 6-9-2-3 | [processMessagesNonQv_6-9-2-3_final.zkey](https://maci-v1-2-0-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/maci-processmessagesnonqv_6-9-2-3/contributions/maci-processmessagesnonqv_6-9-2-3_final.zkey) |
|
|
123
|
-
|
|
|
124
|
-
| tallyVotesNonQv zKey | The production-ready zKey for the tallyVotesNonQv circuit. | 6-2-3 | [tallyVotesNonQv_6-2-3_final.zkey](https://maci-v1-2-0-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/
|
|
125
|
-
|
|
|
123
|
+
| VoteTally zKey | The production-ready zKey for the VoteTally circuit. | 6-2-3 | [tallyVotes_6-2-3_final.zkey](https://maci-v1-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/VoteTallyQv_6-2-3/contributions/VoteTallyQv_6-2-3_final.zkey) |
|
|
124
|
+
| tallyVotesNonQv zKey | The production-ready zKey for the tallyVotesNonQv circuit. | 6-2-3 | [tallyVotesNonQv_6-2-3_final.zkey](https://maci-v1-2-0-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/MACI-VoteTallyNonQv_6-2-3/contributions/MACI-VoteTallyNonQv_6-2-3_final.zkey) |
|
|
125
|
+
| MessageProcessor r1cs | The Rank-1 Constraint System file that was used to generate the zKey | 6-9-2-3 | [MACI-MessageProcessorQv_6-9-2-3.r1cs ](https://maci-v1-2-0-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/MACI-MessageProcessorQv_6-9-2-3/MACI-MessageProcessorQv_6-9-2-3.r1cs) |
|
|
126
126
|
| processMessagesNonQv r1cs | The Rank-1 Constraint System file that was used to generate the zKey | 6-9-2-3 | [MACI-ProcessMessagesNonQv_6-9-2-3.r1cs](https://maci-v1-2-0-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/maci-processmessagesnonqv_6-9-2-3/MACI-ProcessMessagesNonQv_6-9-2-3.r1cs) |
|
|
127
|
-
|
|
|
128
|
-
| tallyVotesNonQv r1cs | The Rank-1 Constraint System file that was used to generate the zKey | 6-2-3 | [
|
|
129
|
-
|
|
|
127
|
+
| VoteTally r1cs | The Rank-1 Constraint System file that was used to generate the zKey | 6-2-3 | [VoteTallyQv_6-2-3.r1cs](https://maci-v1-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/VoteTallyQv_6-2-3/VoteTallyQv_6-2-3.r1cs) |
|
|
128
|
+
| tallyVotesNonQv r1cs | The Rank-1 Constraint System file that was used to generate the zKey | 6-2-3 | [VoteTallyNonQv_6-2-3.r1cs](https://maci-v1-2-0-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/MACI-VoteTallyNonQv_6-2-3/MACI-VoteTallyNonQv_6-2-3.r1cs) |
|
|
129
|
+
| MessageProcessor wasm | The WASM file that can be used to generate proofs | 6-9-2-3 | [MACI-MessageProcessorQv_6-9-2-3.wasm](https://maci-v1-2-0-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/MACI-MessageProcessorQv_6-9-2-3/MACI-MessageProcessorQv_6-9-2-3.wasm) |
|
|
130
130
|
| processMessagesNonQv wasm | The WASM file that can be used to generate proofs | 6-9-2-3 | [MACI-ProcessMessagesNonQv_6-9-2-3.wasm](https://maci-v1-2-0-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/maci-processmessagesnonqv_6-9-2-3/MACI-ProcessMessagesNonQv_6-9-2-3.wasm) |
|
|
131
|
-
|
|
|
132
|
-
| tallyVotesNonQv wasm | The WASM file that can be used to generate proofs | 6-2-3 | [
|
|
133
|
-
|
|
|
131
|
+
| VoteTally wasm | The WASM file that can be used to generate proofs | 6-2-3 | [VoteTallyQv_6-2-3.wasm](https://maci-v1-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/VoteTallyQv_6-2-3/VoteTallyQv_6-2-3.wasm) |
|
|
132
|
+
| tallyVotesNonQv wasm | The WASM file that can be used to generate proofs | 6-2-3 | [VoteTallyNonQv_6-2-3.wasm](https://maci-v1-2-0-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/MACI-VoteTallyNonQv_6-2-3/MACI-VoteTallyNonQv_6-2-3.wasm) |
|
|
133
|
+
| MessageProcessor vKey | The verification key that can be used to verify the MessageProcessor circuit's proofs | 6-9-2-3 | [MACI-MessageProcessorQv_6-9-2-3_vkey.json](https://maci-v1-2-0-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/MACI-MessageProcessorQv_6-9-2-3/MACI-MessageProcessorQv_6-9-2-3_vkey.json) |
|
|
134
134
|
| processMessagesNonQv vKey | The verification key that can be used to verify the processMessagesNonQv circuit's proofs | 6-9-2-3 | [maci-processmessagesnonqv_6-9-2-3_vkey.json](https://maci-v1-2-0-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/maci-processmessagesnonqv_6-9-2-3/maci-processmessagesnonqv_6-9-2-3_vkey.json) |
|
|
135
|
-
|
|
|
136
|
-
| tallyVotesNonQv vKey | The verification key that can be used to verify the tallyVotesNonQv circuit's proofs | 6-2-3 | [
|
|
137
|
-
|
|
|
135
|
+
| VoteTally vKey | The verification key that can be used to verify the VoteTally circuit's proofs | 6-2-3 | [VoteTallyQv_6-2-3_vkey.json](https://maci-v1-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/VoteTallyQv_6-2-3/VoteTallyQv_6-2-3_vkey.json) |
|
|
136
|
+
| tallyVotesNonQv vKey | The verification key that can be used to verify the tallyVotesNonQv circuit's proofs | 6-2-3 | [VoteTallyNonQv_6-2-3_vkey.json](https://maci-v1-2-0-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/MACI-VoteTallyNonQv_6-2-3/MACI-VoteTallyNonQv_6-2-3_vkey.json) |
|
|
137
|
+
| MessageProcessor Solidity verifier | The Solidity smart contract which can be used to verify the MessageProcessor circuit proofs on-chain | 6-9-2-3 | [MACI-MessageProcessorQv_6-9-2-3_verifier.sol](https://maci-v1-2-0-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/MACI-MessageProcessorQv_6-9-2-3/MACI-MessageProcessorQv_6-9-2-3_verifier.sol) |
|
|
138
138
|
| processMessagesNonQv Solidity verifier | The Solidity smart contract which can be used to verify the processMessagesNonQv circuit proofs on-chain | 6-9-2-3 | [maci-processmessagesnonqv_6-9-2-3_verifier.sol](https://maci-v1-2-0-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/maci-processmessagesnonqv_6-9-2-3/maci-processmessagesnonqv_6-9-2-3_verifier.sol) |
|
|
139
|
-
|
|
|
140
|
-
| tallyVotesNonQv Solidity verifier | The Solidity smart contract which can be used to verify the tallyVotesNonQv circuit proofs on-chain | 6-2-3 | [
|
|
139
|
+
| VoteTally Solidity verifier | The Solidity smart contract which can be used to verify the VoteTally circuit proofs on-chain | 6-2-3 | [VoteTallyQv_6-2-3_verifier.sol](https://maci-v1-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/VoteTallyQv_6-2-3/VoteTallyQv_6-2-3_verifier.sol) |
|
|
140
|
+
| tallyVotesNonQv Solidity verifier | The Solidity smart contract which can be used to verify the tallyVotesNonQv circuit proofs on-chain | 6-2-3 | [VoteTallyNonQv_6-2-3_verifier.sol](https://maci-v1-2-0-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/MACI-VoteTallyNonQv_6-2-3/MACI-VoteTallyNonQv_6-2-3_verifier.sol) |
|
|
141
141
|
|
|
142
142
|
## Maci v1.1 Trusted Setup Ceremony
|
|
143
143
|
|
|
144
144
|
Here are the **maximum** values supported by these artifacts:
|
|
145
145
|
|
|
146
|
-
**
|
|
146
|
+
**_MessageProcessor_**
|
|
147
147
|
|
|
148
148
|
- users: $5^6 = 15625$
|
|
149
149
|
- votes: $5^8 = 390625$
|
|
150
150
|
- messages per batch: $5^2 = 25$
|
|
151
151
|
- vote options: $5^3 = 125$
|
|
152
152
|
|
|
153
|
-
**
|
|
153
|
+
**_VoteTally_**
|
|
154
154
|
|
|
155
155
|
- users (ballots): $5^6 = 15625$
|
|
156
156
|
- batch size: $5^2 = 25$
|
|
@@ -158,15 +158,15 @@ Here are the **maximum** values supported by these artifacts:
|
|
|
158
158
|
|
|
159
159
|
For your convenience, here is a list of the artifacts that can be used in production:
|
|
160
160
|
|
|
161
|
-
| Artifact
|
|
162
|
-
|
|
|
163
|
-
|
|
|
164
|
-
|
|
|
165
|
-
|
|
|
166
|
-
|
|
|
167
|
-
| processMessage wasm
|
|
168
|
-
|
|
|
169
|
-
|
|
|
170
|
-
|
|
|
171
|
-
|
|
|
172
|
-
|
|
|
161
|
+
| Artifact | Description | Parameters | Link |
|
|
162
|
+
| ---------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
163
|
+
| MessageProcessor zKey | The production-ready zKey for the MessageProcessor circuit. | 6-8-2-3 | [processmessages_6-8-2-3_final.zkey](https://maci-v1-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/processmessages_6-8-2-3/contributions/processmessages_6-8-2-3_final.zkey) |
|
|
164
|
+
| VoteTally zKey | The production-ready zKey for the VoteTally circuit. | 6-2-3 | [VoteTallyQv_6-2-3_final.zkey](https://maci-v1-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/VoteTallyQv_6-2-3/contributions/VoteTallyQv_6-2-3_final.zkey) |
|
|
165
|
+
| MessageProcessor r1cs | The Rank-1 Constraint System file that was used to generate the zKey | 6-8-2-3 | [processmessages_6-8-2-3.r1cs](https://maci-v1-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/processmessages_6-8-2-3/processmessages_6-8-2-3.r1cs) |
|
|
166
|
+
| VoteTally r1cs | The Rank-1 Constraint System file that was used to generate the zKey | 6-2-3 | [VoteTallyQv_6-2-3.r1cs](https://maci-v1-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/VoteTallyQv_6-2-3/VoteTallyQv_6-2-3.r1cs) |
|
|
167
|
+
| processMessage wasm | The WASM file that can be used to generate proofs | 6-8-2-3 | [processmessages_6-8-2-3.wasm](https://maci-v1-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/processmessages_6-8-2-3/processmessages_6-8-2-3.wasm) |
|
|
168
|
+
| VoteTally wasm | The WASM file that can be used to generate proofs | 6-2-3 | [VoteTallyQv_6-2-3.wasm](https://maci-v1-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/VoteTallyQv_6-2-3/VoteTallyQv_6-2-3.wasm) |
|
|
169
|
+
| MessageProcessor vKey | The verification key that can be used to verify the MessageProcessor circuit's proofs | 6-8-2-3 | [processmessages_6-8-2-3_vkey.json](https://maci-v1-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/processmessages_6-8-2-3/processmessages_6-8-2-3_vkey.json) |
|
|
170
|
+
| VoteTally vKey | The verification key that can be used to verify the VoteTally circuit's proofs | 6-2-3 | [VoteTallyQv_6-2-3_vkey.json](https://maci-v1-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/VoteTallyQv_6-2-3/VoteTallyQv_6-2-3_vkey.json) |
|
|
171
|
+
| MessageProcessor Solidity verifier | The Solidity smart contract which can be used to verify the MessageProcessor circuit proofs on-chain | 6-8-2-3 | [processmessages_6-8-2-3_verifier.sol](https://maci-v1-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/processmessages_6-8-2-3/processmessages_6-8-2-3_verifier.sol) |
|
|
172
|
+
| VoteTally Solidity verifier | The Solidity smart contract which can be used to verify the VoteTally circuit proofs on-chain | 6-2-3 | [VoteTallyQv_6-2-3_verifier.sol](https://maci-v1-trusted-setup-ceremony-pse-p0tion-production.s3.eu-central-1.amazonaws.com/circuits/VoteTallyQv_6-2-3/VoteTallyQv_6-2-3_verifier.sol) |
|
|
@@ -7,14 +7,14 @@ sidebar_position: 2
|
|
|
7
7
|
|
|
8
8
|
There are a number of MACI's smart contracts which can be re-used by different deployments. These are the following:
|
|
9
9
|
|
|
10
|
-
- [VerifyingKeysRegistry](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/VerifyingKeysRegistry.sol)
|
|
11
|
-
- [PoseidonHashers](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/crypto/Hasher.sol)
|
|
12
|
-
- [PollFactory](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/PollFactory.sol)
|
|
13
|
-
- [MessageProcessorFactory](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/MessageProcessorFactory.sol)
|
|
14
|
-
- [TallyFactory](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/TallyFactory.sol)
|
|
15
|
-
- [Verifier](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/crypto/Verifier.sol)
|
|
10
|
+
- [VerifyingKeysRegistry](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/VerifyingKeysRegistry.sol)
|
|
11
|
+
- [PoseidonHashers](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/crypto/Hasher.sol)
|
|
12
|
+
- [PollFactory](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/PollFactory.sol)
|
|
13
|
+
- [MessageProcessorFactory](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/MessageProcessorFactory.sol)
|
|
14
|
+
- [TallyFactory](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/TallyFactory.sol)
|
|
15
|
+
- [Verifier](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/crypto/Verifier.sol)
|
|
16
16
|
- [FreeForAllPolicy](https://github.com/privacy-scaling-explorations/excubiae/tree/main/packages/contracts/contracts/extensions/freeForAll)
|
|
17
|
-
- [ConstantInitialVoiceCreditProxy](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/initialVoiceCreditProxy/ConstantInitialVoiceCreditProxy.sol) - if you are happy to work with a fixed amount of credits
|
|
17
|
+
- [ConstantInitialVoiceCreditProxy](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/initialVoiceCreditProxy/ConstantInitialVoiceCreditProxy.sol) - if you are happy to work with a fixed amount of credits
|
|
18
18
|
|
|
19
19
|
VkRegistries can be re-used by different protocols to share the same set of verifying keys. Please be advised that you should be verifying that those verifying keys are the ones that have undergone a trusted setup ceremony.
|
|
20
20
|
|
|
@@ -25,7 +25,7 @@ In order to verify you will need the following:
|
|
|
25
25
|
- run checkVerifyingKeys with the cli (see below)
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
cd cli && node build/ts/index.js checkVerifyingKeys -q false -vk 0x74569d524a193daC0D3Df17B9E207C916174745b -s 6 -i 2 -m 9 -v 3 -b 2 -p ./zkeys/
|
|
28
|
+
cd cli && node build/ts/index.js checkVerifyingKeys -q false -vk 0x74569d524a193daC0D3Df17B9E207C916174745b -s 6 -i 2 -m 9 -v 3 -b 2 -p ./zkeys/MessageProcessorQv_6-9-2-3/MessageProcessorQv_6-9-2-3.zkey -t ./zkeys/VoteTallyQv_6-2-3/tallyVotes_6-2-3.zkey
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
:::info
|
|
@@ -6,7 +6,7 @@ sidebar_position: 1
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
:::info
|
|
9
|
-
Code location: [MACI.sol](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/MACI.sol)
|
|
9
|
+
Code location: [MACI.sol](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/MACI.sol)
|
|
10
10
|
:::
|
|
11
11
|
|
|
12
12
|
`MACI.sol` is the core contract of the project, as it provides the base layer for user signups and Polls to be created.
|
|
@@ -149,7 +149,7 @@ Polls require the following information:
|
|
|
149
149
|
- `coordinatorPubKey`: the public key of the poll's coordinator
|
|
150
150
|
- `verifier`: the address of the zk-SNARK verifier contract
|
|
151
151
|
- `vkRegistry`: the address of the vk registry contract
|
|
152
|
-
- `mode`: the mode of the poll, to set whether it supports quadratic voting
|
|
152
|
+
- `mode`: the mode of the poll, to set whether it supports quadratic voting, non quadratic voting, full credits voting
|
|
153
153
|
- `signUpPolicy`: the address of the sign up policy contract
|
|
154
154
|
- `initialVoiceCreditProxy`: the address of the initial voice credit proxy contract
|
|
155
155
|
- `relayers`: the addresses of the relayers for the poll (if offchain voting is enabled)
|
package/versioned_docs/version-v3.x/technical-references/smart-contracts/MessageProcessor.md
CHANGED
|
@@ -6,7 +6,7 @@ sidebar_position: 4
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
:::info
|
|
9
|
-
Code location: [MessageProcessor.sol](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/MessageProcessor.sol)
|
|
9
|
+
Code location: [MessageProcessor.sol](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/MessageProcessor.sol)
|
|
10
10
|
:::
|
|
11
11
|
|
|
12
12
|
This contract is used to prepare parameters for the zk-SNARK circuits as well as for verifying proofs. It should be deployed alongside a `Poll`.
|
|
@@ -6,7 +6,7 @@ sidebar_position: 9
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
:::info
|
|
9
|
-
Code location: [Params.sol](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/
|
|
9
|
+
Code location: [Params.sol](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/utilities/Params.sol)
|
|
10
10
|
:::
|
|
11
11
|
|
|
12
12
|
A contract holding three structs:
|
|
@@ -14,7 +14,7 @@ A contract holding three structs:
|
|
|
14
14
|
```ts
|
|
15
15
|
/// @notice A struct holding the depths of the merkle trees
|
|
16
16
|
struct TreeDepths {
|
|
17
|
-
uint8
|
|
17
|
+
uint8 tallyProcessingStateTreeDepth;
|
|
18
18
|
uint8 voteOptionTreeDepth;
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -6,7 +6,7 @@ sidebar_position: 2
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
:::info
|
|
9
|
-
Code location: [Poll.sol](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/Poll.sol)
|
|
9
|
+
Code location: [Poll.sol](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/Poll.sol)
|
|
10
10
|
:::
|
|
11
11
|
|
|
12
12
|
This contract allows users to submit their votes.
|
|
@@ -6,7 +6,7 @@ sidebar_position: 3
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
:::info
|
|
9
|
-
Code location: [PollFactory.sol](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/PollFactory.sol)
|
|
9
|
+
Code location: [PollFactory.sol](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/PollFactory.sol)
|
|
10
10
|
:::
|
|
11
11
|
|
|
12
12
|
`PollFactory` is a smart contract that is used to deploy new Polls. This is used by MACI inside the `deployPoll` function.
|
|
@@ -6,7 +6,7 @@ sidebar_position: 5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
:::info
|
|
9
|
-
Code location: [Tally.sol](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/Tally.sol)
|
|
9
|
+
Code location: [Tally.sol](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/Tally.sol)
|
|
10
10
|
:::
|
|
11
11
|
|
|
12
12
|
The `Tally` contract is used by the coordinator to submit commitments to the tally results via the `tallyVotes` function. This is done in batches and the final commitment can be used by the users to verify the validity of the results.
|
|
@@ -34,7 +34,7 @@ This contract should be deployed alongside a `Poll`, with the the constructor ac
|
|
|
34
34
|
- `vkRegistry` - The address of the vkRegistry contract
|
|
35
35
|
- `poll` - The address of the poll contract
|
|
36
36
|
- `messageProcessor` - The address of the messageProcessor contract
|
|
37
|
-
- `mode` - The mode of the tally contract - depending on this, the commitments will be processed differently, and it must equal the Poll mode (quadratic vs non quadratic voting)
|
|
37
|
+
- `mode` - The mode of the tally contract - depending on this, the commitments will be processed differently, and it must equal the Poll mode (quadratic vs non quadratic vs full credits voting)
|
|
38
38
|
|
|
39
39
|
Users can use the verification functions to verify the Tally results. These are as follows:
|
|
40
40
|
|
|
@@ -6,19 +6,19 @@ sidebar_position: 8
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
:::info
|
|
9
|
-
Code location: [VerifyingKeysRegistry.sol](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/VerifyingKeysRegistry.sol)
|
|
9
|
+
Code location: [VerifyingKeysRegistry.sol](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/VerifyingKeysRegistry.sol)
|
|
10
10
|
:::
|
|
11
11
|
|
|
12
12
|
The VerifyingKeysRegistry is a contract that holds the verifying keys for the zk-SNARK circuits. It holds four different sets of keys:
|
|
13
13
|
|
|
14
|
-
- `processVks` - The keys for the
|
|
15
|
-
- `tallyVks` - The keys for the
|
|
14
|
+
- `processVks` - The keys for the MessageProcessor circuit
|
|
15
|
+
- `tallyVks` - The keys for the VoteTally circuit
|
|
16
16
|
- `pollJoiningVk` - The key for the poll joining circuit
|
|
17
17
|
- `pollJoinedVk` - The key for the poll joined circuit
|
|
18
18
|
|
|
19
19
|
Each circuit will have a signature which is its compile-time constants represented as a uint256.
|
|
20
20
|
|
|
21
|
-
Please note that each Verifying Key should be set with the corresponding mode. Available modes are quadratic
|
|
21
|
+
Please note that each Verifying Key should be set with the corresponding mode. Available modes are quadratic, non quadratic and full credits voting.
|
|
22
22
|
|
|
23
23
|
The contract owner can set them using the `setVerifyingKeysBatch` function:
|
|
24
24
|
|
package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/processMessages.md
CHANGED
|
@@ -5,11 +5,11 @@ sidebar_label: Process Messages Circuit
|
|
|
5
5
|
sidebar_position: 3
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
[**Repo link**](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/
|
|
8
|
+
[**Repo link**](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/coordinator)
|
|
9
9
|
|
|
10
10
|
This circuit allows the coordinator to prove that they have correctly processed each message in reverse order, in a consecutive batch of 5 ^ messageBatchDepth messages to the respective state leaf within the state tree. Coordinators would use this circuit to prove correct execution at the end of each Poll.
|
|
11
11
|
|
|
12
|
-
The [`
|
|
12
|
+
The [`MessageProcessorQv`](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/coordinator/qv/MessageProcessor.circom) circuit will try to decrypt the messages, and based on the content of the message, update within itself the trees, to generate a proof that the coordinator's off-chain processing was done correctly. In other words, the circuit takes a final state, an initial state, and the leaves (messages and user signups) - it processes these messages via the different state transitions to finally check that the expected state is correct.
|
|
13
13
|
The pre-requisites for this circuit are:
|
|
14
14
|
|
|
15
15
|
- the related Poll has ended
|
|
@@ -21,7 +21,11 @@ This circuit requires the coordinator's private key, hence a proof for this circ
|
|
|
21
21
|

|
|
22
22
|
|
|
23
23
|
:::info
|
|
24
|
-
A version working with non quadratic voting (non-qv) is also [available](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/
|
|
24
|
+
A version working with non quadratic voting (non-qv) is also [available](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/coordinator/non-qv/MessageProcessor.circom). This version is called `MessageProcessorNonQV` and is to be used when the Poll is not using the quadratic voting feature. Note that by default MACI works with quadratic voting.
|
|
25
|
+
:::
|
|
26
|
+
|
|
27
|
+
:::info
|
|
28
|
+
A version working with full credits voting (full) is also [available](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/coordinator/full/MessageProcessor.circom). This version is called `MessageProcessorFull` and is to be used when the Poll is not using the quadratic or non quadratic voting features. Note that by default MACI works with quadratic voting.
|
|
25
29
|
:::
|
|
26
30
|
|
|
27
31
|
#### Parameters
|
|
@@ -37,7 +37,7 @@ MACI's circuits are parameterized, and thus can be configured to support differe
|
|
|
37
37
|
- **STATE_TREE_DEPTH** = how many users the system supports
|
|
38
38
|
- **VOTE_OPTIONS_TREE_DEPTH** = how many vote options the system supports
|
|
39
39
|
- **MESSAGE_BATCH_SIZE** = how many messages in a batch the circuit should process
|
|
40
|
-
- **
|
|
40
|
+
- **TALLY_PROCESSING_STATE_TREE_DEPTH** = how many ballots can be processed per batch when tallying the results (`5 ** TALLY_PROCESSING_STATE_TREE_DEPTH` ballots)
|
|
41
41
|
|
|
42
42
|
Please refer to the individual circuit documentation for more details on the inner working of each circuit and where parameters fit.
|
|
43
43
|
|
|
@@ -90,7 +90,7 @@ To test the circuits package, please use `pnpm run test`. This will run all of t
|
|
|
90
90
|
|
|
91
91
|
To run individual tests, you can use the following commands (for all other circuits please refer to the `package.json` scripts section):
|
|
92
92
|
|
|
93
|
-
- `pnpm run test:
|
|
94
|
-
- `pnpm run test:
|
|
93
|
+
- `pnpm run test:messageProcessor` to run the tests for the `MessageProcessor` circuit.
|
|
94
|
+
- `pnpm run test:voteTally` to run the tests for the `VoteTally` circuit.
|
|
95
95
|
|
|
96
96
|
More details on testing are provided in the [testing section](/docs/guides/testing/testing-introduction) of the documentation.
|
|
@@ -15,10 +15,10 @@ sidebar_position: 4
|
|
|
15
15
|
| 1 | State leaf batch depth | Allows $(5^{n})$ users' votes to be processed per batch. |
|
|
16
16
|
| 2 | Vote option tree depth | Allows $(5^{n})$ vote options. |
|
|
17
17
|
|
|
18
|
-

|
|
19
19
|
|
|
20
20
|
:::info
|
|
21
|
-
A version working with non quadratic voting (non-qv) is also [available](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/
|
|
21
|
+
A version working with non quadratic and full credits voting (non-qv, full) is also [available](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/coordinator/non-qv/VoteTally.circom). This version is called `tallyVotes` and is to be used when the Poll is not using the quadratic voting feature. Note that by default MACI works with quadratic voting.
|
|
22
22
|
:::
|
|
23
23
|
|
|
24
24
|
#### Input signals
|
|
@@ -73,7 +73,7 @@ $poseidon_3([tc_r, tc_t, tc_p])$
|
|
|
73
73
|
|
|
74
74
|
1. That the coordinator knows the preimage of `sbCommitment`
|
|
75
75
|
2. That `index` is less than or equal to `totalSignups`
|
|
76
|
-
3. That each ballot in `ballots` is in a member of the ballot tree with the Merkle root `ballotRoot` at indices `batchStartIndex` to `batchStartIndex + (5 **
|
|
76
|
+
3. That each ballot in `ballots` is in a member of the ballot tree with the Merkle root `ballotRoot` at indices `batchStartIndex` to `batchStartIndex + (5 ** tallyProcessingStateTreeDepth)`
|
|
77
77
|
4. That each set of votes (`votes[i]`) has the Merkle root $blt_r$ whose value equals `ballots[i][1]`
|
|
78
78
|
5. That the tally is valid, which is:
|
|
79
79
|
- That the sum of votes per vote option is correct
|
|
@@ -7,7 +7,7 @@ sidebar_position: 5
|
|
|
7
7
|
|
|
8
8
|
#### Process Messages Input Hasher
|
|
9
9
|
|
|
10
|
-
A utility circuit used by the main `
|
|
10
|
+
A utility circuit used by the main `MessageProcessor` circuit to hash its inputs.
|
|
11
11
|
|
|
12
12
|

|
|
13
13
|
|
|
@@ -35,7 +35,7 @@ It outputs one field element, which is the SHA256 hash of the following inputs:
|
|
|
35
35
|
|
|
36
36
|
#### ResultsCommitmentVerifier
|
|
37
37
|
|
|
38
|
-
A utility circuit used by the main `
|
|
38
|
+
A utility circuit used by the main `VoteTally` circuit to verify that the results commitment is correct.
|
|
39
39
|
|
|
40
40
|

|
|
41
41
|
|
package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/zk-snark-circuits.md
CHANGED
|
@@ -5,10 +5,10 @@ sidebar_label: zk-SNARK Circuits
|
|
|
5
5
|
sidebar_position: 1
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
MACI has three main zk-SNARK [circuits](https://github.com/privacy-scaling-explorations/maci/tree/dev/circuits):
|
|
8
|
+
MACI has three main zk-SNARK [circuits](https://github.com/privacy-scaling-explorations/maci/tree/dev/packages/circuits):
|
|
9
9
|
|
|
10
|
-
1. ProcessMessages.circom, which takes a batch of encrypted messages, decrypts them, and generates a proof that the coordinator's local processing was performed correctly. [QV](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/
|
|
11
|
-
2. TallyVotes.circom, which counts votes from users' ballots, batch by batch. [QV](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/
|
|
10
|
+
1. ProcessMessages.circom, which takes a batch of encrypted messages, decrypts them, and generates a proof that the coordinator's local processing was performed correctly. [QV](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/coordinator/qv/MessageProcessor.circom), [non-QV](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/coordinator/non-qv/MessageProcessor.circom), [Full](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/coordinator/full/MessageProcessor.circom) versions are available.
|
|
11
|
+
2. TallyVotes.circom, which counts votes from users' ballots, batch by batch. [QV](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/coordinator/qv/VoteTally.circom) and [non-QV](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/coordinator/non-qv/VoteTally.circom) versions are available.
|
|
12
12
|
3. PollJoining.circom, which allows users to prove they know a private key for a public key signed up to the MACI smart contract, and to register to a specific poll.
|
|
13
13
|
|
|
14
14
|
The rest of the circuits are utilities templates that are required for the main circuits to work correctly. These include utilities such as float math, conversion of private keys, and Poseidon hashing/encryption.
|