Skip to content

Commit

Permalink
fix: fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
rex4539 authored and samajammin committed Feb 26, 2024
1 parent 658e5df commit c1c30fd
Show file tree
Hide file tree
Showing 32 changed files with 64 additions and 64 deletions.
4 changes: 2 additions & 2 deletions circuits/circom/processMessages.circom
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ template ProcessMessages(

// The index of the last message leaf in the batch to process, exclusive.
// This value may be less than batchStartIndex + batchSize if this batch is
// the last batch and the total number of mesages is not a multiple of the
// the last batch and the total number of messages is not a multiple of the
// batch size.
signal batchEndIndex;

Expand Down Expand Up @@ -544,7 +544,7 @@ template ProcessOne(stateTreeDepth, voteOptionTreeDepth) {

// -----------------------------------------------------------------------
// 2. If msgType = 0 and isValid is 0, generate indices for leaf 0
// Otherwise, generate indices for commmand.stateIndex or topupStateIndex depending on msgType
// Otherwise, generate indices for command.stateIndex or topupStateIndex depending on msgType
signal indexByType;
signal tmpIndex1;
signal tmpIndex2;
Expand Down
4 changes: 2 additions & 2 deletions circuits/circom/processMessagesNonQv.circom
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ template ProcessMessagesNonQv(

// The index of the last message leaf in the batch to process, exclusive.
// This value may be less than batchStartIndex + batchSize if this batch is
// the last batch and the total number of mesages is not a multiple of the
// the last batch and the total number of messages is not a multiple of the
// batch size.
signal batchEndIndex;

Expand Down Expand Up @@ -457,7 +457,7 @@ template ProcessOneNonQv(stateTreeDepth, voteOptionTreeDepth) {

// -----------------------------------------------------------------------
// 2. If msgType = 0 and isValid is 0, generate indices for leaf 0
// Otherwise, generate indices for commmand.stateIndex or topupStateIndex depending on msgType
// Otherwise, generate indices for command.stateIndex or topupStateIndex depending on msgType
signal indexByType;
signal tmpIndex1;
signal tmpIndex2;
Expand Down
2 changes: 1 addition & 1 deletion circuits/circom/stateLeafAndBallotTransformer.circom
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ template StateLeafAndBallotTransformer() {
signal input slPubKey[2];
// the current voice credit balance of the signed up user
signal input slVoiceCreditBalance;
// the signup timestmap
// the signup timestamp
signal input slTimestamp;
// when the poll ends
signal input pollEndTimestamp;
Expand Down
2 changes: 1 addition & 1 deletion circuits/circom/stateLeafAndBallotTransformerNonQv.circom
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ template StateLeafAndBallotTransformerNonQv() {
signal input slPubKey[2];
// the current voice credit balance of the signed up user
signal input slVoiceCreditBalance;
// the signup timestmap
// the signup timestamp
signal input slTimestamp;
// when the poll ends
signal input pollEndTimestamp;
Expand Down
2 changes: 1 addition & 1 deletion circuits/circom/trees/incrementalQuinTree.circom
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ include "./checkRoot.circom";
include "../hasherPoseidon.circom";
include "../utils.circom";

// This file contains circuits for quintary Merkle tree verifcation.
// This file contains circuits for quintary Merkle tree verification.
// It assumes that each node contains 5 leaves, as we use the PoseidonT6
// circuit to hash leaves, which supports up to 5 input elements.

Expand Down
2 changes: 1 addition & 1 deletion circuits/ts/__tests__/CeremonyParams.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ describe("Ceremony param tests", () => {
await testCircuit.expectConstraintPass(witness);
});

it("should produce the correct result if the inital tally is not zero", async () => {
it("should produce the correct result if the initial tally is not zero", async () => {
const generatedInputs = poll.tallyVotes() as unknown as ITallyVotesInputs;

// Start the tally from non-zero value
Expand Down
2 changes: 1 addition & 1 deletion circuits/ts/__tests__/Ecdh.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe("Public key derivation circuit", () => {
pubKey: keypair2.pubKey.asCircuitInputs() as unknown as bigint[],
};

// calculate first time witness and check contraints
// calculate first time witness and check constraints
const witness = await circuit.calculateWitness(circuitInputs);
await circuit.expectConstraintPass(witness);

Expand Down
4 changes: 2 additions & 2 deletions circuits/ts/__tests__/TallyVotes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ describe("TallyVotes circuit", function test() {
await circuit.expectConstraintPass(witness);
});

it("should produce the correct result if the inital tally is not zero", async () => {
it("should produce the correct result if the initial tally is not zero", async () => {
const generatedInputs = poll.tallyVotes() as unknown as ITallyVotesInputs;

// Start the tally from non-zero value
Expand Down Expand Up @@ -220,7 +220,7 @@ describe("TallyVotes circuit", function test() {
await circuitNonQv.expectConstraintPass(witness);
});

it("should produce the correct result if the inital tally is not zero", async () => {
it("should produce the correct result if the initial tally is not zero", async () => {
const generatedInputs = poll.tallyVotesNonQv() as unknown as ITallyVotesInputs;

// Start the tally from non-zero value
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const cleanVanilla = (): void => {

/**
* Test utility to clean up the proofs directory
* adn the subsidy.json file
* and the subsidy.json file
*/
export const cleanSubsidy = (): void => {
cleanVanilla();
Expand Down
4 changes: 2 additions & 2 deletions cli/ts/commands/airdrop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { type AirdropArgs, logError, logGreen, success, readContractAddress, con

/**
* Utility that can be used to get
* topup credits aidropped
* topup credits airdropped
* to the coordinator
* @param AirdropArgs - The arguments for the airdrop command
*/
Expand All @@ -23,7 +23,7 @@ export const airdrop = async ({
const topupCredit = readContractAddress("TopupCredit", network?.name);

// we want to ensure that we have either the address stored
// or that it was passed as a paramter
// or that it was passed as a parameter
if (!topupCredit && !contractAddress) {
logError("Please provide an ERC20 contract address");
}
Expand Down
2 changes: 1 addition & 1 deletion cli/ts/commands/deployPoll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export const deployPoll = async ({
logGreen(quiet, info(`Subsidy contract: ${subsidyContractAddress}`));
storeContractAddress(`Subsidy-${pollId.toString()}`, subsidyContractAddress, network?.name);
}
// store the addresss
// store the address
storeContractAddress(`MessageProcessor-${pollId.toString()}`, messageProcessorContractAddress, network?.name);
storeContractAddress(`Tally-${pollId.toString()}`, tallyContractAddress, network?.name);
storeContractAddress(`Poll-${pollId.toString()}`, pollAddr, network?.name);
Expand Down
2 changes: 1 addition & 1 deletion cli/ts/utils/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const DEFAULT_ETH_SK = "0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5
export const DEFAULT_INITIAL_VOICE_CREDITS = 99;
// the default signup gatekeeper data
export const DEFAULT_SG_DATA = "0x0000000000000000000000000000000000000000000000000000000000000000";
// the defualt initial voice credit proxy data
// the default initial voice credit proxy data
export const DEFAULT_IVCP_DATA = "0x0000000000000000000000000000000000000000000000000000000000000000";
// the default number of operations to queue in the state root queue
export const DEFAULT_SR_QUEUE_OPS = 4;
2 changes: 1 addition & 1 deletion contracts/contracts/trees/AccQueue.sol
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ abstract contract AccQueue is Ownable, Hasher {
// There must be subtrees to merge
if (numLeaves == 0) revert NothingToMerge();

// Fill any empty leaves in the current subtree with zeros ony if the
// Fill any empty leaves in the current subtree with zeros only if the
// current subtree is not full
if (numLeaves % subTreeCapacity != 0) {
fill();
Expand Down
2 changes: 1 addition & 1 deletion contracts/tasks/deploy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from "fs";
import path from "path";

/**
* The same as individual imports but doesn't require to add new import line everytime
* The same as individual imports but doesn't require to add new import line every time
*/
["maci", "poll"].forEach((folder) => {
const tasksPath = path.resolve(__dirname, folder);
Expand Down
2 changes: 1 addition & 1 deletion contracts/tasks/helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ export interface IVerifyFullArgs {
}

/**
* Interface that represents verification subtaks arguments
* Interface that represents verification subtask arguments
* This is extracted from hardhat etherscan plugin
*/
export interface IVerificationSubtaskArgs {
Expand Down
2 changes: 1 addition & 1 deletion contracts/tests/AccQueue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ describe("AccQueues", () => {
);
});

it("Merging without enqueing new data should not change the root", async () => {
it("Merging without enqueuing new data should not change the root", async () => {
const MAIN_DEPTH = 5;

const r = await deployTestAccQueues("AccQueueBinary0", SUB_DEPTH, HASH_LENGTH, ZERO);
Expand Down
2 changes: 1 addition & 1 deletion contracts/ts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export interface IDeployedTestContracts {
}

/**
* An interface that representes an action that should
* An interface that represents an action that should
* be applied to a MaciState and its Polls within the
* genMaciState function.
*/
Expand Down
2 changes: 1 addition & 1 deletion contracts/ts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const sleep = async (ms: number): Promise<void> => {
};

/**
* The comparision function for Actions based on block number and transaction
* The comparison function for Actions based on block number and transaction
* index.
* @param actions - the array of actions to sort
* @returns the sorted array of actions
Expand Down
2 changes: 1 addition & 1 deletion core/ts/__tests__/Poll.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ describe("Poll", function test() {
poll.currentMessageBatchIndex = undefined;
});

it("shuold throw if the state has not been copied prior to calling processMessages", () => {
it("should throw if the state has not been copied prior to calling processMessages", () => {
const tmpPoll = maciState.deployPoll(
BigInt(Math.floor(Date.now() / 1000) + duration),
maxValues,
Expand Down
2 changes: 1 addition & 1 deletion crypto/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ employs.

## AccQueue

AccQueue is an implementation of an Accumulator Queue. This is used to manage a queue of elements in merkle-tree like structure. This TypeScript class conforms with the smart contract impemented in _maci-contracts_ - AccQueue.sol.
AccQueue is an implementation of an Accumulator Queue. This is used to manage a queue of elements in merkle-tree like structure. This TypeScript class conforms with the smart contract implemented in _maci-contracts_ - AccQueue.sol.

The main tree is divided into subtrees to allow for easier management. Each of the subtrees has its own root and leaves, with the depth being defined by the _subDepth_ property of the AccQueue class. When a new leaf is "enqued", this is actually added to the current subtree. If this is full, we calculate the root of the subtree and store it, while the new leaf is added to the next subtree.

Expand Down
2 changes: 1 addition & 1 deletion crypto/ts/__tests__/IMT.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe("IMT comparison", () => {
});

describe("genSubrootProof", () => {
it("should geneate a valid proof for a subtree", () => {
it("should generate a valid proof for a subtree", () => {
const mt1 = new IncrementalQuinTree(5, 0n, 5, hash5);

for (let i = 0; i < 100; i += 1) {
Expand Down
2 changes: 1 addition & 1 deletion crypto/ts/hashing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const poseidonT4 = (inputs: bigint[]): bigint => {
/**
* Hash up to 4 elements
* @param inputs The elements to hash
* @retuns the hash of the elements
* @returns the hash of the elements
*/
export const poseidonT5 = (inputs: bigint[]): bigint => {
assert(inputs.length === 4);
Expand Down
2 changes: 1 addition & 1 deletion crypto/ts/quinTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export class IncrementalQuinTree {
/**
* Verify a proof
* @param proof The proof to verify
* @returns Wether the proof is valid
* @returns Whether the proof is valid
*/
verifyProof = (proof: IMerkleProof): boolean => {
const { pathElements, leaf, root, pathIndices } = proof;
Expand Down
2 changes: 1 addition & 1 deletion domainobjs/ts/__tests__/stateLeaf.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe("stateLeaf", () => {
});

describe("toJSON", () => {
it("should produce an object with the correct properities", () => {
it("should produce an object with the correct properties", () => {
const stateLeaf = new StateLeaf(pubKey, BigInt(123), BigInt(1231267));

const json = stateLeaf.toJSON();
Expand Down
4 changes: 2 additions & 2 deletions website/blog/2021-10-12-maci-v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Finally, in early 2021 we were very fortunate to bring on Cory Dickson to the te

It is very difficult for naive voting systems, particularly those which are integrated into smart contract platforms, to prevent collusion. For instance, if a simple Ethereum transaction represents a vote, a briber can easily examine its calldata, tell how its sender voted, and reward or punish them accordingly.

More broadly, collusion resistance is particulary important for cryptoeconomic systems. Vitalik Buterin describes the motivations behind MACI in On Collusion. He argues that systems that use cryptoeconomic incentive mechanisms to align participants’ behaviour can be vulnerable to collusion attacks, such as bribery. In another post, he elaborates:
More broadly, collusion resistance is particularly important for cryptoeconomic systems. Vitalik Buterin describes the motivations behind MACI in On Collusion. He argues that systems that use cryptoeconomic incentive mechanisms to align participants’ behaviour can be vulnerable to collusion attacks, such as bribery. In another post, he elaborates:

if you can prove how you voted, selling your vote becomes very easy. Provability of votes would also enable forms of coercion where the coercer demands to see some kind of proof of voting for their preferred candidate.

Expand All @@ -61,7 +61,7 @@ Finally, MACI is important because as crypto communities are increasingly adopti

## What’s new?

In this release, we rearchitected MACI’s smart contracts to allow for greater flexiblity and separation of concerns. In particular, we support multiple polls within a single instance of MACI. This allows the coordinator to run and tally many elections either subsequently or concurrently.
In this release, we rearchitected MACI’s smart contracts to allow for greater flexibility and separation of concerns. In particular, we support multiple polls within a single instance of MACI. This allows the coordinator to run and tally many elections either subsequently or concurrently.

We’ve kept the ability for developers to provide their own set of logic to gate-keep signups. For instance, application developers can write custom logic that only allows addresses which own a certain token to sign up once to MACI in order to participate in polls.

Expand Down
6 changes: 3 additions & 3 deletions website/blog/2023-01-18-maci-v1.1.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ All of these issues have been successfully resolved, on top of fixing minor issu

### Top Up Credit

Rather than requring a user to sign up multiple times, it is now possible to top up voice credits by sending a top up message on the Poll contract. Withdrawals are not enabled as this would allow a malicious user to bribe others offline to transfer their keys.
Rather than requiring a user to sign up multiple times, it is now possible to top up voice credits by sending a top up message on the Poll contract. Withdrawals are not enabled as this would allow a malicious user to bribe others offline to transfer their keys.

Now, the Poll contract will hold all the funds deposited from users for the current poll. At the end of a poll, the coordinator can transfer the funds to a hardcoded address which can be used to fund public goods.

Expand All @@ -74,15 +74,15 @@ Pairwise subsidy is a new way to reduce collusion in quadratic funding applicati

In this [post](https://ethresear.ch/t/pairwise-coordination-subsidies-a-new-quadratic-funding-design/5553), Vitalik introduced this kind of collusion and also proposed a protocol to penalize this behavior. As a generalized solution, the more correlation between contributions, the smaller subsidy should be allocated to this project, as this reduces the risk of collusion between contributors. It should be noted that this solution assumes that an identity system is in place to prevent the same entity from registering with two different identities.

Please refer to this [post](https://hackmd.io/@chaosma/H1_9xmT2K) for a more detailed explaination of the implementation.
Please refer to this [post](https://hackmd.io/@chaosma/H1_9xmT2K) for a more detailed explanation of the implementation.

Finally, please note that currently it is not possible to generate the `zkeys` for the subsidy circuit with with the `vote options` parameter larger than $5^2$. This issue is documented [here](https://github.com/privacy-scaling-explorations/maci/issues/584) and the team will focus on finding a solution to be able to support larger vote options.

### Coordinator Service

MACI now includes a sample [coordinator service](https://github.com/privacy-scaling-explorations/maci/tree/v1.1.1/server).

There are two roles in the cordinator service: admin (i.e. MACI coordinator) and user (i.e. a voter). The admin's responsibility is to ensure that the code remains updated and that the backend services are live. The user can then simply send HTTP requests to the backend server to interact with MACI, for instance, by signing up and publishing a message on chain.
There are two roles in the coordinator service: admin (i.e. MACI coordinator) and user (i.e. a voter). The admin's responsibility is to ensure that the code remains updated and that the backend services are live. The user can then simply send HTTP requests to the backend server to interact with MACI, for instance, by signing up and publishing a message on chain.

The coordinator service has been wrapped into two docker instances: one for the backend server to accept user requests; one for the Mongodb service to store all necessary information on the current state such as smart contract addresses, zero knowledge proof keys and so on.

Expand Down
2 changes: 1 addition & 1 deletion website/src/scripts/setupTypedoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { copyDirectory, fitFormat, generateSidebarString, insertIndexPage } from
const TYPEDOC_DIR = path.resolve(__dirname, "../../typedoc");

/**
* A function that remove the auto-genrated navigator
* A function that remove the auto-generated navigator
* and the title at the top of the page,
* meanwhile adding sidebar configurations above the content.
* @param file - the file being updated
Expand Down
4 changes: 2 additions & 2 deletions website/versioned_docs/version-v0.x/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Even if Alice reveals the cleartext of her vote to Bob, she just needs to not sh

## Technical process

Refer to the [Glossary](#Glossary) for defintions of terms.
Refer to the [Glossary](#Glossary) for definitions of terms.

1. The coordinator deploys the MACI contract to an Ethereum blockchain and starts the sign-up period. The same transaction that deploys the contract also stores the value of an empty vote option tree.
2. To sign up, each user creates an EdDSA keypair and invokes the contract's `signUp()` function. Alternatively, there is a mechanism where some contract function checks if the user owns a particular ERC721 token and adds them to the whitelist. It in turn generates a new leaf to the state tree and updates the state tree root.
Expand All @@ -48,7 +48,7 @@ Refer to the [Glossary](#Glossary) for defintions of terms.

- Otherwise, the user should use the most current public key they have registered.

- Submit the the message, as well as the epheremal public key in the clear to the contract using its `publishMessage()` function, which hashes the command and inserts it into the message tree.
- Submit the the message, as well as the ephemeral public key in the clear to the contract using its `publishMessage()` function, which hashes the command and inserts it into the message tree.

5. The coordinator processes all the commands after the voting period ends.

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-v1.x/contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ struct MaxValues {
}
```

These are stored separately to avoid a stack overlow error during compilation of the contracts using them.
These are stored separately to avoid a stack overflow error during compilation of the contracts using them.

## AccQueue

Expand Down
4 changes: 2 additions & 2 deletions website/versioned_docs/version-v1.x/key-change.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ sidebar_position: 16

MACI's voters are identified by their MACI public key. Together with their private key, they can sign and submit messages to live Polls.

As MACI's main property is to provide collusion resistence in digital voting applications, it is important to have a mechanism for a user to change their voting key, should this become compromised, or they wish to revoke past actions.
As MACI's main property is to provide collusion resistance in digital voting applications, it is important to have a mechanism for a user to change their voting key, should this become compromised, or they wish to revoke past actions.

## How MACI messages are processed

In order to understand how key changing currenctly works in MACI, we need to understand how messages are processed.
In order to understand how key changing currently works in MACI, we need to understand how messages are processed.

After a poll ends, the coordinator processes messages off chain in reverse order. To improve efficiency, messages are processed in batches, and correctness is proved for each batch using a zk-SNARK circuit.

Expand Down
Loading

0 comments on commit c1c30fd

Please sign in to comment.