@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,311 @@
|
|
|
1
|
+
# Tally
|
|
2
|
+
|
|
3
|
+
The Tally contract is used during votes tallying
|
|
4
|
+
and by users to verify the tally results.
|
|
5
|
+
|
|
6
|
+
### TREE_ARITY
|
|
7
|
+
|
|
8
|
+
```solidity
|
|
9
|
+
uint256 TREE_ARITY
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### tallyCommitment
|
|
13
|
+
|
|
14
|
+
```solidity
|
|
15
|
+
uint256 tallyCommitment
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The commitment to the tally results. Its initial value is 0, but after
|
|
19
|
+
the tally of each batch is proven on-chain via a zk-SNARK, it should be
|
|
20
|
+
updated to:
|
|
21
|
+
|
|
22
|
+
hash3(
|
|
23
|
+
hashLeftRight(merkle root of current results, salt0)
|
|
24
|
+
hashLeftRight(number of spent voice credits, salt1),
|
|
25
|
+
hashLeftRight(merkle root of the no. of spent voice credits per vote option, salt2)
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
Where each salt is unique and the merkle roots are of arrays of leaves
|
|
29
|
+
TREE_ARITY \*\* voteOptionTreeDepth long.
|
|
30
|
+
|
|
31
|
+
### tallyBatchNum
|
|
32
|
+
|
|
33
|
+
```solidity
|
|
34
|
+
uint256 tallyBatchNum
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### sbCommitment
|
|
38
|
+
|
|
39
|
+
```solidity
|
|
40
|
+
uint256 sbCommitment
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### verifier
|
|
44
|
+
|
|
45
|
+
```solidity
|
|
46
|
+
contract IVerifier verifier
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### vkRegistry
|
|
50
|
+
|
|
51
|
+
```solidity
|
|
52
|
+
contract IVkRegistry vkRegistry
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### poll
|
|
56
|
+
|
|
57
|
+
```solidity
|
|
58
|
+
contract IPoll poll
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### messageProcessor
|
|
62
|
+
|
|
63
|
+
```solidity
|
|
64
|
+
contract IMessageProcessor messageProcessor
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### ProcessingNotComplete
|
|
68
|
+
|
|
69
|
+
```solidity
|
|
70
|
+
error ProcessingNotComplete()
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
custom errors
|
|
74
|
+
|
|
75
|
+
### InvalidTallyVotesProof
|
|
76
|
+
|
|
77
|
+
```solidity
|
|
78
|
+
error InvalidTallyVotesProof()
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### AllBallotsTallied
|
|
82
|
+
|
|
83
|
+
```solidity
|
|
84
|
+
error AllBallotsTallied()
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### NumSignUpsTooLarge
|
|
88
|
+
|
|
89
|
+
```solidity
|
|
90
|
+
error NumSignUpsTooLarge()
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### BatchStartIndexTooLarge
|
|
94
|
+
|
|
95
|
+
```solidity
|
|
96
|
+
error BatchStartIndexTooLarge()
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### TallyBatchSizeTooLarge
|
|
100
|
+
|
|
101
|
+
```solidity
|
|
102
|
+
error TallyBatchSizeTooLarge()
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### constructor
|
|
106
|
+
|
|
107
|
+
```solidity
|
|
108
|
+
constructor(address _verifier, address _vkRegistry, address _poll, address _mp) public payable
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Create a new Tally contract
|
|
112
|
+
|
|
113
|
+
#### Parameters
|
|
114
|
+
|
|
115
|
+
| Name | Type | Description |
|
|
116
|
+
| ------------ | ------- | ----------------------------- |
|
|
117
|
+
| \_verifier | address | The Verifier contract |
|
|
118
|
+
| \_vkRegistry | address | The VkRegistry contract |
|
|
119
|
+
| \_poll | address | The Poll contract |
|
|
120
|
+
| \_mp | address | The MessageProcessor contract |
|
|
121
|
+
|
|
122
|
+
### genTallyVotesPackedVals
|
|
123
|
+
|
|
124
|
+
```solidity
|
|
125
|
+
function genTallyVotesPackedVals(uint256 _numSignUps, uint256 _batchStartIndex, uint256 _tallyBatchSize) public pure returns (uint256 result)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Pack the batch start index and number of signups into a 100-bit value.
|
|
129
|
+
|
|
130
|
+
#### Parameters
|
|
131
|
+
|
|
132
|
+
| Name | Type | Description |
|
|
133
|
+
| ----------------- | ------- | ----------- |
|
|
134
|
+
| \_numSignUps | uint256 | |
|
|
135
|
+
| \_batchStartIndex | uint256 | |
|
|
136
|
+
| \_tallyBatchSize | uint256 | |
|
|
137
|
+
|
|
138
|
+
#### Return Values
|
|
139
|
+
|
|
140
|
+
| Name | Type | Description |
|
|
141
|
+
| ------ | ------- | ---------------------------------------------------- |
|
|
142
|
+
| result | uint256 | an uint256 representing the 3 inputs packed together |
|
|
143
|
+
|
|
144
|
+
### isTallied
|
|
145
|
+
|
|
146
|
+
```solidity
|
|
147
|
+
function isTallied() public view returns (bool tallied)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Check if all ballots are tallied
|
|
151
|
+
|
|
152
|
+
#### Return Values
|
|
153
|
+
|
|
154
|
+
| Name | Type | Description |
|
|
155
|
+
| ------- | ---- | ------------------------------- |
|
|
156
|
+
| tallied | bool | whether all ballots are tallied |
|
|
157
|
+
|
|
158
|
+
### genTallyVotesPublicInputHash
|
|
159
|
+
|
|
160
|
+
```solidity
|
|
161
|
+
function genTallyVotesPublicInputHash(uint256 _numSignUps, uint256 _batchStartIndex, uint256 _tallyBatchSize, uint256 _newTallyCommitment) public view returns (uint256 inputHash)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
generate hash of public inputs for tally circuit
|
|
165
|
+
|
|
166
|
+
#### Parameters
|
|
167
|
+
|
|
168
|
+
| Name | Type | Description |
|
|
169
|
+
| -------------------- | ------- | ----------- |
|
|
170
|
+
| \_numSignUps | uint256 | |
|
|
171
|
+
| \_batchStartIndex | uint256 | |
|
|
172
|
+
| \_tallyBatchSize | uint256 | |
|
|
173
|
+
| \_newTallyCommitment | uint256 | |
|
|
174
|
+
|
|
175
|
+
#### Return Values
|
|
176
|
+
|
|
177
|
+
| Name | Type | Description |
|
|
178
|
+
| --------- | ------- | --------------------- |
|
|
179
|
+
| inputHash | uint256 | hash of public inputs |
|
|
180
|
+
|
|
181
|
+
### updateSbCommitment
|
|
182
|
+
|
|
183
|
+
```solidity
|
|
184
|
+
function updateSbCommitment() public
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Update the state and ballot root commitment
|
|
188
|
+
|
|
189
|
+
### tallyVotes
|
|
190
|
+
|
|
191
|
+
```solidity
|
|
192
|
+
function tallyVotes(uint256 _newTallyCommitment, uint256[8] _proof) public
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Verify the result of a tally batch
|
|
196
|
+
|
|
197
|
+
#### Parameters
|
|
198
|
+
|
|
199
|
+
| Name | Type | Description |
|
|
200
|
+
| -------------------- | ---------- | --------------------------------------------- |
|
|
201
|
+
| \_newTallyCommitment | uint256 | the new tally commitment to be verified |
|
|
202
|
+
| \_proof | uint256[8] | the proof generated after tallying this batch |
|
|
203
|
+
|
|
204
|
+
### verifyTallyProof
|
|
205
|
+
|
|
206
|
+
```solidity
|
|
207
|
+
function verifyTallyProof(uint256[8] _proof, uint256 _numSignUps, uint256 _batchStartIndex, uint256 _tallyBatchSize, uint256 _newTallyCommitment) public view returns (bool isValid)
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Verify the tally proof using the verifying key
|
|
211
|
+
|
|
212
|
+
#### Parameters
|
|
213
|
+
|
|
214
|
+
| Name | Type | Description |
|
|
215
|
+
| -------------------- | ---------- | ---------------------------------------------------------- |
|
|
216
|
+
| \_proof | uint256[8] | the proof generated after processing all messages |
|
|
217
|
+
| \_numSignUps | uint256 | number of signups for a given poll |
|
|
218
|
+
| \_batchStartIndex | uint256 | the number of batches multiplied by the size of the batch |
|
|
219
|
+
| \_tallyBatchSize | uint256 | batch size for the tally |
|
|
220
|
+
| \_newTallyCommitment | uint256 | the tally commitment to be verified at a given batch index |
|
|
221
|
+
|
|
222
|
+
#### Return Values
|
|
223
|
+
|
|
224
|
+
| Name | Type | Description |
|
|
225
|
+
| ------- | ---- | -------------------------- |
|
|
226
|
+
| isValid | bool | whether the proof is valid |
|
|
227
|
+
|
|
228
|
+
### computeMerkleRootFromPath
|
|
229
|
+
|
|
230
|
+
```solidity
|
|
231
|
+
function computeMerkleRootFromPath(uint8 _depth, uint256 _index, uint256 _leaf, uint256[][] _pathElements) internal pure returns (uint256 current)
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Compute the merkle root from the path elements
|
|
235
|
+
and a leaf
|
|
236
|
+
|
|
237
|
+
#### Parameters
|
|
238
|
+
|
|
239
|
+
| Name | Type | Description |
|
|
240
|
+
| -------------- | ----------- | ------------------------------------------------ |
|
|
241
|
+
| \_depth | uint8 | the depth of the merkle tree |
|
|
242
|
+
| \_index | uint256 | the index of the leaf |
|
|
243
|
+
| \_leaf | uint256 | the leaf |
|
|
244
|
+
| \_pathElements | uint256[][] | the path elements to reconstruct the merkle root |
|
|
245
|
+
|
|
246
|
+
#### Return Values
|
|
247
|
+
|
|
248
|
+
| Name | Type | Description |
|
|
249
|
+
| ------- | ------- | --------------- |
|
|
250
|
+
| current | uint256 | The merkle root |
|
|
251
|
+
|
|
252
|
+
### verifySpentVoiceCredits
|
|
253
|
+
|
|
254
|
+
```solidity
|
|
255
|
+
function verifySpentVoiceCredits(uint256 _totalSpent, uint256 _totalSpentSalt, uint256 _resultCommitment, uint256 _perVOSpentVoiceCreditsHash) public view returns (bool isValid)
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Verify the number of spent voice credits from the tally.json
|
|
259
|
+
|
|
260
|
+
#### Parameters
|
|
261
|
+
|
|
262
|
+
| Name | Type | Description |
|
|
263
|
+
| ---------------------------- | ------- | -------------------------------------------------------------------------------- |
|
|
264
|
+
| \_totalSpent | uint256 | spent field retrieved in the totalSpentVoiceCredits object |
|
|
265
|
+
| \_totalSpentSalt | uint256 | the corresponding salt in the totalSpentVoiceCredit object |
|
|
266
|
+
| \_resultCommitment | uint256 | hashLeftRight(merkle root of the results.tally, results.salt) in tally.json file |
|
|
267
|
+
| \_perVOSpentVoiceCreditsHash | uint256 | hashLeftRight(merkle root of the no spent voice credits per vote option, salt) |
|
|
268
|
+
|
|
269
|
+
#### Return Values
|
|
270
|
+
|
|
271
|
+
| Name | Type | Description |
|
|
272
|
+
| ------- | ---- | ------------------------------------- |
|
|
273
|
+
| isValid | bool | Whether the provided values are valid |
|
|
274
|
+
|
|
275
|
+
### verifyPerVOSpentVoiceCredits
|
|
276
|
+
|
|
277
|
+
```solidity
|
|
278
|
+
function verifyPerVOSpentVoiceCredits(uint256 _voteOptionIndex, uint256 _spent, uint256[][] _spentProof, uint256 _spentSalt, uint8 _voteOptionTreeDepth, uint256 _spentVoiceCreditsHash, uint256 _resultCommitment) public view returns (bool isValid)
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
#### Return Values
|
|
282
|
+
|
|
283
|
+
| Name | Type | Description |
|
|
284
|
+
| ------- | ---- | ----------------------------------- |
|
|
285
|
+
| isValid | bool | Whether the provided proof is valid |
|
|
286
|
+
|
|
287
|
+
### verifyTallyResult
|
|
288
|
+
|
|
289
|
+
```solidity
|
|
290
|
+
function verifyTallyResult(uint256 _voteOptionIndex, uint256 _tallyResult, uint256[][] _tallyResultProof, uint256 _tallyResultSalt, uint8 _voteOptionTreeDepth, uint256 _spentVoiceCreditsHash, uint256 _perVOSpentVoiceCreditsHash) public view returns (bool isValid)
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
Verify the result generated from the tally.json
|
|
294
|
+
|
|
295
|
+
#### Parameters
|
|
296
|
+
|
|
297
|
+
| Name | Type | Description |
|
|
298
|
+
| ---------------------------- | ----------- | ----------------------------------------------------------------------------------------------------- |
|
|
299
|
+
| \_voteOptionIndex | uint256 | the index of the vote option to verify the correctness of the tally |
|
|
300
|
+
| \_tallyResult | uint256 | Flattened array of the tally |
|
|
301
|
+
| \_tallyResultProof | uint256[][] | Corresponding proof of the tally result |
|
|
302
|
+
| \_tallyResultSalt | uint256 | the respective salt in the results object in the tally.json |
|
|
303
|
+
| \_voteOptionTreeDepth | uint8 | depth of the vote option tree |
|
|
304
|
+
| \_spentVoiceCreditsHash | uint256 | hashLeftRight(number of spent voice credits, spent salt) |
|
|
305
|
+
| \_perVOSpentVoiceCreditsHash | uint256 | hashLeftRight(merkle root of the no spent voice credits per vote option, perVOSpentVoiceCredits salt) |
|
|
306
|
+
|
|
307
|
+
#### Return Values
|
|
308
|
+
|
|
309
|
+
| Name | Type | Description |
|
|
310
|
+
| ------- | ---- | ----------------------------------- |
|
|
311
|
+
| isValid | bool | Whether the provided proof is valid |
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# TallyFactory
|
|
2
|
+
|
|
3
|
+
A factory contract which deploys Tally contracts.
|
|
4
|
+
|
|
5
|
+
### deploy
|
|
6
|
+
|
|
7
|
+
```solidity
|
|
8
|
+
function deploy(address _verifier, address _vkRegistry, address _poll, address _messageProcessor, address _owner) public virtual returns (address tallyAddr)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Deploy a new Tally or Subsidy contract and return the address.
|
|
12
|
+
|
|
13
|
+
#### Parameters
|
|
14
|
+
|
|
15
|
+
| Name | Type | Description |
|
|
16
|
+
| ------------------ | ------- | ------------------------- |
|
|
17
|
+
| \_verifier | address | Verifier contract |
|
|
18
|
+
| \_vkRegistry | address | VkRegistry contract |
|
|
19
|
+
| \_poll | address | Poll contract |
|
|
20
|
+
| \_messageProcessor | address | MessageProcessor contract |
|
|
21
|
+
| \_owner | address | Owner of the contract |
|
|
22
|
+
|
|
23
|
+
#### Return Values
|
|
24
|
+
|
|
25
|
+
| Name | Type | Description |
|
|
26
|
+
| --------- | ------- | --------------------- |
|
|
27
|
+
| tallyAddr | address | The deployed contract |
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
# TallyNonQv
|
|
2
|
+
|
|
3
|
+
The TallyNonQv contract is used during votes tallying
|
|
4
|
+
and by users to verify the tally results.
|
|
5
|
+
|
|
6
|
+
### TREE_ARITY
|
|
7
|
+
|
|
8
|
+
```solidity
|
|
9
|
+
uint256 TREE_ARITY
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### tallyCommitment
|
|
13
|
+
|
|
14
|
+
```solidity
|
|
15
|
+
uint256 tallyCommitment
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The commitment to the tally results. Its initial value is 0, but after
|
|
19
|
+
the tally of each batch is proven on-chain via a zk-SNARK, it should be
|
|
20
|
+
updated to:
|
|
21
|
+
|
|
22
|
+
hash2(
|
|
23
|
+
hashLeftRight(merkle root of current results, salt0)
|
|
24
|
+
hashLeftRight(number of spent voice credits, salt1),
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
Where each salt is unique and the merkle roots are of arrays of leaves
|
|
28
|
+
TREE_ARITY \*\* voteOptionTreeDepth long.
|
|
29
|
+
|
|
30
|
+
### tallyBatchNum
|
|
31
|
+
|
|
32
|
+
```solidity
|
|
33
|
+
uint256 tallyBatchNum
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### sbCommitment
|
|
37
|
+
|
|
38
|
+
```solidity
|
|
39
|
+
uint256 sbCommitment
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### verifier
|
|
43
|
+
|
|
44
|
+
```solidity
|
|
45
|
+
contract IVerifier verifier
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### vkRegistry
|
|
49
|
+
|
|
50
|
+
```solidity
|
|
51
|
+
contract IVkRegistry vkRegistry
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### poll
|
|
55
|
+
|
|
56
|
+
```solidity
|
|
57
|
+
contract IPoll poll
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### messageProcessor
|
|
61
|
+
|
|
62
|
+
```solidity
|
|
63
|
+
contract IMessageProcessor messageProcessor
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### ProcessingNotComplete
|
|
67
|
+
|
|
68
|
+
```solidity
|
|
69
|
+
error ProcessingNotComplete()
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
custom errors
|
|
73
|
+
|
|
74
|
+
### InvalidTallyVotesProof
|
|
75
|
+
|
|
76
|
+
```solidity
|
|
77
|
+
error InvalidTallyVotesProof()
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### AllBallotsTallied
|
|
81
|
+
|
|
82
|
+
```solidity
|
|
83
|
+
error AllBallotsTallied()
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### NumSignUpsTooLarge
|
|
87
|
+
|
|
88
|
+
```solidity
|
|
89
|
+
error NumSignUpsTooLarge()
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### BatchStartIndexTooLarge
|
|
93
|
+
|
|
94
|
+
```solidity
|
|
95
|
+
error BatchStartIndexTooLarge()
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### TallyBatchSizeTooLarge
|
|
99
|
+
|
|
100
|
+
```solidity
|
|
101
|
+
error TallyBatchSizeTooLarge()
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### constructor
|
|
105
|
+
|
|
106
|
+
```solidity
|
|
107
|
+
constructor(address _verifier, address _vkRegistry, address _poll, address _mp) public payable
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Create a new Tally contract
|
|
111
|
+
|
|
112
|
+
#### Parameters
|
|
113
|
+
|
|
114
|
+
| Name | Type | Description |
|
|
115
|
+
| ------------ | ------- | ----------------------------- |
|
|
116
|
+
| \_verifier | address | The Verifier contract |
|
|
117
|
+
| \_vkRegistry | address | The VkRegistry contract |
|
|
118
|
+
| \_poll | address | The Poll contract |
|
|
119
|
+
| \_mp | address | The MessageProcessor contract |
|
|
120
|
+
|
|
121
|
+
### genTallyVotesPackedVals
|
|
122
|
+
|
|
123
|
+
```solidity
|
|
124
|
+
function genTallyVotesPackedVals(uint256 _numSignUps, uint256 _batchStartIndex, uint256 _tallyBatchSize) public pure returns (uint256 result)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Pack the batch start index and number of signups into a 100-bit value.
|
|
128
|
+
|
|
129
|
+
#### Parameters
|
|
130
|
+
|
|
131
|
+
| Name | Type | Description |
|
|
132
|
+
| ----------------- | ------- | ----------- |
|
|
133
|
+
| \_numSignUps | uint256 | |
|
|
134
|
+
| \_batchStartIndex | uint256 | |
|
|
135
|
+
| \_tallyBatchSize | uint256 | |
|
|
136
|
+
|
|
137
|
+
#### Return Values
|
|
138
|
+
|
|
139
|
+
| Name | Type | Description |
|
|
140
|
+
| ------ | ------- | ---------------------------------------------------- |
|
|
141
|
+
| result | uint256 | an uint256 representing the 3 inputs packed together |
|
|
142
|
+
|
|
143
|
+
### isTallied
|
|
144
|
+
|
|
145
|
+
```solidity
|
|
146
|
+
function isTallied() public view returns (bool tallied)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Check if all ballots are tallied
|
|
150
|
+
|
|
151
|
+
#### Return Values
|
|
152
|
+
|
|
153
|
+
| Name | Type | Description |
|
|
154
|
+
| ------- | ---- | ------------------------------- |
|
|
155
|
+
| tallied | bool | whether all ballots are tallied |
|
|
156
|
+
|
|
157
|
+
### genTallyVotesPublicInputHash
|
|
158
|
+
|
|
159
|
+
```solidity
|
|
160
|
+
function genTallyVotesPublicInputHash(uint256 _numSignUps, uint256 _batchStartIndex, uint256 _tallyBatchSize, uint256 _newTallyCommitment) public view returns (uint256 inputHash)
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
generate hash of public inputs for tally circuit
|
|
164
|
+
|
|
165
|
+
#### Parameters
|
|
166
|
+
|
|
167
|
+
| Name | Type | Description |
|
|
168
|
+
| -------------------- | ------- | ----------- |
|
|
169
|
+
| \_numSignUps | uint256 | |
|
|
170
|
+
| \_batchStartIndex | uint256 | |
|
|
171
|
+
| \_tallyBatchSize | uint256 | |
|
|
172
|
+
| \_newTallyCommitment | uint256 | |
|
|
173
|
+
|
|
174
|
+
#### Return Values
|
|
175
|
+
|
|
176
|
+
| Name | Type | Description |
|
|
177
|
+
| --------- | ------- | --------------------- |
|
|
178
|
+
| inputHash | uint256 | hash of public inputs |
|
|
179
|
+
|
|
180
|
+
### updateSbCommitment
|
|
181
|
+
|
|
182
|
+
```solidity
|
|
183
|
+
function updateSbCommitment() public
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Update the state and ballot root commitment
|
|
187
|
+
|
|
188
|
+
### tallyVotes
|
|
189
|
+
|
|
190
|
+
```solidity
|
|
191
|
+
function tallyVotes(uint256 _newTallyCommitment, uint256[8] _proof) public
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Verify the result of a tally batch
|
|
195
|
+
|
|
196
|
+
#### Parameters
|
|
197
|
+
|
|
198
|
+
| Name | Type | Description |
|
|
199
|
+
| -------------------- | ---------- | --------------------------------------------- |
|
|
200
|
+
| \_newTallyCommitment | uint256 | the new tally commitment to be verified |
|
|
201
|
+
| \_proof | uint256[8] | the proof generated after tallying this batch |
|
|
202
|
+
|
|
203
|
+
### verifyTallyProof
|
|
204
|
+
|
|
205
|
+
```solidity
|
|
206
|
+
function verifyTallyProof(uint256[8] _proof, uint256 _numSignUps, uint256 _batchStartIndex, uint256 _tallyBatchSize, uint256 _newTallyCommitment) public view returns (bool isValid)
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Verify the tally proof using the verifying key
|
|
210
|
+
|
|
211
|
+
#### Parameters
|
|
212
|
+
|
|
213
|
+
| Name | Type | Description |
|
|
214
|
+
| -------------------- | ---------- | ---------------------------------------------------------- |
|
|
215
|
+
| \_proof | uint256[8] | the proof generated after processing all messages |
|
|
216
|
+
| \_numSignUps | uint256 | number of signups for a given poll |
|
|
217
|
+
| \_batchStartIndex | uint256 | the number of batches multiplied by the size of the batch |
|
|
218
|
+
| \_tallyBatchSize | uint256 | batch size for the tally |
|
|
219
|
+
| \_newTallyCommitment | uint256 | the tally commitment to be verified at a given batch index |
|
|
220
|
+
|
|
221
|
+
#### Return Values
|
|
222
|
+
|
|
223
|
+
| Name | Type | Description |
|
|
224
|
+
| ------- | ---- | -------------------------- |
|
|
225
|
+
| isValid | bool | whether the proof is valid |
|
|
226
|
+
|
|
227
|
+
### computeMerkleRootFromPath
|
|
228
|
+
|
|
229
|
+
```solidity
|
|
230
|
+
function computeMerkleRootFromPath(uint8 _depth, uint256 _index, uint256 _leaf, uint256[][] _pathElements) internal pure returns (uint256 current)
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Compute the merkle root from the path elements
|
|
234
|
+
and a leaf
|
|
235
|
+
|
|
236
|
+
#### Parameters
|
|
237
|
+
|
|
238
|
+
| Name | Type | Description |
|
|
239
|
+
| -------------- | ----------- | ------------------------------------------------ |
|
|
240
|
+
| \_depth | uint8 | the depth of the merkle tree |
|
|
241
|
+
| \_index | uint256 | the index of the leaf |
|
|
242
|
+
| \_leaf | uint256 | the leaf |
|
|
243
|
+
| \_pathElements | uint256[][] | the path elements to reconstruct the merkle root |
|
|
244
|
+
|
|
245
|
+
#### Return Values
|
|
246
|
+
|
|
247
|
+
| Name | Type | Description |
|
|
248
|
+
| ------- | ------- | --------------- |
|
|
249
|
+
| current | uint256 | The merkle root |
|
|
250
|
+
|
|
251
|
+
### verifySpentVoiceCredits
|
|
252
|
+
|
|
253
|
+
```solidity
|
|
254
|
+
function verifySpentVoiceCredits(uint256 _totalSpent, uint256 _totalSpentSalt, uint256 _resultCommitment) public view returns (bool isValid)
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Verify the number of spent voice credits from the tally.json
|
|
258
|
+
|
|
259
|
+
#### Parameters
|
|
260
|
+
|
|
261
|
+
| Name | Type | Description |
|
|
262
|
+
| ------------------ | ------- | -------------------------------------------------------------------------------- |
|
|
263
|
+
| \_totalSpent | uint256 | spent field retrieved in the totalSpentVoiceCredits object |
|
|
264
|
+
| \_totalSpentSalt | uint256 | the corresponding salt in the totalSpentVoiceCredit object |
|
|
265
|
+
| \_resultCommitment | uint256 | hashLeftRight(merkle root of the results.tally, results.salt) in tally.json file |
|
|
266
|
+
|
|
267
|
+
#### Return Values
|
|
268
|
+
|
|
269
|
+
| Name | Type | Description |
|
|
270
|
+
| ------- | ---- | ------------------------------------- |
|
|
271
|
+
| isValid | bool | Whether the provided values are valid |
|
|
272
|
+
|
|
273
|
+
### verifyTallyResult
|
|
274
|
+
|
|
275
|
+
```solidity
|
|
276
|
+
function verifyTallyResult(uint256 _voteOptionIndex, uint256 _tallyResult, uint256[][] _tallyResultProof, uint256 _tallyResultSalt, uint8 _voteOptionTreeDepth, uint256 _spentVoiceCreditsHash) public view returns (bool isValid)
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Verify the result generated from the tally.json
|
|
280
|
+
|
|
281
|
+
#### Parameters
|
|
282
|
+
|
|
283
|
+
| Name | Type | Description |
|
|
284
|
+
| ----------------------- | ----------- | ------------------------------------------------------------------- |
|
|
285
|
+
| \_voteOptionIndex | uint256 | the index of the vote option to verify the correctness of the tally |
|
|
286
|
+
| \_tallyResult | uint256 | Flattened array of the tally |
|
|
287
|
+
| \_tallyResultProof | uint256[][] | Corresponding proof of the tally result |
|
|
288
|
+
| \_tallyResultSalt | uint256 | the respective salt in the results object in the tally.json |
|
|
289
|
+
| \_voteOptionTreeDepth | uint8 | depth of the vote option tree |
|
|
290
|
+
| \_spentVoiceCreditsHash | uint256 | hashLeftRight(number of spent voice credits, spent salt) |
|
|
291
|
+
|
|
292
|
+
#### Return Values
|
|
293
|
+
|
|
294
|
+
| Name | Type | Description |
|
|
295
|
+
| ------- | ---- | ----------------------------------- |
|
|
296
|
+
| isValid | bool | Whether the provided proof is valid |
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# TallyNonQvFactory
|
|
2
|
+
|
|
3
|
+
A factory contract which deploys TallyNonQv contracts.
|
|
4
|
+
|
|
5
|
+
### deploy
|
|
6
|
+
|
|
7
|
+
```solidity
|
|
8
|
+
function deploy(address _verifier, address _vkRegistry, address _poll, address _messageProcessor, address _owner) public virtual returns (address tallyAddr)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Deploy a new Tally or Subsidy contract and return the address.
|
|
12
|
+
|
|
13
|
+
#### Parameters
|
|
14
|
+
|
|
15
|
+
| Name | Type | Description |
|
|
16
|
+
| ------------------ | ------- | ------------------------- |
|
|
17
|
+
| \_verifier | address | Verifier contract |
|
|
18
|
+
| \_vkRegistry | address | VkRegistry contract |
|
|
19
|
+
| \_poll | address | Poll contract |
|
|
20
|
+
| \_messageProcessor | address | MessageProcessor contract |
|
|
21
|
+
| \_owner | address | Owner of the contract |
|
|
22
|
+
|
|
23
|
+
#### Return Values
|
|
24
|
+
|
|
25
|
+
| Name | Type | Description |
|
|
26
|
+
| --------- | ------- | --------------------- |
|
|
27
|
+
| tallyAddr | address | The deployed contract |
|