@maci-protocol/website 0.0.0-ci.2653bc0
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/.eslintrc.js +157 -0
- package/CHANGELOG.md +566 -0
- package/LICENSE +22 -0
- package/README.md +58 -0
- package/babel.config.js +3 -0
- package/blog/2021-10-12-maci-v1.md +100 -0
- package/blog/2022-09-22-maci-v1-technical-introduction.md +180 -0
- package/blog/2023-01-18-maci-v1.1.1.md +121 -0
- package/blog/2024-01-18-roadmap.md +106 -0
- package/blog/2024-02-28-maci-v1.2.0.md +121 -0
- package/blog/2024-04-10-roadmap-q2.md +96 -0
- package/blog/2024-05-08-ethdam.md +169 -0
- package/blog/2024-05-22-the-origins-of-maci.md +38 -0
- package/blog/2024-05-28-upcoming-grants.md +85 -0
- package/blog/2024-06-17-understanding-maci.md +63 -0
- package/blog/2024-06-21-deciphering-maci.md +48 -0
- package/blog/2024-06-28-revolusioning-public-goods-funding.md +32 -0
- package/blog/2024-07-23-q2-review.md +72 -0
- package/blog/2024-07-30-roadmap-q3.md +61 -0
- package/blog/2024-08-10-maci-v2.md +102 -0
- package/blog/2024-08-29-anonymous-poll-joining.md +47 -0
- package/blog/2024-10-29-q3-review.md +63 -0
- package/blog/2024-11-20-maci-platform.md +93 -0
- package/blog/2024-12-01-maci-getting-started.md +294 -0
- package/blog/2025-03-21-roadmap-2025.md +112 -0
- package/blog/assets/MACI_Bob_SignUp_1.png +0 -0
- package/blog/assets/MACI_Bob_SignUp_2.png +0 -0
- package/blog/assets/MACI_Complex_Message.png +0 -0
- package/blog/assets/MACI_Contracts.png +0 -0
- package/blog/assets/MACI_Sign_Up.png +0 -0
- package/blog/assets/MACI_Simple_Message.png +0 -0
- package/blog/assets/MACI_Verifier_1.png +0 -0
- package/blog/authors.yml +5 -0
- package/docusaurus.config.ts +213 -0
- package/package.json +65 -0
- package/src/components/ActionCard/index.tsx +30 -0
- package/src/components/ActionCard/styles.module.css +96 -0
- package/src/components/HomepageFeatures/index.tsx +91 -0
- package/src/components/HomepageFeatures/styles.module.css +17 -0
- package/src/components/ProjectCard/index.tsx +74 -0
- package/src/components/ProjectCard/styles.module.css +77 -0
- package/src/components/ProjectList/index.tsx +218 -0
- package/src/components/ProjectList/styles.module.css +180 -0
- package/src/content/projects.json +294 -0
- package/src/css/card.module.css +130 -0
- package/src/css/custom.css +91 -0
- package/src/icons/IconDiscord.tsx +16 -0
- package/src/icons/IconGithub.tsx +16 -0
- package/src/icons/IconWebsite.tsx +16 -0
- package/src/pages/blogs.tsx +58 -0
- package/src/pages/index.module.css +152 -0
- package/src/pages/index.tsx +66 -0
- package/src/pages/projects.tsx +44 -0
- package/src/pages/roadmap.md +150 -0
- package/src/pages/typedoc.tsx +11 -0
- package/src/plugins/blog-plugin/index.ts +86 -0
- package/src/react-app-env.d.ts +1 -0
- package/src/scripts/setupSolidityDocs.ts +67 -0
- package/src/scripts/setupTypedoc.ts +112 -0
- package/src/scripts/utils.ts +115 -0
- package/src/utils/getProjectsByFilter.ts +40 -0
- package/static/.nojekyll +0 -0
- package/static/audit_reports/20210922_Hashcloak_audit_report.pdf +0 -0
- package/static/audit_reports/202220930_Hashcloak_audit_report.pdf +0 -0
- package/static/audit_reports/20240223_PSE_Audit_audit_report.pdf +0 -0
- package/static/audit_reports/20240731_PSE_Audit_audit_report.pdf +0 -0
- package/static/fonts/DM_Sans.woff2 +0 -0
- package/static/fonts/Share_Tech_Mono.woff2 +0 -0
- package/static/img/box.png +0 -0
- package/static/img/box_dark.png +0 -0
- package/static/img/chain.png +0 -0
- package/static/img/chain_dark.png +0 -0
- package/static/img/chart.png +0 -0
- package/static/img/chart_dark.png +0 -0
- package/static/img/circuits/MACI-Circuits.excalidraw +39652 -0
- package/static/img/circuits/calculateTotal.svg +21 -0
- package/static/img/circuits/ecdh.svg +21 -0
- package/static/img/circuits/messageToCommand.svg +21 -0
- package/static/img/circuits/messageValidator.svg +21 -0
- package/static/img/circuits/poseidonHasher13.svg +21 -0
- package/static/img/circuits/privToPubkey.svg +21 -0
- package/static/img/circuits/processMessages.svg +21 -0
- package/static/img/circuits/processMessagesInputHasher.svg +21 -0
- package/static/img/circuits/processMessages_2_0.svg +21 -0
- package/static/img/circuits/processOne.svg +21 -0
- package/static/img/circuits/processTopup.svg +21 -0
- package/static/img/circuits/processingAfterPollEnds.svg +21 -0
- package/static/img/circuits/quinBatchLeavesExists.svg +21 -0
- package/static/img/circuits/quinCheckRoot.svg +21 -0
- package/static/img/circuits/quinGeneratePathIndices.svg +21 -0
- package/static/img/circuits/quinSelector.svg +21 -0
- package/static/img/circuits/resultsCommitmentVerifier.svg +21 -0
- package/static/img/circuits/splicer.svg +21 -0
- package/static/img/circuits/tallyInputHasher.svg +21 -0
- package/static/img/circuits/tallyVotes.svg +21 -0
- package/static/img/circuits/unpackElement.svg +21 -0
- package/static/img/circuits/verifySignature.svg +21 -0
- package/static/img/completingAPoll.svg +4 -0
- package/static/img/contracts.svg +16 -0
- package/static/img/coordinatorComponents.svg +21 -0
- package/static/img/favicon.ico +0 -0
- package/static/img/generateProofs.svg +4 -0
- package/static/img/hero.svg +9 -0
- package/static/img/maci-card.png +0 -0
- package/static/img/maci-rpgf-design.jpg +0 -0
- package/static/img/messageProcessingLocal.svg +21 -0
- package/static/img/offlineProcessing.svg +21 -0
- package/static/img/pse-logo-round.png +0 -0
- package/static/img/relayer-diagram.png +0 -0
- package/static/img/tallyCommitments.svg +4 -0
- package/static/img/voteTallyingLocal.svg +21 -0
- package/tsconfig.json +34 -0
- package/versioned_docs/version-v0.x/circuits.md +22 -0
- package/versioned_docs/version-v0.x/contract.md +186 -0
- package/versioned_docs/version-v0.x/faq.md +67 -0
- package/versioned_docs/version-v0.x/introduction.md +119 -0
- package/versioned_docs/version-v0.x/quadratic-vote-tallying-circuit.md +138 -0
- package/versioned_docs/version-v0.x/state-root-transition-circuit.md +230 -0
- package/versioned_docs/version-v1.2/audit.md +160 -0
- package/versioned_docs/version-v1.2/ci-pipeline.md +38 -0
- package/versioned_docs/version-v1.2/circuits.md +508 -0
- package/versioned_docs/version-v1.2/cli.md +689 -0
- package/versioned_docs/version-v1.2/contracts.md +445 -0
- package/versioned_docs/version-v1.2/contributing/code-of-conduct.md +91 -0
- package/versioned_docs/version-v1.2/contributing/contributing.md +129 -0
- package/versioned_docs/version-v1.2/coordinator-processing.md +46 -0
- package/versioned_docs/version-v1.2/deployment.md +122 -0
- package/versioned_docs/version-v1.2/installation.md +175 -0
- package/versioned_docs/version-v1.2/integrating.md +200 -0
- package/versioned_docs/version-v1.2/introduction.md +94 -0
- package/versioned_docs/version-v1.2/key-change.md +182 -0
- package/versioned_docs/version-v1.2/overview.md +47 -0
- package/versioned_docs/version-v1.2/poll-types.md +68 -0
- package/versioned_docs/version-v1.2/primitives.md +216 -0
- package/versioned_docs/version-v1.2/project-ideas.md +14 -0
- package/versioned_docs/version-v1.2/purpose.md +62 -0
- package/versioned_docs/version-v1.2/solidity-docs/MACI.md +345 -0
- package/versioned_docs/version-v1.2/solidity-docs/MessageProcessor.md +266 -0
- package/versioned_docs/version-v1.2/solidity-docs/MessageProcessorFactory.md +26 -0
- package/versioned_docs/version-v1.2/solidity-docs/Poll.md +381 -0
- package/versioned_docs/version-v1.2/solidity-docs/PollFactory.md +50 -0
- package/versioned_docs/version-v1.2/solidity-docs/SignUpToken.md +27 -0
- package/versioned_docs/version-v1.2/solidity-docs/Subsidy.md +218 -0
- package/versioned_docs/version-v1.2/solidity-docs/SubsidyFactory.md +27 -0
- package/versioned_docs/version-v1.2/solidity-docs/Tally.md +311 -0
- package/versioned_docs/version-v1.2/solidity-docs/TallyFactory.md +27 -0
- package/versioned_docs/version-v1.2/solidity-docs/TallyNonQv.md +296 -0
- package/versioned_docs/version-v1.2/solidity-docs/TallyNonQvFactory.md +27 -0
- package/versioned_docs/version-v1.2/solidity-docs/TopupCredit.md +61 -0
- package/versioned_docs/version-v1.2/solidity-docs/VkRegistry.md +457 -0
- package/versioned_docs/version-v1.2/solidity-docs/benchmarks/HasherBenchmarks.md +44 -0
- package/versioned_docs/version-v1.2/solidity-docs/crypto/Hasher.md +125 -0
- package/versioned_docs/version-v1.2/solidity-docs/crypto/IVerifier.md +11 -0
- package/versioned_docs/version-v1.2/solidity-docs/crypto/MockVerifier.md +17 -0
- package/versioned_docs/version-v1.2/solidity-docs/crypto/Pairing.md +85 -0
- package/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT3.md +9 -0
- package/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT4.md +9 -0
- package/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT5.md +9 -0
- package/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT6.md +9 -0
- package/versioned_docs/version-v1.2/solidity-docs/crypto/SnarkCommon.md +16 -0
- package/versioned_docs/version-v1.2/solidity-docs/crypto/SnarkConstants.md +40 -0
- package/versioned_docs/version-v1.2/solidity-docs/crypto/Verifier.md +61 -0
- package/versioned_docs/version-v1.2/solidity-docs/gatekeepers/EASGatekeeper.md +121 -0
- package/versioned_docs/version-v1.2/solidity-docs/gatekeepers/FreeForAllSignUpGatekeeper.md +40 -0
- package/versioned_docs/version-v1.2/solidity-docs/gatekeepers/SignUpGatekeeper.md +26 -0
- package/versioned_docs/version-v1.2/solidity-docs/gatekeepers/SignUpTokenGatekeeper.md +93 -0
- package/versioned_docs/version-v1.2/solidity-docs/gatekeepers/hatsGatekeepers/HatsGatekeeperBase.md +79 -0
- package/versioned_docs/version-v1.2/solidity-docs/gatekeepers/hatsGatekeepers/HatsGatekeeperMultiple.md +48 -0
- package/versioned_docs/version-v1.2/solidity-docs/gatekeepers/hatsGatekeepers/HatsGatekeeperSingle.md +42 -0
- package/versioned_docs/version-v1.2/solidity-docs/index.md +4 -0
- package/versioned_docs/version-v1.2/solidity-docs/initialVoiceCreditProxy/ConstantInitialVoiceCreditProxy.md +40 -0
- package/versioned_docs/version-v1.2/solidity-docs/initialVoiceCreditProxy/InitialVoiceCreditProxy.md +26 -0
- package/versioned_docs/version-v1.2/solidity-docs/interfaces/IEAS.md +40 -0
- package/versioned_docs/version-v1.2/solidity-docs/interfaces/IHats.md +103 -0
- package/versioned_docs/version-v1.2/solidity-docs/interfaces/IMPFactory.md +26 -0
- package/versioned_docs/version-v1.2/solidity-docs/interfaces/IMessageProcessor.md +31 -0
- package/versioned_docs/version-v1.2/solidity-docs/interfaces/IPoll.md +217 -0
- package/versioned_docs/version-v1.2/solidity-docs/interfaces/IPollFactory.md +29 -0
- package/versioned_docs/version-v1.2/solidity-docs/interfaces/ITallyFactory.md +28 -0
- package/versioned_docs/version-v1.2/solidity-docs/interfaces/ITallySubsidyFactory.md +27 -0
- package/versioned_docs/version-v1.2/solidity-docs/interfaces/IVerifier.md +25 -0
- package/versioned_docs/version-v1.2/solidity-docs/interfaces/IVkRegistry.md +70 -0
- package/versioned_docs/version-v1.2/solidity-docs/mocks/MockHatsProtocol.md +133 -0
- package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueue.md +464 -0
- package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueBinary.md +60 -0
- package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueBinary0.md +40 -0
- package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueBinaryMaci.md +34 -0
- package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinary.md +75 -0
- package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinary0.md +40 -0
- package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinaryBlankSl.md +40 -0
- package/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinaryMaci.md +40 -0
- package/versioned_docs/version-v1.2/solidity-docs/trees/EmptyBallotRoots.md +13 -0
- package/versioned_docs/version-v1.2/solidity-docs/utilities/CommonUtilities.md +25 -0
- package/versioned_docs/version-v1.2/solidity-docs/utilities/DomainObjs.md +40 -0
- package/versioned_docs/version-v1.2/solidity-docs/utilities/Params.md +36 -0
- package/versioned_docs/version-v1.2/solidity-docs/utilities/Utilities.md +79 -0
- package/versioned_docs/version-v1.2/spec.md +944 -0
- package/versioned_docs/version-v1.2/testing-in-detail.md +209 -0
- package/versioned_docs/version-v1.2/testing.md +472 -0
- package/versioned_docs/version-v1.2/topup.md +43 -0
- package/versioned_docs/version-v1.2/troubleshooting.md +51 -0
- package/versioned_docs/version-v1.2/trusted-setup.md +76 -0
- package/versioned_docs/version-v1.2/typedoc/cli/.nojekyll +1 -0
- package/versioned_docs/version-v1.2/typedoc/cli/index.md +15 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/AirdropArgs.md +89 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/DeployArgs.md +154 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/DeployPollArgs.md +154 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/DeployedContracts.md +130 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/GenLocalStateArgs.md +168 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/GenProofsArgs.md +388 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/IGenKeypairArgs.md +37 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/IRegisteredUserArgs.md +63 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/MergeMessagesArgs.md +76 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/MergeSignupsArgs.md +76 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/PollContracts.md +53 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/ProveOnChainArgs.md +128 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/PublishArgs.md +154 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/SignupArgs.md +89 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/SubsidyData.md +73 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/TallyData.md +166 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/TopupArgs.md +89 -0
- package/versioned_docs/version-v1.2/typedoc/cli/interfaces/VerifyArgs.md +128 -0
- package/versioned_docs/version-v1.2/typedoc/cli/modules.md +556 -0
- package/versioned_docs/version-v1.2/typedoc/core/.nojekyll +1 -0
- package/versioned_docs/version-v1.2/typedoc/core/classes/MaciState.md +295 -0
- package/versioned_docs/version-v1.2/typedoc/core/classes/Poll.md +1098 -0
- package/versioned_docs/version-v1.2/typedoc/core/index.md +110 -0
- package/versioned_docs/version-v1.2/typedoc/core/interfaces/BatchSizes.md +50 -0
- package/versioned_docs/version-v1.2/typedoc/core/interfaces/IJsonMaciState.md +77 -0
- package/versioned_docs/version-v1.2/typedoc/core/interfaces/IProcessMessagesCircuitInputs.md +242 -0
- package/versioned_docs/version-v1.2/typedoc/core/interfaces/ISubsidyCircuitInputs.md +198 -0
- package/versioned_docs/version-v1.2/typedoc/core/interfaces/ITallyCircuitInputs.md +231 -0
- package/versioned_docs/version-v1.2/typedoc/core/interfaces/MaxValues.md +37 -0
- package/versioned_docs/version-v1.2/typedoc/core/interfaces/TreeDepths.md +63 -0
- package/versioned_docs/version-v1.2/typedoc/core/modules.md +289 -0
- package/versioned_docs/version-v1.2/typedoc/crypto/.nojekyll +1 -0
- package/versioned_docs/version-v1.2/typedoc/crypto/classes/AccQueue.md +770 -0
- package/versioned_docs/version-v1.2/typedoc/crypto/classes/G1Point.md +115 -0
- package/versioned_docs/version-v1.2/typedoc/crypto/classes/G2Point.md +140 -0
- package/versioned_docs/version-v1.2/typedoc/crypto/classes/IncrementalQuinTree.md +470 -0
- package/versioned_docs/version-v1.2/typedoc/crypto/index.md +44 -0
- package/versioned_docs/version-v1.2/typedoc/crypto/interfaces/Keypair.md +33 -0
- package/versioned_docs/version-v1.2/typedoc/crypto/interfaces/PoseidonFuncs.md +115 -0
- package/versioned_docs/version-v1.2/typedoc/crypto/interfaces/Queue.md +33 -0
- package/versioned_docs/version-v1.2/typedoc/crypto/interfaces/Signature.md +37 -0
- package/versioned_docs/version-v1.2/typedoc/crypto/modules.md +913 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/.nojekyll +1 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/Ballot.md +274 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/Keypair.md +181 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/Message.md +244 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/PCommand.md +409 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/PrivKey.md +206 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/PubKey.md +289 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/StateLeaf.md +340 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/TCommand.md +200 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/classes/VerifyingKey.md +240 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/index.md +81 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/ICommand.md +104 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IG1ContractParams.md +31 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IG2ContractParams.md +31 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonBallot.md +42 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonCommand.md +32 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonKeyPair.md +31 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonPCommand.md +111 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonStateLeaf.md +42 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonTCommand.md +67 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IMessageContractParams.md +31 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IStateLeaf.md +39 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IStateLeafContractParams.md +42 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IVkContractParams.md +64 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IVkObjectParams.md +108 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/Proof.md +46 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/VoteOptionTreeLeaf.md +24 -0
- package/versioned_docs/version-v1.2/typedoc/domainobjs/modules.md +110 -0
- package/versioned_docs/version-v1.2/typedoc/index.md +4 -0
- package/versioned_docs/version-v1.2/versioning.md +94 -0
- package/versioned_docs/version-v1.2/workflow.md +142 -0
- package/versioned_docs/version-v2.x/case-studies.md +35 -0
- package/versioned_docs/version-v2.x/contributing/_category_.json +4 -0
- package/versioned_docs/version-v2.x/contributing/code-of-conduct.md +92 -0
- package/versioned_docs/version-v2.x/contributing/contributing.md +149 -0
- package/versioned_docs/version-v2.x/contributing/project-ideas.md +78 -0
- package/versioned_docs/version-v2.x/core-concepts/_category_.json +4 -0
- package/versioned_docs/version-v2.x/core-concepts/ballot.md +19 -0
- package/versioned_docs/version-v2.x/core-concepts/coordinator-processing.md +46 -0
- package/versioned_docs/version-v2.x/core-concepts/hashing-and-encryption.md +45 -0
- package/versioned_docs/version-v2.x/core-concepts/key-change.md +179 -0
- package/versioned_docs/version-v2.x/core-concepts/maci-keys.md +84 -0
- package/versioned_docs/version-v2.x/core-concepts/maci-messages.md +44 -0
- package/versioned_docs/version-v2.x/core-concepts/merkle-trees.md +23 -0
- package/versioned_docs/version-v2.x/core-concepts/poll-types.md +106 -0
- package/versioned_docs/version-v2.x/core-concepts/spec.md +883 -0
- package/versioned_docs/version-v2.x/core-concepts/state-leaf.md +42 -0
- package/versioned_docs/version-v2.x/core-concepts/workflow.md +142 -0
- package/versioned_docs/version-v2.x/getting-started.md +313 -0
- package/versioned_docs/version-v2.x/guides/_category_.json +4 -0
- package/versioned_docs/version-v2.x/guides/compile-circuits.md +163 -0
- package/versioned_docs/version-v2.x/guides/frontend.md +99 -0
- package/versioned_docs/version-v2.x/guides/integrating.md +73 -0
- package/versioned_docs/version-v2.x/guides/maciWrapper.md +173 -0
- package/versioned_docs/version-v2.x/guides/subgraph.md +79 -0
- package/versioned_docs/version-v2.x/guides/testing/_category_.json +4 -0
- package/versioned_docs/version-v2.x/guides/testing/testing-in-detail.md +203 -0
- package/versioned_docs/version-v2.x/guides/testing/testing.md +163 -0
- package/versioned_docs/version-v2.x/guides/troubleshooting.md +161 -0
- package/versioned_docs/version-v2.x/introduction.md +146 -0
- package/versioned_docs/version-v2.x/processes/_category_.json +4 -0
- package/versioned_docs/version-v2.x/processes/ci-pipeline.md +38 -0
- package/versioned_docs/version-v2.x/processes/versioning.md +94 -0
- package/versioned_docs/version-v2.x/resources.md +33 -0
- package/versioned_docs/version-v2.x/security/_category_.json +4 -0
- package/versioned_docs/version-v2.x/security/audit.md +167 -0
- package/versioned_docs/version-v2.x/security/trusted-setup.md +166 -0
- package/versioned_docs/version-v2.x/supported-networks/_category_.json +4 -0
- package/versioned_docs/version-v2.x/supported-networks/deployed-contracts.md +1108 -0
- package/versioned_docs/version-v2.x/supported-networks/supported-networks.md +47 -0
- package/versioned_docs/version-v2.x/technical-references/_category_.json +4 -0
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/AccQueue.md +21 -0
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/Gatekeepers.md +40 -0
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/MACI.md +152 -0
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/MessageProcessor.md +13 -0
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/Params.md +32 -0
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/Poll.md +104 -0
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/PollFactory.md +43 -0
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/Tally.md +45 -0
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/VkRegistry.md +57 -0
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/VoiceCreditProxy.md +18 -0
- package/versioned_docs/version-v2.x/technical-references/smart-contracts/_category_.json +8 -0
- package/versioned_docs/version-v2.x/technical-references/technical-references.md +47 -0
- package/versioned_docs/version-v2.x/technical-references/typescript-code/_category_.json +4 -0
- package/versioned_docs/version-v2.x/technical-references/typescript-code/cli.md +699 -0
- package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/_category_.json +4 -0
- package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/processMessages.md +107 -0
- package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/setup.md +101 -0
- package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/tallyVotes.md +79 -0
- package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/utilities.md +131 -0
- package/versioned_docs/version-v2.x/technical-references/zk-snark-circuits/zk-snark-circuits.md +37 -0
- package/versioned_docs/version-v2.x/use-cases/_category_.json +4 -0
- package/versioned_docs/version-v2.x/use-cases/governance.md +18 -0
- package/versioned_docs/version-v2.x/use-cases/polling.md +10 -0
- package/versioned_docs/version-v2.x/use-cases/public-goods.md +65 -0
- package/versioned_docs/version-v3.x/case-studies.md +35 -0
- package/versioned_docs/version-v3.x/contributing/_category_.json +4 -0
- package/versioned_docs/version-v3.x/contributing/code-of-conduct.md +92 -0
- package/versioned_docs/version-v3.x/contributing/contributing.md +149 -0
- package/versioned_docs/version-v3.x/contributing/project-ideas.md +78 -0
- package/versioned_docs/version-v3.x/core-concepts/_category_.json +4 -0
- package/versioned_docs/version-v3.x/core-concepts/ballot.md +19 -0
- package/versioned_docs/version-v3.x/core-concepts/coordinator-processing.md +46 -0
- package/versioned_docs/version-v3.x/core-concepts/coordinator-service.md +16 -0
- package/versioned_docs/version-v3.x/core-concepts/hashing-and-encryption.md +45 -0
- package/versioned_docs/version-v3.x/core-concepts/key-change.md +179 -0
- package/versioned_docs/version-v3.x/core-concepts/maci-keys.md +84 -0
- package/versioned_docs/version-v3.x/core-concepts/maci-messages.md +44 -0
- package/versioned_docs/version-v3.x/core-concepts/merkle-trees.md +16 -0
- package/versioned_docs/version-v3.x/core-concepts/offchain-voting.md +14 -0
- package/versioned_docs/version-v3.x/core-concepts/poll-types.md +58 -0
- package/versioned_docs/version-v3.x/core-concepts/polls.md +81 -0
- package/versioned_docs/version-v3.x/core-concepts/spec.md +883 -0
- package/versioned_docs/version-v3.x/core-concepts/state-leaf.md +42 -0
- package/versioned_docs/version-v3.x/core-concepts/workflow.md +149 -0
- package/versioned_docs/version-v3.x/guides/_category_.json +4 -0
- package/versioned_docs/version-v3.x/guides/compile-circuits.md +175 -0
- package/versioned_docs/version-v3.x/guides/integrating.md +137 -0
- package/versioned_docs/version-v3.x/guides/subgraph.md +79 -0
- package/versioned_docs/version-v3.x/guides/testing/_category_.json +4 -0
- package/versioned_docs/version-v3.x/guides/testing/testing-in-detail.md +191 -0
- package/versioned_docs/version-v3.x/guides/testing/testing-introduction.md +158 -0
- package/versioned_docs/version-v3.x/guides/troubleshooting.md +161 -0
- package/versioned_docs/version-v3.x/introduction.md +153 -0
- package/versioned_docs/version-v3.x/processes/_category_.json +4 -0
- package/versioned_docs/version-v3.x/processes/ci-pipeline.md +38 -0
- package/versioned_docs/version-v3.x/processes/versioning.md +94 -0
- package/versioned_docs/version-v3.x/quick-start.md +318 -0
- package/versioned_docs/version-v3.x/resources.md +33 -0
- package/versioned_docs/version-v3.x/security/_category_.json +4 -0
- package/versioned_docs/version-v3.x/security/audit.md +167 -0
- package/versioned_docs/version-v3.x/security/trusted-setup.md +172 -0
- package/versioned_docs/version-v3.x/supported-networks/_category_.json +4 -0
- package/versioned_docs/version-v3.x/supported-networks/deployed-contracts.md +112 -0
- package/versioned_docs/version-v3.x/supported-networks/supported-networks.md +53 -0
- package/versioned_docs/version-v3.x/technical-references/_category_.json +4 -0
- package/versioned_docs/version-v3.x/technical-references/coordinator-service/_category_.json +8 -0
- package/versioned_docs/version-v3.x/technical-references/coordinator-service/index.md +10 -0
- package/versioned_docs/version-v3.x/technical-references/coordinator-service/installation.md +43 -0
- package/versioned_docs/version-v3.x/technical-references/offchain-relayer/_category_.json +8 -0
- package/versioned_docs/version-v3.x/technical-references/offchain-relayer/index.md +51 -0
- package/versioned_docs/version-v3.x/technical-references/offchain-relayer/installation.md +109 -0
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/MACI.md +160 -0
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/MessageProcessor.md +13 -0
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/Params.md +33 -0
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/Policies.md +39 -0
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/Poll.md +170 -0
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/PollFactory.md +33 -0
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/Tally.md +43 -0
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/VkRegistry.md +62 -0
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/VoiceCreditProxy.md +18 -0
- package/versioned_docs/version-v3.x/technical-references/smart-contracts/_category_.json +8 -0
- package/versioned_docs/version-v3.x/technical-references/technical-references.md +48 -0
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/_category_.json +4 -0
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/joinPoll.md +53 -0
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/processMessages.md +106 -0
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/setup.md +96 -0
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/tallyVotes.md +79 -0
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/utilities.md +131 -0
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/zk-snark-circuits.md +42 -0
- package/versioned_docs/version-v3.x/use-cases/_category_.json +4 -0
- package/versioned_docs/version-v3.x/use-cases/governance.md +18 -0
- package/versioned_docs/version-v3.x/use-cases/polling.md +10 -0
- package/versioned_docs/version-v3.x/use-cases/public-goods.md +65 -0
- package/versioned_sidebars/version-v0.x-sidebars.json +8 -0
- package/versioned_sidebars/version-v1.2-sidebars.json +8 -0
- package/versioned_sidebars/version-v2.x-sidebars.json +8 -0
- package/versioned_sidebars/version-v3.x-sidebars.json +8 -0
- package/versions.json +1 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: MACI v0.x quadratic vote tallying circuit
|
|
3
|
+
sidebar_label: "Circuit: quadratic vote tallying"
|
|
4
|
+
sidebar_position: 5
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# The quadratic vote tallying circuit
|
|
8
|
+
|
|
9
|
+
Quadratic voting is one of many types of vote tallying mechanisms. We chose it for the first version of MACI due to the high amount of interest that the community has shown for it.
|
|
10
|
+
|
|
11
|
+
Quadratic voting allows users to express the strength of their preferences when they vote for options. Since users are allocated a limited number of _voice credits_, and the number of tallied votes per option is the square root of the number of voice credits spent on said option, quadratic voting [over-privileges neither concentrated nor diffuse interests](https://vitalik.eth.limo/general/2019/12/07/quadratic.html).
|
|
12
|
+
|
|
13
|
+
For instance, if a user has 99 voice credits, they may spend them this way (each row represents a command):
|
|
14
|
+
|
|
15
|
+
| Option | Voice credits spent |
|
|
16
|
+
| ------ | ------------------- |
|
|
17
|
+
| A | 1 |
|
|
18
|
+
| A | 9 |
|
|
19
|
+
| B | 25 |
|
|
20
|
+
| C | 64 |
|
|
21
|
+
|
|
22
|
+
The outcome is as such:
|
|
23
|
+
|
|
24
|
+
| Option | Tallied votes |
|
|
25
|
+
| ------ | ------------- |
|
|
26
|
+
| A | 3.16 |
|
|
27
|
+
| B | 5 |
|
|
28
|
+
| C | 8 |
|
|
29
|
+
|
|
30
|
+
Even though the user has a disproportionate preference for option C (64 voice credits), their impact on the tallied vote (8 votes) is merely the square root of the voice credits they have spent. This prevents them from having an outsized influence on the results simply by virtue of their willingness to spend as many voice credits on that option as they had.
|
|
31
|
+
|
|
32
|
+
Additionally, we consider that votes are cumulative. This means that the user spent 10 voice credits on option A.
|
|
33
|
+
|
|
34
|
+
The MACI contract's `quadraticVoteTally()` function should verify a proof created using this circuit to compute the results of tallying a set of state leaves. This also proves that these state leaves have an intermediate root `A`, as well that `A` is part of the tree with final state root `R`. This allows the coordinator to prove the final tally in batches. The function keeps track of the index of each intermediate root to ensure that they are processed consecutively.
|
|
35
|
+
|
|
36
|
+
## Inputs
|
|
37
|
+
|
|
38
|
+
| Pseudocode name | zk-SNARK input type | Description | Set by |
|
|
39
|
+
| ----------------------------- | ------------------- | ---------------------------------------------------------------------------------------------------------- | ----------- |
|
|
40
|
+
| `fullStateRoot` | Public | The final Merkle root of the state tree | Contract |
|
|
41
|
+
| `fullStateTreeDepth` | Hardcoded | The depth of the state tree | Contract |
|
|
42
|
+
| `intermediateStateTreeDepth` | Hardcoded | The depth of the intermediate state tree | Contract |
|
|
43
|
+
| `intermediateStateRoot` | Public | The intermediate Merkle root generated by the given state leaves | Contract |
|
|
44
|
+
| `intermediatePathElements[k]` | Private | The Merkle path elements from `intermediateStateRoot` to `stateRoot`. | Coordinator |
|
|
45
|
+
| `intermediatePathIndex` | Public | The Merkle path index from `intermediateStateRoot` to `stateRoot`. | Contract |
|
|
46
|
+
| `currentResults[n]` | Private | The vote tally of all prior batches of state leaves | Coordinator |
|
|
47
|
+
| `currentResultsSalt` | Private | A random value to hash with the vote tally for state leaves up to the current batch | Coordinator |
|
|
48
|
+
| `currentResultsCommitment` | Public | The salted commitment of the values in `currentResults` | Contract |
|
|
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 culmulate vote tally for this batch of state leaves | Coordinator |
|
|
51
|
+
| `stateLeaves[m][p]` | Private | The batch of leaves of the state tree to tally. | Coordinator |
|
|
52
|
+
| `voteLeaves[m][n]` | Private | The vote leaves for each user in this batch of state leaves. | Coordinator |
|
|
53
|
+
|
|
54
|
+
`n` is the number of options in `voteOptionTree`.
|
|
55
|
+
`m` is the number of state leaves in this batch.
|
|
56
|
+
`k` is `fullStateTreeDepth - intermediateStateTreeDepth`
|
|
57
|
+
`p` is the message length
|
|
58
|
+
|
|
59
|
+
A result commitment is the hash of a Merkle root of all the vote leaves, and a salt. For instance:
|
|
60
|
+
|
|
61
|
+
```javascript
|
|
62
|
+
root = genTree(results);
|
|
63
|
+
hash(root, salt);
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Circuit pseudocode
|
|
67
|
+
|
|
68
|
+
```javascript
|
|
69
|
+
// Alice votes for party A with 16 credits
|
|
70
|
+
// Bob votes for party A with 9 credits
|
|
71
|
+
|
|
72
|
+
// Party A gets 7 tallied votes. NOT 5 votes.
|
|
73
|
+
|
|
74
|
+
// Ensure via a constraint that the intermediate root is the
|
|
75
|
+
// correct Merkle root of the stateLeaves passed into this
|
|
76
|
+
// snark
|
|
77
|
+
assert(intermediateStateRoot == genTree(stateLeaves))
|
|
78
|
+
|
|
79
|
+
// Ensure via a constraint that the intermediate root is part of the full state tree
|
|
80
|
+
var x = generateMerkleRoot(
|
|
81
|
+
intermediatePathElements,
|
|
82
|
+
intermediatePathIndex,
|
|
83
|
+
intermediateRoot
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
assert(x == stateRoot)
|
|
87
|
+
|
|
88
|
+
// This variable stores the sum of the square roots of each
|
|
89
|
+
// user's voice credits per option.
|
|
90
|
+
var computedResults = currentResults
|
|
91
|
+
|
|
92
|
+
var start = 1
|
|
93
|
+
if intermediatePathIndex > 0:
|
|
94
|
+
start = 0
|
|
95
|
+
|
|
96
|
+
// For each user
|
|
97
|
+
for i as start to m: // we ignore leaf 0 on purpose
|
|
98
|
+
|
|
99
|
+
// Ensure via a constraint that the voteLeaves for this
|
|
100
|
+
// user is correct (such that when each vote leaf is
|
|
101
|
+
// inserted into an MT, the Merkle root matches
|
|
102
|
+
// the `voteOptionTreeRoot` field of the state leaf)
|
|
103
|
+
|
|
104
|
+
var computedVoteOptionTreeRoot = genTree(voteLeaves[i])
|
|
105
|
+
assert(computedVoteOptionTreeRoot == stateLeaves[i].voteOptionTreeRoot)
|
|
106
|
+
|
|
107
|
+
// Calculate the sum of votes for each option
|
|
108
|
+
for j as 0 to n.
|
|
109
|
+
// This adds to the subtotal from previous batches
|
|
110
|
+
// of state leaves
|
|
111
|
+
computedResults[j] += voteLeaves[i][j]
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
// Ensure via a constraint that the commitment to the current results is
|
|
115
|
+
// correct
|
|
116
|
+
|
|
117
|
+
assert(
|
|
118
|
+
hash(genTree(currentResults), currentResultsSalt) ==
|
|
119
|
+
currentResultsCommitment
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
// Ensure via a constraint that the final result
|
|
123
|
+
// is correct
|
|
124
|
+
assert(
|
|
125
|
+
hash(genTree(computedResults), salt) ==
|
|
126
|
+
newResultsCommitment
|
|
127
|
+
)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
where `genTree` is pseudocode for a circuit which computes a Merkle root from a list of leaves.
|
|
131
|
+
|
|
132
|
+
## Circuit failure modes
|
|
133
|
+
|
|
134
|
+
| Condition | Outcome |
|
|
135
|
+
| -------------------------------------------------------------------------------------------------- | ------------------------------ |
|
|
136
|
+
| Invalid state leaves and/or intermediate state root | No such proof can be generated |
|
|
137
|
+
| Invalid vote option leaves | No such proof can be generated |
|
|
138
|
+
| Invalid Merkle path to the full state root from the intermediate state root for the batch of votes | No such proof can be generated |
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: MACI v0.x state root transition proof circuit
|
|
3
|
+
sidebar_label: "Circuit: state root transition proof"
|
|
4
|
+
sidebar_position: 4
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# The state root transition proof circuit
|
|
8
|
+
|
|
9
|
+
This circuit proves the correctness of each state root transition.
|
|
10
|
+
|
|
11
|
+
## Public Inputs
|
|
12
|
+
|
|
13
|
+
All public inputs are set by the contract.
|
|
14
|
+
|
|
15
|
+
| Pseudocode name | Description |
|
|
16
|
+
| -------------------------- | --------------------------------------------------------------------------------------- |
|
|
17
|
+
| `coordinatorPubKey` | The coordinator's public key |
|
|
18
|
+
| `currentStateRoot` | The current state root |
|
|
19
|
+
| `msgTreeRoot` | The Merkle root of the message tree |
|
|
20
|
+
| `msgTreePathIndex` | The Merkle path index of the message in the message tree |
|
|
21
|
+
| `maxStateLeafIndex` | The maximum leaf index of the state tree |
|
|
22
|
+
| `userCurrentLeafPathIndex` | The Merkle path index from the user's latest valid state leaf to the current state root |
|
|
23
|
+
| `newStateRoot` | The new state root |
|
|
24
|
+
|
|
25
|
+
## Private Inputs
|
|
26
|
+
|
|
27
|
+
All private inputs are set by the coordinator.
|
|
28
|
+
|
|
29
|
+
| Pseudocode name | Description |
|
|
30
|
+
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
31
|
+
| `userCurrentLeafPathElements` | The Merkle path elements from the user's latest valid state leaf to the current state root |
|
|
32
|
+
| `currentVoteOptionPathElements[n]` | The Merkle path needed to prove the existence of the current vote option leaf. Size is `253` \* `vote_option_tree_depth` bits |
|
|
33
|
+
| `newVoteOptionPathElements[n]` | The Merkle path needed to update the vote option tree root in the state leaf. Size is `253` \* `vote_option_tree_depth` bits |
|
|
34
|
+
| `currentVoteWeight` | In the quadratic voting use case, this is the square root of the number of voice credits a user wishes to spend on this vote. Size is 32 bits. |
|
|
35
|
+
| `message` | The message |
|
|
36
|
+
| `msgTreePathElements` | The Merkle path elements to the message tree root from the message leaf |
|
|
37
|
+
| `randomLeaf` | Random data |
|
|
38
|
+
| `newStateTreePathIndex` | The Merkle path index to the new state root from the new state leaf |
|
|
39
|
+
| `newStateTreePathElements` | The Merkle path elements to the new state root from the new state leaf |
|
|
40
|
+
| `newStateTreePathElementsToZero` | The Merkle path elements to the new state root from leaf 0, **after** the new state leaf has been updated |
|
|
41
|
+
| `userCurrentLeaf` | The user's latest valid state leaf |
|
|
42
|
+
| `command` | The command to process. Includes all the details in the leaf. |
|
|
43
|
+
| `noOp` | The no-op flag |
|
|
44
|
+
| `userPubKey` | The public key associated with the private key used to sign the command |
|
|
45
|
+
| `encPubKey` | The ephemeral public key used to generate the ECDH shared key which was used to encrypt the command. |
|
|
46
|
+
| `coordinatorPrivKey` | The coordinator's private key. |
|
|
47
|
+
|
|
48
|
+
For the sake of simplicity, in this specification, we assume that there is no batching of commands and we handle each command one at a time.
|
|
49
|
+
|
|
50
|
+
## Check 1: That the message has been encrypted with the correct key
|
|
51
|
+
|
|
52
|
+
```javascript
|
|
53
|
+
// Derive the coordinator's public key from
|
|
54
|
+
// their private key
|
|
55
|
+
var derivedCoordinatorPubKey = eddsaDerivePubKey(coordinatorPrivKey);
|
|
56
|
+
|
|
57
|
+
// Ensure via a constraint that it matches the
|
|
58
|
+
// coordinator's public key given as an input
|
|
59
|
+
assert(derivedCoordinatorPubKey == coordinatorPubKey);
|
|
60
|
+
|
|
61
|
+
// Generate the ECDH key
|
|
62
|
+
var ecdhSharedKey = genEcdhKey(coordinatorPrivKey, encPubKey);
|
|
63
|
+
|
|
64
|
+
// Use the ECDH shared key to decrypt the message
|
|
65
|
+
var decryptedCommand = decrypt(ecdhSharedKey, message);
|
|
66
|
+
|
|
67
|
+
// Ensure via a constraint that the message has been correctly decrypted
|
|
68
|
+
assert(decryptedCommand == command);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Check 2: that the message is part of the message tree
|
|
72
|
+
|
|
73
|
+
```javascript
|
|
74
|
+
var generatedMsgTreeRoot = generateMerkleRoot(msgTreePathElements, msgTreePathIndex, message);
|
|
75
|
+
|
|
76
|
+
assert(generatedMsgTreeRoot, msgTreeRoot);
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Check 3: that the new state root transition is the correct result of executing the given command — _or_ — that the command is invalid and the no-op flag is set to true.
|
|
80
|
+
|
|
81
|
+
## Circuit logic
|
|
82
|
+
|
|
83
|
+
The message should already have been decrypted to `decryptedCommand` (see above).
|
|
84
|
+
|
|
85
|
+
```javascript
|
|
86
|
+
/***********************************
|
|
87
|
+
This function generates a state leaf
|
|
88
|
+
***********************************/
|
|
89
|
+
function generateStateLeaf(
|
|
90
|
+
command,
|
|
91
|
+
computedNewVoteOptionRoot,
|
|
92
|
+
newVoiceCreditBalance
|
|
93
|
+
) => {
|
|
94
|
+
|
|
95
|
+
return [
|
|
96
|
+
command.newPublicKeyX,
|
|
97
|
+
command.newPublicKeyY,
|
|
98
|
+
computedNewVoteOptionRoot,
|
|
99
|
+
newVoiceCreditBalance,
|
|
100
|
+
command.nonce + 1
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/*************************
|
|
105
|
+
// The main circuit logic:
|
|
106
|
+
**************************/
|
|
107
|
+
|
|
108
|
+
// Record in a variable that the new state leaf index is
|
|
109
|
+
// valid (i.e. it is leq to the maximum allowed value)
|
|
110
|
+
var validStateLeafIndex = newStateTreePathIndex <= maxStateLeafIndex && newStateTreePathIndex > 0
|
|
111
|
+
|
|
112
|
+
// Record in a variable if the signature is valid
|
|
113
|
+
var validSignature = verifyEddsa(signature, decryptedCommand, userPubKey)
|
|
114
|
+
|
|
115
|
+
// Record in a variable if the nonce is correct
|
|
116
|
+
var correctNonce = decryptedCommand.nonce == userCurrentLeaf.nonce + 1
|
|
117
|
+
|
|
118
|
+
// Prove that the user's current leaf is part of the
|
|
119
|
+
// Merkle tree. Note that this check is independent of
|
|
120
|
+
// the noOp flag. As such, the coordinator cannot
|
|
121
|
+
// create an invalid proof by tampering with the
|
|
122
|
+
// Merkle proof and setting noOp to true; the Merkle proof
|
|
123
|
+
// *must* be valid.
|
|
124
|
+
var x = generateMerkleRoot(
|
|
125
|
+
userCurrentLeafPathElements,
|
|
126
|
+
userCurrentLeafPathIndex,
|
|
127
|
+
userCurrentLeaf
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
assert(x == currentStateRoot)
|
|
131
|
+
|
|
132
|
+
// Prove that the current vote option weight (leaf)
|
|
133
|
+
// input is correct by checking that it exists in the
|
|
134
|
+
// tree at the given index
|
|
135
|
+
var y = generateMerkleRoot(
|
|
136
|
+
decryptedCommand.currentVoteOptionPathElements,
|
|
137
|
+
decryptedCommand.voteOptionIndex,
|
|
138
|
+
decryptedCommand.currentVoteWeight
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
assert(y == userCurrentLeaf.voteOptionTreeRoot)
|
|
142
|
+
|
|
143
|
+
// Record in a variable if the user has enough
|
|
144
|
+
// voice credits
|
|
145
|
+
|
|
146
|
+
var newVoiceCreditBalance =
|
|
147
|
+
userCurrentLeaf.voiceCreditBalance +
|
|
148
|
+
(decryptedCommand.currentVoteWeight ^ 2) -
|
|
149
|
+
(decryptedCommand.newVoteWeight ^ 2)
|
|
150
|
+
|
|
151
|
+
var enoughVoiceCredits = newVoiceCreditBalance >= 0
|
|
152
|
+
|
|
153
|
+
// Record in a variable if the new leaf's vote option
|
|
154
|
+
// tree root is the correct result of updating the
|
|
155
|
+
// vote option leaf.
|
|
156
|
+
var computedNewVoteOptionRoot =
|
|
157
|
+
updateMerkleTree(
|
|
158
|
+
command.voteOptionIndex,
|
|
159
|
+
command.voteOptionPath,
|
|
160
|
+
command.voteWeight,
|
|
161
|
+
decryptedCommand.newVoteWeight
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
assert(newStateLeaf.voteOptionRoot == computedNewVoteOptionRoot)
|
|
165
|
+
newStateLeaf.voteOptionRoot == computedNewVoteOptionRoot
|
|
166
|
+
|
|
167
|
+
// Record in a variable if the vote option index is
|
|
168
|
+
// within a permissible range (0 to 2 ** vote option tree
|
|
169
|
+
// depth, inclusive) where VOTE_OPTION_TREE_DEPTH is
|
|
170
|
+
// not an input, but rather hardcoded during the trusted
|
|
171
|
+
// setup.
|
|
172
|
+
var validVoteOptionTreeIndex = command.voteOptionIndex < VOTE_OPTION_TREE_DEPTH
|
|
173
|
+
|
|
174
|
+
var newStateLeaf = generateStateLeaf(
|
|
175
|
+
command,
|
|
176
|
+
computedNewVoteOptionRoot,
|
|
177
|
+
newVoiceCreditBalance
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
if (enoughVoiceCredits &&
|
|
181
|
+
correctNonce &&
|
|
182
|
+
validSignature &&
|
|
183
|
+
validStateLeafIndex &&
|
|
184
|
+
validVoteOptionTreeIndex
|
|
185
|
+
):
|
|
186
|
+
// Use a constraint to ensure that the no-op flag
|
|
187
|
+
// is set to false
|
|
188
|
+
assert(noOp == false)
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
// Generate the new state root.
|
|
192
|
+
var s = merkleTreeUpdate(
|
|
193
|
+
newStateTreePathIndex
|
|
194
|
+
newStateLeaf,
|
|
195
|
+
currentStateRoot,
|
|
196
|
+
newStateTreePathElements
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
// Update the leaf at index `0` to generate a new state
|
|
200
|
+
// root, and ensure via a constraint that it is equal
|
|
201
|
+
// to the new state root passed to the snark as an
|
|
202
|
+
// input.
|
|
203
|
+
|
|
204
|
+
var updatedStateRoot = merkleTreeUpdate(
|
|
205
|
+
0,
|
|
206
|
+
randomLeaf,
|
|
207
|
+
s,
|
|
208
|
+
newStateTreePathElementsToZero
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
assert(updatedStateRoot == newStateRoot)
|
|
212
|
+
|
|
213
|
+
else:
|
|
214
|
+
// Use a constraint to ensure that the no-op flag
|
|
215
|
+
// is set to true
|
|
216
|
+
assert(noOp == true)
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Circuit failure modes
|
|
220
|
+
|
|
221
|
+
| Condition | noOp flag | Outcome |
|
|
222
|
+
| --------------------------------------------------- | --------- | --------------------------------------- |
|
|
223
|
+
| Insufficient voice credits | `true` | Valid proof, but only leaf 0 is updated |
|
|
224
|
+
| Invalid nonce | `true` | Valid proof, but only leaf 0 is updated |
|
|
225
|
+
| Invalid signature | `true` | Valid proof, but only leaf 0 is updated |
|
|
226
|
+
| Invalid new vote option root | `true` | Valid proof, but only leaf 0 is updated |
|
|
227
|
+
| Invalid state leaf index | `true` | Valid proof, but only leaf 0 is updated |
|
|
228
|
+
| Invalid vote option tree index | `true` | Valid proof, but only leaf 0 is updated |
|
|
229
|
+
| Invalid Merkle path to the current state root | N/A | No such proof can be generated |
|
|
230
|
+
| Invalid Merkle path to the current vote option root | N/A | No such proof can be generated |
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: MACI Security Audits
|
|
3
|
+
description: Overview of MACI audit history with references to audit reports.
|
|
4
|
+
sidebar_label: Security audits
|
|
5
|
+
sidebar_position: 14
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# MACI Security Audits
|
|
9
|
+
|
|
10
|
+
## Full reports
|
|
11
|
+
|
|
12
|
+
- Audit by PSE Audit 2024/02 [report](/audit_reports/20240223_PSE_Audit_audit_report.pdf)
|
|
13
|
+
- Audit by HashCloak 2022/09 [report](/audit_reports/202220930_Hashcloak_audit_report.pdf)
|
|
14
|
+
- Audit by HashCloak 2021/09 [report](/audit_reports/20210922_Hashcloak_audit_report.pdf)
|
|
15
|
+
|
|
16
|
+
## PSE audit 2024
|
|
17
|
+
|
|
18
|
+
In February 2024 the PSE Audit team audited the MACI codebase with a focus on the smart contracts, TypeScript core, and Circom circuits Three critical bugs were found: two within the Circom circuits and one in the smart contracts. All three of these have been fixed.
|
|
19
|
+
|
|
20
|
+
Please see the [PSE Audit report](/audit_reports/20240223_PSE_Audit_audit_report.pdf) for details.
|
|
21
|
+
|
|
22
|
+
## Veridise disclosure 2023
|
|
23
|
+
|
|
24
|
+
In March 2023, Veridise responsibly disclosed a number of issues to the MACI team, which were identified using their new [tool](https://twitter.com/VeridiseInc/status/1630806464695791616?s=20) for catching ZK circuit bugs.
|
|
25
|
+
|
|
26
|
+
Out of five issues disclosed, only three were relevant and have been since fixed by the MACI team. The other two issues were disregarded as they were present in older version of code which is not in use anymore.
|
|
27
|
+
|
|
28
|
+
We would like to thank the Veridise team for their effort in keeping open source projects safe.
|
|
29
|
+
|
|
30
|
+
### Issue 1
|
|
31
|
+
|
|
32
|
+
**Description**
|
|
33
|
+
|
|
34
|
+
In the template `QuinSelector`, if you want to confirm the input signal index is a valid integer less than 2\*\*3, you should add Num2bits(3) to check it.
|
|
35
|
+
|
|
36
|
+
**Code Location**
|
|
37
|
+
|
|
38
|
+
[`incrementalQuinTree.circom`](https://github.com/privacy-scaling-explorations/maci/blob/78609349aecd94186216ac8743d61b1cb81a097f/circuits/circom/trees/incrementalQuinTree.circom#L30)
|
|
39
|
+
|
|
40
|
+
**Fix**
|
|
41
|
+
|
|
42
|
+
[Code location](https://github.com/chaosma/maci/blob/60727d4d10406edda32ad28e53d399d41d45ed88/circuits/circom/trees/incrementalQuinTree.circom#L37)
|
|
43
|
+
|
|
44
|
+
```javascript
|
|
45
|
+
// Ensure that index < choices
|
|
46
|
+
component lessThan = SafeLessThan(3);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
This was fixed by adding a new Template, `SafeLesThan` which uses `Num2Bits` as further check on the signals:
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
// the implicit assumption of LessThan is both inputs are at most n bits
|
|
53
|
+
// so we need to add range check for both inputs
|
|
54
|
+
template SafeLessThan(n) {
|
|
55
|
+
assert(n <= 252);
|
|
56
|
+
signal input in[2];
|
|
57
|
+
signal output out;
|
|
58
|
+
|
|
59
|
+
component n2b1 = Num2Bits(n);
|
|
60
|
+
n2b1.in <== in[0];
|
|
61
|
+
component n2b2 = Num2Bits(n);
|
|
62
|
+
n2b2.in <== in[1];
|
|
63
|
+
|
|
64
|
+
component n2b = Num2Bits(n+1);
|
|
65
|
+
|
|
66
|
+
n2b.in <== in[0]+ (1<<n) - in[1];
|
|
67
|
+
|
|
68
|
+
out <== 1-n2b.out[n];
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Issue 2
|
|
73
|
+
|
|
74
|
+
**Description**
|
|
75
|
+
|
|
76
|
+
This issue is the same issue number 1, this time for the input signal index.
|
|
77
|
+
|
|
78
|
+
**Code Location**
|
|
79
|
+
|
|
80
|
+
[`incrementalQuinTree.circom`](https://github.com/privacy-scaling-explorations/maci/blob/78609349aecd94186216ac8743d61b1cb81a097f/circuits/circom/trees/incrementalQuinTree.circom#L64)
|
|
81
|
+
|
|
82
|
+
**Fix**
|
|
83
|
+
|
|
84
|
+
[PR with fix](https://github.com/privacy-scaling-explorations/maci/pull/646/files#diff-f3ad1f61e9b95b88929664b67c873325fdf70cb8569c2a96da4b0e9f02710391)
|
|
85
|
+
|
|
86
|
+
As with issue number 1, a new template `SafeGreaterThan` was added:
|
|
87
|
+
|
|
88
|
+
```javascript
|
|
89
|
+
// N is the number of bits the input have.
|
|
90
|
+
// The MSF is the sign bit.
|
|
91
|
+
template SafeGreaterThan(n) {
|
|
92
|
+
signal input in[2];
|
|
93
|
+
signal output out;
|
|
94
|
+
|
|
95
|
+
component lt = SafeLessThan(n);
|
|
96
|
+
|
|
97
|
+
lt.in[0] <== in[1];
|
|
98
|
+
lt.in[1] <== in[0];
|
|
99
|
+
lt.out ==> out;
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
And then used it to constrain the [`index` input signal](https://github.com/chaosma/maci/blob/2d7a3a0efd33dfc3a5f4d3f95bec3adda7abb963/circuits/circom/trees/incrementalQuinTree.circom#L115-L117):
|
|
104
|
+
|
|
105
|
+
```javascript
|
|
106
|
+
greaterThan[i] = SafeGreaterThan(3);
|
|
107
|
+
greaterThan[i].in[0] <== i;
|
|
108
|
+
greaterThan[i].in[1] <== index;
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Issue 3
|
|
112
|
+
|
|
113
|
+
**Description**
|
|
114
|
+
|
|
115
|
+
In the template `QuinGeneratePathIndices`, the constraints of the `signal n[levels + 1]` don't perform well for division and modulo counting.
|
|
116
|
+
|
|
117
|
+
**Code Location**
|
|
118
|
+
|
|
119
|
+
[`incrementalQuinTree.circom`](https://github.com/privacy-scaling-explorations/maci/blob/7c1b3743ea753786011289a356eaa45ba72f9ca1/circuits/circom/trees/incrementalQuinTree.circom#L228-L242)
|
|
120
|
+
|
|
121
|
+
**Fix**
|
|
122
|
+
|
|
123
|
+
The [updated code](https://github.com/chaosma/maci/blob/2d7a3a0efd33dfc3a5f4d3f95bec3adda7abb963/circuits/circom/trees/incrementalQuinTree.circom#L285-L290) uses the `SafeLessThen` template, as shown below:
|
|
124
|
+
|
|
125
|
+
```javascript
|
|
126
|
+
for (var i = 0; i < levels; i++) {
|
|
127
|
+
// Check that each output element is less than the base
|
|
128
|
+
leq[i] = SafeLessThan(3);
|
|
129
|
+
leq[i].in[0] <== out[i];
|
|
130
|
+
leq[i].in[1] <== BASE;
|
|
131
|
+
leq[i].out === 1;
|
|
132
|
+
|
|
133
|
+
// Re-compute the total sum
|
|
134
|
+
sum.nums[i] <== out[i] * (BASE ** i);
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## HashCloak audit 2022
|
|
139
|
+
|
|
140
|
+
In the summer of 2022, MACI v1 was audited by HashCloak. The audit covered both the zk-SNARK circuits and the Solidity smart contracts.
|
|
141
|
+
|
|
142
|
+
This audit revealed a number of high severity issues which have been remediated by the MACI development team. All issues were successfully fixed and reflected in MACI v1.1.1.
|
|
143
|
+
|
|
144
|
+
Please see the [HashCloak report](/audit_reports/202220930_Hashcloak_audit_report.pdf) for details.
|
|
145
|
+
|
|
146
|
+
## HashCloak audit 2021
|
|
147
|
+
|
|
148
|
+
From July 5th, 2021 to August 2nd, 2021, the Ethereum Foundation’s Applied ZKPs team engaged HashCloak for an audit of the MACI protocol. The audit was conducted with 3 auditors over 15 person weeks.
|
|
149
|
+
|
|
150
|
+
The following packages were in scope:
|
|
151
|
+
|
|
152
|
+
- Circuits
|
|
153
|
+
- Contracts
|
|
154
|
+
- Core
|
|
155
|
+
- Crypto
|
|
156
|
+
- Domainobjs
|
|
157
|
+
|
|
158
|
+
From August 18, 2021 to September 22, 2021, Hashcloak assisted the MACI team in resolving the issues.
|
|
159
|
+
|
|
160
|
+
Please see the [HashCloak report](/audit_reports/20210922_Hashcloak_audit_report.pdf) for details.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: CI Pipeline
|
|
3
|
+
description: Introduction to how MACI's CI works
|
|
4
|
+
sidebar_label: CI
|
|
5
|
+
sidebar_position: 15
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Continuous Integration (CI) Pipeline
|
|
9
|
+
|
|
10
|
+
CI (Continuous Integration) pipeline is an automated workflow to ensure that software is always in a working state. An event like opening a pull request causes a pipeline to run. The pipeline consists of an automated build process and a suite of automated tests (See [Testing](https://pse.dev/docs/testing) for more details).
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
## Pipeline Triggers
|
|
15
|
+
|
|
16
|
+
### Commit to Main Branch
|
|
17
|
+
|
|
18
|
+
Each commit (i.e. a merged PR) to the main branch triggers the pipeline. The pipeline creates packages that can be deployed to any environment. Packages are uploaded to an artifact repository (e.g. npm).
|
|
19
|
+
|
|
20
|
+

|
|
21
|
+
|
|
22
|
+
### Pull Request (PR)
|
|
23
|
+
|
|
24
|
+
When a pull request has been created (or updated), it triggers the PR pipeline. It gives the reviewer confidence that the software works as expected with the introduced code changes.
|
|
25
|
+
|
|
26
|
+

|
|
27
|
+
|
|
28
|
+
### Nightly
|
|
29
|
+
|
|
30
|
+
Nightly build runs every midnight. It is to ensure that all required dependencies are present and to show no bugs have been introduced.
|
|
31
|
+
|
|
32
|
+

|
|
33
|
+
|
|
34
|
+
### Tag Push
|
|
35
|
+
|
|
36
|
+
When a tag has been pushed, it triggers a release pipeline. It will draft a release note with an auto-generated changelog and publish npm package(s).
|
|
37
|
+
|
|
38
|
+

|