@maci-protocol/website 0.0.0-ci.eb89f0b → 0.0.0-ci.ec5a063
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 +2 -2
- package/versioned_docs/version-v0.x/quadratic-vote-tallying-circuit.md +16 -16
- package/versioned_docs/version-v3.x/core-concepts/poll-types.md +1 -1
- package/versioned_docs/version-v3.x/core-concepts/polls.md +1 -1
- package/versioned_docs/version-v3.x/core-concepts/spec.md +6 -6
- package/versioned_docs/version-v3.x/guides/integrating.md +1 -1
- package/versioned_docs/version-v3.x/quick-start.md +23 -15
- package/versioned_docs/version-v3.x/supported-networks/deployed-contracts.md +7 -7
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/MACI.md +1 -1
- 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 +1 -1
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/VkRegistry.md +1 -1
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/setup.md +1 -1
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/tallyVotes.md +1 -1
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/zk-snark-circuits.md +1 -1
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.ec5a063",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"engines": {
|
|
62
62
|
"node": ">=18.0"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "08e13ae149ca179df0465f222f6a3a51eca3dc2a"
|
|
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:
|
|
@@ -11,7 +11,7 @@ This document will explain how to use each of these options. Hardhat tasks are t
|
|
|
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
|
|
|
@@ -34,7 +34,7 @@ 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
|
|
|
@@ -751,11 +751,11 @@ The coordinator uses the ballot tallying circuit (`tallyVotes.circom`) to genera
|
|
|
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
|
|
@@ -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 {
|
|
@@ -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 and Non QV 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 generateMaciKeyPair`.
|
|
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
|
|
@@ -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
|
|
|
@@ -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.
|
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.
|
|
@@ -6,7 +6,7 @@ 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:
|
|
@@ -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
|
|
|
@@ -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
|
package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/zk-snark-circuits.md
CHANGED
|
@@ -5,7 +5,7 @@ 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
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/core/qv/processMessages.circom) and [non-QV](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/core/non-qv/processMessages.circom) versions are available.
|
|
11
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/core/qv/tallyVotes.circom) and [non-QV](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/core/non-qv/tallyVotes.circom) versions are available.
|