diff --git a/README.md b/README.md index 9b8a41aabe..2ba9af7c7f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Minimal Anti-Collusion Infrastructure [![CI][cli-actions-badge]][cli-actions-link] -[![License](https://img.shields.io/badge/license-MIT-green)](https://github.com/privacy-scaling-explorations/maci/blob/dev/LICENSE) +[![License](https://img.shields.io/badge/license-MIT-green)](LICENSE) Minimal Anti-Collusion Infrastructure (MACI) is an on-chain voting protocol which protects privacy and minimizes the risk of collusion and bribery. diff --git a/core/README.md b/core/README.md index 2db5c7ee71..30d129312d 100644 --- a/core/README.md +++ b/core/README.md @@ -15,7 +15,7 @@ contracts in discrete components which are easy to test. To this end, this submodule exposes a `MaciState` class and a `Poll` class. Developers should instantiate objects from these classes to test MACI. For -instance, [`MACI.test.ts`](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/tests/MACI.test.ts) creates a +instance, [`MACI.test.ts`](/contracts/tests/MACI.test.ts) creates a `MaciState` object and every time it interacts with the MACI smart contract, it mirrors said interaction on the `MaciState` and `Poll`. As such, the developer can then use their helper functions like `maciState.signUp()`, @@ -35,7 +35,7 @@ call `maciState.signUp()` as well, so that the off-chain representation of MACI is kept up to date. In production, `genMaciStateFromContract()` in -[`genMaciState.ts`](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/ts/genMaciState.ts) uses this function when it +[`genMaciState.ts`](/contracts/ts/genMaciState.ts) uses this function when it scans a MACI contract's event log for signups, so as to bring its `MaciState` instance up to date. diff --git a/website/blog/2024-02-28-maci-v1.2.0.md b/website/blog/2024-02-28-maci-v1.2.0.md index 157b545233..b57b9e8f44 100644 --- a/website/blog/2024-02-28-maci-v1.2.0.md +++ b/website/blog/2024-02-28-maci-v1.2.0.md @@ -92,7 +92,7 @@ Following the successful completion of our [MACI trusted setup ceremony](https:/ 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. -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/trusted-setup), and the [`tallyVotes`](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/tallyVotes.circom) artifacts can still be used in production. +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/trusted-setup), and the [`tallyVotes`](/circuits/circom/tallyVotes.circom) artifacts can still be used in production. ## Get Involved diff --git a/website/versioned_docs/version-v1.x/circuits.md b/website/versioned_docs/version-v1.x/circuits.md index d474275c04..e2e9c78428 100644 --- a/website/versioned_docs/version-v1.x/circuits.md +++ b/website/versioned_docs/version-v1.x/circuits.md @@ -13,9 +13,9 @@ MACI uses zk-SNARKs to essentially hide how each person voted while still reveal MACI has three main zk-SNARK [circuits](https://github.com/privacy-scaling-explorations/maci/tree/dev/circuits): -1. [`ProcessMessages.circom`](https://github.com/privacy-scaling-explorations/maci/blob/dev/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. -2. [`TallyVotes.circom`](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/tallyVotes.circom), which counts votes from users' ballots, batch by batch. -3. [`Subsidy.circom`](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/subsidy.circom), which implements [pairwise subsidy](https://hackmd.io/@chaosma/H1_9xmT2K). Please note this is an optional feature. +1. [`ProcessMessages.circom`](/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. +2. [`TallyVotes.circom`](/circuits/circom/tallyVotes.circom), which counts votes from users' ballots, batch by batch. +3. [`Subsidy.circom`](/circuits/circom/subsidy.circom), which implements [pairwise subsidy](https://hackmd.io/@chaosma/H1_9xmT2K). Please note this is an optional feature. 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. @@ -45,7 +45,7 @@ The circuits are used by the coordinator (the prover) to prove that they have co ## How do the circuits work? -### Message processing ([`processMessages`](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/processMessages.circom)) +### Message processing ([`processMessages`](/circuits/circom/processMessages.circom)) 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. @@ -177,7 +177,7 @@ This method requires fewer circuit constraints than if we verified a Merkle proo 7. That each message in `msgs` exists in the message tree 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` -### Tally Votes ([`tallyVotes`](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/tallyVotes.circom)) +### Tally Votes ([`tallyVotes`](/circuits/circom/tallyVotes.circom)) #### Parameters @@ -280,7 +280,7 @@ $poseidon_3([tc_r, tc_t, tc_p])$ 6. That the tally is valid, which is: - That the sum of votes per vote option is correct -### Subsisdy ([`subsidy`](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/circom/subsidy.circom)) +### Subsisdy ([`subsidy`](/circuits/circom/subsidy.circom)) This circuit is an optional feature - it's not required for MACI to function. 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. diff --git a/website/versioned_docs/version-v1.x/integrating.md b/website/versioned_docs/version-v1.x/integrating.md index ca5bf02e56..63c359e575 100644 --- a/website/versioned_docs/version-v1.x/integrating.md +++ b/website/versioned_docs/version-v1.x/integrating.md @@ -96,7 +96,7 @@ maci-cli verify \ --tally-file tally.json # this file is generated in genProofs ``` -When poll finishes, [Tally contract](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/Tally.sol) emits the event with poll address so you can track the state changes. +When poll finishes, [Tally contract](/contracts/contracts/Tally.sol) emits the event with poll address so you can track the state changes. ```javascript event BallotsTallied(address poll); @@ -142,7 +142,7 @@ function contribute( ## InitialVoiceCreditProxy -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/dev/contracts/contracts/initialVoiceCreditProxy/InitialVoiceCreditProxy.sol) contract. You can see our [basic example](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/initialVoiceCreditProxy/ConstantInitialVoiceCreditProxy.sol) how it's implemented for constant distribution. +If you'd like to extend the functionality of how votes are distributed among users, you need to extend [InitialVoiceCreditProxy](/contracts/contracts/initialVoiceCreditProxy/InitialVoiceCreditProxy.sol) contract. You can see our [basic example](/contracts/contracts/initialVoiceCreditProxy/ConstantInitialVoiceCreditProxy.sol) how it's implemented for constant distribution. ```javascript // SPDX-License-Identifier: MIT diff --git a/website/versioned_docs/version-v1.x/key-change.md b/website/versioned_docs/version-v1.x/key-change.md index 02ae41a15f..f2d848da49 100644 --- a/website/versioned_docs/version-v1.x/key-change.md +++ b/website/versioned_docs/version-v1.x/key-change.md @@ -178,5 +178,5 @@ expect(stateLeaf2.pubKey.equals(user2Keypair.pubKey)).to.eq(true); 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. :::info -Tests related to key changes have been added to the [core package](https://github.com/privacy-scaling-explorations/maci/blob/dev/core/ts/__tests__/) and to the [cli package](https://github.com/privacy-scaling-explorations/maci/blob/dev/cli/tests/). +Tests related to key changes have been added to the [core package](/core/ts/__tests__/) and to the [cli package](/cli/tests/). ::: diff --git a/website/versioned_docs/version-v1.x/poll-types.md b/website/versioned_docs/version-v1.x/poll-types.md index 27c5f0e2f3..7b097b5815 100644 --- a/website/versioned_docs/version-v1.x/poll-types.md +++ b/website/versioned_docs/version-v1.x/poll-types.md @@ -13,7 +13,7 @@ This document will explain how to use each of these options. ## Quadratic Voting -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/dev/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. +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](/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. 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. diff --git a/website/versioned_docs/version-v1.x/testing-in-detail.md b/website/versioned_docs/version-v1.x/testing-in-detail.md index 5ade3d0642..75b027df59 100644 --- a/website/versioned_docs/version-v1.x/testing-in-detail.md +++ b/website/versioned_docs/version-v1.x/testing-in-detail.md @@ -171,7 +171,7 @@ Within the circuits folder, there are a number of tests that are used to verify 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. -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/dev/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/trusted-setup). +All of the tests run using test parameters, usually `10, 2, 1, 2`, aside from the tests inside: [`ceremonyParam`](/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/trusted-setup). ### Core @@ -179,7 +179,7 @@ The core package contains a number of tests that are used to verify that the cor 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. -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/dev/core/ts/__tests__/e2e.test.ts) and unit tests in the other files. +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](/core/ts/__tests__/e2e.test.ts) and unit tests in the other files. ### Domainobjs/Crypto tests @@ -187,7 +187,7 @@ These tests are used to verify that MACI's primitives such as private keys work ## "Manual" Testing -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/dev/cli/testScript.sh) inside the cli folder which can be used. +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](/cli/testScript.sh) inside the cli folder which can be used. This script contains a number of actions which touch all of the parts of MACI, and resemble exactly what other e2e tests do. diff --git a/website/versioned_docs/version-v1.x/testing.md b/website/versioned_docs/version-v1.x/testing.md index 7207fa484a..8e62ec4261 100644 --- a/website/versioned_docs/version-v1.x/testing.md +++ b/website/versioned_docs/version-v1.x/testing.md @@ -87,7 +87,7 @@ circuits. Note the locations of the `.zkey` files as the CLI requires them as command-line flags. -For testing purposes you can download the required artifacts using the [`download_zkeys`](https://github.com/privacy-scaling-explorations/maci/blob/dev/integrationTests/scripts/download_zkeys.sh) script inside the `integrationTests/scripts` folder. The script will place all required artifacts inside the `cli/zkeys` folder. +For testing purposes you can download the required artifacts using the [`download_zkeys`](/integrationTests/scripts/download_zkeys.sh) script inside the `integrationTests/scripts` folder. The script will place all required artifacts inside the `cli/zkeys` folder. You can run the script directly with bash or use pnpm: `pnpm run download:test-zkeys` from the monorepo root. ### Compile the circuits and generate zkeys (if decided to generate from scratch) diff --git a/website/versioned_docs/version-v1.x/topup.md b/website/versioned_docs/version-v1.x/topup.md index 7d1f310b84..07892efbb5 100644 --- a/website/versioned_docs/version-v1.x/topup.md +++ b/website/versioned_docs/version-v1.x/topup.md @@ -13,7 +13,7 @@ In a nutshell, this feature was added to support some application like quadratic ## How topup messages are processed -Topup messages are submitted on chain using the same smart contract used for voting, [`Poll`](https://github.com/privacy-scaling-explorations/maci/blob/dev/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. +Topup messages are submitted on chain using the same smart contract used for voting, [`Poll`](/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. :::info 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. diff --git a/website/versioned_docs/version-v1.x/versioning.md b/website/versioned_docs/version-v1.x/versioning.md index 6f5455bc9c..4b0a7f9adf 100644 --- a/website/versioned_docs/version-v1.x/versioning.md +++ b/website/versioned_docs/version-v1.x/versioning.md @@ -19,7 +19,7 @@ MACI follows the [Semantic Versioning Specification (SemVer)](https://semver.org All MACI packages are organized in our monorepo and follow a global release approach, meaning that all packages have the same version. -Currently, MACI core team manually decides when to release and what the version should be. Packages are released [automatically via CI](https://github.com/privacy-scaling-explorations/maci/blob/dev/.github/workflows/release.yml) when a new tag is created in GitHub. [You can view our releases and tags in GitHub](https://github.com/privacy-scaling-explorations/maci/releases). +Currently, MACI core team manually decides when to release and what the version should be. Packages are released [automatically via CI](/.github/workflows/release.yml) when a new tag is created in GitHub. [You can view our releases and tags in GitHub](https://github.com/privacy-scaling-explorations/maci/releases). ## MACI Release Process diff --git a/website/versioned_docs/version-v1.x/workflow.md b/website/versioned_docs/version-v1.x/workflow.md index 0894d23bda..9cc80714f0 100644 --- a/website/versioned_docs/version-v1.x/workflow.md +++ b/website/versioned_docs/version-v1.x/workflow.md @@ -99,7 +99,7 @@ During this stage, users can sign up and vote. Before a user can cast a vote, they must sign up by generating a MACI keypair and then sending the public key they wish to use to cast their vote to the MACI smart contract. This MACI public key (distinct from their Ethereum account public key) acts as their identity when voting. Users can vote from any Ethereum address, but their message must contain a signature from that MACI public key. -This registration process is necessary to fortify MACI against Sybil attacks. The particular criteria used to allow user signups is customizable, and can be configured using any [SignUpGatekeeper contract](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/contracts/gatekeepers/SignUpGatekeeper.sol). This contract dictates the criteria a user must pass in order to participate in a poll. For example, a user might need to prove ownership of a certain NFT, or that they've received some attestation on EAS, or prove that they have passed some sort of proof-of-personhood verification. Note that MACI presumes an identity system where each legitimate member +This registration process is necessary to fortify MACI against Sybil attacks. The particular criteria used to allow user signups is customizable, and can be configured using any [SignUpGatekeeper contract](/contracts/contracts/gatekeepers/SignUpGatekeeper.sol). This contract dictates the criteria a user must pass in order to participate in a poll. For example, a user might need to prove ownership of a certain NFT, or that they've received some attestation on EAS, or prove that they have passed some sort of proof-of-personhood verification. Note that MACI presumes an identity system where each legitimate member controls a unique private key - MACI does not specifically solve for this, but allows for customization on how this is configured. #### Vote