Thank you for your interest in contributing to ZKVote!
-
Fork and clone the repository
-
Install dependencies:
# Rust contracts rustup target add wasm32v1-none # Frontend cd frontend && npm install # Backend cd backend && npm install # Circuits cd circuits && npm install
-
Run tests to verify your setup:
cargo test --workspace cd backend && npm test cd frontend && npm test cd circuits && npm test
Rust:
- Run
cargo fmtbefore committing - Run
cargo clippyto check for common issues - Use
panic_with_error!instead of barepanic!
TypeScript:
- Run
npm run lintin frontend/backend directories - Use TypeScript strict mode
- Prefer explicit types over
any
Use semantic commit prefixes:
feat:new featurefix:bug fixrefactor:code restructuringtest:adding/updating testsdocs:documentation changeschore:maintenance tasks
Example: feat(voting): add nullifier field validation
- Create a feature branch from
master - Make your changes with clear, focused commits
- Ensure all tests pass:
cargo test --workspace - Update documentation if needed
- Submit PR with description of changes
- All new features must include tests
- Bug fixes should include regression tests
- Maintain or improve test coverage
- Integration tests for cross-contract flows
contracts/
├── dao-registry/ # DAO creation & admin management
├── membership-sbt/ # Soulbound membership NFTs
├── membership-tree/ # On-chain Poseidon Merkle tree
├── voting/ # Groth16 verification + voting
├── comments/ # Anonymous ZK comments
└── zkvote-groth16/ # Shared Groth16 verification library
frontend/ # React + Vite frontend
backend/ # Express relayer for anonymous voting
circuits/ # Circom ZK circuits
- Field validation: All BN254 public signals must be < Fr modulus
- Nullifier uniqueness: One vote per nullifier per proposal
- Admin verification: All privileged ops verify through registry
- VK versioning: Proposals snapshot VK version at creation
If modifying vote.circom:
-
Regenerate the circuit artifacts:
cd circuits ./compile.sh -
Update verification key in contracts
-
Run verification script:
./scripts/verify-circuit.sh circuits
-
Update trusted setup documentation
- Report security issues privately via GitHub Security Advisories
- Do not commit secrets, keys, or sensitive data
- Follow OWASP guidelines for input validation
- All ZK public signals must be field-validated
- Open a GitHub Issue for bugs or feature requests
- Check existing issues before creating new ones
- See README.md for project overview
- See THREAT_MODEL.md for security considerations