Skip to content

chore: print out .env to copy paste contracts#1112

Merged
ctrlc03 merged 3 commits into
mainfrom
chore/print-out-env-example
Dec 16, 2025
Merged

chore: print out .env to copy paste contracts#1112
ctrlc03 merged 3 commits into
mainfrom
chore/print-out-env-example

Conversation

@ctrlc03

@ctrlc03 ctrlc03 commented Dec 15, 2025

Copy link
Copy Markdown
Collaborator

print out contracts to add to CRISP server .env

Summary by CodeRabbit

  • New Features

    • Optionally print deployed contract addresses in .env-friendly format after deployment (flag-controlled), with validation to avoid incomplete output.
  • Chores

    • Split deployment workflows into standard and mock-verifier variants; added a mock deployment entry that enables env printing and updated local deployment to use the mock variant.
  • Documentation

    • Expanded deployment instructions and clarified program validation and input/verification behavior.

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

@ctrlc03 ctrlc03 requested a review from cedoor December 15, 2025 22:20
@vercel

vercel Bot commented Dec 15, 2025

Copy link
Copy Markdown

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

Project Deployment Review Updated (UTC)
crisp Ready Ready Preview, Comment Dec 16, 2025 0:20am
enclave-docs Ready Ready Preview, Comment Dec 16, 2025 0:20am

@coderabbitai

coderabbitai Bot commented Dec 15, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Adds optional .env-style printing of deployed contract addresses (guarded by PRINT_ENV_VARS) to the CRISP deploy script, introduces a mock full-deploy npm script that enables it, updates local wrappers to call the mock flow, and documents the new commands in the CRISP README.

Changes

Cohort / File(s) Summary
Deployment script enhancement
examples/CRISP/packages/crisp-contracts/deploy/deploy.ts
Imported readDeploymentArgs from @enclave-e3/contracts/scripts; added shouldPrintEnv (driven by PRINT_ENV_VARS) and a conditional block after updateE3Config that reads deployment addresses (Enclave, MockUSDC, CRISPProgram, CiphernodeRegistryOwnable), validates presence, and prints them as .env-style lines.
Package scripts
examples/CRISP/packages/crisp-contracts/package.json
Modified deploy:contracts:full to set only DEPLOY_ENCLAVE=true; added deploy:contracts:full:mock which sets DEPLOY_ENCLAVE=true USE_MOCK_VERIFIER=true PRINT_ENV_VARS=true before running deploy.
Local deploy wrappers
deploy/local/contracts.sh, examples/CRISP/scripts/crisp_deploy.sh
Updated wrapper scripts to invoke the new mock-full deploy script (pnpm deploy:contracts:full:mock) instead of the previous full deploy variant.
Documentation
examples/CRISP/packages/crisp-contracts/README.md
Added a Deployment section with testing and full-deploy commands, noted that server environment variables are printed after deployment, restructured CRISP Program and Input validation descriptions for clarity.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Primary changes are a small conditional and import in one TypeScript file, plus package/script updates and README edits.
  • Areas to double-check:
    • Import path/name and return shape of readDeploymentArgs.
    • Validation that all required addresses exist before printing.
    • Consistency of printed variable names with server expectations.

Possibly related PRs

Suggested reviewers

  • 0xjei
  • cedoor

Poem

🐰 I hopped through scripts at break of day,
I parsed the addresses, then I'd say:
"PRINT_ENV_VARS" makes servers bright,
Mock runs print and tests take flight,
Tiny env lines guide every deploy ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding functionality to print deployment contract addresses in .env format for the CRISP server, which aligns with the primary objective shown in all modified files.
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/print-out-env-example

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: 2

📜 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 ca8f01d and 163f9c8.

📒 Files selected for processing (2)
  • examples/CRISP/packages/crisp-contracts/deploy/deploy.ts (3 hunks)
  • examples/CRISP/packages/crisp-contracts/package.json (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 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/packages/crisp-contracts/deploy/deploy.ts
📚 Learning: 2025-09-11T13:09:03.800Z
Learnt from: ctrlc03
Repo: gnosisguild/enclave PR: 677
File: packages/enclave-contracts/scripts/deployAndSave/naiveRegistryFilter.ts:30-31
Timestamp: 2025-09-11T13:09:03.800Z
Learning: In Hardhat v3 deployment scripts, use `(await signer.provider?.getNetwork())?.name ?? "localhost"` instead of `hre.globalOptions.network` to reliably get the network name, as `hre.globalOptions.network` can be undefined in some contexts.

Applied to files:

  • examples/CRISP/packages/crisp-contracts/deploy/deploy.ts
🧬 Code graph analysis (1)
examples/CRISP/packages/crisp-contracts/deploy/deploy.ts (1)
packages/enclave-contracts/scripts/utils.ts (1)
  • readDeploymentArgs (96-110)
⏰ 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: build_sdk
  • GitHub Check: crisp_unit
  • GitHub Check: build_e3_support_dev
  • GitHub Check: integration_prebuild
  • GitHub Check: test_net
  • GitHub Check: rust_unit
  • GitHub Check: test_contracts
  • GitHub Check: build_ciphernode_image
  • GitHub Check: rust_integration
  • GitHub Check: build_enclave_cli
🔇 Additional comments (2)
examples/CRISP/packages/crisp-contracts/deploy/deploy.ts (2)

6-6: LGTM!

The readDeploymentArgs import is correctly added and used in the new env printing block.


33-33: LGTM!

The shouldPrintEnv flag follows the same pattern as shouldDeployEnclave and correctly gates the new functionality.

Comment thread examples/CRISP/packages/crisp-contracts/deploy/deploy.ts
Comment thread examples/CRISP/packages/crisp-contracts/package.json
@ctrlc03 ctrlc03 requested a review from 0xjei December 15, 2025 22:27
@cedoor cedoor force-pushed the chore/print-out-env-example branch from 163f9c8 to deff1b7 Compare December 16, 2025 09:22
@vercel vercel Bot temporarily deployed to Preview – crisp December 16, 2025 09:22 Inactive
@vercel vercel Bot temporarily deployed to Preview – enclave-docs December 16, 2025 09:22 Inactive
@ctrlc03 ctrlc03 force-pushed the chore/print-out-env-example branch from deff1b7 to 3931051 Compare December 16, 2025 09:30
@vercel vercel Bot temporarily deployed to Preview – crisp December 16, 2025 09:30 Inactive
@vercel vercel Bot temporarily deployed to Preview – enclave-docs December 16, 2025 09:30 Inactive
cedoor
cedoor previously approved these changes Dec 16, 2025

@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

♻️ Duplicate comments (1)
examples/CRISP/packages/crisp-contracts/package.json (1)

36-37: Script changes align with updated documentation.

The refactoring of deploy:contracts:full to use the real verifier and the addition of deploy:contracts:full:mock for testing scenarios are correctly implemented. The README has been updated to document both variants, which addresses the concern raised in the previous review about clarifying the behavioral change.

🧹 Nitpick comments (1)
examples/CRISP/packages/crisp-contracts/README.md (1)

23-50: Good documentation addressing previous concerns!

The new Deployment section effectively documents the different deployment workflows and addresses the concern raised in the previous review about clarifying the deploy:contracts:full script change. The separation between testing (:full:mock with mock verifier) and production (:full with Risc0Verifier) deployments is clear.


Minor: Clarify environment variable printing behavior.

Lines 34-35 state that :full:mock prints environment variables, but it's unclear whether :full also prints them. Consider explicitly stating whether the production deployment command prints env vars or if that's exclusive to the mock variant.

For example:

 pnpm deploy:contracts:full

+Note: Unlike the mock deployment, this command does not print environment variables. You can manually retrieve them from your deployment artifacts if needed.


</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used**: Path: .coderabbit.yaml

**Review profile**: CHILL

**Plan**: Pro

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between deff1b7359d4936587a7082ec5b3d26f1b01bcbd and 393105133092f5b461beb9c3bf8e4ded854c4d9f.

</details>

<details>
<summary>📒 Files selected for processing (3)</summary>

* `examples/CRISP/packages/crisp-contracts/README.md` (2 hunks)
* `examples/CRISP/packages/crisp-contracts/deploy/deploy.ts` (3 hunks)
* `examples/CRISP/packages/crisp-contracts/package.json` (1 hunks)

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary>

* examples/CRISP/packages/crisp-contracts/deploy/deploy.ts

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🧠 Learnings (1)</summary>

<details>
<summary>📚 Learning: 2025-11-12T10:08:30.720Z</summary>

Learnt from: ctrlc03
Repo: gnosisguild/enclave PR: 996
File: examples/CRISP/packages/crisp-contracts/contracts/CRISPProgram.sol:144-169
Timestamp: 2025-11-12T10:08:30.720Z
Learning: In the CRISP program (examples/CRISP/packages/crisp-contracts/contracts/CRISPProgram.sol), there are plans to move the merkle tree from the Enclave contract to the program contract itself in the future, which would allow direct calls to validateInput to be stored in the merkle tree.


**Applied to files:**
- `examples/CRISP/packages/crisp-contracts/README.md`

</details>

</details>

</details>

<details>
<summary>⏰ 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). (9)</summary>

* GitHub Check: build_enclave_cli
* GitHub Check: test_contracts
* GitHub Check: test_net
* GitHub Check: crisp_unit
* GitHub Check: build_e3_support_dev
* GitHub Check: build_sdk
* GitHub Check: integration_prebuild
* GitHub Check: rust_unit
* GitHub Check: rust_integration

</details>

<details>
<summary>🔇 Additional comments (1)</summary><blockquote>

<details>
<summary>examples/CRISP/packages/crisp-contracts/README.md (1)</summary><blockquote>

`62-68`: **Comprehensive documentation of the validateInput function.**

The addition clearly explains the role of `validateInput` in the voting workflow, its integration with `Enclave.publishInput`, and the technical implementation using Greco. The references to gating conditions and the academic paper provide helpful context.

</blockquote></details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

@ctrlc03 ctrlc03 force-pushed the chore/print-out-env-example branch from 00a6c91 to 79082c8 Compare December 16, 2025 12:18

@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

♻️ Duplicate comments (1)
examples/CRISP/packages/crisp-contracts/deploy/deploy.ts (1)

43-58: Handle potentially undefined chain value.

The chain variable on line 30 can be undefined (per learnings from previous reviews), but it's passed directly to readDeploymentArgs which expects a string. This could cause runtime errors or incorrect behavior when the network option is not set.

Apply this diff to add a fallback:

   if (shouldPrintEnv) {
+    const network = chain ?? 'localhost'
-    const enclaveAddress = readDeploymentArgs('Enclave', chain)?.address
-    const tokenAddress = readDeploymentArgs('MockUSDC', chain)?.address
-    const programAddress = readDeploymentArgs('CRISPProgram', chain)?.address
-    const ciphernodeRegistryAddress = readDeploymentArgs('CiphernodeRegistryOwnable', chain)?.address
+    const enclaveAddress = readDeploymentArgs('Enclave', network)?.address
+    const tokenAddress = readDeploymentArgs('MockUSDC', network)?.address
+    const programAddress = readDeploymentArgs('CRISPProgram', network)?.address
+    const ciphernodeRegistryAddress = readDeploymentArgs('CiphernodeRegistryOwnable', network)?.address
 
     if (!enclaveAddress || !tokenAddress || !programAddress || !ciphernodeRegistryAddress) {
       console.error('Error: Missing deployment addresses. Ensure all contracts are deployed.')
       return
     }

Based on learnings, hre.globalOptions.network can be undefined in some contexts, so a fallback to 'localhost' is necessary.

🧹 Nitpick comments (1)
examples/CRISP/packages/crisp-contracts/README.md (1)

23-50: Consider clarifying the deployment options more explicitly.

The documentation covers the deployment commands, but the distinction between the scripts could be clearer:

  • The "For testing" section describes :mock uses a mock verifier (good)
  • The "Full deployment with Risc0Verifier" heading implies real verifier, but doesn't explicitly state that :full now uses the real verifier vs. the previous behavior

Consider making the distinction more explicit:

-### Full deployment with Risc0Verifier
+### Production/Full deployment with Risc0Verifier
 
-You can deploy CRISP contracts only using:
+For production or full testing with the real Risc0 verifier, you can deploy CRISP contracts only using:

This would make it immediately clear that :full uses the real verifier, while :mock uses the mock verifier.

📜 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 c245b17 and 79082c8.

📒 Files selected for processing (5)
  • deploy/local/contracts.sh (1 hunks)
  • examples/CRISP/packages/crisp-contracts/README.md (2 hunks)
  • examples/CRISP/packages/crisp-contracts/deploy/deploy.ts (3 hunks)
  • examples/CRISP/packages/crisp-contracts/package.json (1 hunks)
  • examples/CRISP/scripts/crisp_deploy.sh (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • examples/CRISP/scripts/crisp_deploy.sh
🧰 Additional context used
🧠 Learnings (6)
📚 Learning: 2025-09-11T13:09:03.800Z
Learnt from: ctrlc03
Repo: gnosisguild/enclave PR: 677
File: packages/enclave-contracts/scripts/deployAndSave/naiveRegistryFilter.ts:30-31
Timestamp: 2025-09-11T13:09:03.800Z
Learning: In Hardhat v3 deployment scripts, use `(await signer.provider?.getNetwork())?.name ?? "localhost"` instead of `hre.globalOptions.network` to reliably get the network name, as `hre.globalOptions.network` can be undefined in some contexts.

Applied to files:

  • examples/CRISP/packages/crisp-contracts/deploy/deploy.ts
📚 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/packages/crisp-contracts/deploy/deploy.ts
  • deploy/local/contracts.sh
📚 Learning: 2025-08-25T10:28:56.174Z
Learnt from: ctrlc03
Repo: gnosisguild/enclave PR: 657
File: Cargo.toml:32-34
Timestamp: 2025-08-25T10:28:56.174Z
Learning: The examples/CRISP directory has its own Cargo.toml workspace configuration with members like "server", "wasm-crypto", "program/core", "program/client", etc. The root workspace intentionally excludes "examples/CRISP/server", "examples/CRISP/program", and "examples/CRISP/wasm-crypto" to prevent double workspace membership, which is the correct approach for self-contained example workspaces.

Applied to files:

  • deploy/local/contracts.sh
📚 Learning: 2024-10-28T12:00:09.010Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 156
File: packages/ciphernode/enclave/src/commands/wallet/set.rs:17-23
Timestamp: 2024-10-28T12:00:09.010Z
Learning: In the `enclave` package of the `ciphernode` project, prefer using `println!` over logging macros like `error!` from the `tracing` crate for error output in CLI commands.

Applied to files:

  • deploy/local/contracts.sh
📚 Learning: 2025-11-12T10:08:30.720Z
Learnt from: ctrlc03
Repo: gnosisguild/enclave PR: 996
File: examples/CRISP/packages/crisp-contracts/contracts/CRISPProgram.sol:144-169
Timestamp: 2025-11-12T10:08:30.720Z
Learning: In the CRISP program (examples/CRISP/packages/crisp-contracts/contracts/CRISPProgram.sol), there are plans to move the merkle tree from the Enclave contract to the program contract itself in the future, which would allow direct calls to validateInput to be stored in the merkle tree.

Applied to files:

  • deploy/local/contracts.sh
  • examples/CRISP/packages/crisp-contracts/README.md
📚 Learning: 2024-10-23T01:59:42.967Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 156
File: packages/ciphernode/tests/tests/test_aggregation_and_decryption.rs:274-274
Timestamp: 2024-10-23T01:59:42.967Z
Learning: In the `packages/ciphernode/tests/tests/test_aggregation_and_decryption.rs` file and other test files within this project, hardcoding `CIPHERNODE_SECRET` is acceptable for testing purposes.

Applied to files:

  • deploy/local/contracts.sh
🧬 Code graph analysis (1)
examples/CRISP/packages/crisp-contracts/deploy/deploy.ts (1)
packages/enclave-contracts/scripts/utils.ts (1)
  • readDeploymentArgs (96-110)
⏰ 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: rust_integration
  • GitHub Check: build_enclave_cli
  • GitHub Check: integration_prebuild
  • GitHub Check: rust_unit
  • GitHub Check: crisp_unit
  • GitHub Check: test_net
  • GitHub Check: build_e3_support_dev
🔇 Additional comments (3)
deploy/local/contracts.sh (1)

7-7: LGTM! Appropriate use of mock deployment for local testing.

The switch to deploy:contracts:full:mock is appropriate for local development, as it enables the mock verifier and prints environment variables for easy setup.

examples/CRISP/packages/crisp-contracts/package.json (1)

36-37: Script refactoring looks good.

The separation of concerns between deploy:contracts:full (real verifier) and deploy:contracts:full:mock (mock verifier + env printing) is clear and follows good practices. The README documentation addresses the previous concern, though it could be slightly more explicit (see README comments).

examples/CRISP/packages/crisp-contracts/README.md (1)

62-68: LGTM! Clear and informative description.

The updated validateInput description provides good context about the validation process, the role of voters, and the technical implementation using Greco.

@ctrlc03 ctrlc03 requested a review from cedoor December 16, 2025 12:22
@ctrlc03 ctrlc03 merged commit 4d85bab into main Dec 16, 2025
25 checks passed
@ctrlc03 ctrlc03 deleted the chore/print-out-env-example branch December 16, 2025 12:40
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.

2 participants