@maci-protocol/website 0.0.0-ci.00107eb
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 +21 -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/2025-08-18-maci-aragon-plugin.md +107 -0
- package/blog/2025-09-05-maci-coordinator-service.md +167 -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 +219 -0
- package/package.json +66 -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 +109 -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 +115 -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 +155 -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 +82 -0
- package/versioned_docs/version-v3.x/core-concepts/polls.md +105 -0
- package/versioned_docs/version-v3.x/core-concepts/spec.md +817 -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 +191 -0
- package/versioned_docs/version-v3.x/guides/integrating.md +137 -0
- package/versioned_docs/version-v3.x/guides/sdk.md +121 -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 +190 -0
- package/versioned_docs/version-v3.x/guides/troubleshooting.md +206 -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 +326 -0
- package/versioned_docs/version-v3.x/resources.md +34 -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/costs.md +725 -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 +69 -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 +24 -0
- package/versioned_docs/version-v3.x/technical-references/coordinator-service/installation.md +15 -0
- package/versioned_docs/version-v3.x/technical-references/coordinator-service/usage.md +64 -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 +52 -0
- package/versioned_docs/version-v3.x/technical-references/zk-snark-circuits/processMessages.md +170 -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,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Params Smart Contract
|
|
3
|
+
description: Params smart contract
|
|
4
|
+
sidebar_label: Params
|
|
5
|
+
sidebar_position: 9
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
Code location: [Params.sol](https://github.com/privacy-scaling-explorations/maci/blob/main/packages/contracts/contracts/utilities/Params.sol)
|
|
10
|
+
:::
|
|
11
|
+
|
|
12
|
+
A contract holding three structs:
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
/// @notice A struct holding the depths of the merkle trees
|
|
16
|
+
struct TreeDepths {
|
|
17
|
+
uint8 tallyProcessingStateTreeDepth;
|
|
18
|
+
uint8 voteOptionTreeDepth;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/// @notice A struct holding the external contracts
|
|
22
|
+
/// that are to be passed to a Poll contract on
|
|
23
|
+
/// deployment
|
|
24
|
+
struct ExtContracts {
|
|
25
|
+
IMACI maci;
|
|
26
|
+
IVerifier verifier;
|
|
27
|
+
IVkRegistry vkRegistry;
|
|
28
|
+
IBasePolicy policy;
|
|
29
|
+
IInitialVoiceCreditProxy initialVoiceCreditProxy;
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Struct parameters are used to avoid stack too deep errors in the other contracts.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Policies Smart Contract
|
|
3
|
+
description: Policies smart contract
|
|
4
|
+
sidebar_label: Policies
|
|
5
|
+
sidebar_position: 6
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
Code location: [Policies](https://github.com/privacy-scaling-explorations/excubiae/tree/main/packages/contracts/contracts/extensions)
|
|
10
|
+
:::
|
|
11
|
+
|
|
12
|
+
MACI is composed of multiple smart contracts, which together with the zk-SNARK circuits, can be used to carry out on-chain voting. Start with an [overview of our smart contracts here](/docs/technical-references/smart-contracts/MACI).
|
|
13
|
+
|
|
14
|
+
MACI uses a "policy" contract from Excubiae, which is used to configure and enforce the eligibility criteria of voters who can participate in MACI polls. In other words, it is a way to whitelist signups to the system. Operators of MACI can use the policy contract to configure signup eligibility and to protect against sybil attacks in their polls.
|
|
15
|
+
|
|
16
|
+
The MACI repository comes with several out-of-the-box options:
|
|
17
|
+
|
|
18
|
+
- `FreeForAllPolicy` - This allows anyone to signup on MACI.
|
|
19
|
+
- `SignUpTokenPolicy` - This restricts signups only to holders of a specific ERC721 token.
|
|
20
|
+
- `EASPolicy` - This restricts signups only to users who have received an attestation of a specific schema from a trusted attester.
|
|
21
|
+
- `HatsPolicy` - This allows gatekeeping signups to only users who have a specific [Hat](https://www.hatsprotocol.xyz/).
|
|
22
|
+
- `GitcoinPassportPolicy` - This allows gatekeeping signups to only users who have a specific [Gitcoin Passport](https://passport.gitcoin.co/) score.
|
|
23
|
+
- `ZupassPolicy` - This allows gatekeeping signups only to users who have a valid [Zupass PCD ticket](https://github.com/proofcarryingdata/zupass).
|
|
24
|
+
- `SemaphorePolicy` - This allows gatekeeping signups only to users who can prove they are part of a [Semaphore](https://semaphore.pse.main/) group.
|
|
25
|
+
|
|
26
|
+
You can find all of the latest policy contracts here:
|
|
27
|
+
https://github.com/privacy-scaling-explorations/excubiae/tree/main/packages/contracts/contracts/extensions
|
|
28
|
+
|
|
29
|
+
Developers are also welcome to implement a custom policy contract as long as it conforms to the `BasePolicy` - an abstract contract to inherit from with function signature:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
abstract contract BasePolicy {
|
|
33
|
+
function enforce(address subject, bytes calldata evidence) external override onlyTarget {}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Whenever a user signs up (via the `MACI.signUp` function), this triggers the MACI contract to call the `BasePolicy.enforce` function. Please note that this function should throw if the user is not eligible to sign up, rather than returning true or false.
|
|
38
|
+
|
|
39
|
+
If you'd like to create a policy contract for your project, or if there's specific policy functionality you'd like to see MACI support, we'd be happy to help! Please [create a GitHub issue](https://github.com/privacy-scaling-explorations/maci/issues/new/choose).
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Poll Smart Contract
|
|
3
|
+
description: MACI Poll Contract
|
|
4
|
+
sidebar_label: Poll
|
|
5
|
+
sidebar_position: 2
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
Code location: [Poll.sol](https://github.com/privacy-scaling-explorations/maci/blob/main/packages/contracts/contracts/Poll.sol)
|
|
10
|
+
:::
|
|
11
|
+
|
|
12
|
+
This contract allows users to submit their votes.
|
|
13
|
+
|
|
14
|
+
The main functions of the contract are as follows:
|
|
15
|
+
|
|
16
|
+
- `publishMessage` - This function allows anyone to publish a message, and it accepts the message object as well as an ephemeral public key. This key together with the coordinator public key will be used to generate a shared ECDH key that will encrypt the message.
|
|
17
|
+
Before saving the message, the function will check that the voting deadline has not passed, as well as the max number of messages was not reached.
|
|
18
|
+
- `publisMessageBatch` - This function allows to submit a batch of messages, and it accepts an array of messages with their corresponding public keys used in the encryption step. It will call the `publishMessage` function for each message in the array.
|
|
19
|
+
- `joinPoll` - This function allows a user to join a poll. It will check if the voter is allowed to join the poll based on the sign up policy, as well as allocate voice credits based on the voice credit proxy.
|
|
20
|
+
|
|
21
|
+
## JoinPoll
|
|
22
|
+
|
|
23
|
+
The `joinPoll` function looks as follows:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
/// @inheritdoc IPoll
|
|
27
|
+
function joinPoll(
|
|
28
|
+
uint256 _nullifier,
|
|
29
|
+
PublicKey calldata _publicKey,
|
|
30
|
+
uint256 _stateRootIndex,
|
|
31
|
+
uint256[8] calldata _proof,
|
|
32
|
+
bytes memory _signUpPolicyData,
|
|
33
|
+
bytes memory _initialVoiceCreditProxyData
|
|
34
|
+
) external virtual isWithinVotingDeadline {
|
|
35
|
+
// Whether the user has already joined
|
|
36
|
+
if (pollNullifiers[_nullifier]) {
|
|
37
|
+
revert UserAlreadyJoined();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Set nullifier for user's private key
|
|
41
|
+
pollNullifiers[_nullifier] = true;
|
|
42
|
+
|
|
43
|
+
// Verify user's proof
|
|
44
|
+
if (!verifyJoiningPollProof(_nullifier, _stateRootIndex, _publicKey, _proof)) {
|
|
45
|
+
revert InvalidPollProof();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Check if the user is eligible to join the poll
|
|
49
|
+
extContracts.policy.enforce(msg.sender, _signUpPolicyData);
|
|
50
|
+
|
|
51
|
+
// Get the user's voice credit balance.
|
|
52
|
+
uint256 voiceCreditBalance = extContracts.initialVoiceCreditProxy.getVoiceCredits(
|
|
53
|
+
msg.sender,
|
|
54
|
+
_initialVoiceCreditProxyData
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
// Store user in the pollStateTree
|
|
58
|
+
uint256 stateLeaf = hashStateLeaf(StateLeaf(_publicKey, voiceCreditBalance, block.timestamp));
|
|
59
|
+
|
|
60
|
+
uint256 stateRoot = InternalLazyIMT._insert(pollStateTree, stateLeaf);
|
|
61
|
+
|
|
62
|
+
// Store the current state tree root in the array
|
|
63
|
+
pollStateRootsOnJoin.push(stateRoot);
|
|
64
|
+
|
|
65
|
+
uint256 pollStateIndex = pollStateTree.numberOfLeaves - 1;
|
|
66
|
+
emit PollJoined(_publicKey.x, _publicKey.y, voiceCreditBalance, block.timestamp, _nullifier, pollStateIndex);
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## PublishMessage
|
|
71
|
+
|
|
72
|
+
The `publishMessage` function looks as follows:
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
function publishMessage(Message calldata _message, PublicKey calldata _encPubKey) public virtual isOpenForVoting {
|
|
76
|
+
// check if the public key is on the curve
|
|
77
|
+
if (!CurveBabyJubJub.isOnCurve(_encPubKey.x, _encPubKey.y)) {
|
|
78
|
+
revert InvalidPubKey();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// cannot realistically overflow
|
|
82
|
+
unchecked {
|
|
83
|
+
numMessages++;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// compute current message hash
|
|
87
|
+
uint256 messageHash = hashMessageAndPublicKey(_message, _encPubKey);
|
|
88
|
+
|
|
89
|
+
// update current message chain hash
|
|
90
|
+
updateChainHash(messageHash);
|
|
91
|
+
|
|
92
|
+
emit PublishMessage(_message, _encPubKey);
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The `publishMessageBatch` function looks as follows:
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
function publishMessageBatch(Message[] calldata _messages, PublicKey[] calldata _encPubKeys) public virtual {
|
|
100
|
+
if (_messages.length != _encPubKeys.length) {
|
|
101
|
+
revert InvalidBatchLength();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
uint256 len = _messages.length;
|
|
105
|
+
for (uint256 i = 0; i < len; ) {
|
|
106
|
+
// an event will be published by this function already
|
|
107
|
+
publishMessage(_messages[i], _encPubKeys[i]);
|
|
108
|
+
|
|
109
|
+
unchecked {
|
|
110
|
+
i++;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## MergeState
|
|
117
|
+
|
|
118
|
+
After a Poll's voting period ends, the coordinator's job is to store the main state root, as well as some more information on the Poll contract using `mergeState`:
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
function mergeState() public isAfterVotingDeadline {
|
|
122
|
+
// This function can only be called once per Poll after the voting
|
|
123
|
+
// deadline
|
|
124
|
+
if (stateMerged) revert StateAlreadyMerged();
|
|
125
|
+
|
|
126
|
+
// set merged to true so it cannot be called again
|
|
127
|
+
stateMerged = true;
|
|
128
|
+
|
|
129
|
+
uint256 _mergedStateRoot = InternalLazyIMT._root(pollStateTree);
|
|
130
|
+
mergedStateRoot = _mergedStateRoot;
|
|
131
|
+
|
|
132
|
+
// Set currentSbCommitment
|
|
133
|
+
uint256[3] memory sb;
|
|
134
|
+
sb[0] = _mergedStateRoot;
|
|
135
|
+
sb[1] = emptyBallotRoot;
|
|
136
|
+
sb[2] = uint256(0);
|
|
137
|
+
|
|
138
|
+
currentSbCommitment = hash3(sb);
|
|
139
|
+
|
|
140
|
+
// get number of joined users and cache in a var for later use
|
|
141
|
+
uint256 _numSignups = pollStateTree.numberOfLeaves;
|
|
142
|
+
numSignups = _numSignups;
|
|
143
|
+
|
|
144
|
+
// dynamically determine the actual depth of the state tree
|
|
145
|
+
uint8 depth = 1;
|
|
146
|
+
while (uint40(1 << depth) < _numSignups) {
|
|
147
|
+
depth++;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
actualStateTreeDepth = depth;
|
|
151
|
+
|
|
152
|
+
emit MergeState(mergedStateRoot, numSignups);
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The function will store the state root from the MACI contract, create a commitment by hashing this merkle root, an empty ballot root stored in the `emptyBallotRoot` variable, and a zero as salt. The commitment will be stored in the `currentSbCommitment` variable. Finally, it will store the total number of signups, and calculate the actual depth of the state tree. This information will be used when processing messages and tally to ensure proof validity.
|
|
157
|
+
|
|
158
|
+
The `emptyBallotRoot` value is used to store the empty ballot root for the configured vote option tree depth. For instance, if the vote option tree depth is 5, a build script will generate the following values (this assumes that the state tree depth is 10):
|
|
159
|
+
|
|
160
|
+
```javascript
|
|
161
|
+
emptyBallotRoots[0] = uint256(16015576667038038422103932363190100635991292382181099511410843174865570503661);
|
|
162
|
+
emptyBallotRoots[1] = uint256(166510078825589460025300915201657086611944528317298994959376081297530246971);
|
|
163
|
+
emptyBallotRoots[2] = uint256(10057734083972610459557695472359628128485394923403014377687504571662791937025);
|
|
164
|
+
emptyBallotRoots[3] = uint256(4904828619307091008204672239231377290495002626534171783829482835985709082773);
|
|
165
|
+
emptyBallotRoots[4] = uint256(18694062287284245784028624966421731916526814537891066525886866373016385890569);
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
:::info
|
|
169
|
+
Please be advised that the number of signups in this case includes the zero leaf. For this reason, when accounting for the real users signed up to the Poll, you should subtract one from the value stored in the Poll contract.
|
|
170
|
+
:::
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Poll Factory Smart Contract
|
|
3
|
+
description: Poll Factory smart contract
|
|
4
|
+
sidebar_label: PollFactory
|
|
5
|
+
sidebar_position: 3
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
Code location: [PollFactory.sol](https://github.com/privacy-scaling-explorations/maci/blob/main/packages/contracts/contracts/PollFactory.sol)
|
|
10
|
+
:::
|
|
11
|
+
|
|
12
|
+
`PollFactory` is a smart contract that is used to deploy new Polls. This is used by MACI inside the `deployPoll` function.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
/// @inheritdoc IPollFactory
|
|
16
|
+
function deploy(DeployPollArgs calldata _args) public virtual returns (address pollAddr) {
|
|
17
|
+
// deploy the poll
|
|
18
|
+
Poll poll = new Poll(
|
|
19
|
+
_args.startDate,
|
|
20
|
+
_args.endDate,
|
|
21
|
+
_args.treeDepths,
|
|
22
|
+
_args.messageBatchSize,
|
|
23
|
+
_args.coordinatorPubKey,
|
|
24
|
+
_args.extContracts,
|
|
25
|
+
_args.emptyBallotRoot,
|
|
26
|
+
_args.pollId,
|
|
27
|
+
_args.relayers,
|
|
28
|
+
_args.voteOptions
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
pollAddr = address(poll);
|
|
32
|
+
}
|
|
33
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Tally Smart Contract
|
|
3
|
+
description: Tally smart contract
|
|
4
|
+
sidebar_label: Tally
|
|
5
|
+
sidebar_position: 5
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
Code location: [Tally.sol](https://github.com/privacy-scaling-explorations/maci/blob/main/packages/contracts/contracts/Tally.sol)
|
|
10
|
+
:::
|
|
11
|
+
|
|
12
|
+
The `Tally` contract is used by the coordinator to submit commitments to the tally results via the `tallyVotes` function. This is done in batches and the final commitment can be used by the users to verify the validity of the results.
|
|
13
|
+
|
|
14
|
+
This contract should be deployed alongside a `Poll`, with the the constructor accepting the following parameters:
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
constructor(
|
|
18
|
+
address _verifier,
|
|
19
|
+
address _verifyingKeysRegistry,
|
|
20
|
+
address _poll,
|
|
21
|
+
address _mp,
|
|
22
|
+
address _tallyOwner,
|
|
23
|
+
Mode _mode
|
|
24
|
+
) payable {
|
|
25
|
+
verifier = IVerifier(_verifier);
|
|
26
|
+
vkRegistry = IVkRegistry(_verifyingKeysRegistry);
|
|
27
|
+
poll = IPoll(_poll);
|
|
28
|
+
messageProcessor = IMessageProcessor(_mp);
|
|
29
|
+
mode = _mode;
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
- `verifier` - The address of the verifier contract
|
|
34
|
+
- `vkRegistry` - The address of the vkRegistry contract
|
|
35
|
+
- `poll` - The address of the poll contract
|
|
36
|
+
- `messageProcessor` - The address of the messageProcessor contract
|
|
37
|
+
- `mode` - The mode of the tally contract - depending on this, the commitments will be processed differently, and it must equal the Poll mode (quadratic vs non quadratic vs full credits voting)
|
|
38
|
+
|
|
39
|
+
Users can use the verification functions to verify the Tally results. These are as follows:
|
|
40
|
+
|
|
41
|
+
- `verifySpentVoiceCredits` - Verifies the spent voice credits
|
|
42
|
+
- `verifyPerVOSpentVoiceCredits` - Verifies the spent voice credits per vote option
|
|
43
|
+
- `verifyTallyResult` - Verifies the tally result
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: VerifyingKeysRegistry Smart Contract
|
|
3
|
+
description: VerifyingKeysRegistry smart contract
|
|
4
|
+
sidebar_label: VerifyingKeysRegistry
|
|
5
|
+
sidebar_position: 8
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
Code location: [VerifyingKeysRegistry.sol](https://github.com/privacy-scaling-explorations/maci/blob/main/packages/contracts/contracts/VerifyingKeysRegistry.sol)
|
|
10
|
+
:::
|
|
11
|
+
|
|
12
|
+
The VerifyingKeysRegistry is a contract that holds the verifying keys for the zk-SNARK circuits. It holds four different sets of keys:
|
|
13
|
+
|
|
14
|
+
- `processVks` - The keys for the MessageProcessor circuit
|
|
15
|
+
- `tallyVks` - The keys for the VoteTally circuit
|
|
16
|
+
- `pollJoiningVk` - The key for the poll joining circuit
|
|
17
|
+
- `pollJoinedVk` - The key for the poll joined circuit
|
|
18
|
+
|
|
19
|
+
Each circuit will have a signature which is its compile-time constants represented as a uint256.
|
|
20
|
+
|
|
21
|
+
Please note that each Verifying Key should be set with the corresponding mode. Available modes are quadratic, non quadratic and full credits voting.
|
|
22
|
+
|
|
23
|
+
The contract owner can set them using the `setVerifyingKeysBatch` function:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
function setVerifyingKeysBatch(
|
|
27
|
+
uint256 _stateTreeDepth,
|
|
28
|
+
uint256 _intStateTreeDepth,
|
|
29
|
+
uint256 _voteOptionTreeDepth,
|
|
30
|
+
uint8 _messageBatchSize,
|
|
31
|
+
Mode[] calldata _modes,
|
|
32
|
+
VerifyingKey calldata _pollJoiningVk,
|
|
33
|
+
VerifyingKey calldata _pollJoinedVk,
|
|
34
|
+
VerifyingKey[] calldata _processVks,
|
|
35
|
+
VerifyingKey[] calldata _tallyVks
|
|
36
|
+
) public onlyOwner {
|
|
37
|
+
if (_modes.length != _processVks.length || _modes.length != _tallyVks.length) {
|
|
38
|
+
revert InvalidKeysParams();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
uint256 length = _modes.length;
|
|
42
|
+
|
|
43
|
+
setPollJoiningVkKey(_stateTreeDepth, _pollJoiningVk);
|
|
44
|
+
setPollJoinedVkKey(_stateTreeDepth, _pollJoinedVk);
|
|
45
|
+
|
|
46
|
+
for (uint256 index = 0; index < length; ) {
|
|
47
|
+
setVerifyingKeys(
|
|
48
|
+
_stateTreeDepth,
|
|
49
|
+
_intStateTreeDepth,
|
|
50
|
+
_voteOptionTreeDepth,
|
|
51
|
+
_messageBatchSize,
|
|
52
|
+
_modes[index],
|
|
53
|
+
_processVks[index],
|
|
54
|
+
_tallyVks[index]
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
unchecked {
|
|
58
|
+
index++;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Voice Credits Proxy Smart Contract
|
|
3
|
+
description: Voice Credits Proxy smart contract
|
|
4
|
+
sidebar_label: VoiceCreditsProxy
|
|
5
|
+
sidebar_position: 7
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
:::info
|
|
9
|
+
Code location: [InitialVoiceCreditProxy](https://github.com/privacy-scaling-explorations/maci/tree/main/contracts/contracts/initialVoiceCreditProxy)
|
|
10
|
+
:::
|
|
11
|
+
|
|
12
|
+
The VoiceCreditProxy contract is used to assign voice credits to users. Whichever implementation should the MACI deployers use, this must implement a view function that returns the balance for a user, such as the one below:
|
|
13
|
+
|
|
14
|
+
```javascript
|
|
15
|
+
function getVoiceCredits(address _user, bytes memory _data) public virtual view returns (uint256) {}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The repository comes with a simple implementation called `ConstantInitialVoiceCreditProxy` which assigns a fixed amount of voice credits to each user.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"label": "Smart Contracts",
|
|
3
|
+
"position": 1,
|
|
4
|
+
"link": {
|
|
5
|
+
"type": "generated-index",
|
|
6
|
+
"description": "MACI is composed of multiple smart contracts, which together with the zk-SNARK circuits, can be used to carry out on-chain voting. The main contracts are presented and explained below. Please also find autogenerated solidity documentation with solidity-docs."
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: MACI Codebase
|
|
3
|
+
description: High-level overview of the MACI codebase
|
|
4
|
+
sidebar_label: Technical References
|
|
5
|
+
sidebar_position: 1
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# MACI Overview
|
|
9
|
+
|
|
10
|
+
The MACI codebase consists of three subsystems in different programming languages:
|
|
11
|
+
|
|
12
|
+
1. Solidity smart contracts
|
|
13
|
+
2. TypeScript libraries
|
|
14
|
+
3. Circom circuits
|
|
15
|
+
|
|
16
|
+
## Smart contracts
|
|
17
|
+
|
|
18
|
+
The MACI smart contracts handle the on-chain aspects - both the functionality and the storage - of the voting system. They provide the functionality to deploy polls, register voters, and accept votes. They also store and manage the on-chain data from transactions, such as the encrypted votes of a poll. Finally, they verify proofs of the zk-SNARK circuits, so that everyone can validate the voting results.
|
|
19
|
+
|
|
20
|
+
The MACI smart contracts are written in [Solidity](https://soliditylang.org/).
|
|
21
|
+
|
|
22
|
+
Contracts are released through the [`@maci-protocol/contracts`](https://www.npmjs.com/package/@maci-protocol/contracts) NPM package.
|
|
23
|
+
|
|
24
|
+
[Learn more about MACI contracts](/docs/technical-references/smart-contracts/)
|
|
25
|
+
|
|
26
|
+
## TypeScript libraries
|
|
27
|
+
|
|
28
|
+
The TypeScript libraries manage the business logic between the smart contracts and the circuit code. They provide a variety of functionality, such as encryption tools, utilities, and a CLI for interacting with MACI (for actions like signing up, voting, tallying votes & generating proofs).
|
|
29
|
+
|
|
30
|
+
The MACI [TypeScript](https://www.typescriptlang.org/) libraries are released through the following NPM packages:
|
|
31
|
+
|
|
32
|
+
- [`@maci-protocol/cli`](https://www.npmjs.com/package/@maci-protocol/cli)
|
|
33
|
+
- [`@maci-protocol/core`](https://www.npmjs.com/package/@maci-protocol/core)
|
|
34
|
+
- [`@maci-protocol/crypto`](https://www.npmjs.com/package/@maci-protocol/crypto)
|
|
35
|
+
- [`@maci-protocol/domainobjs`](https://www.npmjs.com/package/@maci-protocol/domainobjs)
|
|
36
|
+
- [`@maci-protocol/integrationtests`](https://www.npmjs.com/package/@maci-protocol/integrationtests)
|
|
37
|
+
- [`@maci-protocol/sdk`](https://www.npmjs.com/package/@maci-protocol/sdk)
|
|
38
|
+
|
|
39
|
+
## Circuits
|
|
40
|
+
|
|
41
|
+
MACI has multiple circuits that ensure all off-chain computation is completed correctly. The circuits are used to generate zero-knowledge proofs (zk-SNARKs) that the votes were counted correctly. Specifically, they enforce that message processing and vote tallying were correctly executed by the coordinator. The proofs can then be verified through a verifier smart contract on-chain.
|
|
42
|
+
|
|
43
|
+
The circuits for these zero-knowledge proofs are written
|
|
44
|
+
in [Circom](https://iden3.io/circom).
|
|
45
|
+
|
|
46
|
+
The MACI circuits are released through the [`@maci-protocol/circuits`](https://www.npmjs.com/package/@maci-protocol/circuits) NPM package.
|
|
47
|
+
|
|
48
|
+
[Learn more about MACI circuits](/docs/technical-references/zk-snark-circuits/)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: MACI Poll Circuits
|
|
3
|
+
description: Introduction to the core zk-SNARK circuits of MACI
|
|
4
|
+
sidebar_label: Join Poll Circuit
|
|
5
|
+
sidebar_position: 6
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
[**Repo link**](https://github.com/privacy-scaling-explorations/maci/blob/main/circuits/circom/voter)
|
|
9
|
+
|
|
10
|
+
## PollJoining
|
|
11
|
+
|
|
12
|
+
Users need to provide a valid proof to the Poll smart contract to join a poll, allowing to vote on it. The circuit ensures that they signup to all polls with the same MACI public key, as well as that they can prove being included in MACI's state tree.
|
|
13
|
+
|
|
14
|
+
#### Parameters
|
|
15
|
+
|
|
16
|
+
| # | Parameter | Description |
|
|
17
|
+
| --- | ---------------- | ------------------------- |
|
|
18
|
+
| 0 | State tree depth | Allows $(2^{n})$ signups. |
|
|
19
|
+
|
|
20
|
+
#### Inputs
|
|
21
|
+
|
|
22
|
+
| Input signal | Description |
|
|
23
|
+
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
24
|
+
| `privateKey` | The user's private key |
|
|
25
|
+
| `pollPublicKey` | The poll's public key |
|
|
26
|
+
| `siblings` | The siblings for the merkle tree inclusion proof |
|
|
27
|
+
| `indices` | The indices for the merkle tree inclusion proof |
|
|
28
|
+
| `nullifier` | The nullifier |
|
|
29
|
+
| `stateRoot` | The MACI state tree root |
|
|
30
|
+
| `actualStateTreeDepth` | The actual tree depth (might be less or equal to stateTreeDepth), used by the [LeanIMT structure](https://github.com/privacy-scaling-explorations/zk-kit/tree/main/papers/leanimt) |
|
|
31
|
+
| `pollId` | The poll id |
|
|
32
|
+
|
|
33
|
+
## PollJoined
|
|
34
|
+
|
|
35
|
+
Users will use this circuit to anonymously prove that they joined a poll. This can be used to authenticate to the relayer service, to reduce spam.
|
|
36
|
+
|
|
37
|
+
#### Parameters
|
|
38
|
+
|
|
39
|
+
| # | Parameter | Description |
|
|
40
|
+
| --- | ---------------- | ------------------------- |
|
|
41
|
+
| 0 | State tree depth | Allows $(2^{n})$ signups. |
|
|
42
|
+
|
|
43
|
+
#### Inputs
|
|
44
|
+
|
|
45
|
+
| Input signal | Description |
|
|
46
|
+
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
47
|
+
| `privateKey` | The user's private key |
|
|
48
|
+
| `voiceCreditsBalance` | The user's initial voice credits balance |
|
|
49
|
+
| `pathElements` | The path elements for the merkle tree inclusion proof |
|
|
50
|
+
| `pathIndices` | The path indices for the merkle tree inclusion proof |
|
|
51
|
+
| `stateRoot` | The MACI state tree root |
|
|
52
|
+
| `actualStateTreeDepth` | The actual tree depth (might be less or equal to stateTreeDepth), used by the [LeanIMT structure](https://github.com/privacy-scaling-explorations/zk-kit/tree/main/papers/leanimt) |
|