Feat/hybrid ahe voting#22
Open
99Kies wants to merge 2 commits into
Open
Conversation
Implements the full hybrid MACI + Additively Homomorphic ElGamal (AHE) on-chain voting flow, solving the B-line problem by ensuring the coordinator never sees individual vote contents. Key changes: Circuits (new): - Add hybrid/ Circom circuits: BallotValidity, ProcessHybridMessages, RevealVerify (client + onchain wrapper variants each) - BallotValidity proves voter eligibility and binds routing/AHE commitment without revealing stateIdx to the chain - ProcessHybridMessages implements reverse-order batch processing with an independent quinary nonce tree for cross-batch last-write-wins (LWW) - RevealVerify proves threshold partial decryption via DLEQ Contract (amaci): - Add hybrid message publishing: PublishHybridMessage validates ballot proof, curve points, and coordinator binding; stores routing + AHE ciphertexts - Add ProcessHybridBatch: reverse batch selection (chain-tail first), 11-field SHA256 inputHash including currentNonceRoot/newNonceRoot, auto-transition to Tallying when all messages processed - Add RevealHybridTally: threshold DLEQ proof verification, saves tally, transitions period to Ended - Add SetHybridKc / ConfirmHybridKc (threshold committee path) - Add HYBRID_NONCE_STATE_ROOT persistent nonce tree state - Guard StopProcessingPeriod / StopTallyingPeriod against hybrid messages - Validate vote_option_map.len() == HYBRID_M at instantiate - Add 24 multitest e2e tests covering full flow, multi-batch chaining, partial batches, all error paths, and cross-message ballot proof rejection - Remove dead HybridBatchFull error variant SDK: - Add AHE crypto primitives (ahe.ts): ElGamal encrypt/decrypt, addAhe, recoverAhe, solveDLog, DLEQ proof generation - Add buildHybridVotePayload (voter.ts): constructs routing envelope + AHE ciphertext + ballot validity proof - Add decodeHybridRouting / processHybridBatch (operator.ts): coordinator routing decryption and batch processing with nonce-tree LWW simulation - Add genHybridOnchainProcessProof (operator.ts): two-phase Groth16 proof generation for on-chain batch verification
Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.