Skip to content

chore: add crisp sdk and circuits tests to ci#980

Merged
cedoor merged 9 commits into
mainfrom
chore/crisp-ci
Dec 4, 2025
Merged

chore: add crisp sdk and circuits tests to ci#980
cedoor merged 9 commits into
mainfrom
chore/crisp-ci

Conversation

@ctrlc03

@ctrlc03 ctrlc03 commented Nov 7, 2025

Copy link
Copy Markdown
Collaborator

Closes #959

Summary by CodeRabbit

  • Chores

    • Updated SDK build and test commands for improved workspace integration
    • Enhanced test script with stricter error handling and clearer process orchestration
    • Restructured CI workflow for comprehensive testing across Rust, Noir, JavaScript, and Solidity components
  • Refactor

    • SDK API updated: generateProof replaced by executeCircuit and a new ExecuteCircuitResult type
    • Tests updated to use executeCircuit and validate returned ciphertext outputs

✏️ Tip: You can customize this high-level summary in your review settings.

@ctrlc03 ctrlc03 self-assigned this Nov 7, 2025
@vercel

vercel Bot commented Nov 7, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
crisp Ready Ready Preview Comment Dec 4, 2025 3:58pm
enclave-docs Ready Ready Preview Comment Dec 4, 2025 3:58pm

@coderabbitai

coderabbitai Bot commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Consolidates CRISP CI and scripts, adds SDK workspace build/test commands, renames circuit compilation script, hardens end-to-end orchestration, and changes the CRISP SDK API/type surface (adds ExecuteCircuitResult, renames generateWitnessexecuteCircuit) with accompanying test updates.

Changes

Cohort / File(s) Change Summary
Package script updates
examples/CRISP/package.json
Removed test:circuits:inputs; renamed compile:circuitcompile:circuits and pointed it to bash ./scripts/compile_circuits.sh; added test:sdk and build:sdk workspace commands.
E2E orchestration
examples/CRISP/scripts/test_e2e.sh
Rewrote concurrent pnpm invocation to use named tasks -n "SERVER,SDK,PLAYWRIGHT", added --kill-others and --fail-fast, and split tasks into explicit commands (setup/dev, SDK test, Playwright).
CI workflow
.github/workflows/ci.yml
Removed crisp_rust_unit job; added consolidated crisp_unit job that sets up Rust/Noir/Node/PNPM/Foundry/Nargo/solc and runs Rust, Noir, JS, and Solidity tests; removed standalone Noir circuits test step.
SDK types
examples/CRISP/packages/crisp-sdk/src/types.ts
Added exported type ExecuteCircuitResult = { witness: Uint8Array; returnValue: [Polynomial[][], Polynomial[][]] }.
SDK API & logic
examples/CRISP/packages/crisp-sdk/src/vote.ts
Replaced exported generateWitness with executeCircuit returning Promise<ExecuteCircuitResult>; updated imports/usages and adjusted generateProof to call executeCircuit and to use circuit.bytecode.
Tests
examples/CRISP/packages/crisp-sdk/tests/vote.test.ts
Replaced tests to call executeCircuit and assert on returnValue (ciphertext components); removed generateProof usage and adjusted/added scenarios accordingly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–30 minutes

  • Review areas needing extra attention:
    • examples/CRISP/packages/crisp-sdk/src/vote.ts — API rename and type changes; ensure callers/exports updated.
    • examples/CRISP/packages/crisp-sdk/tests/vote.test.ts — test assertions now target returnValue; verify equivalence to prior proof-based assertions.
    • .github/workflows/ci.yml — new consolidated job with many tooling/setup steps; check caching and matrix implications.

Possibly related PRs

Suggested reviewers

  • ctrlc03
  • ryardley

Poem

🐰
Hop quick, I ran the CI trail,
Circuits compile and SDKs set sail,
Tests line up—fail-fast, no bail,
New types and names in the rabbit mail,
Hooray for green builds on the trail!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR includes refactoring of the vote.ts module (renaming generateWitness to executeCircuit and updating related types) which goes beyond adding tests to CI. Review whether the vote.ts refactoring is necessary for the CI testing objective, or consider moving it to a separate PR focused on SDK improvements.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding CRISP SDK and circuits tests to CI, which aligns with the primary objective of the PR.
Linked Issues check ✅ Passed The PR implements the primary objective from issue #959 by adding CRISP Noir and SDK tests to the CI workflow through modifications to .github/workflows/ci.yml and package.json.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/crisp-ci

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e08531e and a656384.

📒 Files selected for processing (5)
  • examples/CRISP/package.json (1 hunks)
  • examples/CRISP/packages/crisp-sdk/tests/vote.test.ts (1 hunks)
  • examples/CRISP/scripts/run-playwright-tests.sh (1 hunks)
  • examples/CRISP/scripts/run-sdk-tests.sh (1 hunks)
  • examples/CRISP/scripts/test_e2e.sh (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2024-10-08T19:45:18.209Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 107
File: tests/basic_integration/test.sh:81-83
Timestamp: 2024-10-08T19:45:18.209Z
Learning: In `tests/basic_integration/test.sh`, it's acceptable to wait indefinitely for the EVM node to start without a timeout, as it's unlikely to fail here.

Applied to files:

  • examples/CRISP/scripts/run-sdk-tests.sh
  • examples/CRISP/scripts/test_e2e.sh
📚 Learning: 2025-10-29T23:35:30.146Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 936
File: scripts/run-crisp-test.sh:1-3
Timestamp: 2025-10-29T23:35:30.146Z
Learning: In the scripts/run-crisp-test.sh file, the use of `rm -rf *` is acceptable as it's intentionally designed as a definitive reset-and-test script for clean checkouts.

Applied to files:

  • examples/CRISP/scripts/run-playwright-tests.sh
📚 Learning: 2025-11-05T14:12:57.814Z
Learnt from: ctrlc03
Repo: gnosisguild/enclave PR: 963
File: examples/CRISP/client/package.json:25-25
Timestamp: 2025-11-05T14:12:57.814Z
Learning: In the Enclave/CRISP codebase, `enclave-e3/sdk` and `crisp-e3/sdk` are different packages: `enclave-e3/sdk` is the general Enclave SDK, while `crisp-e3/sdk` is the CRISP-specific SDK. The CRISP client (`examples/CRISP/client`) intentionally depends on `enclave-e3/sdk`, not `crisp-e3/sdk`.

Applied to files:

  • examples/CRISP/package.json
📚 Learning: 2025-10-03T08:38:36.786Z
Learnt from: ctrlc03
Repo: gnosisguild/enclave PR: 781
File: examples/CRISP/test/governanceCircuit.test.ts:15-50
Timestamp: 2025-10-03T08:38:36.786Z
Learning: Hardhat v3 supports Node.js's native test runner (node:test) including importing describe and it from 'node:test'. Tests using this interface are compatible with Hardhat v3's test task.

Applied to files:

  • examples/CRISP/scripts/test_e2e.sh
🧬 Code graph analysis (1)
examples/CRISP/scripts/run-sdk-tests.sh (1)
examples/CRISP/scripts/run-playwright-tests.sh (1)
  • cleanup (4-7)
🪛 Shellcheck (0.11.0)
examples/CRISP/scripts/run-sdk-tests.sh

[error] 9-9: SIGKILL/SIGSTOP can not be trapped.

(SC2173)

examples/CRISP/scripts/run-playwright-tests.sh

[error] 9-9: SIGKILL/SIGSTOP can not be trapped.

(SC2173)


[warning] 12-12: Remove "exec " if script should continue after this command.

(SC2093)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: build_sdk
  • GitHub Check: build_enclave_cli
  • GitHub Check: test_contracts
  • GitHub Check: test_net
  • GitHub Check: build_e3_support_dev
  • GitHub Check: rust_integration
  • GitHub Check: integration_prebuild
  • GitHub Check: rust_unit
🔇 Additional comments (3)
examples/CRISP/packages/crisp-sdk/tests/vote.test.ts (1)

316-316: LGTM! Timeout increase is appropriate for CI environments.

The timeout increase from 180s to 240s provides additional headroom for this computationally intensive masking operation, which is reasonable given that CI environments can be slower than local development machines.

examples/CRISP/package.json (1)

23-23: LGTM! Workspace-relative path is clearer.

Using pnpm -C packages/crisp-sdk test is more explicit than the previous cd approach and aligns better with pnpm workspace conventions.

examples/CRISP/scripts/test_e2e.sh (1)

17-23: LGTM! Improved test orchestration with better error handling.

The updated concurrently invocation provides better control and observability:

  • --kill-others ensures all processes terminate when one fails
  • --fail-fast stops execution on first failure for faster feedback
  • Named process labels (-n "SERVER,SDK,PLAYWRIGHT") improve debugging
  • Multi-line format enhances readability

Comment thread examples/CRISP/scripts/run-playwright-tests.sh Outdated
Comment thread examples/CRISP/scripts/run-playwright-tests.sh Outdated
Comment thread examples/CRISP/scripts/run-sdk-tests.sh Outdated
@ctrlc03 ctrlc03 marked this pull request as draft November 7, 2025 14:38
@vercel vercel Bot temporarily deployed to Preview – enclave-docs December 4, 2025 13:04 Inactive
@vercel vercel Bot temporarily deployed to Preview – crisp December 4, 2025 13:04 Inactive
@vercel vercel Bot temporarily deployed to Preview – enclave-docs December 4, 2025 15:34 Inactive
@cedoor cedoor requested review from 0xjei and cedoor December 4, 2025 15:34

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
examples/CRISP/packages/crisp-sdk/src/vote.ts (1)

129-138: Consider making bytecode access consistent.

Line 131 accesses circuit.bytecode directly without casting to CompiledCircuit, while Line 181 in verifyProof still uses (circuit as CompiledCircuit).bytecode. For consistency and clarity, consider applying the same pattern in both places.

Apply this diff to make Line 181 consistent:

 export const verifyProof = async (proof: ProofData): Promise<boolean> => {
-  const backend = new UltraHonkBackend((circuit as CompiledCircuit).bytecode, { threads: optimalThreadCount })
+  const backend = new UltraHonkBackend(circuit.bytecode, { threads: optimalThreadCount })
 
   const isValid = await backend.verifyProof(proof, { keccakZK: true })
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 11d0567 and 3b6a831.

📒 Files selected for processing (3)
  • examples/CRISP/packages/crisp-sdk/src/types.ts (1 hunks)
  • examples/CRISP/packages/crisp-sdk/src/vote.ts (2 hunks)
  • examples/CRISP/packages/crisp-sdk/tests/vote.test.ts (3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: ctrlc03
Repo: gnosisguild/enclave PR: 963
File: examples/CRISP/client/package.json:25-25
Timestamp: 2025-11-05T14:12:57.814Z
Learning: In the Enclave/CRISP codebase, `enclave-e3/sdk` and `crisp-e3/sdk` are different packages: `enclave-e3/sdk` is the general Enclave SDK, while `crisp-e3/sdk` is the CRISP-specific SDK. The CRISP client (`examples/CRISP/client`) intentionally depends on `enclave-e3/sdk`, not `crisp-e3/sdk`.
🧬 Code graph analysis (1)
examples/CRISP/packages/crisp-sdk/src/vote.ts (2)
examples/CRISP/packages/crisp-sdk/src/types.ts (2)
  • CircuitInputs (124-164)
  • ExecuteCircuitResult (166-169)
packages/enclave-sdk/src/greco.ts (2)
  • CircuitInputs (23-37)
  • generateProof (122-159)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: crisp_unit
  • GitHub Check: build_sdk
  • GitHub Check: integration_prebuild
  • GitHub Check: test_net
  • GitHub Check: build_e3_support_dev
  • GitHub Check: test_contracts
  • GitHub Check: build_ciphernode_image
  • GitHub Check: build_enclave_cli
  • GitHub Check: rust_integration
  • GitHub Check: rust_unit
🔇 Additional comments (7)
examples/CRISP/packages/crisp-sdk/src/types.ts (1)

166-169: LGTM! Clean type definition.

The new ExecuteCircuitResult type clearly represents the circuit execution output with both the witness and return value. The structure aligns well with the refactored API.

examples/CRISP/packages/crisp-sdk/tests/vote.test.ts (3)

20-20: LGTM! Import updated to match new API.

The import change correctly reflects the API refactoring from generateProof to executeCircuit.


144-172: LGTM! Test correctly validates circuit output.

The test properly validates that the circuit output ciphertext matches the input ciphertext for a regular vote scenario.


174-233: LGTM! Comprehensive test coverage for mask vote scenarios.

The two new test cases properly cover:

  1. Mask vote with previous ciphertext (validates ciphertext addition)
  2. Mask vote without previous ciphertext (validates zero-vote ciphertext)

Both tests correctly validate the returnValue structure from executeCircuit.

examples/CRISP/packages/crisp-sdk/src/vote.ts (3)

8-8: LGTM! Import updated for new return type.

The ExecuteCircuitResult import is correctly added to support the new executeCircuit function signature.


123-127: LGTM! Clean refactoring of circuit execution.

The new executeCircuit function properly exposes both the witness and return value from the circuit execution. The type assertion on Line 126 assumes noir.execute() returns the expected structure—this appears safe based on passing tests.


140-178: LGTM! Proof generation functions properly use refactored API.

Both generateVoteProof and generateMaskVoteProof correctly delegate to the updated generateProof function, which now internally uses executeCircuit. The validation logic and error handling remain sound.

@0xjei 0xjei left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add CRISP Noir and SDK tests to CI

3 participants