@maci-protocol/website 0.0.0-ci.2df0337 → 0.0.0-ci.2ea88a0
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 +2 -2
- package/blog/2024-08-10-maci-v2.md +1 -1
- package/blog/2025-03-21-roadmap-2025.md +1 -1
- package/blog/2025-08-18-maci-aragon-plugin.md +107 -0
- package/blog/2025-09-05-maci-coordinator-service.md +167 -0
- package/docusaurus.config.ts +9 -3
- package/package.json +17 -16
- package/src/pages/roadmap.md +39 -80
- package/static/img/circuits/MACI-Circuits.excalidraw +69 -69
- package/static/img/circuits/messageValidator.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/versioned_docs/version-v0.x/contract.md +1 -1
- package/versioned_docs/version-v0.x/introduction.md +0 -4
- package/versioned_docs/version-v0.x/quadratic-vote-tallying-circuit.md +16 -16
- package/versioned_docs/version-v1.2/circuits.md +8 -8
- package/versioned_docs/version-v1.2/contributing/contributing.md +4 -4
- package/versioned_docs/version-v1.2/deployment.md +1 -1
- package/versioned_docs/version-v1.2/integrating.md +1 -1
- package/versioned_docs/version-v1.2/key-change.md +1 -1
- package/versioned_docs/version-v1.2/poll-types.md +1 -1
- package/versioned_docs/version-v1.2/testing-in-detail.md +3 -3
- package/versioned_docs/version-v1.2/testing.md +1 -1
- package/versioned_docs/version-v1.2/topup.md +1 -1
- package/versioned_docs/version-v1.2/typedoc/core/index.md +2 -2
- package/versioned_docs/version-v1.2/versioning.md +3 -3
- package/versioned_docs/version-v1.2/workflow.md +1 -1
- package/versioned_docs/version-v2.x/contributing/contributing.md +4 -4
- package/versioned_docs/version-v2.x/core-concepts/key-change.md +1 -1
- package/versioned_docs/version-v2.x/core-concepts/merkle-trees.md +1 -1
- package/versioned_docs/version-v2.x/core-concepts/poll-types.md +1 -1
- package/versioned_docs/version-v2.x/core-concepts/workflow.md +1 -1
- package/versioned_docs/version-v2.x/guides/integrating.md +1 -1
- package/versioned_docs/version-v2.x/guides/testing/testing-in-detail.md +3 -3
- package/versioned_docs/version-v2.x/guides/testing/testing.md +1 -1
- package/versioned_docs/version-v2.x/processes/versioning.md +3 -3
- package/versioned_docs/version-v2.x/supported-networks/deployed-contracts.md +7 -7
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/AccQueue.md +1 -1
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/MACI.md +1 -1
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/MessageProcessor.md +1 -1
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/Params.md +1 -1
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/Poll.md +1 -1
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/PollFactory.md +1 -1
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/Tally.md +1 -1
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/VkRegistry.md +1 -1
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/VoiceCreditProxy.md +1 -1
- package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/processMessages.md +4 -4
- package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/tallyVotes.md +2 -2
- package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/zk-snark-circuits.md +3 -3
- package/versioned_docs/version-v3.x/contributing/contributing.md +11 -5
- package/versioned_docs/version-v3.x/core-concepts/key-change.md +14 -14
- 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 +39 -105
- package/versioned_docs/version-v3.x/core-concepts/workflow.md +2 -2
- package/versioned_docs/version-v3.x/guides/compile-circuits.md +36 -20
- package/versioned_docs/version-v3.x/guides/integrating.md +10 -10
- package/versioned_docs/version-v3.x/guides/sdk.md +121 -0
- package/versioned_docs/version-v3.x/guides/testing/testing-in-detail.md +4 -4
- package/versioned_docs/version-v3.x/guides/testing/testing-introduction.md +38 -6
- package/versioned_docs/version-v3.x/guides/troubleshooting.md +64 -19
- package/versioned_docs/version-v3.x/processes/versioning.md +3 -3
- 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 +36 -36
- package/versioned_docs/version-v3.x/supported-networks/costs.md +725 -0
- package/versioned_docs/version-v3.x/supported-networks/deployed-contracts.md +9 -9
- package/versioned_docs/version-v3.x/supported-networks/supported-networks.md +16 -0
- package/versioned_docs/version-v3.x/technical-references/coordinator-service/index.md +15 -1
- package/versioned_docs/version-v3.x/technical-references/coordinator-service/installation.md +5 -33
- package/versioned_docs/version-v3.x/technical-references/coordinator-service/usage.md +64 -0
- 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/Policies.md +1 -1
- 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/smart-contracts/VoiceCreditProxy.md +1 -1
- package/versioned_docs/version-v3.x/technical-references/technical-references.md +8 -8
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/joinPoll.md +2 -2
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/processMessages.md +81 -17
- 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 +6 -6
- 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
|
@@ -57,15 +57,21 @@ Pull requests are great if you want to add a feature or fix a bug. Here's a quic
|
|
|
57
57
|
|
|
58
58
|
7. Make the test pass.
|
|
59
59
|
|
|
60
|
-
8. Commit your changes. Please make sure your forked `
|
|
60
|
+
8. Commit your changes. Please make sure your forked `main` branch is synced as well feature/fix branch and there are no "temp" commits (like wip, fix typo/lint/types and etc). We recommend to squash the feature/fix branch commits before creating PR. You can use this command for it:
|
|
61
61
|
|
|
62
62
|
```bash
|
|
63
|
-
git
|
|
63
|
+
git checkout main
|
|
64
|
+
git pull
|
|
65
|
+
git checkout your-branch
|
|
66
|
+
git rebase main
|
|
67
|
+
git reset $(git merge-base main $(git rev-parse --abbrev-ref HEAD))
|
|
64
68
|
```
|
|
65
69
|
|
|
66
|
-
9.
|
|
70
|
+
9. Before creating a pull request make sure your work is ready. Do not create WIP pull requests and do not skip pre-commit hooks.
|
|
67
71
|
|
|
68
|
-
10.
|
|
72
|
+
10. Push to your fork and submit a pull request on our `main` branch. Please provide us with some explanation of why you made the changes you made. For new features make sure to explain a standard use case to us. Do not remove our PR template and follow all the steps defined in it.
|
|
73
|
+
|
|
74
|
+
11. Link any issues that the PR is addressing as described in our processes documentation.
|
|
69
75
|
|
|
70
76
|
## CI (Github Actions) Tests
|
|
71
77
|
|
|
@@ -131,7 +137,7 @@ Just as in the subject, use the imperative, present tense: "change" not "changed
|
|
|
131
137
|
|
|
132
138
|
### Branch rules
|
|
133
139
|
|
|
134
|
-
- Branches should generally be created off of the base branch (`
|
|
140
|
+
- Branches should generally be created off of the base branch (`main` )
|
|
135
141
|
- Avoid long descriptive names for long-lived branches
|
|
136
142
|
- Use kebab-case (no CamelCase)
|
|
137
143
|
- Use grouping tokens (words) at the beginning of your branch names (in a similar way to the `type` of commit)
|
|
@@ -23,14 +23,14 @@ Reverse processing was introduced to prevent a type of attack where a briber wou
|
|
|
23
23
|
|
|
24
24
|
Let's take as an example the following:
|
|
25
25
|
|
|
26
|
-
1. Alice signs up with
|
|
27
|
-
2. Bob (Briber) bribes Alice and asks her to submit a key change message to $
|
|
28
|
-
3. Bob submits a vote with $
|
|
29
|
-
4. Alice submits a vote with $
|
|
26
|
+
1. Alice signs up with public key $public1$
|
|
27
|
+
2. Bob (Briber) bribes Alice and asks her to submit a key change message to $public2$ (owned by Bob)
|
|
28
|
+
3. Bob submits a vote with $public2$
|
|
29
|
+
4. Alice submits a vote with $public1$
|
|
30
30
|
|
|
31
31
|
If messages were processed in the same order as they were submitted, Alice's vote would not be valid, due to it being signed with a private key $priv1$ - which now would not be valid.
|
|
32
32
|
|
|
33
|
-
On the other hand, due to messages being processed in reverse order, Alice's last message would be counted as valid as the key change would have not been processed yet. Then, Bob's vote would not be counted as valid as the current key for Alice would be $
|
|
33
|
+
On the other hand, due to messages being processed in reverse order, Alice's last message would be counted as valid as the key change would have not been processed yet. Then, Bob's vote would not be counted as valid as the current key for Alice would be $public1$.
|
|
34
34
|
|
|
35
35
|
> Note that a key change message should have the nonce set to 1 in order for it to be valid. We'll see a code example in the next sections.
|
|
36
36
|
|
|
@@ -47,7 +47,7 @@ Let's take a look into a code example:
|
|
|
47
47
|
```ts
|
|
48
48
|
const user1Keypair = new Keypair();
|
|
49
49
|
const user2Keypair = new Keypair();
|
|
50
|
-
const
|
|
50
|
+
const secondKeypair = new Keypair();
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
- Votes will be
|
|
@@ -77,7 +77,7 @@ As seen above, we expect the first vote weight 9 to not be counted, but instead
|
|
|
77
77
|
- Deploy a MaciState locally and sign up
|
|
78
78
|
|
|
79
79
|
```ts
|
|
80
|
-
const maciState
|
|
80
|
+
const maciState = new MaciState(STATE_TREE_DEPTH);
|
|
81
81
|
// Sign up
|
|
82
82
|
user1StateIndex = maciState.signUp(user1Keypair.publicKey, voiceCreditBalance, BigInt(Math.floor(Date.now() / 1000)));
|
|
83
83
|
user2StateIndex = maciState.signUp(user2Keypair.publicKey, voiceCreditBalance, BigInt(Math.floor(Date.now() / 1000)));
|
|
@@ -95,7 +95,7 @@ pollId = maciState.deployPoll(
|
|
|
95
95
|
|
|
96
96
|
```ts
|
|
97
97
|
const poll = maciState.polls[pollId];
|
|
98
|
-
const command1 = new
|
|
98
|
+
const command1 = new VoteCommand(
|
|
99
99
|
BigInt(user1StateIndex),
|
|
100
100
|
user1Keypair.publicKey,
|
|
101
101
|
user1VoteOptionIndex,
|
|
@@ -112,7 +112,7 @@ const sharedKey1 = Keypair.genEcdhSharedKey(ecdhKeypair1.privateKey, coordinator
|
|
|
112
112
|
const message1 = command1.encrypt(signature1, sharedKey1);
|
|
113
113
|
poll.publishMessage(message1, ecdhKeypair1.publicKey);
|
|
114
114
|
|
|
115
|
-
const command2 = new
|
|
115
|
+
const command2 = new VoteCommand(
|
|
116
116
|
BigInt(user2StateIndex),
|
|
117
117
|
user2Keypair.publicKey,
|
|
118
118
|
user2VoteOptionIndex,
|
|
@@ -134,9 +134,9 @@ poll.publishMessage(message2, ecdhKeypair2.publicKey);
|
|
|
134
134
|
|
|
135
135
|
```ts
|
|
136
136
|
const poll = maciState.polls[pollId];
|
|
137
|
-
const command = new
|
|
137
|
+
const command = new VoteCommand(
|
|
138
138
|
BigInt(user1StateIndex),
|
|
139
|
-
|
|
139
|
+
secondKeypair.publicKey,
|
|
140
140
|
user1VoteOptionIndex,
|
|
141
141
|
user1NewVoteWeight,
|
|
142
142
|
BigInt(1),
|
|
@@ -158,8 +158,8 @@ poll.publishMessage(message, ecdhKeypair.publicKey);
|
|
|
158
158
|
const poll = maciState.polls[pollId];
|
|
159
159
|
poll.processMessages(pollId);
|
|
160
160
|
poll.tallyVotes();
|
|
161
|
-
expect(poll.
|
|
162
|
-
expect(poll.
|
|
161
|
+
expect(poll.perVoteOptionSpentVoiceCredits[0].toString()).to.eq((user1NewVoteWeight * user1NewVoteWeight).toString());
|
|
162
|
+
expect(poll.perVoteOptionSpentVoiceCredits[1].toString()).to.eq((user2VoteWeight * user2VoteWeight).toString());
|
|
163
163
|
```
|
|
164
164
|
|
|
165
165
|
- Finally confirm that the keypair was changed for the user1
|
|
@@ -175,5 +175,5 @@ expect(stateLeaf2.publicKey.equals(user2Keypair.publicKey)).to.eq(true);
|
|
|
175
175
|
We see that is important that we set the final message (the one with the new vote) with nonce 1, as this vote would be counted as the first vote.
|
|
176
176
|
|
|
177
177
|
:::info
|
|
178
|
-
Tests related to key changes have been added to the [core package](https://github.com/privacy-scaling-explorations/maci/blob/
|
|
178
|
+
Tests related to key changes have been added to the [core package](https://github.com/privacy-scaling-explorations/maci/blob/main/core/ts/__tests__/) and to the [cli package](https://github.com/privacy-scaling-explorations/maci/blob/main/cli/tests/).
|
|
179
179
|
:::
|
|
@@ -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/
|
|
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/main/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
|
-
"
|
|
26
|
-
"
|
|
25
|
+
"coordinatorPublicKey": "macipk",
|
|
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
|
-
"
|
|
50
|
-
"
|
|
49
|
+
"coordinatorPublicKey": "macipk",
|
|
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)
|
|
@@ -23,7 +23,7 @@ The full configuration for a poll looks like this:
|
|
|
23
23
|
"Poll": {
|
|
24
24
|
"pollStartDate": 3600,
|
|
25
25
|
"pollEndDate": 3600,
|
|
26
|
-
"
|
|
26
|
+
"coordinatorPublicKey": "macipk.9a59264310d95cfd8eb7083aebeba221b5c26e77427f12b7c0f50bc1cc35e621",
|
|
27
27
|
"useQuadraticVoting": false,
|
|
28
28
|
"policy": "FreeForAllPolicy",
|
|
29
29
|
"relayers": "0x0000000000000000000000000000000000000000",
|
|
@@ -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/
|
|
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/main/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
|
-
"
|
|
49
|
-
"
|
|
48
|
+
"coordinatorPublicKey": "macipk",
|
|
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
|
-
"
|
|
73
|
-
"
|
|
72
|
+
"coordinatorPublicKey": "macipk",
|
|
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
|
|
|
@@ -550,88 +550,22 @@ To make these processes easy to use, we provide command-line interface tools.
|
|
|
550
550
|
|
|
551
551
|
The integration tests and shell scripts in the `cli` directory provide examples of the order in which to execute them.
|
|
552
552
|
|
|
553
|
-
| Command
|
|
554
|
-
|
|
|
555
|
-
| `
|
|
556
|
-
| `
|
|
557
|
-
| `
|
|
558
|
-
| `setVerifyingKeys`
|
|
559
|
-
| `create`
|
|
560
|
-
| `deployPoll`
|
|
561
|
-
| `signup`
|
|
562
|
-
| `publish`
|
|
563
|
-
| `mergeMessages`
|
|
564
|
-
| `mergeSignups`
|
|
565
|
-
| `
|
|
566
|
-
| `proveOnChain`
|
|
567
|
-
|
|
568
|
-
## 5.
|
|
569
|
-
|
|
570
|
-
### 5.1. MACI
|
|
571
|
-
|
|
572
|
-
| Function | Permissions | Notes |
|
|
573
|
-
| ---------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
|
|
574
|
-
| `init(VkRegistry _vkRegistry, MessageAqFactory _messageAqFactory)` | Coordinator only | Initialise factory, helper and registry contracts that share equal ownership |
|
|
575
|
-
| `signUp(PubKey memory _pubKey, bytes memory _signUpPolicyData, bytes memory _initialVoiceCreditProxyData)` | Executable only during the sign-up period and after initialisation | Participant registration and voice credit assignment |
|
|
576
|
-
| `mergeStateAqSubRoots(uint256 _numSrQueueOps, uint256 _pollId)` | Executable only by poll contract `_pollId` and after initialisation | Merge queued state leaves to form the state tree subroots |
|
|
577
|
-
| `mergeStateAq(uint256 _pollId)` | Executable only by poll contract `_pollId` and after initialisation | Merge the state subroots to form the state root |
|
|
578
|
-
| `getStateTreeRoot()` | Non-applicable | Query the state root |
|
|
579
|
-
| `deployPoll(uint256 _duration, TreeDepths memory _treeDepths, PubKey memory _coordinatorPubKey)` | Executable only after initialisation | Create a new poll |
|
|
580
|
-
| `getPoll(uint256 _pollId)` | Non-applicable | Query a poll address |
|
|
581
|
-
|
|
582
|
-
### 5.2. Poll
|
|
583
|
-
|
|
584
|
-
| Function | Permissions | Notes |
|
|
585
|
-
| ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
586
|
-
| `getDeployTimeAndDuration()` | Non-applicable | Query the deployment timestamp and duration |
|
|
587
|
-
| `numSignUpsAndMessages()` | Non-applicable | Query the number of participants and messages cast |
|
|
588
|
-
| `currentSbAndTallyCommitments()` | Non-applicable | Query the current state-ballot and tally commitments hashes |
|
|
589
|
-
| `publishMessage(Message memory _message, PubKey memory _encPubKey)` | Executable only during the voting period and if the message limit has not been not met | Submit a message (whether valid or not) to the message queue |
|
|
590
|
-
| `hashMessageAndEncPubKey(Message memory _message, PubKey memory _encPubKey)` | Non-applicable | Query a hash of a message and public key coordinates |
|
|
591
|
-
| `mergeMaciStateAqSubRoots( uint256 _numSrQueueOps, uint256 _pollId)` | Executable only by the coordinator and after the voting period | Merge queued state leaves to form the state subroots |
|
|
592
|
-
| `mergeMaciStateAq(uint256 _pollId)` | Executable only by the coordinator and after the voting period | Merge the state subroots to form the state root and initialise the state-ballot commitment hash |
|
|
593
|
-
| `mergeMessageAqSubRoots(uint256 _numSrQueueOps)` | Executable only by the coordinator and after the voting period | Merge the queued message leaves to form the message tree subroots |
|
|
594
|
-
| `mergeMessageAq()` | Executable only by the coordinator and after the voting period | Merge the message tree subroots to form the message tree root |
|
|
595
|
-
| `batchEnqueueMessage(uint256 _messageSubRoot)` | Executable only by the coordinator and after the voting period | Submit a batch of messages to the queue |
|
|
596
|
-
|
|
597
|
-
### 5.3. PollFactory
|
|
598
|
-
|
|
599
|
-
| Function | Permissions | Notes |
|
|
600
|
-
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------- | --------------------------------------- |
|
|
601
|
-
| `setMessageAqFactory(MessageAqFactory _messageAqFactory)` | Coordinator only | Initialise the message factory contract |
|
|
602
|
-
| `deploy(uint256 _duration, TreeDepths memory _treeDepths, BatchSizes memory _batchSizes, PubKey memory _coordinatorPubKey, VkRegistry _vkRegistry, IMACI _maci, address _pollOwner)` | Coordinator only | Create a new poll |
|
|
603
|
-
|
|
604
|
-
### 5.4. VkRegistry
|
|
605
|
-
|
|
606
|
-
| Function | Permissions | Notes |
|
|
607
|
-
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
608
|
-
| `isProcessVkSet(uint256 _sig)` | Non-applicable | Query whether a signature is valid for message processing |
|
|
609
|
-
| `isTallyVkSet(uint256 _sig)` | Non-applicable | Query whether a signature valid for tallying votes |
|
|
610
|
-
| `genProcessVkSig(uint256 _stateTreeDepth, uint256 _messageTreeDepth, uint256 _voteOptionTreeDepth, uint256 _messageBatchSize)` | Non-applicable | Generate a signature (used for verifying key mapping lookups) for message processing by compressing parameters into a singular value |
|
|
611
|
-
| `genTallyVkSig(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _voteOptionTreeDepth)` | Non-applicable | Generate a signature (used for verifying key mapping lookups) for vote tallying by compressing parameters into a singular value |
|
|
612
|
-
| `setVerifyingKeys( uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _messageTreeDepth, uint256 _voteOptionTreeDepth, uint256 _messageBatchSize, VerifyingKey memory _processVk, VerifyingKey memory _tallyVk)` | Coordinator only | Initialise verifying keys for processing and tallying to the contract alongside specifying each tree depth |
|
|
613
|
-
| `hasProcessVk(uint256 _stateTreeDepth, uint256 _messageTreeDepth, uint256 _voteOptionTreeDepth, uint256 _messageBatchSize)` | Non-applicable | Query whether the signature of the parameters is valid for message processing |
|
|
614
|
-
| `getProcessVkBySig(uint256 _sig)` | Non-applicable | Query a processing verifying key by providing a valid signature |
|
|
615
|
-
| `getProcessVk(uint256 _stateTreeDepth, uint256 _messageTreeDepth, uint256 _voteOptionTreeDepth, uint256 _messageBatchSize)` | Non-applicable | Query a processing verifying key by providing parameters to generate a valid signature |
|
|
616
|
-
| `hasTallyVk(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _voteOptionTreeDepth)` | Non-applicable | Query whether the signature of the parameters is valid for vote tallying |
|
|
617
|
-
| `getTallyVkBySig(uint256 _sig)` | Non-applicable | Query a tallying verifying key by providing a valid signature |
|
|
618
|
-
| `getTallyVk(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _voteOptionTreeDepth)` | Non-applicable | Query a tallying verifying key by providing parameters to generate a valid signature |
|
|
619
|
-
|
|
620
|
-
### 5.5. PollProcessorAndTallyer
|
|
621
|
-
|
|
622
|
-
| Function | Permissions | Notes |
|
|
623
|
-
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
|
|
624
|
-
| `sha256Hash(uint256[] memory array)` | Non-applicable | Hash an array of values (using SHA256) moduluo the snark field size |
|
|
625
|
-
| `processMessages(Poll _poll, uint256 _newSbCommitment, uint256[8] memory _proof)` | Executable only by the coordinator and after the voting period | Process state messages relative to a new state-ballot commitment given that the proof is valid |
|
|
626
|
-
| `verifyProcessProof(Poll _poll, uint256 _currentMessageBatchIndex, uint256 _messageRoot, uint256 _currentSbCommitment, uint256 _newSbCommitment, uint256[8] memory _proof)` | Non-applicable | Query whether a message processing proof is valid |
|
|
627
|
-
| `genProcessMessagesPublicInputHash(Poll _poll, uint256 _currentMessageBatchIndex, uint256 _messageRoot, uint256 _numSignUps, uint256 _currentSbCommitment, uint256 _newSbCommitment)` | Non-applicable | Hash of the coordinators public key, `packedVals`, current state-ballot commitment and message root |
|
|
628
|
-
| `genProcessMessagesPackedVals( Poll _poll, uint256 _currentMessageBatchIndex, uint256 _numSignUps)` | Non-applicable | Generate a packed 250-bit value `packedVals` for message processing |
|
|
629
|
-
| `genTallyVotesPackedVals( uint256 _numSignUps, uint256 _batchStartIndex, uint256 _tallyBatchSize)` | Non-applicable | Generate a packed 100-bit value `packedVals` for vote tallying |
|
|
630
|
-
| `genTallyVotesPublicInputHash( uint256 _numSignUps, uint256 _batchStartIndex, uint256 _tallyBatchSize, uint256 _newTallyCommitment )` | Non-applicable | Hash of the current tally commitment, the new tally commitment, `packedVals` and the state-ballot commitment |
|
|
631
|
-
| `tallyVotes(Poll _poll, uint256 _newTallyCommitment, uint256[8] memory _proof)` | Executable only by the coordinator and after the voting period | Tally votes relative to a new tally commitment given that the proof is valid |
|
|
632
|
-
| `verifyTallyProof(Poll _poll, uint256[8] memory _proof, uint256 _numSignUps, uint256 _batchStartIndex, uint256 _tallyBatchSize, uint256 _newTallyCommitment)` | Non-applicable | Query whether a vote tallying proof is valid |
|
|
633
|
-
|
|
634
|
-
## 6. zk-SNARKs
|
|
553
|
+
| Command | Description | Notes |
|
|
554
|
+
| ----------------------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
555
|
+
| `generateMaciPublicKey` | Generate a MACI public key from a private key | Only the coordinator needs to run this, as users should generate their keys in the browser and should be automated by the client application |
|
|
556
|
+
| `generateMaciKeypair` | Generates a MACI private key and public key | Only the coordinator needs to run this, as users should generate their keys in the browser and should be automated by the client application |
|
|
557
|
+
| `deployVerifyingKeysRegistry` | Deploy the `deployVerifyingKeysRegistry` contract | Executed only the coordinator |
|
|
558
|
+
| `setVerifyingKeys` | Set verifying keys to the `deployVerifyingKeysRegistry` | Executed only the coordinator |
|
|
559
|
+
| `create` | Deploy a new instance of MACI | Executed only the coordinator |
|
|
560
|
+
| `deployPoll` | Deploy a new poll on a MACI instance | Executed only the coordinator |
|
|
561
|
+
| `signup` | Sign up a user | Mainly for testing; as users are more likely to use the client application instead of the CLI |
|
|
562
|
+
| `publish` | Submit a message to a poll | Mainly for testing; as users are more likely to use the client application instead of the CLI |
|
|
563
|
+
| `mergeMessages` | Must be executed before generating proofs | Executed only the coordinator |
|
|
564
|
+
| `mergeSignups` | Must be executed before generating proofs | Executed only the coordinator |
|
|
565
|
+
| `generateProofs` | Generate all message processing and vote tallying proofs | Executed only the coordinator |
|
|
566
|
+
| `proveOnChain` | Submit proofs to the `MessageProcessor` and `Tally` contracts | Executed only the coordinator |
|
|
567
|
+
|
|
568
|
+
## 5. zk-SNARKs
|
|
635
569
|
|
|
636
570
|
The zk-SNARK circuits in MACI are written in the [circom](https://github.com/iden3/circom) language. Proofs are [Groth16](https://eprint.iacr.org/2016/260.pdf) and are generated using the [`rapidsnark`](https://github.com/iden3/rapidsnark) prover.
|
|
637
571
|
|
|
@@ -646,15 +580,15 @@ Please note that MACI requires the coordinator to generate proofs on an x86 mach
|
|
|
646
580
|
|
|
647
581
|
### 6.1. Message processing circuit
|
|
648
582
|
|
|
649
|
-
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.
|
|
650
584
|
|
|
651
585
|
#### Parameters
|
|
652
586
|
|
|
653
587
|
| Parameter | Description |
|
|
654
588
|
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
655
589
|
| `stateTreeDepth` | Depth of the state tree, this value must be equal to `10` |
|
|
656
|
-
| `
|
|
657
|
-
| `
|
|
590
|
+
| `messageTreeDepth` | Depth of the message tree, this must be the same value passed to the `deployPoll()` contract function of `MACI.sol` |
|
|
591
|
+
| `messageBatchDepth` | Depth of a tree that exactly fits the number of messages in a batch, this must be the same value passed to the `deployPoll()` contract function of `MACI.sol` |
|
|
658
592
|
| `voteOptionTreeDepth` | Depth of the vote option tree, this must be the same value passed to the `deployPoll()` contract function of `MACI.sol` |
|
|
659
593
|
|
|
660
594
|
The state tree, message tree, and vote option trees all have an arity of 5. As such, it is possible to calculate the maximum number of signups, messages per poll, and vote options per poll.
|
|
@@ -663,17 +597,17 @@ The state tree, message tree, and vote option trees all have an arity of 5. As s
|
|
|
663
597
|
|
|
664
598
|
| Input signal | Description |
|
|
665
599
|
| -------------------------------- | --------------------------------------------------------------------------------------- |
|
|
666
|
-
| `
|
|
600
|
+
| `totalSignups` | Number of users that have completed the sign up |
|
|
667
601
|
| `index` | The batch index of current message batch |
|
|
668
602
|
| `pollEndTimestamp` | The Unix timestamp at which the poll ends |
|
|
669
|
-
| `
|
|
670
|
-
| `
|
|
671
|
-
| `
|
|
603
|
+
| `messageRoot` | The root of the message tree |
|
|
604
|
+
| `messages` | The batch of messages as an array of arrays |
|
|
605
|
+
| `messageSubrootPathElements` | As described below |
|
|
672
606
|
| `coordinatorPublicKeyHash` | $\mathsf{poseidon_2}([cPk_x, cPk_y])$ |
|
|
673
607
|
| `newSbCommitment` | As described below |
|
|
674
|
-
| `
|
|
608
|
+
| `coordinatorPrivateKey` | The coordinator's private key |
|
|
675
609
|
| `batchEndIndex` | The last batch index |
|
|
676
|
-
| `
|
|
610
|
+
| `encryptionPublicKeys` | The public keys used to generate shared ECDH encryption keys to encrypt the messages |
|
|
677
611
|
| `currentStateRoot` | The state root before the commands are applied |
|
|
678
612
|
| `currentStateLeaves` | The state leaves upon which messages are applied |
|
|
679
613
|
| `currentStateLeavesPathElements` | The Merkle path to each incremental state root |
|
|
@@ -701,9 +635,9 @@ The salt used to produce `currentSbCommitment` (see above).
|
|
|
701
635
|
|
|
702
636
|
The salt used to produce `newSbCommitment` (see above).
|
|
703
637
|
|
|
704
|
-
##### `
|
|
638
|
+
##### `messageSubrootPathElements`
|
|
705
639
|
|
|
706
|
-
The index of each message in `
|
|
640
|
+
The index of each message in `messages` is consecutive. As such, in order to prove that each message in `messages` is indeed a leaf of the message tree, we compute the subtree root of `messages`, and then verify that the subtree root is indeed a subroot of `messageRoot`.
|
|
707
641
|
|
|
708
642
|
A simplified example using a tree of arity 2:
|
|
709
643
|
|
|
@@ -727,9 +661,9 @@ This method requires fewer circuit constraints than if we verified a Merkle proo
|
|
|
727
661
|
|
|
728
662
|
1. That the prover knows the preimage to `currentSbCommitment` (that is, the state root, ballot root, and `currentSbSalt`)
|
|
729
663
|
2. That `maxVoteOptions <= (5 ^ voteOptionTreeDepth)`
|
|
730
|
-
3. That `
|
|
731
|
-
4. That `coordinatorPublicKeyHash` is a hash of public key that is correctly derived from `
|
|
732
|
-
5. That each message in `
|
|
664
|
+
3. That `totalSignups <== (5 ^ stateTreeDepth)`
|
|
665
|
+
4. That `coordinatorPublicKeyHash` is a hash of public key that is correctly derived from `coordinatorPrivateKey`
|
|
666
|
+
5. That each message in `messages` exists in the message tree
|
|
733
667
|
6. That after decrypting and applying each message, in reverse order, to the corresponding state and ballot leaves, the new state root, new ballot root, and `newSbSalt` are the preimage to `newSbCommitment`
|
|
734
668
|
|
|
735
669
|
#### How messages are decrypted and applied
|
|
@@ -813,21 +747,21 @@ The final tally should be:
|
|
|
813
747
|
2. Total voice credits per vote option: `[3, 9, 19, 33, 26]`
|
|
814
748
|
3. Total spent voice credits: `66`
|
|
815
749
|
|
|
816
|
-
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.
|
|
817
751
|
|
|
818
752
|
#### Parameters
|
|
819
753
|
|
|
820
|
-
| Parameter
|
|
821
|
-
|
|
|
822
|
-
| `stateTreeDepth`
|
|
823
|
-
| `
|
|
824
|
-
| `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` |
|
|
825
759
|
|
|
826
760
|
#### Input signals
|
|
827
761
|
|
|
828
762
|
| Input signal | Description |
|
|
829
763
|
| --------------------------------------- | ---------------------------------------------------------------- |
|
|
830
|
-
| `
|
|
764
|
+
| `totalSignups` | The number of users that signup |
|
|
831
765
|
| `index` | Start index of given batch |
|
|
832
766
|
| `sbCommitment` | As described below |
|
|
833
767
|
| `currentTallyCommitment` | As described below |
|
|
@@ -874,8 +808,8 @@ $\mathsf{poseidon_3}([tc_r, tc_t, tc_p])$
|
|
|
874
808
|
#### Statements that the circuit proves
|
|
875
809
|
|
|
876
810
|
1. That the coordinator knows the preimage of `sbCommitment` (see above)
|
|
877
|
-
2. That `index` is less than or equal to `
|
|
878
|
-
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 **
|
|
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 ** tallyProcessingStateTreeDepth)`
|
|
879
813
|
4. That each set of votes (`votes[i]`) has the Merkle root $blt_r$ whose value equals `ballots[i][1]`
|
|
880
814
|
5. That the tally is valid, which is:
|
|
881
815
|
- That the sum of votes per vote option is correct
|
|
@@ -66,7 +66,7 @@ Therefore, even if a coordinator is corrupt, they are unable to change a user’
|
|
|
66
66
|
|
|
67
67
|
To explain the MACI workflow, let's give a quick overview of the key smart contracts.
|
|
68
68
|
|
|
69
|
-
See our [smart contract docs](/docs/category/smart-contracts) or our [contract source code](https://github.com/privacy-scaling-explorations/maci/tree/
|
|
69
|
+
See our [smart contract docs](/docs/category/smart-contracts) or our [contract source code](https://github.com/privacy-scaling-explorations/maci/tree/main/contracts/contracts) for a more in-depth explanation of all smart contracts.
|
|
70
70
|
|
|
71
71
|
### MACI.sol
|
|
72
72
|
|
|
@@ -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
|
|