@crisp-e3/contracts
v0.5.10
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
For testing
For testing, you can deploy the contracts without using the Risc0 verifier. The following command can be run:
pnpm deploy:contracts:full:mockThis will also print out the environment variables needed for the CRISP server to work with your newly deployed contracts.
Full deployment with Risc0Verifier
You can deploy CRISP contracts only using:
pnpm deploy:contractsOr the following to deploy Enclave contracts too (useful for testing scenarios):
pnpm deploy:contracts:fullCRISP 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.
