@maci-protocol/website 0.0.0-ci.ec84efe → 0.0.0-ci.ef4f2d5
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 +5 -5
- 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 +42 -108
- package/versioned_docs/version-v3.x/core-concepts/state-leaf.md +2 -2
- 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 +62 -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/costs.md +419 -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/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 -4
- 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
|
@@ -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,9 +44,8 @@ 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
|
-
| `joinTimestamp` | The timestamp of when the user joined the poll |
|
|
50
49
|
| `pathElements` | The path elements for the merkle tree inclusion proof |
|
|
51
50
|
| `pathIndices` | The path indices for the merkle tree inclusion proof |
|
|
52
51
|
| `stateRoot` | The MACI state tree root |
|
package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/processMessages.md
CHANGED
|
@@ -5,11 +5,11 @@ sidebar_label: Process Messages Circuit
|
|
|
5
5
|
sidebar_position: 3
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
[**Repo link**](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/
|
|
8
|
+
[**Repo link**](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/coordinator)
|
|
9
9
|
|
|
10
|
-
This circuit allows the coordinator to prove that they have correctly processed each message in reverse order, in a consecutive batch of 5 ^
|
|
10
|
+
This circuit allows the coordinator to prove that they have correctly processed each message in reverse order, in a consecutive batch of 5 ^ messageBatchDepth messages to the respective state leaf within the state tree. Coordinators would use this circuit to prove correct execution at the end of each Poll.
|
|
11
11
|
|
|
12
|
-
The [`
|
|
12
|
+
The [`MessageProcessorQv`](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/coordinator/qv/MessageProcessor.circom) circuit will try to decrypt the messages, and based on the content of the message, update within itself the trees, to generate a proof that the coordinator's off-chain processing was done correctly. In other words, the circuit takes a final state, an initial state, and the leaves (messages and user signups) - it processes these messages via the different state transitions to finally check that the expected state is correct.
|
|
13
13
|
The pre-requisites for this circuit are:
|
|
14
14
|
|
|
15
15
|
- the related Poll has ended
|
|
@@ -21,7 +21,11 @@ This circuit requires the coordinator's private key, hence a proof for this circ
|
|
|
21
21
|

|
|
22
22
|
|
|
23
23
|
:::info
|
|
24
|
-
A version working with non quadratic voting (non-qv) is also [available](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/
|
|
24
|
+
A version working with non quadratic voting (non-qv) is also [available](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/coordinator/non-qv/MessageProcessor.circom). This version is called `MessageProcessorNonQV` and is to be used when the Poll is not using the quadratic voting feature. Note that by default MACI works with quadratic voting.
|
|
25
|
+
:::
|
|
26
|
+
|
|
27
|
+
:::info
|
|
28
|
+
A version working with full credits voting (full) is also [available](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/coordinator/full/MessageProcessor.circom). This version is called `MessageProcessorFull` and is to be used when the Poll is not using the quadratic or non quadratic voting features. Note that by default MACI works with quadratic voting.
|
|
25
29
|
:::
|
|
26
30
|
|
|
27
31
|
#### Parameters
|
|
@@ -36,17 +40,17 @@ A version working with non quadratic voting (non-qv) is also [available](https:/
|
|
|
36
40
|
|
|
37
41
|
| Input signal | Description |
|
|
38
42
|
| -------------------------------- | --------------------------------------------------------------------------------------- |
|
|
39
|
-
| `
|
|
43
|
+
| `totalSignups` | Number of users that have completed the sign up |
|
|
40
44
|
| `index` | The batch index of current message batch |
|
|
41
45
|
| `pollEndTimestamp` | The Unix timestamp at which the poll ends |
|
|
42
|
-
| `
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
46
|
+
| `messageRoot` | The root of the message tree |
|
|
47
|
+
| `messages` | The batch of messages as an array of arrays |
|
|
48
|
+
| `messageSubrootPathElements` | As described below |
|
|
45
49
|
| `coordinatorPublicKeyHash` | $\mathsf{poseidon_2}([cPk_x, cPk_y])$ |
|
|
46
50
|
| `newSbCommitment` | As described below |
|
|
47
|
-
| `
|
|
51
|
+
| `coordinatorPrivateKey` | The coordinator's private key |
|
|
48
52
|
| `batchEndIndex` | The last batch index |
|
|
49
|
-
| `
|
|
53
|
+
| `encryptionPublicKeys` | The public keys used to generate shared ECDH encryption keys to encrypt the messages |
|
|
50
54
|
| `currentStateRoot` | The state root before the commands are applied |
|
|
51
55
|
| `currentStateLeaves` | The state leaves upon which messages are applied |
|
|
52
56
|
| `currentStateLeavesPathElements` | The Merkle path to each incremental state root |
|
|
@@ -74,9 +78,9 @@ The salt used to produce `currentSbCommitment` (see above).
|
|
|
74
78
|
|
|
75
79
|
The salt used to produce `newSbCommitment` (see above).
|
|
76
80
|
|
|
77
|
-
##### `
|
|
81
|
+
##### `messageSubrootPathElements`
|
|
78
82
|
|
|
79
|
-
The index of each message in `
|
|
83
|
+
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`.
|
|
80
84
|
|
|
81
85
|
A simplified example using a tree of arity 2:
|
|
82
86
|
|
|
@@ -100,7 +104,7 @@ This method requires fewer circuit constraints than if we verified a Merkle proo
|
|
|
100
104
|
|
|
101
105
|
1. That the prover knows the preimage to `currentSbCommitment` (that is, the state root, ballot root, and `currentSbSalt`)
|
|
102
106
|
2. That `maxVoteOptions <= (5 ^ voteOptionTreeDepth)`
|
|
103
|
-
3. That `
|
|
104
|
-
4. That `coordinatorPublicKeyHash` is a hash of public key that is correctly derived from `
|
|
105
|
-
5. That each message in `
|
|
107
|
+
3. That `totalSignups <= (2 ^ stateTreeDepth)`
|
|
108
|
+
4. That `coordinatorPublicKeyHash` is a hash of public key that is correctly derived from `coordinatorPrivateKey`
|
|
109
|
+
5. That each message in `messages` exists in the message tree
|
|
106
110
|
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`
|
|
@@ -37,7 +37,7 @@ MACI's circuits are parameterized, and thus can be configured to support differe
|
|
|
37
37
|
- **STATE_TREE_DEPTH** = how many users the system supports
|
|
38
38
|
- **VOTE_OPTIONS_TREE_DEPTH** = how many vote options the system supports
|
|
39
39
|
- **MESSAGE_BATCH_SIZE** = how many messages in a batch the circuit should process
|
|
40
|
-
- **
|
|
40
|
+
- **TALLY_PROCESSING_STATE_TREE_DEPTH** = how many ballots can be processed per batch when tallying the results (`2 ** TALLY_PROCESSING_STATE_TREE_DEPTH` ballots)
|
|
41
41
|
|
|
42
42
|
Please refer to the individual circuit documentation for more details on the inner working of each circuit and where parameters fit.
|
|
43
43
|
|
|
@@ -90,7 +90,7 @@ To test the circuits package, please use `pnpm run test`. This will run all of t
|
|
|
90
90
|
|
|
91
91
|
To run individual tests, you can use the following commands (for all other circuits please refer to the `package.json` scripts section):
|
|
92
92
|
|
|
93
|
-
- `pnpm run test:
|
|
94
|
-
- `pnpm run test:
|
|
93
|
+
- `pnpm run test:messageProcessor` to run the tests for the `MessageProcessor` circuit.
|
|
94
|
+
- `pnpm run test:voteTally` to run the tests for the `VoteTally` circuit.
|
|
95
95
|
|
|
96
96
|
More details on testing are provided in the [testing section](/docs/guides/testing/testing-introduction) of the documentation.
|
|
@@ -15,17 +15,17 @@ sidebar_position: 4
|
|
|
15
15
|
| 1 | State leaf batch depth | Allows $(5^{n})$ users' votes to be processed per batch. |
|
|
16
16
|
| 2 | Vote option tree depth | Allows $(5^{n})$ vote options. |
|
|
17
17
|
|
|
18
|
-

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

|
|
13
13
|
|
|
@@ -15,7 +15,7 @@ It outputs one field element, which is the SHA256 hash of the following inputs:
|
|
|
15
15
|
|
|
16
16
|
1. `packedVals`
|
|
17
17
|
2. `pollEndTimestamp`
|
|
18
|
-
3. `
|
|
18
|
+
3. `messageRoot`
|
|
19
19
|
4. `coordinatorPubKeyHash`
|
|
20
20
|
5. `newSbCommitment`
|
|
21
21
|
6. `currentSbCommitment`
|
|
@@ -35,15 +35,15 @@ It outputs one field element, which is the SHA256 hash of the following inputs:
|
|
|
35
35
|
|
|
36
36
|
#### ResultsCommitmentVerifier
|
|
37
37
|
|
|
38
|
-
A utility circuit used by the main `
|
|
38
|
+
A utility circuit used by the main `VoteTally` circuit to verify that the results commitment is correct.
|
|
39
39
|
|
|
40
40
|

|
|
41
41
|
|
|
42
|
-
####
|
|
42
|
+
#### QuinaryCheckRoot
|
|
43
43
|
|
|
44
44
|
Utility circuit that given a quin Merkle root and a list of leaves, check if the root is the correct result of inserting all the leaves into the tree in the given order.
|
|
45
45
|
|
|
46
|
-

|
|
47
47
|
|
|
48
48
|
#### CalculateTotal
|
|
49
49
|
|
|
@@ -100,11 +100,11 @@ Utility circuit used to unpack an input element.
|
|
|
100
100
|
|
|
101
101
|

|
|
102
102
|
|
|
103
|
-
####
|
|
103
|
+
#### QuinarySelector
|
|
104
104
|
|
|
105
105
|
Utility circuit used to select one element from an array of n elements at a given index.
|
|
106
106
|
|
|
107
|
-

|
|
108
108
|
|
|
109
109
|
#### Splicer
|
|
110
110
|
|
|
@@ -118,11 +118,11 @@ Utility circuit used to check if a batch of leaves exists in a quinary tree.
|
|
|
118
118
|
|
|
119
119
|

|
|
120
120
|
|
|
121
|
-
####
|
|
121
|
+
#### QuinaryGeneratePathIndices
|
|
122
122
|
|
|
123
123
|
Utility circuit used to generate the indices needed to traverse the tree until we find the leaf we are looking for.
|
|
124
124
|
|
|
125
|
-

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