From 846024fc1c98a486d9c147721d35cc6c82fb9a3b Mon Sep 17 00:00:00 2001 From: ctrlc03 <93448202+ctrlc03@users.noreply.github.com> Date: Fri, 7 Nov 2025 10:41:09 +0000 Subject: [PATCH 1/8] chore: add crisp sdk and circuits tests to ci --- examples/CRISP/package.json | 1 + examples/CRISP/scripts/run-playwright-tests.sh | 13 +++++++++++++ examples/CRISP/scripts/run-sdk-tests.sh | 12 ++++++++++++ examples/CRISP/scripts/test_e2e.sh | 9 ++++++++- 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100755 examples/CRISP/scripts/run-playwright-tests.sh create mode 100755 examples/CRISP/scripts/run-sdk-tests.sh diff --git a/examples/CRISP/package.json b/examples/CRISP/package.json index b614f9ad4f..5aa10b8672 100644 --- a/examples/CRISP/package.json +++ b/examples/CRISP/package.json @@ -24,6 +24,7 @@ "test:circuits:inputs": "node --test test/governanceCircuit.test.ts", "test:circuits": "cd circuits && nargo test", "compile:circuit": "bash ./scripts/compile_circuits.sh", + "test:sdk": "pnpm -C packages/crisp-sdk test", "report": "playwright show-report", "publish:packages": "tsx scripts/publish.ts", "setup:testnet": "bash ./scripts/setup_testnet.sh" diff --git a/examples/CRISP/scripts/run-playwright-tests.sh b/examples/CRISP/scripts/run-playwright-tests.sh new file mode 100755 index 0000000000..9b2c91e606 --- /dev/null +++ b/examples/CRISP/scripts/run-playwright-tests.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -e + +cleanup() { + kill -- -$$ # Kill entire process group + exit 1 +} + +trap cleanup SIGTERM SIGINT SIGKILL + +wait-on tcp:3000 +exec ${PLAYWRIGHT_CMD} +sleep 3 diff --git a/examples/CRISP/scripts/run-sdk-tests.sh b/examples/CRISP/scripts/run-sdk-tests.sh new file mode 100755 index 0000000000..a9fd95e8ce --- /dev/null +++ b/examples/CRISP/scripts/run-sdk-tests.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -e + +cleanup() { + kill -- -$$ # Kill entire process group + exit 1 +} + +trap cleanup SIGTERM SIGINT SIGKILL + +wait-on tcp:3000 +exec pnpm test:sdk diff --git a/examples/CRISP/scripts/test_e2e.sh b/examples/CRISP/scripts/test_e2e.sh index b188de1e15..ebb703a5d2 100755 --- a/examples/CRISP/scripts/test_e2e.sh +++ b/examples/CRISP/scripts/test_e2e.sh @@ -14,4 +14,11 @@ else fi echo "TEST E2E SCRIPT STARTING..." -pnpm concurrently -krs first "./scripts/setup.sh && ./scripts/dev.sh" "wait-on tcp:3000 && sleep 20 && ${PLAYWRIGHT_CMD} && sleep 3" +pnpm concurrently \ + --kill-others \ + --fail-fast \ + -n "SERVER,SDK,PLAYWRIGHT" \ + "./scripts/setup.sh && ./scripts/dev.sh" \ + "./scripts/run-sdk-tests.sh" \ + "./scripts/run-playwright-tests.sh" + \ No newline at end of file From c46f971f0b7a60fbc6fef5124fc7c180c7639f2b Mon Sep 17 00:00:00 2001 From: Cedoor Date: Thu, 4 Dec 2025 13:33:20 +0000 Subject: [PATCH 2/8] ci: add crisp unit tests to ci workflow --- .github/workflows/ci.yml | 91 +++++++++++++------ examples/CRISP/package.json | 3 +- .../CRISP/scripts/run-playwright-tests.sh | 13 --- examples/CRISP/scripts/run-sdk-tests.sh | 12 --- examples/CRISP/scripts/test_e2e.sh | 8 +- 5 files changed, 64 insertions(+), 63 deletions(-) delete mode 100755 examples/CRISP/scripts/run-playwright-tests.sh delete mode 100755 examples/CRISP/scripts/run-sdk-tests.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f75ae2c2d2..5cab755e1a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,30 +29,6 @@ permissions: packages: write jobs: - crisp_rust_unit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Install Rust 1.86.0 - uses: dtolnay/rust-toolchain@stable - with: - toolchain: 1.86.0 - - # We must install foundry in order to be able to test anvil - - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 - - - name: Install solc - run: | - sudo add-apt-repository ppa:ethereum/ethereum \ - && sudo apt-get update -y \ - && sudo apt-get install -y solc - - - name: Run CRISP Unit Tests - working-directory: ./examples/CRISP - run: 'cargo test' - rust_unit: runs-on: ubuntu-latest steps: @@ -439,6 +415,68 @@ jobs: path: ~/.cargo/bin/enclave retention-days: 1 + # CRISP Unit Tests (Rust, JavaScript, Noir, Solidity) + crisp_unit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Rust 1.86.0 + uses: dtolnay/rust-toolchain@stable + with: + toolchain: 1.86.0 + + - name: Install Nargo + uses: noir-lang/noirup@v0.1.4 + with: + toolchain: v1.0.0-beta.15 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Setup pnpm + uses: pnpm/action-setup@v3 + with: + version: 10.7.1 + run_install: false + + - name: Get pnpm store directory + id: pnpm-cache + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + + - name: Setup pnpm cache + uses: actions/cache@v4 + with: + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + working-directory: . + run: | + pnpm --version && pnpm install --frozen-lockfile && pnpm build:ts + + - name: Run Rust tests + working-directory: ./examples/CRISP + run: 'cargo test' + + - name: Run Noir tests + working-directory: ./examples/CRISP + run: 'pnpm test:circuits' + + - name: Run JavaScript tests + working-directory: ./examples/CRISP + run: 'pnpm test:sdk' + + - name: Run Solidity tests + working-directory: ./examples/CRISP + run: 'pnpm test:contracts' + crisp_e2e: runs-on: ubuntu-latest needs: [build_enclave_cli] @@ -536,11 +574,6 @@ jobs: path: ./examples/CRISP/playwright-report/ retention-days: 30 - - name: Test Noir circuits - working-directory: ./examples/CRISP - run: | - pnpm test:circuits - test_enclave_circuits: runs-on: ubuntu-latest steps: diff --git a/examples/CRISP/package.json b/examples/CRISP/package.json index 5aa10b8672..51f9a141e8 100644 --- a/examples/CRISP/package.json +++ b/examples/CRISP/package.json @@ -21,9 +21,8 @@ "ciphernode:add:self": "pnpm -C packages/crisp-contracts ciphernode:add:self", "deploy:contracts": "pnpm -C packages/crisp-contracts deploy:contracts", "test": "pnpm test:e2e", - "test:circuits:inputs": "node --test test/governanceCircuit.test.ts", "test:circuits": "cd circuits && nargo test", - "compile:circuit": "bash ./scripts/compile_circuits.sh", + "compile:circuits": "bash ./scripts/compile_circuits.sh", "test:sdk": "pnpm -C packages/crisp-sdk test", "report": "playwright show-report", "publish:packages": "tsx scripts/publish.ts", diff --git a/examples/CRISP/scripts/run-playwright-tests.sh b/examples/CRISP/scripts/run-playwright-tests.sh deleted file mode 100755 index 9b2c91e606..0000000000 --- a/examples/CRISP/scripts/run-playwright-tests.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -set -e - -cleanup() { - kill -- -$$ # Kill entire process group - exit 1 -} - -trap cleanup SIGTERM SIGINT SIGKILL - -wait-on tcp:3000 -exec ${PLAYWRIGHT_CMD} -sleep 3 diff --git a/examples/CRISP/scripts/run-sdk-tests.sh b/examples/CRISP/scripts/run-sdk-tests.sh deleted file mode 100755 index a9fd95e8ce..0000000000 --- a/examples/CRISP/scripts/run-sdk-tests.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -set -e - -cleanup() { - kill -- -$$ # Kill entire process group - exit 1 -} - -trap cleanup SIGTERM SIGINT SIGKILL - -wait-on tcp:3000 -exec pnpm test:sdk diff --git a/examples/CRISP/scripts/test_e2e.sh b/examples/CRISP/scripts/test_e2e.sh index ebb703a5d2..0927f8aee5 100755 --- a/examples/CRISP/scripts/test_e2e.sh +++ b/examples/CRISP/scripts/test_e2e.sh @@ -14,11 +14,5 @@ else fi echo "TEST E2E SCRIPT STARTING..." -pnpm concurrently \ - --kill-others \ - --fail-fast \ - -n "SERVER,SDK,PLAYWRIGHT" \ - "./scripts/setup.sh && ./scripts/dev.sh" \ - "./scripts/run-sdk-tests.sh" \ - "./scripts/run-playwright-tests.sh" +pnpm concurrently -krs first "./scripts/setup.sh && ./scripts/dev.sh" "wait-on tcp:3000 && sleep 20 && ${PLAYWRIGHT_CMD} && sleep 3" \ No newline at end of file From c2e59fe4d3ff101a0917b329948f267ee606305e Mon Sep 17 00:00:00 2001 From: Cedoor Date: Thu, 4 Dec 2025 13:42:05 +0000 Subject: [PATCH 3/8] ci: add solc installation to ci workflow --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5cab755e1a..f6e56e1b00 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -461,6 +461,12 @@ jobs: run: | pnpm --version && pnpm install --frozen-lockfile && pnpm build:ts + - name: Install solc + run: | + sudo add-apt-repository ppa:ethereum/ethereum \ + && sudo apt-get update -y \ + && sudo apt-get install -y solc + - name: Run Rust tests working-directory: ./examples/CRISP run: 'cargo test' From cbaef67e2439b109e5d490742bbd3b88227f5fca Mon Sep 17 00:00:00 2001 From: Cedoor Date: Thu, 4 Dec 2025 14:08:44 +0000 Subject: [PATCH 4/8] ci: add foundry installation to crisp ci workflow --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f6e56e1b00..068d5e5df8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -426,6 +426,9 @@ jobs: with: toolchain: 1.86.0 + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + - name: Install Nargo uses: noir-lang/noirup@v0.1.4 with: From c62aec844034e34adab9b2752191dc612c86f161 Mon Sep 17 00:00:00 2001 From: Cedoor Date: Thu, 4 Dec 2025 14:28:19 +0000 Subject: [PATCH 5/8] ci: add submodules recursive to crisp ci workflow --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 068d5e5df8..cfd2d759ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -420,6 +420,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + submodules: recursive - name: Install Rust 1.86.0 uses: dtolnay/rust-toolchain@stable From 11d05676b420f3161f66018d5bbf8c96345195b1 Mon Sep 17 00:00:00 2001 From: Cedoor Date: Thu, 4 Dec 2025 14:58:56 +0000 Subject: [PATCH 6/8] ci: add build:sdk to crisp ci workflow --- .github/workflows/ci.yml | 2 +- examples/CRISP/package.json | 1 + examples/CRISP/scripts/setup.sh | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cfd2d759ea..d323623aba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -486,7 +486,7 @@ jobs: - name: Run Solidity tests working-directory: ./examples/CRISP - run: 'pnpm test:contracts' + run: 'pnpm build:sdk && pnpm test:contracts' crisp_e2e: runs-on: ubuntu-latest diff --git a/examples/CRISP/package.json b/examples/CRISP/package.json index 51f9a141e8..7064bbc07c 100644 --- a/examples/CRISP/package.json +++ b/examples/CRISP/package.json @@ -24,6 +24,7 @@ "test:circuits": "cd circuits && nargo test", "compile:circuits": "bash ./scripts/compile_circuits.sh", "test:sdk": "pnpm -C packages/crisp-sdk test", + "build:sdk": "pnpm -C packages/crisp-sdk build", "report": "playwright show-report", "publish:packages": "tsx scripts/publish.ts", "setup:testnet": "bash ./scripts/setup_testnet.sh" diff --git a/examples/CRISP/scripts/setup.sh b/examples/CRISP/scripts/setup.sh index dbd9d12793..9589e22518 100755 --- a/examples/CRISP/scripts/setup.sh +++ b/examples/CRISP/scripts/setup.sh @@ -8,10 +8,10 @@ echo "SETUP..." echo "pnpm install" (cd ../../ && pnpm install --frozen-lockfile) echo "sdk" -(cd packages/crisp-sdk && pnpm install && pnpm build) +(pnpm build:sdk) echo "evm" -(cd ../../packages/enclave-contracts && pnpm compile) -(cd packages/crisp-contracts && pnpm compile) +(cd ../../packages/enclave-contracts && pnpm compile:contracts) +(pnpm compile:contracts) echo "server" (cd ./server && [[ ! -f .env ]] && cp .env.example .env; cargo build --locked --bin cli && cargo build --locked --bin server) echo "client" From bf16b353e772ef4d8d1da0210feabc7b5461df5f Mon Sep 17 00:00:00 2001 From: Cedoor Date: Thu, 4 Dec 2025 15:32:57 +0000 Subject: [PATCH 7/8] test: make vote.test.ts faster --- .../CRISP/packages/crisp-sdk/src/types.ts | 5 + examples/CRISP/packages/crisp-sdk/src/vote.ts | 12 +- .../packages/crisp-sdk/tests/vote.test.ts | 143 +++++++++--------- 3 files changed, 82 insertions(+), 78 deletions(-) diff --git a/examples/CRISP/packages/crisp-sdk/src/types.ts b/examples/CRISP/packages/crisp-sdk/src/types.ts index c313767983..550eb043f6 100644 --- a/examples/CRISP/packages/crisp-sdk/src/types.ts +++ b/examples/CRISP/packages/crisp-sdk/src/types.ts @@ -163,6 +163,11 @@ export type CircuitInputs = { is_first_vote: boolean } +export type ExecuteCircuitResult = { + witness: Uint8Array + returnValue: [Polynomial[][], Polynomial[][]] +} + export type ProofInputs = { vote: Vote publicKey: Uint8Array diff --git a/examples/CRISP/packages/crisp-sdk/src/vote.ts b/examples/CRISP/packages/crisp-sdk/src/vote.ts index a453fc2fed..ec40f017ff 100644 --- a/examples/CRISP/packages/crisp-sdk/src/vote.ts +++ b/examples/CRISP/packages/crisp-sdk/src/vote.ts @@ -5,7 +5,7 @@ // or FITNESS FOR A PARTICULAR PURPOSE. import { ZKInputsGenerator } from '@crisp-e3/zk-inputs' -import { type CircuitInputs, type Vote, MaskVoteProofInputs, ProofInputs, VoteProofInputs } from './types' +import { type CircuitInputs, type Vote, ExecuteCircuitResult, MaskVoteProofInputs, Polynomial, ProofInputs, VoteProofInputs } from './types' import { generateMerkleProof, toBinary, extractSignatureComponents, getAddressFromSignature, getOptimalThreadCount } from './utils' import { MAXIMUM_VOTE_VALUE, HALF_LARGEST_MINIMUM_DEGREE, MASK_SIGNATURE } from './constants' import { Noir, type CompiledCircuit } from '@noir-lang/noir_js' @@ -120,17 +120,15 @@ export const generateCircuitInputs = async (proofInputs: ProofInputs): Promise => { +export const executeCircuit = async (crispInputs: CircuitInputs): Promise => { const noir = new Noir(circuit as CompiledCircuit) - const { witness } = await noir.execute(crispInputs as any) - - return witness + return noir.execute(crispInputs) as Promise } export const generateProof = async (crispInputs: CircuitInputs): Promise => { - const witness = await generateWitness(crispInputs) - const backend = new UltraHonkBackend((circuit as CompiledCircuit).bytecode, { threads: optimalThreadCount }) + const { witness } = await executeCircuit(crispInputs) + const backend = new UltraHonkBackend(circuit.bytecode, { threads: optimalThreadCount }) const proof = await backend.generateProof(witness, { keccakZK: true }) diff --git a/examples/CRISP/packages/crisp-sdk/tests/vote.test.ts b/examples/CRISP/packages/crisp-sdk/tests/vote.test.ts index c15cc5fb90..92d53aa663 100644 --- a/examples/CRISP/packages/crisp-sdk/tests/vote.test.ts +++ b/examples/CRISP/packages/crisp-sdk/tests/vote.test.ts @@ -16,8 +16,8 @@ import { generatePublicKey, verifyProof, encodeVote, - generateProof, generateCircuitInputs, + executeCircuit, } from '../src/vote' import { publicKeyToAddress, signMessage } from 'viem/accounts' import { Hex, recoverPublicKey } from 'viem' @@ -141,7 +141,7 @@ describe('Vote', () => { }) describe('generateProof', () => { - it('Should generate a proof where the output is the new ciphertext', { timeout: 100000 }, async () => { + it('Should generate a proof where the output is the new ciphertext', async () => { // This test simulates a real vote (i.e. generateVoteProof). // Using generateCircuitInputs directly to check the output of the circuit. @@ -155,81 +155,82 @@ describe('Vote', () => { merkleProof, }) - const proof = await generateProof(crispInputs) - - expect(proof).toBeDefined() - expect(proof.proof).toBeDefined() - expect(proof.publicInputs).toBeDefined() + const { returnValue } = await executeCircuit(crispInputs) const ct0is = crispInputs.ct0is.flatMap((p) => p.coefficients).map((b) => BigInt(b)) const ct1is = crispInputs.ct1is.flatMap((p) => p.coefficients).map((b) => BigInt(b)) - const outputCiphertext = proof.publicInputs.slice(2).map((b) => BigInt(b)) + const outputCt0is = returnValue[0] + .flat() + .flatMap((p) => p.coefficients) + .map((b) => BigInt(b)) + const outputCt1is = returnValue[1] + .flat() + .flatMap((p) => p.coefficients) + .map((b) => BigInt(b)) + + expect([...outputCt0is, ...outputCt1is]).toEqual([...ct0is, ...ct1is]) + }) + + it('Should generate a proof where the output is the ciphertext addition if there is a previous ciphertext and 0 vote', async () => { + // This test simulates a mask vote (i.e. generateMaskVoteProof). + + // Using generateCircuitInputs directly to check the output of the circuit. + const merkleProof = generateMerkleProof(balance, slotAddress, LEAVES) + const crispInputs = await generateCircuitInputs({ + vote: { yes: 0n, no: 0n }, + publicKey, + previousCiphertext, + signature: MASK_SIGNATURE, + merkleProof, + balance, + slotAddress, + }) - expect([...ct0is, ...ct1is]).toEqual(outputCiphertext) + const { returnValue } = await executeCircuit(crispInputs) + + const sumCt0is = crispInputs.sum_ct0is.flatMap((p) => p.coefficients).map((b) => BigInt(b)) + const sumCt1is = crispInputs.sum_ct1is.flatMap((p) => p.coefficients).map((b) => BigInt(b)) + const outputSumCt0is = returnValue[0] + .flat() + .flatMap((p) => p.coefficients) + .map((b) => BigInt(b)) + const outputSumCt1is = returnValue[1] + .flat() + .flatMap((p) => p.coefficients) + .map((b) => BigInt(b)) + + expect([...outputSumCt0is, ...outputSumCt1is]).toEqual([...sumCt0is, ...sumCt1is]) }) - it( - 'Should generate a proof where the output is the ciphertext addition if there is a previous ciphertext and 0 vote', - { timeout: 100000 }, - async () => { - // This test simulates a mask vote (i.e. generateMaskVoteProof). - - // Using generateCircuitInputs directly to check the output of the circuit. - const merkleProof = generateMerkleProof(balance, slotAddress, LEAVES) - const crispInputs = await generateCircuitInputs({ - vote: { yes: 0n, no: 0n }, - publicKey, - previousCiphertext, - signature: MASK_SIGNATURE, - merkleProof, - balance, - slotAddress, - }) - - const proof = await generateProof(crispInputs) - - expect(proof).toBeDefined() - expect(proof.proof).toBeDefined() - expect(proof.publicInputs).toBeDefined() - - const sumCt0is = crispInputs.sum_ct0is.flatMap((p) => p.coefficients).map((b) => BigInt(b)) - const sumCt1is = crispInputs.sum_ct1is.flatMap((p) => p.coefficients).map((b) => BigInt(b)) - const outputCiphertext = proof.publicInputs.slice(2).map((b) => BigInt(b)) - - expect([...sumCt0is, ...sumCt1is]).toEqual(outputCiphertext) - }, - ) - - it( - 'Should generate a proof where the output is the ciphertext of a 0 vote if there is no previous ciphertext', - { timeout: 100000 }, - async () => { - // This test simulates a mask vote (i.e. generateMaskVoteProof). - - // Using generateCircuitInputs directly to check the output of the circuit. - const merkleProof = generateMerkleProof(balance, slotAddress, LEAVES) - const crispInputs = await generateCircuitInputs({ - vote: { yes: 0n, no: 0n }, - publicKey, - signature: MASK_SIGNATURE, - merkleProof, - balance, - slotAddress, - }) - - const proof = await generateProof(crispInputs) - - expect(proof).toBeDefined() - expect(proof.proof).toBeDefined() - expect(proof.publicInputs).toBeDefined() - - const ct0is = crispInputs.ct0is.flatMap((p) => p.coefficients).map((b) => BigInt(b)) - const ct1is = crispInputs.ct1is.flatMap((p) => p.coefficients).map((b) => BigInt(b)) - const outputCiphertext = proof.publicInputs.slice(2).map((b) => BigInt(b)) - - expect([...ct0is, ...ct1is]).toEqual(outputCiphertext) - }, - ) + it('Should generate a proof where the output is the ciphertext of a 0 vote if there is no previous ciphertext', async () => { + // This test simulates a mask vote (i.e. generateMaskVoteProof). + + // Using generateCircuitInputs directly to check the output of the circuit. + const merkleProof = generateMerkleProof(balance, slotAddress, LEAVES) + const crispInputs = await generateCircuitInputs({ + vote: { yes: 0n, no: 0n }, + publicKey, + signature: MASK_SIGNATURE, + merkleProof, + balance, + slotAddress, + }) + + const { returnValue } = await executeCircuit(crispInputs) + + const ct0is = crispInputs.ct0is.flatMap((p) => p.coefficients).map((b) => BigInt(b)) + const ct1is = crispInputs.ct1is.flatMap((p) => p.coefficients).map((b) => BigInt(b)) + const outputCt0is = returnValue[0] + .flat() + .flatMap((p) => p.coefficients) + .map((b) => BigInt(b)) + const outputCt1is = returnValue[1] + .flat() + .flatMap((p) => p.coefficients) + .map((b) => BigInt(b)) + + expect([...outputCt0is, ...outputCt1is]).toEqual([...ct0is, ...ct1is]) + }) }) describe('generateVoteProof', () => { From 3b6a83149359c820a80462755cd59fd99b547504 Mon Sep 17 00:00:00 2001 From: Cedoor Date: Thu, 4 Dec 2025 15:33:45 +0000 Subject: [PATCH 8/8] style: fix type import in vote.ts --- examples/CRISP/packages/crisp-sdk/src/vote.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/CRISP/packages/crisp-sdk/src/vote.ts b/examples/CRISP/packages/crisp-sdk/src/vote.ts index ec40f017ff..c641d006a7 100644 --- a/examples/CRISP/packages/crisp-sdk/src/vote.ts +++ b/examples/CRISP/packages/crisp-sdk/src/vote.ts @@ -5,7 +5,7 @@ // or FITNESS FOR A PARTICULAR PURPOSE. import { ZKInputsGenerator } from '@crisp-e3/zk-inputs' -import { type CircuitInputs, type Vote, ExecuteCircuitResult, MaskVoteProofInputs, Polynomial, ProofInputs, VoteProofInputs } from './types' +import { type CircuitInputs, type Vote, ExecuteCircuitResult, MaskVoteProofInputs, ProofInputs, VoteProofInputs } from './types' import { generateMerkleProof, toBinary, extractSignatureComponents, getAddressFromSignature, getOptimalThreadCount } from './utils' import { MAXIMUM_VOTE_VALUE, HALF_LARGEST_MINIMUM_DEGREE, MASK_SIGNATURE } from './constants' import { Noir, type CompiledCircuit } from '@noir-lang/noir_js'