chore: print out .env to copy paste contracts#1112
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughAdds 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 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
readDeploymentArgsimport is correctly added and used in the new env printing block.
33-33: LGTM!The
shouldPrintEnvflag follows the same pattern asshouldDeployEnclaveand correctly gates the new functionality.
163f9c8 to
deff1b7
Compare
deff1b7 to
3931051
Compare
There was a problem hiding this comment.
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:fullto use the real verifier and the addition ofdeploy:contracts:full:mockfor 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:fullscript change. The separation between testing (:full:mockwith mock verifier) and production (:fullwith Risc0Verifier) deployments is clear.
Minor: Clarify environment variable printing behavior.
Lines 34-35 state that
:full:mockprints environment variables, but it's unclear whether:fullalso 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 -->
3931051 to
a390736
Compare
a390736 to
6b98b24
Compare
6b98b24 to
c245b17
Compare
c245b17 to
00a6c91
Compare
00a6c91 to
79082c8
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (1)
examples/CRISP/packages/crisp-contracts/deploy/deploy.ts (1)
43-58: Handle potentially undefinedchainvalue.The
chainvariable on line 30 can beundefined(per learnings from previous reviews), but it's passed directly toreadDeploymentArgswhich expects astring. 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.networkcan 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
:mockuses a mock verifier (good)- The "Full deployment with Risc0Verifier" heading implies real verifier, but doesn't explicitly state that
:fullnow uses the real verifier vs. the previous behaviorConsider 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
:fulluses the real verifier, while:mockuses the mock verifier.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 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.tsdeploy/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.shexamples/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:mockis 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) anddeploy: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
validateInputdescription provides good context about the validation process, the role of voters, and the technical implementation using Greco.
print out contracts to add to CRISP server .env
Summary by CodeRabbit
New Features
Chores
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.