Skip to content

Feat/hybrid ahe voting#22

Open
99Kies wants to merge 2 commits into
mainfrom
feat/hybrid-ahe-voting
Open

Feat/hybrid ahe voting#22
99Kies wants to merge 2 commits into
mainfrom
feat/hybrid-ahe-voting

Conversation

@99Kies

@99Kies 99Kies commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

99Kies and others added 2 commits July 13, 2026 14:31
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>
@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
maci Ready Ready Preview, Comment Jul 13, 2026 6:34am

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant