@crisp-e3/contracts
v0.10.0
Published
This directory contains the Solidity contracts for CRISP - Coercion-Resistant Impartial Selection Protocol.
Readme
Solidity Contracts
This directory contains the Solidity contracts for CRISP - Coercion-Resistant Impartial Selection Protocol.
Contracts are built and tested with Hardhat. Tests are defined in the test
directory.
Running Tests
To run contract tests from the CRISP example root (examples/CRISP/):
pnpm test:contractsAlternatively, you can run tests directly from this directory:
pnpm testDeployment
Local deploy is driven by ../../crisp.dev.env (see
../../docs/PROOF_AGGREGATION_AND_ZK.md):
pnpm dev:setup— applies profile, builds DKG circuits whenCRISP_PROOF_AGGREGATION_ENABLED=truepnpm dev:up→scripts/crisp_deploy.sh— setsENABLE_ZK_VERIFICATIONfrom the same file
CRISP-only deploy (Enclave already deployed)
pnpm deploy:contracts # production RISC0 verifier
pnpm deploy:contracts:full # also deploy Enclave stack (no ZK unless ENABLE_ZK_VERIFICATION=true)CRISP Program
This is the main logic of CRISP - an enclave program for secure voting.
It exposes two main functions:
validate- that is called when a new E3 instance is requested on Enclave (Enclave.request).verify- that is called when the ciphertext output is published on Enclave (Enclave.publishCiphertextOutput). This function ensures that the ciphertext output is valid. CRISP uses Risc0 as the compute provider for running the FHE program, thus the proof will be a Risc0 proof.validateInput- validate the input data that is submitted to the E3 instance. It is called by the Enclave contract when a new input is published (Enclave.publishInput). In CRISP, the data providers (the ones submitting the inputs) are the voters, and the input submitted is the vote itself. The logic checks that gating conditions are satisfied and that the ciphertext is constructed correctly using Greco. See the Greco paper.
