@maci-protocol/website 0.0.0-ci.f9da2fc → 0.0.0-ci.fc91dc9

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.
Files changed (36) hide show
  1. package/LICENSE +1 -2
  2. package/blog/2024-02-28-maci-v1.2.0.md +1 -1
  3. package/blog/2024-08-10-maci-v2.md +1 -1
  4. package/package.json +4 -4
  5. package/src/pages/roadmap.md +39 -80
  6. package/static/img/circuits/MACI-Circuits.excalidraw +28 -28
  7. package/static/img/circuits/ecdh.svg +1 -1
  8. package/static/img/circuits/messageToCommand.svg +1 -1
  9. package/static/img/circuits/messageValidator.svg +1 -1
  10. package/static/img/circuits/privToPubkey.svg +1 -1
  11. package/static/img/circuits/processMessages.svg +1 -1
  12. package/static/img/circuits/processMessagesInputHasher.svg +1 -1
  13. package/static/img/circuits/processMessages_2_0.svg +1 -1
  14. package/static/img/circuits/processOne.svg +1 -1
  15. package/static/img/circuits/processTopup.svg +1 -1
  16. package/static/img/circuits/tallyInputHasher.svg +1 -1
  17. package/static/img/circuits/verifySignature.svg +1 -1
  18. package/versioned_docs/version-v3.x/core-concepts/key-change.md +25 -25
  19. package/versioned_docs/version-v3.x/core-concepts/maci-keys.md +1 -1
  20. package/versioned_docs/version-v3.x/core-concepts/poll-types.md +2 -2
  21. package/versioned_docs/version-v3.x/core-concepts/polls.md +3 -3
  22. package/versioned_docs/version-v3.x/core-concepts/spec.md +33 -99
  23. package/versioned_docs/version-v3.x/guides/compile-circuits.md +7 -7
  24. package/versioned_docs/version-v3.x/guides/integrating.md +8 -8
  25. package/versioned_docs/version-v3.x/guides/testing/testing-in-detail.md +1 -1
  26. package/versioned_docs/version-v3.x/guides/troubleshooting.md +11 -11
  27. package/versioned_docs/version-v3.x/quick-start.md +6 -6
  28. package/versioned_docs/version-v3.x/supported-networks/deployed-contracts.md +2 -2
  29. package/versioned_docs/version-v3.x/technical-references/smart-contracts/MACI.md +5 -5
  30. package/versioned_docs/version-v3.x/technical-references/smart-contracts/Poll.md +7 -7
  31. package/versioned_docs/version-v3.x/technical-references/smart-contracts/Tally.md +2 -2
  32. package/versioned_docs/version-v3.x/technical-references/smart-contracts/VkRegistry.md +5 -5
  33. package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/joinPoll.md +3 -3
  34. package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/processMessages.md +12 -12
  35. package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/tallyVotes.md +2 -2
  36. package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/utilities.md +1 -1
@@ -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
- "coordinatorPubkey": "macipk.9a59264310d95cfd8eb7083aebeba221b5c26e77427f12b7c0f50bc1cc35e621",
26
+ "coordinatorPublicKey": "macipk.9a59264310d95cfd8eb7083aebeba221b5c26e77427f12b7c0f50bc1cc35e621",
27
27
  "useQuadraticVoting": false,
28
28
  "policy": "FreeForAllPolicy",
29
29
  "relayers": "0x0000000000000000000000000000000000000000",
@@ -45,7 +45,7 @@ In the deploy-config.json file set the `useQuadraticVoting` value to **true**.
45
45
  ```json
46
46
  "Poll": {
47
47
  [...]
48
- "coordinatorPubkey": "macipk",
48
+ "coordinatorPublicKey": "macipk",
49
49
  "useQuadraticVoting": true
50
50
  }
51
51
  ```
@@ -69,7 +69,7 @@ In the deploy-config.json file set the `useQuadraticVoting` value to **false**.
69
69
  ```json
70
70
  "Poll": {
71
71
  [...]
72
- "coordinatorPubkey": "macipk",
72
+ "coordinatorPublicKey": "macipk",
73
73
  "useQuadraticVoting": false
74
74
  }
75
75
  ```
@@ -86,7 +86,7 @@ while true:
86
86
  if rand >= min:
87
87
  break
88
88
 
89
- privKey = rand % p
89
+ privateKey = rand % p
90
90
  ```
91
91
 
92
92
  #### 1.3. Private key formatting
@@ -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 | Description | Notes |
554
- | ------------------ | -------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
555
- | `genMaciPubkey` | 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
- | `genMaciKeypair` | 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
- | `deployVkRegistry` | Deploy the `VkRegistry` contract | Executed only the coordinator |
558
- | `setVerifyingKeys` | Set verifying keys to the `VkRegistry` | 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
- | `genProofs` | Generate all message processing and vote tallying proofs | Executed only the coordinator |
566
- | `proveOnChain` | Submit proofs to the `PollProcessorAndTallyer` contract | Executed only the coordinator |
567
-
568
- ## 5. Ethereum contracts
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/processMessages.circom`, allows the coordinator to prove that they have correctly applied each message in reverse order, in a consecutive batch of `5 ^ msgBatchDepth` messages to the respective state leaf within the state tree.
583
+ The message processing circuit, defined in `circuits/circom/processMessages.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
- | `msgTreeDepth` | Depth of the message tree, this must be the same value passed to the `deployPoll()` contract function of `MACI.sol` |
657
- | `msgBatchDepth` | 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` |
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
- | `numSignUps` | Number of users that have completed the sign up |
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
- | `msgRoot` | The root of the message tree |
670
- | `msgs` | The batch of messages as an array of arrays |
671
- | `msgSubrootPathElements` | As described below |
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
- | `coordPrivKey` | The coordinator's private key |
608
+ | `coordinatorPrivateKey` | The coordinator's private key |
675
609
  | `batchEndIndex` | The last batch index |
676
- | `encPubKeys` | The public keys used to generate shared ECDH encryption keys to encrypt the messages |
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
- ##### `msgSubrootPathElements`
638
+ ##### `messageSubrootPathElements`
705
639
 
706
- The index of each message in `msgs` is consecutive. As such, in order to prove that each message in `msgs` is indeed a leaf of the message tree, we compute the subtree root of `msgs`, and then verify that the subtree root is indeed a subroot of `msgRoot`.
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 `numSignUps <== (5 ^ stateTreeDepth)`
731
- 4. That `coordinatorPublicKeyHash` is a hash of public key that is correctly derived from `coordPrivKey`
732
- 5. That each message in `msgs` exists in the message tree
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
@@ -827,7 +761,7 @@ The coordinator uses the ballot tallying circuit (`tallyVotes.circom`) to genera
827
761
 
828
762
  | Input signal | Description |
829
763
  | --------------------------------------- | ---------------------------------------------------------------- |
830
- | `numSignUps` | The number of users that signup |
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,7 +808,7 @@ $\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 `numSignUps`
811
+ 2. That `index` is less than or equal to `totalSignups`
878
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 ** intStateTreeDepth)`
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:
@@ -82,13 +82,13 @@ Edit `circuits/circom/circuits` to include the circuits you would like to compil
82
82
  ```json
83
83
  {
84
84
  "PollJoining_10_test": {
85
- "file": "./anon/poll",
85
+ "file": "./anon/voter/PollJoining",
86
86
  "template": "PollJoining",
87
87
  "params": [10],
88
- "pubs": ["nullifier", "stateRoot", "pollPubKey", "pollId"]
88
+ "pubs": ["nullifier", "stateRoot", "pollPublicKey", "pollId"]
89
89
  },
90
90
  "PollJoined_10_test": {
91
- "file": "./anon/poll",
91
+ "file": "./anon/voter/PollJoined",
92
92
  "template": "PollJoined",
93
93
  "params": [10],
94
94
  "pubs": ["stateRoot"]
@@ -98,7 +98,7 @@ Edit `circuits/circom/circuits` to include the circuits you would like to compil
98
98
  "template": "ProcessMessages",
99
99
  "params": [10, 20, 2],
100
100
  "pubs": [
101
- "numSignUps",
101
+ "totalSignups",
102
102
  "index",
103
103
  "batchEndIndex",
104
104
  "currentSbCommitment",
@@ -114,7 +114,7 @@ Edit `circuits/circom/circuits` to include the circuits you would like to compil
114
114
  "template": "ProcessMessagesNonQv",
115
115
  "params": [10, 20, 2],
116
116
  "pubs": [
117
- "numSignUps",
117
+ "totalSignups",
118
118
  "index",
119
119
  "batchEndIndex",
120
120
  "currentSbCommitment",
@@ -129,13 +129,13 @@ Edit `circuits/circom/circuits` to include the circuits you would like to compil
129
129
  "file": "./core/qv/tallyVotes",
130
130
  "template": "TallyVotes",
131
131
  "params": [10, 1, 2],
132
- "pubs": ["index", "numSignUps", "sbCommitment", "currentTallyCommitment", "newTallyCommitment"]
132
+ "pubs": ["index", "totalSignups", "sbCommitment", "currentTallyCommitment", "newTallyCommitment"]
133
133
  },
134
134
  "TallyVotesNonQv_10-1-2_test": {
135
135
  "file": "./core/non-qv/tallyVotes",
136
136
  "template": "TallyVotesNonQv",
137
137
  "params": [10, 1, 2],
138
- "pubs": ["index", "numSignUps", "sbCommitment", "currentTallyCommitment", "newTallyCommitment"]
138
+ "pubs": ["index", "totalSignups", "sbCommitment", "currentTallyCommitment", "newTallyCommitment"]
139
139
  }
140
140
  }
141
141
  ```
@@ -17,12 +17,12 @@ As an example, a [contract](https://github.com/ctrlc03/minimalQF/blob/main/contr
17
17
 
18
18
  ```javascript
19
19
  /// @inheritdoc IMACI
20
- function signUp(PubKey memory _pubKey, bytes memory _signUpPolicyData) public virtual {
20
+ function signUp(PublicKey memory _publicKey, bytes memory _signUpPolicyData) public virtual {
21
21
  // ensure we do not have more signups than what the circuits support
22
22
  if (leanIMTData.size >= maxSignups) revert TooManySignups();
23
23
 
24
24
  // ensure that the public key is on the baby jubjub curve
25
- if (!CurveBabyJubJub.isOnCurve(_pubKey.x, _pubKey.y)) {
25
+ if (!CurveBabyJubJub.isOnCurve(_publicKey.x, _publicKey.y)) {
26
26
  revert InvalidPubKey();
27
27
  }
28
28
 
@@ -31,13 +31,13 @@ function signUp(PubKey memory _pubKey, bytes memory _signUpPolicyData) public vi
31
31
  signUpPolicy.enforce(msg.sender, _signUpPolicyData);
32
32
 
33
33
  // Hash the public key and insert it into the tree.
34
- uint256 pubKeyHash = hashLeftRight(_pubKey.x, _pubKey.y);
34
+ uint256 pubKeyHash = hashLeftRight(_publicKey.x, _publicKey.y);
35
35
  uint256 stateRoot = InternalLeanIMT._insert(leanIMTData, pubKeyHash);
36
36
 
37
37
  // Store the current state tree root in the array
38
38
  stateRootsOnSignUp.push(stateRoot);
39
39
 
40
- emit SignUp(leanIMTData.size - 1, block.timestamp, _pubKey.x, _pubKey.y);
40
+ emit SignUp(leanIMTData.size - 1, block.timestamp, _publicKey.x, _publicKey.y);
41
41
  }
42
42
  ```
43
43
 
@@ -71,7 +71,7 @@ On the other hand, the Poll contract can be inherited to expand functionality su
71
71
  ```javascript
72
72
  function joinPoll(
73
73
  uint256 _nullifier,
74
- PubKey calldata _pubKey,
74
+ PublicKey calldata _publicKey,
75
75
  uint256 _stateRootIndex,
76
76
  uint256[8] calldata _proof,
77
77
  bytes memory _signUpPolicyData,
@@ -86,7 +86,7 @@ function joinPoll(
86
86
  pollNullifiers[_nullifier] = true;
87
87
 
88
88
  // Verify user's proof
89
- if (!verifyJoiningPollProof(_nullifier, _stateRootIndex, _pubKey, _proof)) {
89
+ if (!verifyJoiningPollProof(_nullifier, _stateRootIndex, _publicKey, _proof)) {
90
90
  revert InvalidPollProof();
91
91
  }
92
92
 
@@ -100,7 +100,7 @@ function joinPoll(
100
100
  );
101
101
 
102
102
  // Store user in the pollStateTree
103
- uint256 stateLeaf = hashStateLeaf(StateLeaf(_pubKey, voiceCreditBalance, block.timestamp));
103
+ uint256 stateLeaf = hashStateLeaf(StateLeaf(_publicKey, voiceCreditBalance, block.timestamp));
104
104
 
105
105
  uint256 stateRoot = InternalLazyIMT._insert(pollStateTree, stateLeaf);
106
106
 
@@ -108,7 +108,7 @@ function joinPoll(
108
108
  pollStateRootsOnJoin.push(stateRoot);
109
109
 
110
110
  uint256 pollStateIndex = pollStateTree.numberOfLeaves - 1;
111
- emit PollJoined(_pubKey.x, _pubKey.y, voiceCreditBalance, block.timestamp, _nullifier, pollStateIndex);
111
+ emit PollJoined(_publicKey.x, _publicKey.y, voiceCreditBalance, block.timestamp, _nullifier, pollStateIndex);
112
112
  }
113
113
  ```
114
114
 
@@ -176,7 +176,7 @@ This script contains a number of actions which touch all of the parts of MACI, a
176
176
 
177
177
  Looking at this in more details we do the following:
178
178
 
179
- 1. Deploy a `VkRegistry` contract
179
+ 1. Deploy a `VerifyingKeysRegistry` contract
180
180
  2. Set the verification keys on this smart contract
181
181
  3. Deploy a `MACI` contract (and associated utility contracts)
182
182
  4. Deploy a Poll from the MACI contract.
@@ -7,14 +7,14 @@ sidebar_position: 5
7
7
 
8
8
  # Troubleshooting
9
9
 
10
- ## cli: `genProofs` command failure
10
+ ## cli: `generateProofs` command failure
11
11
 
12
12
  ### Case: missing `.dat` files
13
13
 
14
14
  If your logs look like the following, then make sure you have `ProcessMessages_10-2-1-2_test.dat` and `TallyVotes_10-1-2_test.dat` files in the same directory as your zkeys:
15
15
 
16
16
  ```
17
- node build/ts/index.js genProofs -x 0xf204a4Ef082f5c04bB89F7D5E6568B796096735a \
17
+ node build/ts/index.js generateProofs -x 0xf204a4Ef082f5c04bB89F7D5E6568B796096735a \
18
18
  > -sk macisk.49953af3585856f539d194b46c82f4ed54ec508fb9b882940cbe68bbc57e59e \
19
19
  > -o 0 \
20
20
  > -r ~/rapidsnark/build/prover \
@@ -38,10 +38,10 @@ Aborted (core dumped)
38
38
  Error: could not generate proof.
39
39
  Error: Error executing ./zkeys/ProcessMessages_10-2-1-2_test /tmp/tmp-9904-zG0k8YPTATWB/input.json /tmp/tmp-9904-zG0k8YPTATWB/output.wtns
40
40
  at genProof (/home/ubuntu/maci/circuits/ts/index.ts:44:15)
41
- at /home/ubuntu/maci/cli/ts/genProofs.ts:339:25
42
- at step (/home/ubuntu/maci/cli/build/genProofs.js:33:23)
43
- at Object.next (/home/ubuntu/maci/cli/build/genProofs.js:14:53)
44
- at fulfilled (/home/ubuntu/maci/cli/build/genProofs.js:5:58)
41
+ at /home/ubuntu/maci/cli/ts/generateProofs.ts:339:25
42
+ at step (/home/ubuntu/maci/cli/build/generateProofs.js:33:23)
43
+ at Object.next (/home/ubuntu/maci/cli/build/generateProofs.js:14:53)
44
+ at fulfilled (/home/ubuntu/maci/cli/build/generateProofs.js:5:58)
45
45
  ```
46
46
 
47
47
  You can generate the missing `.dat` files using the following command:
@@ -54,7 +54,7 @@ pnpm build:circuits-c -- --outPath ../cli/zkeys
54
54
 
55
55
  ### Case `Commitment mismatch`
56
56
 
57
- If your log looks like the following, that's because you have already run the `prove` command. You can access the `cli` and attempt again by executing the `genProofs` command.
57
+ If your log looks like the following, that's because you have already run the `prove` command. You can access the `cli` and attempt again by executing the `generateProofs` command.
58
58
 
59
59
  ```
60
60
  Error: commitment mismatch
@@ -69,7 +69,7 @@ Error: commitment mismatch
69
69
   ELIFECYCLE  Command failed with exit code 1.
70
70
  ```
71
71
 
72
- This is because commitments are generated using random salts, thus will differ at each `genProofs` run.
72
+ This is because commitments are generated using random salts, thus will differ at each `generateProofs` run.
73
73
 
74
74
  In [core/Poll.ts](https://github.com/privacy-scaling-explorations/maci/blob/dev/packages/core/ts/Poll.ts):
75
75
 
@@ -84,7 +84,7 @@ while (this.sbSalts[this.currentMessageBatchIndex!] === newSbSalt) {
84
84
 
85
85
  ### Case `AssertionError`
86
86
 
87
- This could happen when you run `prove` in the `contracts` package, or run `genProofs` in the `cli` package. If your log looks like the following, there are two possible reasons:
87
+ This could happen when you run `prove` in the `contracts` package, or run `generateProofs` in the `cli` package. If your log looks like the following, there are two possible reasons:
88
88
 
89
89
  1. If your MACI keypair for the coordinator was generated based on a previous version, it may have been generated incorrectly due to a breaking change in a third-party package (`zk-kit/eddsa-poseidon`). Please generate a new pair and run the whole process again.
90
90
  2. The provided private key is unmatched to the public key which deployed the poll, you will need to input the correct private key.
@@ -130,7 +130,7 @@ TypeError: cannot filter non-indexed parameters; must be null (argument="contrac
130
130
  }
131
131
  ```
132
132
 
133
- This could happen during running `genProofs` in `cli` package, or running `prove` in `contracts` package.
133
+ This could happen during running `generateProofs` in `cli` package, or running `prove` in `contracts` package.
134
134
  Be aware that we updated several parameters to `indexed`:
135
135
 
136
136
  ```javascript
@@ -144,7 +144,7 @@ Please remember to pull the latest MACI repo updates(`git fetch origin && git pu
144
144
 
145
145
  ### Verifier contract found the proof invalid
146
146
 
147
- If your log looks like the following, that's because the zkey and wasm files added to the [`VkRegistry` contract](/docs/technical-references/smart-contracts/VkRegistry) are different from what you use to run the **prove** command. Check if you're using the correct zkey and wasm files.
147
+ If your log looks like the following, that's because the zkey and wasm files added to the [`VerifyingKeysRegistry` contract](/docs/technical-references/smart-contracts/VerifyingKeysRegistry) are different from what you use to run the **prove** command. Check if you're using the correct zkey and wasm files.
148
148
 
149
149
  ```
150
150
  Error: The verifier contract found the proof invalid.
@@ -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 genMaciKeyPair
76
+ pnpm run generateMaciKeyPair
77
77
  ```
78
78
 
79
79
  ### Set the .env
@@ -131,9 +131,9 @@ 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
- #### VkRegistry
134
+ #### VerifyingKeysRegistry
135
135
 
136
- The VkRegistry 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.
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
138
  | Property | Description |
139
139
  | ----------------------- | ------------------------------------------------------------------------------------ |
@@ -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
- | **coordinatorPubkey** | Defines the coordinator public MACI key. |
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. |
@@ -277,7 +277,7 @@ Once the proofs are generated, and results tallied, the results (Tally) are writ
277
277
  "salt": "0x24f57b75c227987727c13d1e83409d70478b42bdc12a4a4df8129c72fbaf5aaf",
278
278
  "commitment": "0xb4ebe68b0da828c0b978ddee86ba934b8e215499ac766491f236ad85fd606de"
279
279
  },
280
- "perVOSpentVoiceCredits": {
280
+ "perVoteOptionSpentVoiceCredits": {
281
281
  "tally": [
282
282
  "81",
283
283
  "0",
@@ -315,4 +315,4 @@ We observe an array named results, which holds the aggregated votes for each opt
315
315
 
316
316
  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
317
 
318
- The `perVOSpentVoiceCredits` 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.
318
+ 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.
@@ -7,7 +7,7 @@ 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
- - [VkRegistry](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/VkRegistry.sol)
10
+ - [VerifyingKeysRegistry](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/VerifyingKeysRegistry.sol)
11
11
  - [PoseidonHashers](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/crypto/Hasher.sol)
12
12
  - [PollFactory](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/PollFactory.sol)
13
13
  - [MessageProcessorFactory](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/MessageProcessorFactory.sol)
@@ -29,7 +29,7 @@ cd cli && node build/ts/index.js checkVerifyingKeys -q false -vk 0x74569d524a193
29
29
  ```
30
30
 
31
31
  :::info
32
- You should change the -vk parameter to the VkRegistry 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.
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
@@ -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(PubKey memory _pubKey, bytes memory _signUpPolicyData) public virtual {
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(_pubKey.x, _pubKey.y)) {
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(_pubKey.x, _pubKey.y);
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, _pubKey.x, _pubKey.y);
85
+ emit SignUp(leanIMTData.size - 1, block.timestamp, _publicKey.x, _publicKey.y);
86
86
  }
87
87
  ```
88
88
 
@@ -156,5 +156,5 @@ Polls require the following information:
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 `numSignUps` function.
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
  :::
@@ -26,7 +26,7 @@ The `joinPoll` function looks as follows:
26
26
  /// @inheritdoc IPoll
27
27
  function joinPoll(
28
28
  uint256 _nullifier,
29
- PubKey calldata _pubKey,
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, _pubKey, _proof)) {
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(_pubKey, voiceCreditBalance, block.timestamp));
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(_pubKey.x, _pubKey.y, voiceCreditBalance, block.timestamp, _nullifier, pollStateIndex);
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, PubKey calldata _encPubKey) public virtual isOpenForVoting {
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 = hashMessageAndEncPubKey(_message, _encPubKey);
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, PubKey[] calldata _encPubKeys) public virtual {
99
+ function publishMessageBatch(Message[] calldata _messages, PublicKey[] calldata _encPubKeys) public virtual {
100
100
  if (_messages.length != _encPubKeys.length) {
101
101
  revert InvalidBatchLength();
102
102
  }