@maci-protocol/website 0.0.0-ci.044d30d → 0.0.0-ci.068da56
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/LICENSE +1 -2
- package/blog/2024-02-28-maci-v1.2.0.md +1 -1
- package/blog/2024-08-10-maci-v2.md +1 -1
- package/docusaurus.config.ts +2 -2
- package/package.json +4 -4
- package/src/pages/roadmap.md +39 -80
- package/static/img/circuits/MACI-Circuits.excalidraw +79 -79
- package/static/img/circuits/ecdh.svg +1 -1
- package/static/img/circuits/messageToCommand.svg +1 -1
- package/static/img/circuits/messageValidator.svg +1 -1
- package/static/img/circuits/privToPubkey.svg +1 -1
- package/static/img/circuits/processMessages.svg +1 -1
- package/static/img/circuits/processMessagesInputHasher.svg +1 -1
- package/static/img/circuits/processMessages_2_0.svg +1 -1
- package/static/img/circuits/processOne.svg +1 -1
- package/static/img/circuits/processTopup.svg +1 -1
- package/static/img/circuits/quinBatchLeavesExists.svg +1 -1
- package/static/img/circuits/quinCheckRoot.svg +1 -1
- package/static/img/circuits/quinGeneratePathIndices.svg +1 -1
- package/static/img/circuits/quinSelector.svg +1 -1
- package/static/img/circuits/resultsCommitmentVerifier.svg +1 -1
- package/static/img/circuits/splicer.svg +1 -1
- package/static/img/circuits/tallyInputHasher.svg +1 -1
- package/static/img/circuits/tallyVotes.svg +1 -1
- package/static/img/circuits/verifySignature.svg +1 -1
- package/versioned_docs/version-v0.x/quadratic-vote-tallying-circuit.md +16 -16
- package/versioned_docs/version-v3.x/core-concepts/key-change.md +28 -28
- package/versioned_docs/version-v3.x/core-concepts/maci-keys.md +1 -1
- package/versioned_docs/version-v3.x/core-concepts/poll-types.md +33 -9
- package/versioned_docs/version-v3.x/core-concepts/polls.md +34 -10
- package/versioned_docs/version-v3.x/core-concepts/spec.md +40 -106
- package/versioned_docs/version-v3.x/core-concepts/workflow.md +1 -1
- package/versioned_docs/version-v3.x/guides/compile-circuits.md +36 -20
- package/versioned_docs/version-v3.x/guides/integrating.md +9 -9
- package/versioned_docs/version-v3.x/guides/testing/testing-in-detail.md +2 -2
- package/versioned_docs/version-v3.x/guides/testing/testing-introduction.md +8 -2
- package/versioned_docs/version-v3.x/guides/troubleshooting.md +17 -17
- package/versioned_docs/version-v3.x/quick-start.md +29 -21
- package/versioned_docs/version-v3.x/resources.md +1 -0
- package/versioned_docs/version-v3.x/security/audit.md +2 -2
- package/versioned_docs/version-v3.x/security/trusted-setup.md +35 -35
- package/versioned_docs/version-v3.x/supported-networks/deployed-contracts.md +9 -9
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/MACI.md +7 -7
- 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 +8 -8
- 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 +4 -4
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/VkRegistry.md +8 -8
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/joinPoll.md +3 -3
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/processMessages.md +19 -15
- 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 +5 -5
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/utilities.md +9 -9
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/zk-snark-circuits.md +3 -3
|
@@ -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 generateMaciKeyPair
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
### Set the .env
|
|
@@ -131,20 +131,20 @@ For testing we suggest using the **FreeForAlPolicy** as it allows anyone to sign
|
|
|
131
131
|
| **stateTreeDepth** | Defines how many users the system supports. |
|
|
132
132
|
| **policy** | Defines which policy to use. |
|
|
133
133
|
|
|
134
|
-
####
|
|
134
|
+
#### VerifyingKeysRegistry
|
|
135
135
|
|
|
136
|
-
The
|
|
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**.
|
|
@@ -156,7 +156,7 @@ The recommended values for test keys are: **10-1-2-2-1**. For ceremony keys: **1
|
|
|
156
156
|
| --------------------------- | ----------------------------------------------------------------- |
|
|
157
157
|
| **pollStartDate** | Defines when the poll starts in seconds. |
|
|
158
158
|
| **pollEndDate** | Defines how long is going to be the poll in seconds. |
|
|
159
|
-
| **
|
|
159
|
+
| **coordinatorPublicKey** | Defines the coordinator public MACI key. |
|
|
160
160
|
| **useQuadraticVoting** | Defines if the poll uses quadratic voting or not. |
|
|
161
161
|
| **policy** | Defines the policy of the poll. |
|
|
162
162
|
| **relayers** | Defines an array of addresses that are allowed to relay messages. |
|
|
@@ -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
|
|
@@ -277,7 +285,7 @@ Once the proofs are generated, and results tallied, the results (Tally) are writ
|
|
|
277
285
|
"salt": "0x24f57b75c227987727c13d1e83409d70478b42bdc12a4a4df8129c72fbaf5aaf",
|
|
278
286
|
"commitment": "0xb4ebe68b0da828c0b978ddee86ba934b8e215499ac766491f236ad85fd606de"
|
|
279
287
|
},
|
|
280
|
-
"
|
|
288
|
+
"perVoteOptionSpentVoiceCredits": {
|
|
281
289
|
"tally": [
|
|
282
290
|
"81",
|
|
283
291
|
"0",
|
|
@@ -315,4 +323,4 @@ We observe an array named results, which holds the aggregated votes for each opt
|
|
|
315
323
|
|
|
316
324
|
The `totalSpentVoiceCredits` object contains the total amount of voice credits spent in the poll. This is the sum of all voice credits spent by all voters, and in quadratic voting, is the sum of the squares of all votes.
|
|
317
325
|
|
|
318
|
-
The `
|
|
326
|
+
The `perVoteOptionSpentVoiceCredits` will contain the amount of voice credits spent per vote option. In this case, the first option received 81 voice credits, and every other option received 0 voice credits. This is because there was only one valid vote casted, with a weight of 9. Given the quadratic voting formula, the total amount of voice credits spent is 81.
|
|
@@ -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
|
|
@@ -38,7 +38,7 @@ We would like to thank the Veridise team for their effort in keeping open source
|
|
|
38
38
|
|
|
39
39
|
**Description**
|
|
40
40
|
|
|
41
|
-
In the template `
|
|
41
|
+
In the template `QuinarySelector`, if you want to confirm the input signal index is a valid integer less than 2\*\*3, you should add Num2bits(3) to check it.
|
|
42
42
|
|
|
43
43
|
**Code Location**
|
|
44
44
|
|
|
@@ -119,7 +119,7 @@ greaterThan[i].in[1] <== index;
|
|
|
119
119
|
|
|
120
120
|
**Description**
|
|
121
121
|
|
|
122
|
-
In the template `
|
|
122
|
+
In the template `QuinaryGeneratePathIndices`, the constraints of the `signal n[levels + 1]` don't perform well for division and modulo counting.
|
|
123
123
|
|
|
124
124
|
**Code Location**
|
|
125
125
|
|
|
@@ -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
|
-
- [
|
|
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,11 +25,11 @@ 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
|
|
32
|
-
You should change the -vk parameter to the
|
|
32
|
+
You should change the -vk parameter to the VerifyingKeysRegistry address for the chain you are deploying to. Also you might need to modify the parameters based on the circuit configuration. Please refer to the [circuits page](/docs/technical-references/zk-snark-circuits/setup) for more information. Also you can add `-uq false` if you want to check non quadratic voting keys.
|
|
33
33
|
:::
|
|
34
34
|
|
|
35
35
|
## Contract Addresses
|
|
@@ -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.
|
|
@@ -62,12 +62,12 @@ This function does the following:
|
|
|
62
62
|
- hashes the public key and inserts it into the state tree.
|
|
63
63
|
|
|
64
64
|
```ts
|
|
65
|
-
function signUp(
|
|
65
|
+
function signUp(PublicKey memory _publicKey, bytes memory _signUpPolicyData) public virtual {
|
|
66
66
|
// ensure we do not have more signups than what the circuits support
|
|
67
67
|
if (leanIMTData.size >= maxSignups) revert TooManySignups();
|
|
68
68
|
|
|
69
69
|
// ensure that the public key is on the baby jubjub curve
|
|
70
|
-
if (!CurveBabyJubJub.isOnCurve(
|
|
70
|
+
if (!CurveBabyJubJub.isOnCurve(_publicKey.x, _publicKey.y)) {
|
|
71
71
|
revert InvalidPubKey();
|
|
72
72
|
}
|
|
73
73
|
|
|
@@ -76,13 +76,13 @@ function signUp(PubKey memory _pubKey, bytes memory _signUpPolicyData) public vi
|
|
|
76
76
|
signUpPolicy.register(msg.sender, _signUpPolicyData);
|
|
77
77
|
|
|
78
78
|
// Hash the public key and insert it into the tree.
|
|
79
|
-
uint256 pubKeyHash = hashLeftRight(
|
|
79
|
+
uint256 pubKeyHash = hashLeftRight(_publicKey.x, _publicKey.y);
|
|
80
80
|
uint256 stateRoot = InternalLeanIMT._insert(leanIMTData, pubKeyHash);
|
|
81
81
|
|
|
82
82
|
// Store the current state tree root in the array
|
|
83
83
|
stateRootsOnSignUp.push(stateRoot);
|
|
84
84
|
|
|
85
|
-
emit SignUp(leanIMTData.size - 1, block.timestamp,
|
|
85
|
+
emit SignUp(leanIMTData.size - 1, block.timestamp, _publicKey.x, _publicKey.y);
|
|
86
86
|
}
|
|
87
87
|
```
|
|
88
88
|
|
|
@@ -149,12 +149,12 @@ 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)
|
|
156
156
|
- `voteOptions`: the number of vote options for the poll
|
|
157
157
|
|
|
158
158
|
:::info
|
|
159
|
-
Please be advised that the number of signups in the MACI contract (number of leaves in the merkle tree holding MACI's state) considers the initial zero leaf as one signup. For this reason, when accounting for the real users signed up to MACI, you should subtract one from the value returned from the `
|
|
159
|
+
Please be advised that the number of signups in the MACI contract (number of leaves in the merkle tree holding MACI's state) considers the initial zero leaf as one signup. For this reason, when accounting for the real users signed up to MACI, you should subtract one from the value returned from the `totalSignups` function.
|
|
160
160
|
:::
|
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.
|
|
@@ -26,7 +26,7 @@ The `joinPoll` function looks as follows:
|
|
|
26
26
|
/// @inheritdoc IPoll
|
|
27
27
|
function joinPoll(
|
|
28
28
|
uint256 _nullifier,
|
|
29
|
-
|
|
29
|
+
PublicKey calldata _publicKey,
|
|
30
30
|
uint256 _stateRootIndex,
|
|
31
31
|
uint256[8] calldata _proof,
|
|
32
32
|
bytes memory _signUpPolicyData,
|
|
@@ -41,7 +41,7 @@ The `joinPoll` function looks as follows:
|
|
|
41
41
|
pollNullifiers[_nullifier] = true;
|
|
42
42
|
|
|
43
43
|
// Verify user's proof
|
|
44
|
-
if (!verifyJoiningPollProof(_nullifier, _stateRootIndex,
|
|
44
|
+
if (!verifyJoiningPollProof(_nullifier, _stateRootIndex, _publicKey, _proof)) {
|
|
45
45
|
revert InvalidPollProof();
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -55,7 +55,7 @@ The `joinPoll` function looks as follows:
|
|
|
55
55
|
);
|
|
56
56
|
|
|
57
57
|
// Store user in the pollStateTree
|
|
58
|
-
uint256 stateLeaf = hashStateLeaf(StateLeaf(
|
|
58
|
+
uint256 stateLeaf = hashStateLeaf(StateLeaf(_publicKey, voiceCreditBalance, block.timestamp));
|
|
59
59
|
|
|
60
60
|
uint256 stateRoot = InternalLazyIMT._insert(pollStateTree, stateLeaf);
|
|
61
61
|
|
|
@@ -63,7 +63,7 @@ The `joinPoll` function looks as follows:
|
|
|
63
63
|
pollStateRootsOnJoin.push(stateRoot);
|
|
64
64
|
|
|
65
65
|
uint256 pollStateIndex = pollStateTree.numberOfLeaves - 1;
|
|
66
|
-
emit PollJoined(
|
|
66
|
+
emit PollJoined(_publicKey.x, _publicKey.y, voiceCreditBalance, block.timestamp, _nullifier, pollStateIndex);
|
|
67
67
|
}
|
|
68
68
|
```
|
|
69
69
|
|
|
@@ -72,7 +72,7 @@ The `joinPoll` function looks as follows:
|
|
|
72
72
|
The `publishMessage` function looks as follows:
|
|
73
73
|
|
|
74
74
|
```ts
|
|
75
|
-
function publishMessage(Message calldata _message,
|
|
75
|
+
function publishMessage(Message calldata _message, PublicKey calldata _encPubKey) public virtual isOpenForVoting {
|
|
76
76
|
// check if the public key is on the curve
|
|
77
77
|
if (!CurveBabyJubJub.isOnCurve(_encPubKey.x, _encPubKey.y)) {
|
|
78
78
|
revert InvalidPubKey();
|
|
@@ -84,7 +84,7 @@ function publishMessage(Message calldata _message, PubKey calldata _encPubKey) p
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
// compute current message hash
|
|
87
|
-
uint256 messageHash =
|
|
87
|
+
uint256 messageHash = hashMessageAndPublicKey(_message, _encPubKey);
|
|
88
88
|
|
|
89
89
|
// update current message chain hash
|
|
90
90
|
updateChainHash(messageHash);
|
|
@@ -96,7 +96,7 @@ function publishMessage(Message calldata _message, PubKey calldata _encPubKey) p
|
|
|
96
96
|
The `publishMessageBatch` function looks as follows:
|
|
97
97
|
|
|
98
98
|
```ts
|
|
99
|
-
function publishMessageBatch(Message[] calldata _messages,
|
|
99
|
+
function publishMessageBatch(Message[] calldata _messages, PublicKey[] calldata _encPubKeys) public virtual {
|
|
100
100
|
if (_messages.length != _encPubKeys.length) {
|
|
101
101
|
revert InvalidBatchLength();
|
|
102
102
|
}
|
|
@@ -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.
|
|
@@ -16,14 +16,14 @@ This contract should be deployed alongside a `Poll`, with the the constructor ac
|
|
|
16
16
|
```ts
|
|
17
17
|
constructor(
|
|
18
18
|
address _verifier,
|
|
19
|
-
address
|
|
19
|
+
address _verifyingKeysRegistry,
|
|
20
20
|
address _poll,
|
|
21
21
|
address _mp,
|
|
22
22
|
address _tallyOwner,
|
|
23
23
|
Mode _mode
|
|
24
24
|
) payable {
|
|
25
25
|
verifier = IVerifier(_verifier);
|
|
26
|
-
vkRegistry = IVkRegistry(
|
|
26
|
+
vkRegistry = IVkRegistry(_verifyingKeysRegistry);
|
|
27
27
|
poll = IPoll(_poll);
|
|
28
28
|
messageProcessor = IMessageProcessor(_mp);
|
|
29
29
|
mode = _mode;
|
|
@@ -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
|
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
description:
|
|
4
|
-
sidebar_label:
|
|
2
|
+
title: VerifyingKeysRegistry Smart Contract
|
|
3
|
+
description: VerifyingKeysRegistry smart contract
|
|
4
|
+
sidebar_label: VerifyingKeysRegistry
|
|
5
5
|
sidebar_position: 8
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
:::info
|
|
9
|
-
Code location: [
|
|
9
|
+
Code location: [VerifyingKeysRegistry.sol](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/contracts/contracts/VerifyingKeysRegistry.sol)
|
|
10
10
|
:::
|
|
11
11
|
|
|
12
|
-
The
|
|
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
|
|
|
@@ -21,8 +21,8 @@ Users need to provide a valid proof to the Poll smart contract to join a poll, a
|
|
|
21
21
|
|
|
22
22
|
| Input signal | Description |
|
|
23
23
|
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
24
|
-
| `
|
|
25
|
-
| `
|
|
24
|
+
| `privateKey` | The user's private key |
|
|
25
|
+
| `pollPublicKey` | The poll's public key |
|
|
26
26
|
| `siblings` | The siblings for the merkle tree inclusion proof |
|
|
27
27
|
| `indices` | The indices for the merkle tree inclusion proof |
|
|
28
28
|
| `nullifier` | The nullifier |
|
|
@@ -44,7 +44,7 @@ Users will use this circuit to anonymously prove that they joined a poll. This c
|
|
|
44
44
|
|
|
45
45
|
| Input signal | Description |
|
|
46
46
|
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
47
|
-
| `
|
|
47
|
+
| `privateKey` | The user's private key |
|
|
48
48
|
| `voiceCreditsBalance` | The user's initial voice credits balance |
|
|
49
49
|
| `pathElements` | The path elements for the merkle tree inclusion proof |
|
|
50
50
|
| `pathIndices` | The path indices for the merkle tree inclusion proof |
|