diff --git a/docs/pages/CRISP/setup.mdx b/docs/pages/CRISP/setup.mdx index 8bb806761a..7d25f53d36 100644 --- a/docs/pages/CRISP/setup.mdx +++ b/docs/pages/CRISP/setup.mdx @@ -128,50 +128,29 @@ the script again (they must match). The fastest way to get CRISP running is using the scripts provided in the `scripts/` directory: ```bash -# Install dependencies -pnpm install - # Setup and build the development environment pnpm dev:setup -# Start all services (Anvil, Ciphernodes, Applications) +# Start all services (Hardhat, Ciphernodes, Applications) pnpm dev:up - -# Clean up all artifacts and generated output (e.g., builds) -# This must be run from enclave root (do cd ../../ if you are inside examples/CRISP) -pnpm clean ``` This will start all CRISP components: -- Anvil (local blockchain) +- Hardhat (local blockchain) - Deploy all contracts - Compile all ZK circuits - Ciphernodes network - CRISP applications (server, client) -```bash -# Build the development containers -pnpm dev:setup - -# Start all services -pnpm dev:up - -# Rebuild containers -pnpm dev:build - -# Invoke the Server CLI -pnpm cli -``` - Once everything is running, you can: 1. Navigate `http://localhost:3000` for the client interface -2. Add the Anvil private key to your wallet: +2. Add the Hardhat private key to your wallet: `0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80` 3. Press `Connect Wallet` button and complete the association with your MetaMask account -4. Switch to `Anvil` local network (this will be handled automatically by the app. You just need to - press on the connected account on the frontend and select the network. Then, complete the +4. Switch to `Hardhat` local network (this will be handled automatically by the app. You just need + to press on the connected account on the frontend and select the network. Then, complete the configuration on MetaMask pop-up). 5. Open a new terminal, run `pnpm cli` and start a new E3 Round. 6. Refresh and interact with the round following the Client interface. diff --git a/examples/CRISP/Readme.md b/examples/CRISP/Readme.md index 7b5e5830ac..617ba1a100 100644 --- a/examples/CRISP/Readme.md +++ b/examples/CRISP/Readme.md @@ -90,22 +90,9 @@ You need to setup your environment variables for `client/` and `server/`. Just c `.env.default` as `.env` and overwrite with your values the following variables (you can leave the others initialized with the default values). -### Client +`pnpm dev:setup` already makes a copy of the env files for you. -```bash -VITE_E3_PROGRAM_ADDRESS=0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1 # Default E3 program address -``` - -### Server - -```bash -ENCLAVE_ADDRESS="0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0" -CIPHERNODE_REGISTRY_ADDRESS="0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9" -NAIVE_REGISTRY_FILTER_ADDRESS="0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9" -E3_PROGRAM_ADDRESS="0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1" # CRISPProgram Contract Address -``` - -These address will be displayed after successfully running the `pnpm dev:up` command in a log that +The addresses will be displayed after successfully running the `pnpm dev:up` command in a log that will look like the following: ```bash @@ -140,16 +127,6 @@ This will start all CRISP components: - Ciphernodes network - CRISP applications (server, client) -Additionally, other specific commands are: - -```bash -# Rebuild crates, compiles contracts and build the client app -pnpm dev:build - -# Invoke the Server CLI -pnpm cli -``` - Once everything is running, you can: 1. Navigate `http://localhost:3000` for the client interface diff --git a/examples/CRISP/package.json b/examples/CRISP/package.json index 06a04e644d..7382e3acc0 100644 --- a/examples/CRISP/package.json +++ b/examples/CRISP/package.json @@ -12,10 +12,10 @@ "cli": "bash ./scripts/cli.sh", "lint": "eslint .", "dev:setup": "bash ./scripts/setup.sh", - "dev:build": "bash ./scripts/build.sh", "dev:up": "bash ./scripts/dev.sh", "test:e2e": "bash ./scripts/test_e2e.sh", "compile:contracts": "pnpm -C packages/crisp-contracts compile", + "test:contracts": "pnpm -C packages/crisp-contracts test", "ciphernode:add": "pnpm -C packages/crisp-contracts ciphernode:add", "ciphernode:mint:tokens": "pnpm -C packages/crisp-contracts ciphernode:mint:tokens", "ciphernode:add:self": "pnpm -C packages/crisp-contracts ciphernode:add:self", diff --git a/examples/CRISP/packages/crisp-contracts/README.md b/examples/CRISP/packages/crisp-contracts/README.md index a99c3ceb3d..5afed88e19 100644 --- a/examples/CRISP/packages/crisp-contracts/README.md +++ b/examples/CRISP/packages/crisp-contracts/README.md @@ -3,8 +3,21 @@ This directory contains the Solidity contracts for CRISP - Coercion-Resistant Impartial Selection Protocol. -Contracts are built and tested with [forge], which is part of the [Foundry] toolkit. Tests are -defined in the `tests` directory in the root of this template. +Contracts are built and tested with [Hardhat](https://hardhat.org). Tests are defined in the `test` directory. + +## Running Tests + +To run contract tests from the CRISP example root (`examples/CRISP/`): + +```bash +pnpm test:contracts +``` + +Alternatively, you can run tests directly from this directory: + +```bash +pnpm test +``` ## CRISP Program diff --git a/examples/CRISP/scripts/build.sh b/examples/CRISP/scripts/build.sh deleted file mode 100755 index db6d9dfc58..0000000000 --- a/examples/CRISP/scripts/build.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -set -e - -(cargo build --locked) -(cd ../../packages/enclave-contracts && pnpm compile) -(cd ./client && pnpm build) diff --git a/examples/CRISP/scripts/setup.sh b/examples/CRISP/scripts/setup.sh index c9c1aef1bd..dbd9d12793 100755 --- a/examples/CRISP/scripts/setup.sh +++ b/examples/CRISP/scripts/setup.sh @@ -11,6 +11,7 @@ echo "sdk" (cd packages/crisp-sdk && pnpm install && pnpm build) echo "evm" (cd ../../packages/enclave-contracts && pnpm compile) +(cd packages/crisp-contracts && pnpm compile) echo "server" (cd ./server && [[ ! -f .env ]] && cp .env.example .env; cargo build --locked --bin cli && cargo build --locked --bin server) echo "client" @@ -21,5 +22,4 @@ if [[ ! -f ~/.cargo/bin/enclave ]]; then (cd ../../ && cargo build --locked -p e3-cli && cargo install --locked --path crates/cli) else echo "enclave CLI already installed, skipping build" -fi -echo "Skipping circuit compilation - using pre-compiled circuits" +fi \ No newline at end of file