@maci-protocol/website 0.0.0-ci.d0dddbc → 0.0.0-ci.d231815
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/blog/2024-02-28-maci-v1.2.0.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 +7 -1
- package/package.json +11 -10
- 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 +1 -1
- 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 +1 -1
- package/versioned_docs/version-v3.x/core-concepts/poll-types.md +1 -1
- package/versioned_docs/version-v3.x/core-concepts/polls.md +1 -1
- package/versioned_docs/version-v3.x/core-concepts/workflow.md +1 -1
- package/versioned_docs/version-v3.x/guides/integrating.md +2 -2
- package/versioned_docs/version-v3.x/guides/sdk.md +3 -3
- package/versioned_docs/version-v3.x/guides/testing/testing-in-detail.md +3 -3
- package/versioned_docs/version-v3.x/guides/testing/testing-introduction.md +4 -4
- package/versioned_docs/version-v3.x/guides/troubleshooting.md +2 -2
- package/versioned_docs/version-v3.x/processes/versioning.md +3 -3
- package/versioned_docs/version-v3.x/security/trusted-setup.md +1 -1
- package/versioned_docs/version-v3.x/supported-networks/deployed-contracts.md +7 -7
- 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 +1 -1
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/MessageProcessor.md +1 -1
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/Params.md +1 -1
- 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 +1 -1
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/PollFactory.md +1 -1
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/Tally.md +1 -1
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/VkRegistry.md +1 -1
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/VoiceCreditProxy.md +1 -1
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/joinPoll.md +1 -1
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/processMessages.md +66 -6
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/tallyVotes.md +2 -2
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/zk-snark-circuits.md +3 -3
|
@@ -94,7 +94,7 @@ Following the successful completion of our [MACI trusted setup ceremony](https:/
|
|
|
94
94
|
|
|
95
95
|
To accomplish this, we'll leverage the tooling of [P0tion](https://github.com/privacy-scaling-explorations/p0tion), which helps to streamline and automate Groth16 phase2 ceremonies.
|
|
96
96
|
|
|
97
|
-
We'll update this page after the ceremony completes to include the production-ready zkey artifacts. In the meantime, the artifacts for v.1.1.1 can be found on our [website](/docs/security/trusted-setup), and the [`tallyVotes`](https://github.com/privacy-scaling-explorations/maci/blob/
|
|
97
|
+
We'll update this page after the ceremony completes to include the production-ready zkey artifacts. In the meantime, the artifacts for v.1.1.1 can be found on our [website](/docs/security/trusted-setup), and the [`tallyVotes`](https://github.com/privacy-scaling-explorations/maci/blob/main/circuits/circom/tallyVotes.circom) artifacts can still be used in production.
|
|
98
98
|
|
|
99
99
|
## Get Involved
|
|
100
100
|
|
|
@@ -26,7 +26,7 @@ We are happy to announce that we completed the work on developing a service to a
|
|
|
26
26
|
|
|
27
27
|
This server exposes a REST API, as well as some Websocket endpoints (for proof generation only). We soon will publish a detailed guide on how to use, and how to integrate it via its SDK -stay tuned for a separate blog post.
|
|
28
28
|
|
|
29
|
-
For anyone interested in the code, you can find it [here](https://github.com/privacy-scaling-explorations/maci/tree/
|
|
29
|
+
For anyone interested in the code, you can find it [here](https://github.com/privacy-scaling-explorations/maci/tree/main/apps/coordinator).
|
|
30
30
|
|
|
31
31
|
### MACI Offchain voting support
|
|
32
32
|
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
slug: maci-aragon-plugin
|
|
3
|
+
title: MACI Aragon Plugin
|
|
4
|
+
description: A MACI plugin for Aragon OSx to enable private voting in DAOs
|
|
5
|
+
authors:
|
|
6
|
+
- name: ctrlc03
|
|
7
|
+
title: MACI former team lead
|
|
8
|
+
url: https://x.com/ctrlc03
|
|
9
|
+
image_url: https://avatars.githubusercontent.com/u/93448202?v=4
|
|
10
|
+
- name: John Guilding
|
|
11
|
+
title: MACI team lead
|
|
12
|
+
url: https://x.com/john_guilding
|
|
13
|
+
image_url: https://pbs.twimg.com/profile_images/1629144990914945024/C6_xsK78_400x400.jpg
|
|
14
|
+
- name: NicoSerranoP
|
|
15
|
+
title: MACI team member
|
|
16
|
+
url: https://x.com/NicoSerranoP
|
|
17
|
+
image_url: https://avatars.githubusercontent.com/u/38594836?v=4
|
|
18
|
+
tags: [voting, security, anonymity, Aragon, MACI, development]
|
|
19
|
+
excerpt: "A MACI plugin for Aragon OSx to enable private voting in DAOs"
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
Hey Anon,
|
|
23
|
+
|
|
24
|
+
Welcome to another MACI blogpost. Today we are going to be looking at a voting plugin we have been developing to work with the [Aragon OSx stack](https://www.aragon.org/osx).
|
|
25
|
+
|
|
26
|
+
As mentioned in our [latest roadmap blog post](https://maci.pse.dev/blog/2025-Roadmap#2025---what-will-we-focus-the-rest-of-the-year), our team decided to focus on supporting governance projects by integrating with tooling providers such as [Aragon](https://www.aragon.org/). Look out for further announcements over the next month. We're working on some exciting additions to the roadmap to accelerate private governance on Ethereum.
|
|
27
|
+
|
|
28
|
+
So why integrate MACI with Aragon OSx? Our thesis is simple: \***\*private voting will increase voter participation and protect those voting. It will also lead to more honest and accurate outcomes as people can vote more honestly.\*\***
|
|
29
|
+
|
|
30
|
+
Current public voting systems create barriers to honest participation. Voters face social pressure, fear of retaliation, and concerns about how their choices might affect future opportunities. Private voting removes these barriers, enabling DAOs to capture the true preferences of their communities.
|
|
31
|
+
|
|
32
|
+
We chose to integrate with Aragon because their OSx platform provides an excellent foundation for custom DAO governance, and as a reputable team building in the open, they're the perfect partner for this integration.
|
|
33
|
+
|
|
34
|
+
### The real cost of public voting
|
|
35
|
+
|
|
36
|
+
While transparency is often celebrated in crypto, public voting creates serious barriers to honest participation that threaten the legitimacy of DAO governance.
|
|
37
|
+
|
|
38
|
+
**Fear of retaliation keeps voters silent.** Large token holders can pressure smaller voters by threatening to exclude them from future opportunities, airdrops, or partnerships. When voting records are public, retaliation becomes easy to execute, leading many to abstain rather than risk consequences.
|
|
39
|
+
|
|
40
|
+
**Social pressure distorts genuine preferences.** Voters often wait to see how others vote before casting their own ballot, leading to herding behavior that doesn't reflect genuine preferences. Some even [say](https://x.com/LefterisJP/status/1921562225333916094) governance voting has devolved into a game of politics. The "follow the whale" mentality and politics involved undermine the democratic ideals DAOs strive for.
|
|
41
|
+
|
|
42
|
+
**Vote verification enables problematic markets.** When votes are public, it also creates conditions where governance power can be openly [traded](https://www.tronweekly.com/arbitrum-vote-buying-scandal-how-5-eth-shook/), as buyers can verify they received what they paid for.
|
|
43
|
+
|
|
44
|
+
**Public real time results can enable whales intervention.** If the votes are public and visible in real time while the voting period is happening, whales (or users through token loans) could influence the decision by using their voting power to overpower the community decision.
|
|
45
|
+
|
|
46
|
+
### Why MACI
|
|
47
|
+
|
|
48
|
+
MACI (Minimal Anti Collusion Infrastructure) is a private voting protocol that aims to reduce collusion and coercion with receipt freeness - this makes it the logical next step for DAOs that really care about the problems highlighted above.
|
|
49
|
+
|
|
50
|
+
In more detail, every vote is encrypted and can only be decrypted for tallying, by a trusted entity referred to as the coordinator. Voters can override their votes at any point during the voting period, and thus without a clear receipt for their vote, they are not able to prove beyond reasonable doubt that they actually voted for an option. This discourages bribers from buying votes and other voters from attempting to collude.
|
|
51
|
+
|
|
52
|
+
While the coordinator can decrypt votes, they cannot produce an incorrect tally or censor votes, thanks to zero knowledge proofs and smart contracts.
|
|
53
|
+
|
|
54
|
+
For more details about MACI and how it works, we recommend reading our other blogposts such as this introductory [article](https://maci.pse.dev/blog/maci-for-beginners) and our comprehensive documentation [website](https://maci.pse.dev/docs/introduction).
|
|
55
|
+
|
|
56
|
+
### How does Aragon OSx work
|
|
57
|
+
|
|
58
|
+
Aragon OSx is a smart contract framework that works on EVM compatible chains. DAOs can easily deploy custom governance stacks using Aragon OSx, and can benefit from several plugins to extend their functionality over time. This plugin architecture allows DAOs to customise their governance without rebuilding from scratch.
|
|
59
|
+
|
|
60
|
+
A plugin is a smart contract with custom governance logic, limited in scope, and with single-purpose logic that can be used to extend OSx-based organisations. Examples include [token voting](https://docs.aragon.org/token-voting/1.x/index.html) and [multisig](https://docs.aragon.org/multisig/1.x/index.html), and now.. privacy-preserving voting through MACI.
|
|
61
|
+
|
|
62
|
+
### How does the MACI plugin work
|
|
63
|
+
|
|
64
|
+
The plugin allows DAO members to create new proposals by calling a smart contract function: `createProposal`. The function checks that the caller has enough governance tokens - this minimum amount is set by the DAO at deployment time. The plugin creates a new MACI poll that hosts the encrypted private votes for that particular proposal.
|
|
65
|
+
|
|
66
|
+
The plugin then captures the current block number (minus one) as a snapshot to determine voter eligibility. Once they decide to vote, they can register their interest to vote via their DAO frontend (in MACI's context we call this process _join a poll_), and their voting power is determined by their token balance at the time of proposal creation. Voters can use their real wallet holding their tokens to register themselves by publishing a MACI public key created on their devices. After that, the voter can use any wallet to submit an encrypted message containing the registered public key and their selected option.
|
|
67
|
+
|
|
68
|
+
Voters are then able to vote using their full voting power by choosing one of the options available, which at this time are Yes, No or Abstain. Voting is completely handled by MACI’s smart contracts, therefore voters do not actually ever interact with the DAO plugin.
|
|
69
|
+
|
|
70
|
+
Once the proposal ends, MACI’s backend service (the [coordinator service](https://github.com/privacy-scaling-explorations/maci/tree/dev/apps/coordinator)), starts processing the votes, and generate zk-SNARK proofs to be validated on chain. Voters can be sure of the correct execution thanks to those proofs verifying on chain. Finally, the results are uploaded and the proposal execution can be triggered.
|
|
71
|
+
|
|
72
|
+
The full flow can be observed in the diagram below:
|
|
73
|
+
|
|
74
|
+

|
|
75
|
+
|
|
76
|
+
A proposal execution can range from transferring funds, calling a function on the DAO smart contract itself, calling out an external contract (for instance to initiate a token swap), or setting up a new plugin.
|
|
77
|
+
|
|
78
|
+
An example proposal shown below, with a proposal requesting users to vote on whether they are happy to convert part of the DAOs USDC reserves to ETH.
|
|
79
|
+
|
|
80
|
+

|
|
81
|
+
|
|
82
|
+
The familiar voting interface makes privacy seamless - voters simply select their choice without needing to understand the cryptography running behind the scenes.
|
|
83
|
+
|
|
84
|
+

|
|
85
|
+
|
|
86
|
+
### Implementation Considerations
|
|
87
|
+
|
|
88
|
+
- **Network Support:** Currently compatible with all EVM chains such as Ethereum, Arbitrum, Optimism, and some zkEVM networks such as Scroll and Linea. [Here](https://maci.pse.dev/docs/supported-networks/) is a list of all compatible networks.
|
|
89
|
+
- **Timeline:** Vote processing is not immediate due to the need to process votes offchain and to generate zk-SNARK proofs of correct execution. The time it takes to process votes can be reduced by using more powerful hardware.
|
|
90
|
+
- **Reliance on trusted coordinator:** MACI in its current form relies on a trusted coordinator entity which can decrypt the votes - this is an automated piece of software that can run on a server or a Trusted Execution Environment for more security. The team is working on decentralising the coordinator entity and will soon begin working on an upgraded version that uses homomorphic encryption and threshold encryption to distribute the responsibilities across multiple entities. Please note that while the coordinator can see the votes, they cannot censor users nor provide incorrect results.
|
|
91
|
+
- **Costs:** Using MACI can be more costly than traditional blockchain-based voting. While these costs are negligible in layer 2 networks, costs can increase in Ethereum mainnet. Please refer to our [costs](https://maci.pse.dev/docs/supported-networks/costs) section in the documentation website for more details on current benchmarks.
|
|
92
|
+
|
|
93
|
+
### Next steps
|
|
94
|
+
|
|
95
|
+
As DAOs evolve from experimental communities to serious organisations managing significant resources, governance systems must evolve too. The current landscape presents an ideal opportunity for DAOs to pioneer MACI, thus we are looking for forward-thinking DAOs to pilot MACI’s governance plugin - especially those facing challenges around voter participation, sensitive decision-making, or community pressure. Ready to be among the first? Reach out at [maci@pse.dev](mailto:maci@pse.dev) or join our [Discord](https://discord.com/invite/sF5CT5rzrR). Governance on Ethereum needs a privacy shake up, stay in the loop if you're interested in hearing what else the team has been working on.
|
|
96
|
+
|
|
97
|
+
### References and resources
|
|
98
|
+
|
|
99
|
+
- [MACI repo](https://github.com/privacy-scaling-explorations/maci)
|
|
100
|
+
- [MACI voting plugin](https://github.com/privacy-scaling-explorations/maci-voting-plugin-aragon)
|
|
101
|
+
- [MACI -Aragon sample frontend](https://github.com/privacy-scaling-explorations/maci-aragon-osx-gov-app)
|
|
102
|
+
- [Aragon OSx](https://github.com/aragon/osx)
|
|
103
|
+
- [Aragon docs](https://docs.aragon.org/)
|
|
104
|
+
|
|
105
|
+
## Acknowledgements
|
|
106
|
+
|
|
107
|
+
Thanks to the Aragon team for review.
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
---
|
|
2
|
+
slug: maci-coordinator-service
|
|
3
|
+
title: MACI Coordinator Service
|
|
4
|
+
description: Announcing our coordinator service for MACI
|
|
5
|
+
authors:
|
|
6
|
+
- name: ctrlc03
|
|
7
|
+
title: MACI former team lead
|
|
8
|
+
url: https://x.com/ctrlc03
|
|
9
|
+
image_url: https://avatars.githubusercontent.com/u/93448202?v=4c
|
|
10
|
+
- name: NicoSerranoP
|
|
11
|
+
title: MACI team member
|
|
12
|
+
url: https://x.com/NicoSerranoP
|
|
13
|
+
image_url: https://avatars.githubusercontent.com/u/38594836?v=4
|
|
14
|
+
tags: [voting, security, anonymity, MACI, coordinator]
|
|
15
|
+
excerpt: "A MACI plugin for Aragon OSx to enable private voting in DAOs"
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
Hey Anon,
|
|
19
|
+
|
|
20
|
+
Welcome back to our MACI blog.
|
|
21
|
+
|
|
22
|
+
Today, we are excited to officially announce something we have referenced frequently: the Coordinator Service.
|
|
23
|
+
|
|
24
|
+
If you ever used MACI, for instance to run a Retroactive Public Goods Funding (RPGF) or Quadratic Funding (QF) round, you might be aware of how tedious it was to operate. The manual process of running scripts to finalise a round and calculate the tally as well as all of the zk-SNARK proofs could require some time and technical expertise. All these steps had to be done in the terminal and you needed to be familiar with MACI's inner workings to understand the process.
|
|
25
|
+
|
|
26
|
+
**Fear no more - the coordinator service is here to make your life easier.**
|
|
27
|
+
|
|
28
|
+
## The vision: MACI for everyone
|
|
29
|
+
|
|
30
|
+
Our goal is ambitious, yet simple: **completely eliminate the need for any technical knowledge to use MACI**. No more terminal commands, no more manual proof generation, no more complex scripts. Just configure once, run inside a Docker container on your server, and enjoy the full power of MACI's privacy-preserving voting infrastructure.
|
|
31
|
+
|
|
32
|
+
## Technical implementation
|
|
33
|
+
|
|
34
|
+
The service was built with the following technologies for reliability and scalability:
|
|
35
|
+
|
|
36
|
+
- TypeScript for type-safe, maintainable code
|
|
37
|
+
- Nest.js framework for enterprise-grade architecture
|
|
38
|
+
- REST API for standard CRUD operations
|
|
39
|
+
- WebSocket endpoints for real-time updates during intensive computations
|
|
40
|
+
- MACI SDK package to have all the logic and functions ready to use
|
|
41
|
+
- Docker-ready for simple deployment anywhere
|
|
42
|
+
|
|
43
|
+
The core functionalities of the service are as follows:
|
|
44
|
+
|
|
45
|
+
- Deploy a MACI [subgraph](https://github.com/privacy-scaling-explorations/maci/tree/dev/apps/coordinator/ts/subgraph) to query on-chain data easily
|
|
46
|
+
- [Deploy](https://github.com/privacy-scaling-explorations/maci/tree/dev/apps/coordinator/ts/deployer) the MACI smart contracts, including polls
|
|
47
|
+
- [Finalise](https://github.com/privacy-scaling-explorations/maci/tree/dev/apps/coordinator/ts/proof) polls by processing votes and tallying the results
|
|
48
|
+
- [Schedule](https://github.com/privacy-scaling-explorations/maci/tree/main/apps/coordinator/ts/scheduler) polls for automatic finalization when the voting period ends
|
|
49
|
+
- [Health](https://github.com/privacy-scaling-explorations/maci/tree/main/apps/coordinator/ts/health) endpoint to check everything is setup and working
|
|
50
|
+
|
|
51
|
+
Let's dive into more details in the following sections.
|
|
52
|
+
|
|
53
|
+
### Subraph deployment
|
|
54
|
+
|
|
55
|
+
The endpoint to deploy a subgraph requires some configuration in the `.env` file, as well as an HTTP request to the endpoint responsible for this `https://coordinator.maci.vote/v1/subgraph/deploy`. Make sure you have an account in [The Graph](https://thegraph.com/studio/) to setup your `.env` file before starting the coordinator service.
|
|
56
|
+
|
|
57
|
+
### Contracts deployment
|
|
58
|
+
|
|
59
|
+
There are two endpoints in this module: deploy maci (`https://coordinator.maci.vote/v1/deploy/maci`) and deploy poll (`https://coordinator.maci.vote/v1/deploy/poll`). This will take care of all contracts deployment and configuration. It is worth pointing out that you should read the [coordinator service API documentation](https://coordinator.maci.vote/api) and the [MACI guides](https://maci.pse.dev/docs/core-concepts/workflow) to understand the roles of each contract (MACI, poll, policy, initialVoiceCredit).
|
|
60
|
+
|
|
61
|
+
You can deploy one MACI contract (and its internal smart contracts) that will have one gatekeeper policy (e.g. FreeForAll) for all voters to sign up. After that you can deploy multiple polls with different settings (start date, end date, gatekeeper policy, etc). Each voter will have to join each poll to be eligible to participate in. The poll's gatekeeper will check the voter eligibility to join the poll.
|
|
62
|
+
|
|
63
|
+
### Finalisation
|
|
64
|
+
|
|
65
|
+
This step includes three separate actions:
|
|
66
|
+
|
|
67
|
+
1. Merge - calculate the state merkle tree root and store a commitment to its root (`https://coordinator.maci.vote/v1/proof/merge`)
|
|
68
|
+
2. Process - fetch all smart contracts events to reconstruct the state locally and process all votes. This includes decrypting votes, checking validity, and finally tallying them. zk-SNARK proofs are generated for each batch of votes processed (`https://coordinator.maci.vote/v1/proof/generate`)
|
|
69
|
+
3. Submit - submitting all of the zk-SNARK proofs on chain to prove that the poll was processed correctly. Finally, submit the tally results on chain so that they can be seen by everyone (`https://coordinator.maci.vote/v1/proof/submit`)
|
|
70
|
+
|
|
71
|
+
We chose to separate each action into its own endpoint to avoid long-running computations that could lead to network errors or timeouts.
|
|
72
|
+
|
|
73
|
+
### Schedule
|
|
74
|
+
|
|
75
|
+
After finishing up the finalisation module, we realized that it would be a lot easier for users to create polls and schedule the finalization process. This removes the need for users to manually call the finalization endpoints described above.
|
|
76
|
+
|
|
77
|
+
1. To schedule a deployed poll you can use `https://coordinator.maci.vote/v1/scheduler/register`.
|
|
78
|
+
2. To check if a poll is scheduled you can use `https://coordinator.maci.vote/v1/scheduler/status`
|
|
79
|
+
3. To delete a scheduled poll you can use `https://coordinator.maci.vote/v1/scheduler/delete`
|
|
80
|
+
|
|
81
|
+
## How to use
|
|
82
|
+
|
|
83
|
+
### Run it from source
|
|
84
|
+
|
|
85
|
+
1. Clone the MACI repository: [https://github.com/privacy-scaling-explorations/maci](https://github.com/privacy-scaling-explorations/maci)
|
|
86
|
+
2. Install dependencies and build the project
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
pnpm install
|
|
90
|
+
pnpm run build
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
3. Download the zkeys for the coordinator
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
pnpm run download-zkeys:ceremony:coordinator
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
4. Generate a coordinator MACI keypair. Remember to store those values for later.
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
pnpm run generate-maci-keypair
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
5. Move to the coordinator service directory
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
cd apps/coordinator
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
6. Configure your `.env` file. Make sure to configure it with your own secure values. The coordinator MACI private key from the previous step should be set here
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
cp .env.example .env
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
7. Start the service
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
pnpm run start
|
|
121
|
+
# or
|
|
122
|
+
pnpm run start:prod
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Run it with Docker
|
|
126
|
+
|
|
127
|
+
1. Clone the MACI repository: [https://github.com/privacy-scaling-explorations/maci](https://github.com/privacy-scaling-explorations/maci)
|
|
128
|
+
2. Go inside the project directory
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
cd maci
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
3. Build the docker image and run the container
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Build docker
|
|
138
|
+
docker compose -f apps/coordinator/docker-compose.yml build
|
|
139
|
+
|
|
140
|
+
# Run container detached
|
|
141
|
+
docker compose -f apps/coordinator/docker-compose.yml up -d
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Usage notes
|
|
145
|
+
|
|
146
|
+
1. You can check out the documentation while the service is running in [http://localhost:3001/api](http://localhost:3001/api)
|
|
147
|
+
|
|
148
|
+
2. We have a [e2e.deploy.test.ts](https://github.com/privacy-scaling-explorations/maci/blob/main/apps/coordinator/tests/e2e.deploy.test.ts) file that performs a complete process: deployment, voting and finalization. You can use it to guide yourself.
|
|
149
|
+
|
|
150
|
+
## Future work
|
|
151
|
+
|
|
152
|
+
We are researching about different cryptographic methods to decentralize the coordinator. The idea is to eliminate reliance on a single centralized service for finalizing polls. A group of people would be able to spin up their own coordinator services and finalize the poll in a multi-party computation. For more info check out our MACI v4 research.
|
|
153
|
+
|
|
154
|
+
## Conclusion
|
|
155
|
+
|
|
156
|
+
The MACI Coordinator Service represents a significant leap forward in making MACI accessible to everyone. Whether you're running a small community poll or a large-scale funding round, the coordinator service handles the complexity so you can focus on what matters - empowering your community with private, secure voting.
|
|
157
|
+
|
|
158
|
+
Ready to get started? Head over to our documentation and deploy your first MACI round today!
|
|
159
|
+
|
|
160
|
+
Please reach out if you would like to integrate the service into your frontend.
|
|
161
|
+
|
|
162
|
+
## References
|
|
163
|
+
|
|
164
|
+
- [MACI repo](https://github.com/privacy-scaling-explorations/maci)
|
|
165
|
+
- [Sample frontend](https://github.com/privacy-scaling-explorations/maci-aragon-osx-gov-app) using the coordinator service
|
|
166
|
+
- [Code examples](https://github.com/privacy-scaling-explorations/maci-aragon-osx-gov-app/blob/main/plugins/maciVoting/contexts/CoordinatorContext.tsx)
|
|
167
|
+
- [Documentation](https://maci.pse.dev/docs/category/coordinator-service)
|
package/docusaurus.config.ts
CHANGED
|
@@ -204,9 +204,15 @@ async function getConfig(): Promise<Config> {
|
|
|
204
204
|
phpLoader: "matomo.php",
|
|
205
205
|
jsLoader: "matomo.js",
|
|
206
206
|
},
|
|
207
|
+
mermaid: {
|
|
208
|
+
theme: { light: "neutral", dark: "forest" },
|
|
209
|
+
},
|
|
207
210
|
} satisfies Preset.ThemeConfig,
|
|
211
|
+
markdown: {
|
|
212
|
+
mermaid: true,
|
|
213
|
+
},
|
|
214
|
+
themes: ["@docusaurus/theme-mermaid"],
|
|
208
215
|
};
|
|
209
|
-
|
|
210
216
|
return config;
|
|
211
217
|
}
|
|
212
218
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maci-protocol/website",
|
|
3
|
-
"version": "0.0.0-ci.
|
|
3
|
+
"version": "0.0.0-ci.d231815",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -25,26 +25,27 @@
|
|
|
25
25
|
"@docusaurus/preset-classic": "^3.8.1",
|
|
26
26
|
"@docusaurus/theme-classic": "^3.8.1",
|
|
27
27
|
"@docusaurus/theme-common": "^3.8.1",
|
|
28
|
-
"@
|
|
28
|
+
"@docusaurus/theme-mermaid": "^3.8.1",
|
|
29
|
+
"@easyops-cn/docusaurus-search-local": "^0.55.1",
|
|
29
30
|
"@mdx-js/react": "^3.1.0",
|
|
30
31
|
"clsx": "^2.1.1",
|
|
31
32
|
"docusaurus-plugin-image-zoom": "^3.0.1",
|
|
32
33
|
"docusaurus-plugin-matomo": "^0.0.8",
|
|
33
34
|
"gray-matter": "^4.0.3",
|
|
34
35
|
"prism-react-renderer": "^2.4.1",
|
|
35
|
-
"react": "^19.
|
|
36
|
-
"react-dom": "^19.
|
|
36
|
+
"react": "^19.2.4",
|
|
37
|
+
"react-dom": "^19.2.4",
|
|
37
38
|
"rehype-katex": "^7.0.1",
|
|
38
39
|
"remark-math": "^6.0.0"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
|
-
"@docusaurus/module-type-aliases": "^3.
|
|
42
|
+
"@docusaurus/module-type-aliases": "^3.9.2",
|
|
42
43
|
"@docusaurus/tsconfig": "^3.8.1",
|
|
43
44
|
"@docusaurus/types": "^3.8.1",
|
|
44
|
-
"@types/node": "^24.0
|
|
45
|
-
"@types/react": "^19.1.
|
|
45
|
+
"@types/node": "^24.11.0",
|
|
46
|
+
"@types/react": "^19.1.9",
|
|
46
47
|
"ts-node": "^10.9.2",
|
|
47
|
-
"typescript": "^5.
|
|
48
|
+
"typescript": "^5.9.2"
|
|
48
49
|
},
|
|
49
50
|
"browserslist": {
|
|
50
51
|
"production": [
|
|
@@ -59,7 +60,7 @@
|
|
|
59
60
|
]
|
|
60
61
|
},
|
|
61
62
|
"engines": {
|
|
62
|
-
"node": "
|
|
63
|
+
"node": "20"
|
|
63
64
|
},
|
|
64
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "271bc779ccbd8510ae0fcbc43063aacffe39d4d9"
|
|
65
66
|
}
|
|
@@ -84,7 +84,7 @@ uint256[] memory _finalSaltedResults,
|
|
|
84
84
|
uint256[8] memory _proof
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
-
This allows the coordinator to prove the correctness of their vote tally (in `_finalSaltedResults`). They do this in batches of state leaves. Each batch of state leaves is accumulated into an intermediate state root, and the Merkle root of all the intermediate state roots is the full state root. The proof shows that the result of adding the votes in the current batch to the
|
|
87
|
+
This allows the coordinator to prove the correctness of their vote tally (in `_finalSaltedResults`). They do this in batches of state leaves. Each batch of state leaves is accumulated into an intermediate state root, and the Merkle root of all the intermediate state roots is the full state root. The proof shows that the result of adding the votes in the current batch to the cumulative results is computed correctly, but hides the results by salting and hashing them.
|
|
88
88
|
|
|
89
89
|
`_finalSaltedResults` can be any value but for the final batch, it must be the correct quadratic vote tally.
|
|
90
90
|
|
|
@@ -41,9 +41,7 @@ Refer to the [Glossary](#glossary) for definitions of terms.
|
|
|
41
41
|
3. The signup period ends after a fixed amount of time. From that point onwards, users may no longer invoke `signUp()` in this contract.
|
|
42
42
|
|
|
43
43
|
4. Each user votes. To do this, they:
|
|
44
|
-
|
|
45
44
|
- Sign their command using the key which they had signed up with and then use a random (ephemeral) key as well as the coordinator's public key to generate a shared key (via ECDH) encrypt it.
|
|
46
|
-
|
|
47
45
|
- If they are bribed, the user should sign it using an old public key which has already been replaced with a new one.
|
|
48
46
|
|
|
49
47
|
- Otherwise, the user should use the most current public key they have registered.
|
|
@@ -53,9 +51,7 @@ Refer to the [Glossary](#glossary) for definitions of terms.
|
|
|
53
51
|
5. The coordinator processes all the commands after the voting period ends.
|
|
54
52
|
|
|
55
53
|
6. For each batch of commands, they perform the following steps:
|
|
56
|
-
|
|
57
54
|
- Generate a new state root which is the result of:
|
|
58
|
-
|
|
59
55
|
- For each valid command, in reverse order, update the state leaf accordingly
|
|
60
56
|
|
|
61
57
|
- Ignore all invalid commands
|
|
@@ -47,7 +47,7 @@ The MACI contract's `quadraticVoteTally()` function should verify a proof create
|
|
|
47
47
|
| `currentResultsSalt` | Private | A random value to hash with the vote tally for state leaves up to the current batch | Coordinator |
|
|
48
48
|
| `currentResultsCommitment` | Public | The salted commitment of the values in `currentResults` | Contract |
|
|
49
49
|
| `newResultsCommitment` | Public | The salted commitment of the vote tally for this batch of leaves plus the vote tally from `currentResults` | Contract |
|
|
50
|
-
| `salt` | Private | A random value to hash with the
|
|
50
|
+
| `salt` | Private | A random value to hash with the cumulate vote tally for this batch of state leaves | Coordinator |
|
|
51
51
|
| `stateLeaves[m][p]` | Private | The batch of leaves of the state tree to tally. | Coordinator |
|
|
52
52
|
| `voteLeaves[m][n]` | Private | The vote leaves for each user in this batch of state leaves. | Coordinator |
|
|
53
53
|
|
|
@@ -11,11 +11,11 @@ MACI uses zk-SNARKs to essentially hide how each person voted while still reveal
|
|
|
11
11
|
|
|
12
12
|
## MACI Circuits
|
|
13
13
|
|
|
14
|
-
MACI has three main zk-SNARK [circuits](https://github.com/privacy-scaling-explorations/maci/tree/
|
|
14
|
+
MACI has three main zk-SNARK [circuits](https://github.com/privacy-scaling-explorations/maci/tree/main/circuits):
|
|
15
15
|
|
|
16
|
-
1. [`ProcessMessages.circom`](https://github.com/privacy-scaling-explorations/maci/blob/
|
|
17
|
-
2. [`TallyVotes.circom`](https://github.com/privacy-scaling-explorations/maci/blob/
|
|
18
|
-
3. [`Subsidy.circom`](https://github.com/privacy-scaling-explorations/maci/blob/
|
|
16
|
+
1. [`ProcessMessages.circom`](https://github.com/privacy-scaling-explorations/maci/blob/main/circuits/circom/processMessages.circom), which takes a batch of encrypted messages, decrypts them, and generates a proof that the coordinator's local processing was performed correctly.
|
|
17
|
+
2. [`TallyVotes.circom`](https://github.com/privacy-scaling-explorations/maci/blob/main/circuits/circom/tallyVotes.circom), which counts votes from users' ballots, batch by batch.
|
|
18
|
+
3. [`Subsidy.circom`](https://github.com/privacy-scaling-explorations/maci/blob/main/circuits/circom/subsidy.circom), which implements [pairwise subsidy](https://hackmd.io/@chaosma/H1_9xmT2K). Please note this is an optional feature.
|
|
19
19
|
|
|
20
20
|
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.
|
|
21
21
|
|
|
@@ -45,7 +45,7 @@ The circuits are used by the coordinator (the prover) to prove that they have co
|
|
|
45
45
|
|
|
46
46
|
## How do the circuits work?
|
|
47
47
|
|
|
48
|
-
### Message processing ([`processMessages`](https://github.com/privacy-scaling-explorations/maci/blob/
|
|
48
|
+
### Message processing ([`processMessages`](https://github.com/privacy-scaling-explorations/maci/blob/main/circuits/circom/processMessages.circom))
|
|
49
49
|
|
|
50
50
|
This circuit allows the coordinator to prove that they have correctly processed each message in reverse order, in a consecutive batch of 5 ^ msgBatchDepth 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.
|
|
51
51
|
|
|
@@ -162,7 +162,7 @@ A simplified example using a tree of arity 2:
|
|
|
162
162
|
|
|
163
163
|
To prove that `a...d` are leaves of the tree with root `r`, we prove that the leaves have the subroot `s` with depth 2, and _then_ prove that `s` is a member of `r` at depth 1.
|
|
164
164
|
|
|
165
|
-
The implementation for this is in the `QuinBatchLeavesExists` circuit in `https://github.com/privacy-scaling-explorations/maci/blob/
|
|
165
|
+
The implementation for this is in the `QuinBatchLeavesExists` circuit in `https://github.com/privacy-scaling-explorations/maci/blob/main/circuits/circom/trees/incrementalQuinTree.circom`.
|
|
166
166
|
|
|
167
167
|
This method requires fewer circuit constraints than if we verified a Merkle proof for each leaf.
|
|
168
168
|
|
|
@@ -177,7 +177,7 @@ This method requires fewer circuit constraints than if we verified a Merkle proo
|
|
|
177
177
|
7. That each message in `msgs` exists in the message tree
|
|
178
178
|
8. 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`
|
|
179
179
|
|
|
180
|
-
### Tally Votes ([`tallyVotes`](https://github.com/privacy-scaling-explorations/maci/blob/
|
|
180
|
+
### Tally Votes ([`tallyVotes`](https://github.com/privacy-scaling-explorations/maci/blob/main/circuits/circom/tallyVotes.circom))
|
|
181
181
|
|
|
182
182
|
#### Parameters
|
|
183
183
|
|
|
@@ -280,7 +280,7 @@ $poseidon_3([tc_r, tc_t, tc_p])$
|
|
|
280
280
|
6. That the tally is valid, which is:
|
|
281
281
|
- That the sum of votes per vote option is correct
|
|
282
282
|
|
|
283
|
-
### Subsisdy ([`subsidy`](https://github.com/privacy-scaling-explorations/maci/blob/
|
|
283
|
+
### Subsisdy ([`subsidy`](https://github.com/privacy-scaling-explorations/maci/blob/main/circuits/circom/subsidy.circom))
|
|
284
284
|
|
|
285
285
|
This circuit is an optional feature - it's not required for MACI to function.
|
|
286
286
|
The subsidy circuit is used to implement pairwise subsidy. This is a technique that can be used to detect voters collusion. It currently is not optimized for production and the team will work on a more efficient implementation in the future.
|
|
@@ -37,13 +37,13 @@ Pull requests are great if you want to add a feature or fix a bug. Here's a quic
|
|
|
37
37
|
|
|
38
38
|
7. Make the test pass.
|
|
39
39
|
|
|
40
|
-
8. Commit your changes. Please make sure your forked `
|
|
40
|
+
8. Commit your changes. Please make sure your forked `main` branch is synched 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:
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
|
-
git reset $(git merge-base
|
|
43
|
+
git reset $(git merge-base main $(git rev-parse --abbrev-ref HEAD))
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
9. Push to your fork and submit a pull request on our `
|
|
46
|
+
9. 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.
|
|
47
47
|
|
|
48
48
|
10. Link any issues that the PR is addressing as described in our processes documentation.
|
|
49
49
|
|
|
@@ -111,7 +111,7 @@ Just as in the subject, use the imperative, present tense: "change" not "changed
|
|
|
111
111
|
|
|
112
112
|
### Branch rules
|
|
113
113
|
|
|
114
|
-
- Branches should generally be created off of the base branch (`
|
|
114
|
+
- Branches should generally be created off of the base branch (`main` )
|
|
115
115
|
- Avoid long descriptive names for long-lived branches
|
|
116
116
|
- Use kebab-case (no CamelCase)
|
|
117
117
|
- Use grouping tokens (words) at the beginning of your branch names (in a similar way to the `type` of commit)
|
|
@@ -112,7 +112,7 @@ For non-quadratic voting polls, you can use the `--use-quadratic-voting false` f
|
|
|
112
112
|
5. Run `pnpm deploy-poll` to deploy your first Poll (you can specify the network by appending `:network` to the command, e.g. `pnpm deploy-poll:sepolia` - please refer to the available networks on the `package.json` scripts section)
|
|
113
113
|
|
|
114
114
|
:::info
|
|
115
|
-
Should you wish to deploy on a different network, you will need to update the [contracts/tasks/helpers/constants.ts](https://github.com/privacy-scaling-explorations/maci/blob/
|
|
115
|
+
Should you wish to deploy on a different network, you will need to update the [contracts/tasks/helpers/constants.ts](https://github.com/privacy-scaling-explorations/maci/blob/main/contracts/tasks/helpers/constants.ts) file.
|
|
116
116
|
:::
|
|
117
117
|
|
|
118
118
|
6. You will find all of the deployed contracts addresses and configs in the `deployed-contracts.json` file inside the contracts folder.
|
|
@@ -140,7 +140,7 @@ function contribute(
|
|
|
140
140
|
|
|
141
141
|
## InitialVoiceCreditProxy
|
|
142
142
|
|
|
143
|
-
If you'd like to extend the functionality of how votes are distributed among users, you need to extend [InitialVoiceCreditProxy](https://github.com/privacy-scaling-explorations/maci/blob/
|
|
143
|
+
If you'd like to extend the functionality of how votes are distributed among users, you need to extend [InitialVoiceCreditProxy](https://github.com/privacy-scaling-explorations/maci/blob/main/contracts/contracts/initialVoiceCreditProxy/InitialVoiceCreditProxy.sol) contract. You can see our [basic example](https://github.com/privacy-scaling-explorations/maci/blob/main/contracts/contracts/initialVoiceCreditProxy/ConstantInitialVoiceCreditProxy.sol) how it's implemented for constant distribution.
|
|
144
144
|
|
|
145
145
|
```javascript
|
|
146
146
|
// SPDX-License-Identifier: MIT
|
|
@@ -178,5 +178,5 @@ expect(stateLeaf2.pubKey.equals(user2Keypair.pubKey)).to.eq(true);
|
|
|
178
178
|
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.
|
|
179
179
|
|
|
180
180
|
:::info
|
|
181
|
-
Tests related to key changes have been added to the [core package](https://github.com/privacy-scaling-explorations/maci/blob/
|
|
181
|
+
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/).
|
|
182
182
|
:::
|
|
@@ -13,7 +13,7 @@ This document will explain how to use each of these options.
|
|
|
13
13
|
|
|
14
14
|
## Quadratic Voting
|
|
15
15
|
|
|
16
|
-
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/
|
|
16
|
+
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/contracts/contracts/initialVoiceCreditProxy/InitialVoiceCreditProxy.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.
|
|
17
17
|
|
|
18
18
|
To run a poll with quadratic voting, the coordinator must set the `useQuadraticVoting` parameter to `true` when creating the MACI instance. This will make the MACI instance use the `Tally` smart contract, which is the one that has been used since the beginning of MACI.
|
|
19
19
|
|
|
@@ -171,7 +171,7 @@ Within the circuits folder, there are a number of tests that are used to verify
|
|
|
171
171
|
|
|
172
172
|
These tests often use mock data from the `core` package. For instance, when testing the `processMessages` circuit, we are required to generate the parameters from the `core` packing, using the `Poll:processMessages` function. The same applies to vote tallying, where we need the `Poll:tally` function to be run first with mock users and vote messages.
|
|
173
173
|
|
|
174
|
-
All of the tests run using test parameters, usually `10, 2, 1, 2`, aside from the tests inside: [`ceremonyParam`](https://github.com/privacy-scaling-explorations/maci/blob/
|
|
174
|
+
All of the tests run using test parameters, usually `10, 2, 1, 2`, aside from the tests inside: [`ceremonyParam`](https://github.com/privacy-scaling-explorations/maci/blob/main/circuits/ts/__tests__/CeremonyParams.test.ts) which use the parameters of the latest MACI ceremony. More details on the trusted setup can be found [here](/docs/v1.2/trusted-setup).
|
|
175
175
|
|
|
176
176
|
### Core
|
|
177
177
|
|
|
@@ -179,7 +179,7 @@ The core package contains a number of tests that are used to verify that the cor
|
|
|
179
179
|
|
|
180
180
|
These tests interact with the crypto and dombinobjs packages, where mock data comes from. Their main goal is to ensure that the core functions work as expected, and that the state is as expected after a series of operations.
|
|
181
181
|
|
|
182
|
-
Currently, there is a blend of e2e and unit tests, where e2e tests are used to verify that the entire MACI local processing works as expected (users signup, publish votes, messages are processed and finally these votes are tallied). Unit tests on the other hand are used to verify that the core functions work as expected, such as `processMessage` and `tallyVotes`. You will find them in separate files, with e2e being [here](https://github.com/privacy-scaling-explorations/maci/blob/
|
|
182
|
+
Currently, there is a blend of e2e and unit tests, where e2e tests are used to verify that the entire MACI local processing works as expected (users signup, publish votes, messages are processed and finally these votes are tallied). Unit tests on the other hand are used to verify that the core functions work as expected, such as `processMessage` and `tallyVotes`. You will find them in separate files, with e2e being [here](https://github.com/privacy-scaling-explorations/maci/blob/main/core/ts/__tests__/e2e.test.ts) and unit tests in the other files.
|
|
183
183
|
|
|
184
184
|
### Domainobjs/Crypto tests
|
|
185
185
|
|
|
@@ -187,7 +187,7 @@ These tests are used to verify that MACI's primitives such as private keys work
|
|
|
187
187
|
|
|
188
188
|
## "Manual" Testing
|
|
189
189
|
|
|
190
|
-
To ensure that the MACI stack works as expected, without having to run the entire test suite (or even just the e2e tests), there is a [bash script](https://github.com/privacy-scaling-explorations/maci/blob/
|
|
190
|
+
To ensure that the MACI stack works as expected, without having to run the entire test suite (or even just the e2e tests), there is a [bash script](https://github.com/privacy-scaling-explorations/maci/blob/main/cli/testScript.sh) inside the cli folder which can be used.
|
|
191
191
|
|
|
192
192
|
This script contains a number of actions which touch all of the parts of MACI, and resemble exactly what other e2e tests do.
|
|
193
193
|
|
|
@@ -87,7 +87,7 @@ circuits.
|
|
|
87
87
|
Note the locations of the `.zkey` files as the CLI requires them as
|
|
88
88
|
command-line flags.
|
|
89
89
|
|
|
90
|
-
For testing purposes you can download the required artifacts using the [`download_zkeys`](https://github.com/privacy-scaling-explorations/maci/blob/
|
|
90
|
+
For testing purposes you can download the required artifacts using the [`download_zkeys`](https://github.com/privacy-scaling-explorations/maci/blob/main/integrationTests/scripts/download_zkeys.sh) script inside the `integrationTests/scripts` folder. The script will place all required artifacts inside the `cli/zkeys` folder.
|
|
91
91
|
You can run the script directly with bash or use pnpm: `pnpm run download:test-zkeys` from the monorepo root.
|
|
92
92
|
|
|
93
93
|
### Compile the circuits and generate zkeys (if decided to generate from scratch)
|
|
@@ -13,7 +13,7 @@ In a nutshell, this feature was added to support some application like quadratic
|
|
|
13
13
|
|
|
14
14
|
## How topup messages are processed
|
|
15
15
|
|
|
16
|
-
Topup messages are submitted on chain using the same smart contract used for voting, [`Poll`](https://github.com/privacy-scaling-explorations/maci/blob/
|
|
16
|
+
Topup messages are submitted on chain using the same smart contract used for voting, [`Poll`](https://github.com/privacy-scaling-explorations/maci/blob/main/contracts/contracts/Poll.sol). With the current design, a TopUpCredit token smart contract is required. In this implementation of MACI, there is an example token, which is an ERC20 contract with 1 decimal, of which the coordinator (or MACI's operator) has ownership of. This privileged figure can mint tokens to users (at their discretion) and users will need to deposit such tokens to the Poll contract in order to topup their voice credits.
|
|
17
17
|
|
|
18
18
|
:::info
|
|
19
19
|
MACI is not concerned with the way of distributing such tokens. The operators of the MACI instance should implement their own way of distributing such tokens, as well as withdrawing them from the Poll contract. For instance, if the operator chooses to use a token with a monetary value, the Poll balance could be withdrawn and sent to fund public goods.
|
|
@@ -18,7 +18,7 @@ contracts in discrete components which are easy to test.
|
|
|
18
18
|
|
|
19
19
|
To this end, this submodule exposes a `MaciState` class and a `Poll` class.
|
|
20
20
|
Developers should instantiate objects from these classes to test MACI. For
|
|
21
|
-
instance, [`MACI.test.ts`](https://github.com/privacy-scaling-explorations/maci/blob/
|
|
21
|
+
instance, [`MACI.test.ts`](https://github.com/privacy-scaling-explorations/maci/blob/main/packages/contracts/tests/MACI.test.ts) creates a
|
|
22
22
|
`MaciState` object and every time it interacts with the MACI smart contract, it
|
|
23
23
|
mirrors said interaction on the `MaciState` and `Poll`. As such, the developer
|
|
24
24
|
can then use their helper functions like `maciState.signUp()`,
|
|
@@ -38,7 +38,7 @@ call `maciState.signUp()` as well, so that the off-chain representation of MACI
|
|
|
38
38
|
is kept up to date.
|
|
39
39
|
|
|
40
40
|
In production, `genMaciStateFromContract()` in
|
|
41
|
-
[`genMaciState.ts`](https://github.com/privacy-scaling-explorations/maci/blob/
|
|
41
|
+
[`genMaciState.ts`](https://github.com/privacy-scaling-explorations/maci/blob/main/contracts/ts/genMaciState.ts) uses this function when it
|
|
42
42
|
scans a MACI contract's event log for signups, so as to bring its `MaciState`
|
|
43
43
|
instance up to date.
|
|
44
44
|
|