Skip to content

PHASE 0: Hackathon Ready Devnet#408

Merged
ryardley merged 106 commits into
mainfrom
hacknet
Jul 21, 2025
Merged

PHASE 0: Hackathon Ready Devnet#408
ryardley merged 106 commits into
mainfrom
hacknet

Conversation

@ryardley

@ryardley ryardley commented May 18, 2025

Copy link
Copy Markdown
Contributor

Whats the point of this

  • We all stay tightly integrated
  • We use tests to define functionality when we can
  • We all stay integrated and can refactor quickly

Working with hacknet

  • Branch from here
  • PR to this branch select the hacknet template
  • Your PR must be reviewed by coderabbit using @coderabbit review
  • Make small changes
  • Merge daily to this branch (don't need to match tickets 1:1)
  • Use tests to define working functionality
  • Write unit tests to prevent regressions
  • Avoid long-running branches
  • Break up large/messy changes or use cargo features
  • We'll rebase (not merge) to main for linear history

Summary by CodeRabbit

  • New Features

    • Introduced a new Rust package, enclave-sdk-isomorphic, and added supporting configuration and documentation files.
    • Added new modules and public interfaces to the enclave SDK for improved contract interaction.
  • Bug Fixes

    • Updated contract event handling to use explicit expiration values and improved event emission assertions in tests.
  • Refactor

    • Replaced dependencies on the commons package with enclave-sdk and enclave-sdk-isomorphic across multiple components.
    • Updated contract instantiation logic to use detailed configuration parameters (HTTP RPC URL, private key, contract address).
  • Documentation

    • Added and updated README files to clarify module roles and system architecture.
  • Chores

    • Updated workflow configurations to support the new "hacknet" branch.
    • Upgraded dependency versions and deployment metadata.
    • Added placeholder and configuration files for new development branches.

@vercel

vercel Bot commented May 18, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
crisp ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 21, 2025 3:54pm
enclave-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 21, 2025 3:54pm

@coderabbitai

coderabbitai Bot commented May 18, 2025

Copy link
Copy Markdown
Contributor

Important

Review skipped

More than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review.

113 files out of 295 files are above the max files limit of 100. Please upgrade to Pro plan to get higher limits.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update introduces a new "enclave-sdk" and "enclave-sdk-isomorphic" package architecture, replacing the former "commons" crate throughout the codebase. Numerous workflows and configurations are updated to support a new "hacknet" branch. The server and contract interaction logic is refactored to use more explicit configuration parameters. Documentation and new minimal Rust app modules are added.

Changes

File(s) / Path(s) Change Summary
.deleteme New marker file added for branch tracking, intended for deletion in the first pull request.
.github/workflows/ci.yml
.github/workflows/integration.yml
.github/workflows/rust-ci.yml
CI workflows updated to trigger on both "main" and "hacknet" branches.
.github/workflows/crisp-e2e.yaml Workflow triggers refactored: path filters removed, triggers expanded to include "hacknet" branch for push events, and manual trigger always enabled.
.github/workflows/ec2-deployment.yml Deployment workflow now triggers on "hacknet" branch in addition to "main" and "release" for relevant paths.
examples/CRISP/apps/client/src/providers/Web3Provider.tsx Production mode now explicitly sets initialChainId to Sepolia's ID for provider options.
examples/CRISP/apps/program/Cargo.toml Added "app" as a workspace member.
examples/CRISP/apps/program/README.md New README with architecture description and Mermaid diagram for the program module.
examples/CRISP/apps/program/app/Cargo.toml
examples/CRISP/apps/program/app/src/main.rs
New minimal Rust app module with "Hello, world!" main function and its manifest.
examples/CRISP/apps/program/core/Cargo.toml
examples/CRISP/apps/program/core/src/lib.rs
Switched dependency from "commons" to "enclave-sdk-isomorphic" and updated imports accordingly.
examples/CRISP/apps/program/host/README.md New README for Risc0 Host component.
examples/CRISP/apps/server/Cargo.toml Updated "alloy" dependency version; replaced "commons" with "enclave-sdk" and "enclave-sdk-isomorphic" dependencies.
examples/CRISP/apps/server/src/cli/commands.rs
examples/CRISP/apps/server/src/server/blockchain/handlers.rs
examples/CRISP/apps/server/src/server/blockchain/sync.rs
examples/CRISP/apps/server/src/server/routes/rounds.rs
examples/CRISP/apps/server/src/server/routes/voting.rs
Refactored imports to use "enclave-sdk" and "enclave-sdk-isomorphic". Instantiation of EnclaveContract now requires explicit HTTP RPC URL, private key, and contract address. Some event handling logic updated for expiration timing.
examples/CRISP/apps/server/src/server/blockchain/mod.rs Removed public relayer module.
examples/CRISP/apps/server/src/server/mod.rs Made config module public.
examples/CRISP/apps/wasm-crypto/Cargo.toml
examples/CRISP/apps/wasm-crypto/src/lib.rs
Switched dependency and imports from "commons" to "enclave-sdk-isomorphic".
packages/ciphernode/Cargo.toml Updated "alloy" dependency version.
packages/ciphernode/Dockerfile Now copies "enclave-sdk" and "enclave-sdk-isomorphic" instead of "commons".
packages/ciphernode/fhe/Cargo.toml
packages/ciphernode/fhe/src/utils.rs
packages/ciphernode/test_helpers/Cargo.toml
packages/ciphernode/test_helpers/src/bin/fake_encrypt.rs
packages/ciphernode/test_helpers/src/bin/pack_e3_params.rs
packages/ciphernode/tests/Cargo.toml
packages/ciphernode/tests/tests/test_aggregation_and_decryption.rs
Updated dependencies and imports from "commons" to "enclave-sdk-isomorphic".
packages/enclave-sdk-isomorphic/Cargo.toml New Rust package manifest for "enclave-sdk-isomorphic" with conditional features and cryptography dependencies.
packages/enclave-sdk/Cargo.toml Renamed crate from "commons" to "enclave-sdk", reordered and expanded dependencies, added "alloy" and "eyre".
packages/enclave-sdk/src/evm/contracts.rs Made CRISPProvider public; refactored EnclaveContract::new to require explicit config parameters; removed global config reliance.
packages/enclave-sdk/src/evm/mod.rs
packages/enclave-sdk/src/lib.rs
Added public contracts module under evm and exposed evm at the crate root.
packages/evm/contracts/Enclave.sol Refactored expiration assignment in activate function to use a local variable.
packages/evm/deployments/sepolia/NaiveRegistryFilter.json Updated deployment metadata for new contract address and related on-chain details.
packages/evm/test/Enclave.spec.ts Test for activate() event emission relaxed: now matches any expiration value and expects fixed zero hash for the committee public key.

Sequence Diagram(s)

sequenceDiagram
    participant Server
    participant Config
    participant EnclaveContract

    Server->>Config: Retrieve HTTP RPC URL, Private Key, Enclave Address
    Server->>EnclaveContract: new(http_rpc_url, private_key, contract_address)
    EnclaveContract-->>Server: Instance ready for blockchain interaction
Loading

Poem

A rabbit hops with code anew,
"Commons" gone, the SDK grew!
Hacknet’s branch now triggers flows,
Config passed where logic goes.
Contracts clear, deployments bright—
Hello, world! in Rust’s delight.
🐇✨ Onward, builders—code takes flight!

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

* Add hacknet branch to actions and fix scoping

* Run tests no matter what
… library (#414)

* Add app entrypoint to program

* Add architectural explanation

* Extract EnclaveContract from CRISP into enclave-sdk

* Differentiate between isomorphic libs and non-isomorphic libs

* Add isomorphic package to Dockerfile
* Fix a couple of small bugs

* Update examples/CRISP/apps/client/src/providers/Web3Provider.tsx

Co-authored-by: гλ <contact@rudiyardley.com>

* fix: emit correct timestamp

* Update EVM Test

* Formatting

---------

Co-authored-by: гλ <contact@rudiyardley.com>
@ryardley

Copy link
Copy Markdown
Contributor Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented May 19, 2025

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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: 4

🧹 Nitpick comments (8)
.github/workflows/rust-ci.yml (1)

6-8: Consider centralizing branch triggers.

To reduce duplication across multiple workflow files, use YAML anchors or a reusable workflow to define the branches list (e.g., main and hacknet) in one place. This makes future additions or removals simpler and less error-prone.

.github/workflows/crisp-e2e.yaml (1)

6-9: Push trigger expanded to main and hacknet
Broadening the push event to include both main and the new hacknet branch aligns perfectly with the Phase 0 workflow.

Once the hackathon stabilizes, you may consider adding path filters (e.g., examples/CRISP/**) or branch patterns to avoid unnecessary runs and speed up CI.

examples/CRISP/apps/program/host/README.md (1)

3-3: Nit: Clarify Description Sentence.

Consider rephrasing for readability:

- Exposes a function to run the computation found in `voting-core::fhe_processor` whilst also generating a risc0 proof assuming `risc0_dev_mode` is _not_ set.
+ Exposes a function to run the computation in `voting-core::fhe_processor` and generates a RISC0 proof when the `risc0_dev_mode` flag is not set.
examples/CRISP/apps/server/src/server/blockchain/handlers.rs (2)

26-32: Avoid repeated EnclaveContract::new instantiation – extract a helper

The three-argument constructor is now invoked in almost every handler and CLI command. Building a new provider + signer stack for each call incurs network I/O (chain-ID discovery, nonce query, etc.) and allocates fresh objects that can’t benefit from connection pooling.

Consider adding a small factory/helper in server::blockchain:

pub async fn enclave_contract() -> Result<EnclaveContract> {
    EnclaveContract::new(
        &CONFIG.http_rpc_url,
        &CONFIG.private_key,
        &CONFIG.enclave_address,
    )
    .await
}

Then call let contract = enclave_contract().await?;.

This keeps the call-sites concise, centralises error handling, and allows you later to add caching or retry logic in one place.


38-39: Shadowing two different expiration variables is error-prone

expiration is first a u64 Unix timestamp, then re-declared as an Instant.
While legal, it hurts readability and invites bugs if the wrong one is used.

-    let expiration =  e3_activated.expiration.to::<u64>();
+    let expiration_ts = e3_activated.expiration.to::<u64>();-    let expiration = Instant::now()
-        + (UNIX_EPOCH + Duration::from_secs(expiration))
+    let expiration_instant = Instant::now()
+        + (UNIX_EPOCH + Duration::from_secs(expiration_ts))-    sleep_until(expiration).await;
+    sleep_until(expiration_instant).await;

Clear names (*_ts, *_instant) make the intent unambiguous.

Also applies to: 82-85, 90-91

packages/enclave-sdk-isomorphic/Cargo.toml (1)

16-19: Feature matrix clarification

default = ["host"] pulls in alloy/full, which in turn re-enables most of Alloy’s default features and dependencies (tokio, reqwest, etc.). If the WASM guest side is intended to compile with the default feature set turned off, consider:

[features]
default = []
host     = ["alloy/full"]
guest    = ["alloy/dyn-abi", "alloy/rlp", "alloy/serde"]

Downstream crates can then opt-in explicitly (features=["host"]).
Otherwise, building for the guest without --no-default-features will fail.

examples/CRISP/apps/server/src/cli/commands.rs (2)

9-13: TODO still present – consolidate configuration before GA

CONFIG (CLI) and SERVER_CONFIG (server) hold overlapping fields; this duplication has already caused an incorrect URL in decrypt_and_publish_result (uses CONFIG.enclave_address).
Before the hackathon ends, merge them into a single source of truth (e.g., crisp::config) or introduce a trait/struct that both CLI and server load.


50-56: Contract-creation boilerplate repeated 4×

Same recommendation as for handlers.rs: wrap the three-parameter call in a small async helper to DRY up the CLI code.

async fn contract() -> anyhow::Result<EnclaveContract> {
    EnclaveContract::new(
        &SERVER_CONFIG.http_rpc_url,
        &SERVER_CONFIG.private_key,
        &SERVER_CONFIG.enclave_address,
    )
    .await
}

Besides readability, this will make it trivial to inject mocks in unit tests.

Also applies to: 111-117, 161-167, 208-214

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 465edfc and 6d4ae79.

⛔ Files ignored due to path filters (9)
  • examples/CRISP/apps/program/Cargo.lock is excluded by !**/*.lock
  • examples/CRISP/apps/program/core/Cargo.lock is excluded by !**/*.lock
  • examples/CRISP/apps/program/host/Cargo.lock is excluded by !**/*.lock
  • examples/CRISP/apps/program/methods/guest/Cargo.lock is excluded by !**/*.lock
  • examples/CRISP/apps/server/Cargo.lock is excluded by !**/*.lock
  • examples/CRISP/apps/wasm-crypto/Cargo.lock is excluded by !**/*.lock
  • packages/ciphernode/Cargo.lock is excluded by !**/*.lock
  • packages/enclave-sdk-isomorphic/Cargo.lock is excluded by !**/*.lock
  • packages/enclave-sdk/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (41)
  • .deleteme (1 hunks)
  • .github/workflows/ci.yml (1 hunks)
  • .github/workflows/crisp-e2e.yaml (1 hunks)
  • .github/workflows/ec2-deployment.yml (1 hunks)
  • .github/workflows/integration.yml (1 hunks)
  • .github/workflows/rust-ci.yml (1 hunks)
  • examples/CRISP/apps/client/src/providers/Web3Provider.tsx (1 hunks)
  • examples/CRISP/apps/program/Cargo.toml (1 hunks)
  • examples/CRISP/apps/program/README.md (1 hunks)
  • examples/CRISP/apps/program/app/Cargo.toml (1 hunks)
  • examples/CRISP/apps/program/app/src/main.rs (1 hunks)
  • examples/CRISP/apps/program/core/Cargo.toml (1 hunks)
  • examples/CRISP/apps/program/core/src/lib.rs (1 hunks)
  • examples/CRISP/apps/program/host/README.md (1 hunks)
  • examples/CRISP/apps/server/Cargo.toml (2 hunks)
  • examples/CRISP/apps/server/src/cli/commands.rs (5 hunks)
  • examples/CRISP/apps/server/src/server/blockchain/handlers.rs (7 hunks)
  • examples/CRISP/apps/server/src/server/blockchain/mod.rs (0 hunks)
  • examples/CRISP/apps/server/src/server/blockchain/sync.rs (2 hunks)
  • examples/CRISP/apps/server/src/server/mod.rs (1 hunks)
  • examples/CRISP/apps/server/src/server/routes/rounds.rs (2 hunks)
  • examples/CRISP/apps/server/src/server/routes/voting.rs (2 hunks)
  • examples/CRISP/apps/wasm-crypto/Cargo.toml (2 hunks)
  • examples/CRISP/apps/wasm-crypto/src/lib.rs (1 hunks)
  • packages/ciphernode/Cargo.toml (1 hunks)
  • packages/ciphernode/Dockerfile (1 hunks)
  • packages/ciphernode/fhe/Cargo.toml (1 hunks)
  • packages/ciphernode/fhe/src/utils.rs (1 hunks)
  • packages/ciphernode/test_helpers/Cargo.toml (1 hunks)
  • packages/ciphernode/test_helpers/src/bin/fake_encrypt.rs (1 hunks)
  • packages/ciphernode/test_helpers/src/bin/pack_e3_params.rs (1 hunks)
  • packages/ciphernode/tests/Cargo.toml (1 hunks)
  • packages/ciphernode/tests/tests/test_aggregation_and_decryption.rs (1 hunks)
  • packages/enclave-sdk-isomorphic/Cargo.toml (1 hunks)
  • packages/enclave-sdk/Cargo.toml (1 hunks)
  • packages/enclave-sdk/src/evm/contracts.rs (2 hunks)
  • packages/enclave-sdk/src/evm/mod.rs (1 hunks)
  • packages/enclave-sdk/src/lib.rs (1 hunks)
  • packages/evm/contracts/Enclave.sol (1 hunks)
  • packages/evm/deployments/sepolia/NaiveRegistryFilter.json (2 hunks)
  • packages/evm/test/Enclave.spec.ts (2 hunks)
💤 Files with no reviewable changes (1)
  • examples/CRISP/apps/server/src/server/blockchain/mod.rs
🧰 Additional context used
🧬 Code Graph Analysis (5)
packages/ciphernode/test_helpers/src/bin/fake_encrypt.rs (1)
packages/enclave-sdk-isomorphic/src/bfv/mod.rs (1)
  • build_bfv_params_arc (68-82)
examples/CRISP/apps/program/core/src/lib.rs (1)
packages/enclave-sdk-isomorphic/src/bfv/mod.rs (1)
  • deserialize_bfv_params_arc (120-122)
packages/ciphernode/test_helpers/src/bin/pack_e3_params.rs (1)
packages/enclave-sdk-isomorphic/src/bfv/mod.rs (2)
  • build_bfv_params_arc (68-82)
  • encode_bfv_params (152-154)
packages/ciphernode/fhe/src/utils.rs (1)
packages/enclave-sdk-isomorphic/src/bfv/mod.rs (1)
  • build_bfv_params_arc (68-82)
examples/CRISP/apps/wasm-crypto/src/lib.rs (1)
packages/enclave-sdk-isomorphic/src/bfv/mod.rs (1)
  • build_bfv_params_arc (68-82)
🔇 Additional comments (42)
.github/workflows/rust-ci.yml (1)

7-8: Branch trigger updated to include hacknet.

The CI workflow will now run on pushes to the hacknet branch alongside main, satisfying the hackathon integration objective.

.github/workflows/ci.yml (1)

22-23: Include hacknet in push triggers.

The CI workflow will now run on push events to the hacknet branch as well as main, ensuring EVM CI coverage for hacknet development.

.github/workflows/integration.yml (1)

12-13: Trigger integration workflow on hacknet.

Adding hacknet under branches for the push event aligns integration testing with the hackathon branch.

.github/workflows/ec2-deployment.yml (2)

5-7: Add hacknet to deployment push triggers.

Including the hacknet branch here ensures Docker images are built and pushed whenever hacknet code under the specified paths changes.


13-15: Add hacknet to deployment PR triggers.

By adding hacknet under pull_request branches, pull requests against hacknet will also validate the build and deployment pipeline.

.github/workflows/crisp-e2e.yaml (1)

4-4: Good addition of manual trigger
Including workflow_dispatch enables on-demand runs of the E2E suite, which is especially useful during a hackathon for quick validations without needing new commits.

examples/CRISP/apps/program/core/src/lib.rs (1)

2-2:

Details

✅ Verification successful

Ensure dependency alignment with new import
The deserialize_bfv_params_arc import now points to enclave_sdk_isomorphic::bfv. Confirm that the enclave-sdk-isomorphic crate is declared in examples/CRISP/apps/program/core/Cargo.toml (with correct version/features) to avoid build errors.


🏁 Script executed:

#!/bin/bash
# Verify that enclave-sdk-isomorphic is added as a dependency
grep -R "^enclave-sdk-isomorphic" -n examples/CRISP/apps/program/core/Cargo.toml

Length of output: 218


Dependency Verified
The enclave-sdk-isomorphic crate is declared in examples/CRISP/apps/program/core/Cargo.toml (line 10) with

default-features = false
features = ["guest"]

This satisfies the deserialize_bfv_params_arc import—no further changes required.

packages/ciphernode/test_helpers/src/bin/pack_e3_params.rs (1)

2-2: Import paths updated correctly
Switching to enclave_sdk_isomorphic::bfv::{build_bfv_params_arc, encode_bfv_params} aligns with the new SDK package and matches the updated crate dependencies.

packages/ciphernode/test_helpers/src/bin/fake_encrypt.rs (1)

3-3: Import path adjustment is correct
Replacing commons::bfv with enclave_sdk_isomorphic::bfv (including the params::SET_2048_1032193_1 constant) is consistent with the refactoring.

examples/CRISP/apps/program/Cargo.toml (1)

3-3: Workspace members updated
Adding "app" to the members list correctly includes the new app crate under examples/CRISP/apps/program/app.

packages/ciphernode/test_helpers/Cargo.toml (1)

17-17: Dependency switched to enclave-sdk-isomorphic
The commons path dependency has been replaced with enclave-sdk-isomorphic = { path = "../../enclave-sdk-isomorphic" }, aligning the test helper crate with the new SDK.

packages/ciphernode/fhe/Cargo.toml (1)

21-21: Dependency Addition: Add enclave-sdk-isomorphic.

You’ve introduced a new path dependency on enclave-sdk-isomorphic for BFV utilities. The relative path (../../enclave-sdk-isomorphic) looks correct from packages/ciphernode/fhe. Verify that this crate is part of the root workspace (if you want unified versioning) and that its Cargo.toml name field matches the import (enclave_sdk_isomorphic).

packages/ciphernode/fhe/src/utils.rs (1)

2-2: Import Path Updated for BFV Parameters Builder.

The import of build_bfv_params_arc now correctly references enclave_sdk_isomorphic::bfv instead of the old commons crate. This change preserves the existing API surface and should be low-risk.

examples/CRISP/apps/wasm-crypto/src/lib.rs (1)

5-5:

Details

✅ Verification successful

Align BFV Imports with New Crate.

You’ve updated the imports for build_bfv_params_arc and SET_2048_1032193_1 to point at enclave_sdk_isomorphic::bfv. Ensure that the params submodule publicly re-exports SET_2048_1032193_1 as expected.

Run this to confirm:


🏁 Script executed:

#!/bin/bash
grep -R "pub const SET_2048_1032193_1" -n packages/enclave-sdk-isomorphic/src/bfv/params.rs

Length of output: 176


🏁 Script executed:

#!/bin/bash
set -e
# Search for the definition of SET_2048_1032193_1 across the repository
rg -n "pub const SET_2048_1032193_1"

Length of output: 158


🏁 Script executed:

#!/bin/bash
set -e
echo "=== Files and directories in bfv module ==="
find packages/enclave-sdk-isomorphic/src/bfv -maxdepth 1 -printf "%f\n"

echo -e "\n=== Top of bfv/mod.rs ==="
head -n 200 packages/enclave-sdk-isomorphic/src/bfv/mod.rs

Length of output: 6324


🏁 Script executed:

#!/bin/bash
set -e
echo "=== Root files in packages/enclave-sdk-isomorphic/src ==="
find packages/enclave-sdk-isomorphic/src -maxdepth 1 -type f -printf "%f\n"

echo -e "\n=== Checking for 'pub mod bfv' in lib.rs ==="
grep -n "pub mod bfv" -n packages/enclave-sdk-isomorphic/src/lib.rs || echo "No 'pub mod bfv' found in lib.rs"

Length of output: 414


✅ BFV Imports Are Correct

The enclave_sdk_isomorphic::bfv::params module publicly defines SET_2048_1032193_1, and build_bfv_params_arc is exposed in the bfv module. Your import in examples/CRISP/apps/wasm-crypto/src/lib.rs is valid—no further changes required.

examples/CRISP/apps/program/host/README.md (1)

1-1: Header Looks Good.

The section title # Risc0 Host is clear and consistent with other READMEs.

packages/ciphernode/Cargo.toml (1)

47-47:

Details

❓ Verification inconclusive

Crate Version Bump: alloy = "0.8.3".

The update to alloy = "0.8.3" (with node-bindings and full) matches related packages. Please run the ciphernode integration tests to catch any regressions from this version bump.


🏁 Script executed:

#!/bin/bash
# Verify ciphernode builds and tests pass after bump
cargo test -p ciphernode -- --nocapture

Length of output: 137


ACTION REQUIRED: Manually run ciphernode tests after bumping alloy to 0.8.3

The alloy dependency in packages/ciphernode/Cargo.toml (line 47) was updated to:

alloy = { version = "0.8.3", features = ["node-bindings", "full"] }

Please verify there are no regressions by running the integration tests locally:

cd packages/ciphernode
cargo test -p ciphernode -- --nocapture
packages/ciphernode/tests/Cargo.toml (1)

33-33:

Details

❌ Incorrect review comment

Ensure workspace includes the new crate
Confirm that enclave-sdk-isomorphic is declared in the root Cargo workspace (members) so that this path dependency is recognized during builds.


🏁 Script executed:

#!/bin/bash
# Check if the root workspace contains enclave-sdk-isomorphic
grep -R "enclave-sdk-isomorphic" Cargo.toml

Length of output: 87


🏁 Script executed:

#!/bin/bash
# List all Cargo.toml manifests in the repo (up to depth 3)
echo "=== Found Cargo.toml files ==="
find . -maxdepth 3 -type f -name Cargo.toml

# Identify which one defines the workspace
echo -e "\n=== Workspace declarations ==="
grep -R "\[workspace\]" -n .

# If a workspace file is found, show its members block for inspection
WS_FILE=$(grep -R "\[workspace\]" -l . | head -n1)
if [ -n "$WS_FILE" ]; then
  echo -e "\n=== members in $WS_FILE ==="
  sed -n '/members = \[/,/\]/p' "$WS_FILE"
else
  echo -e "\nNo workspace manifest detected."
fi

Length of output: 973


#!/bin/bash
# Inspect workspace members in packages/ciphernode/Cargo.toml
echo "=== packages/ciphernode/Cargo.toml ==="
sed -n '1,200p' packages/ciphernode/Cargo.toml

echo -e "\n=== members block ==="
grep -n 'members' -n packages/ciphernode/Cargo.toml -A 20 | sed -n '/members = \[/,/\]/p'

No root Cargo workspace detected
I didn’t find a Cargo.toml at the repository root declaring a [workspace], so there’s no workspace to update. The explicit path dependency in packages/ciphernode/tests/Cargo.toml will still be resolved by Cargo without needing to list it as a workspace member. If you do want a unified workspace, you’ll need to add a root Cargo.toml with a [workspace] members = […] block; otherwise, this review comment can be ignored.

Likely an incorrect or invalid review comment.

packages/ciphernode/tests/tests/test_aggregation_and_decryption.rs (1)

9-9: Approve import path update
The import of SET_2048_1032193_1 from enclave_sdk_isomorphic::bfv::params correctly reflects the new crate structure and naming conventions.

examples/CRISP/apps/program/app/Cargo.toml (1)

1-7: Initial Cargo.toml for app package looks correct
Defining name, version.workspace, and edition.workspace without external dependencies is acceptable for a minimal example.

packages/enclave-sdk/src/lib.rs (1)

1-1: Expose evm module in public API
Adding pub mod evm; correctly integrates the new EVM submodule into the SDK's public interface.

packages/ciphernode/Dockerfile (1)

46-48:

Details

❌ Incorrect review comment

Verify Docker COPY paths for new SDK crates
Ensure that these COPY instructions place enclave-sdk and enclave-sdk-isomorphic at the exact relative paths expected by the ciphernode crate’s Cargo.toml. Otherwise, the build may fail due to missing dependencies.


🏁 Script executed:

#!/bin/bash
# Verify that ciphernode’s path dependencies match the copied directories
grep -R 'path *= *"../enclave-sdk"' packages/ciphernode/Cargo.toml
grep -R 'path *= *"../enclave-sdk-isomorphic"' packages/ciphernode/Cargo.toml

Length of output: 148


🏁 Script executed:

#!/bin/bash
# Show any enclave-related dependencies and path entries in ciphernode's Cargo.toml
grep -n 'enclave' -n packages/ciphernode/Cargo.toml || true
grep -n 'path' -n packages/ciphernode/Cargo.toml || true

Length of output: 839


No path dependencies for enclave-sdk in ciphernode crate
The packages/ciphernode/Cargo.toml does not reference enclave-sdk or enclave-sdk-isomorphic, so these COPY steps appear redundant. Please confirm whether you actually need to bundle those packages in this image; if not, remove lines 46–48 from packages/ciphernode/Dockerfile:

- COPY ./packages/enclave-sdk ../enclave-sdk
- COPY ./packages/enclave-sdk-isomorphic ../enclave-sdk-isomorphic

Likely an incorrect or invalid review comment.

packages/enclave-sdk/src/evm/mod.rs (1)

1-1: Well-structured module organization

Adding a public contracts module aligns with good software architecture principles. This change helps organize contract-related code and makes the interface more explicit by moving away from global configuration to parameter-based initialization.

examples/CRISP/apps/wasm-crypto/Cargo.toml (2)

19-19: Appropriate dependency replacement

Replacing the commons package with enclave-sdk-isomorphic aligns with the broader refactoring effort across the codebase for better modularization.


33-33: LGTM: Proper crate type configuration for WASM

The cdylib and rlib crate types are appropriate for a WASM library, allowing both dynamic linking (for web use) and static linking (for testing and integration).

examples/CRISP/apps/server/src/server/mod.rs (1)

2-2: Good modularization by exposing the config module

Making the config module public is appropriate as it supports the architectural changes where configuration is centralized and accessed throughout the server codebase. This enables more consistent configuration management for blockchain contract interactions and other server functionalities.

examples/CRISP/apps/program/core/Cargo.toml (1)

10-10: Dependency migration to new SDK structure - LGTM

This change replaces the previous commons dependency with the new enclave-sdk-isomorphic package, aligning with the broader refactoring initiative. The path looks correct and the feature selection (disabling defaults, enabling only "guest") is appropriate for this module.

examples/CRISP/apps/server/Cargo.toml (2)

29-29: Minor version bump for alloy - LGTM

Updating from 0.8 to 0.8.3 is a patch version upgrade that likely includes bug fixes or minor improvements while maintaining API compatibility.


40-41: SDK structure reorganization - LGTM

Replacing the commons dependency with separate enclave-sdk and enclave-sdk-isomorphic packages aligns with the broader architectural refactoring to improve modularity. The paths are correct for the new package structure.

packages/evm/contracts/Enclave.sol (1)

202-206: Improved code clarity with local variable - LGTM

This refactoring introduces a local variable expiresAt to store the expiration timestamp before assigning it to state and using it in the event emission. This improves readability and reduces the risk of inconsistencies if future modifications are needed.

examples/CRISP/apps/server/src/server/routes/voting.rs (1)

1-14: Updated imports for centralized contract interactions - LGTM

Reorganizing imports to use enclave_sdk::evm::contracts::EnclaveContract instead of a local module aligns with the broader refactoring initiative to centralize contract interactions.

examples/CRISP/apps/server/src/server/blockchain/sync.rs (1)

14-14: Import path updated as part of SDK restructuring

The import path for EnclaveContract and E3 as ContractE3 has been updated from the local super::relayer module to the external enclave_sdk::evm::contracts crate path. This is consistent with the codebase-wide migration from the local commons crate to the new enclave-sdk structure.

examples/CRISP/apps/client/src/providers/Web3Provider.tsx (1)

26-32: Improved network configuration for different environments

The updated options configuration now explicitly sets the initial chain ID for different environments:

  • Development: initialChainId: 0 to prevent automatic network switching during testing
  • Production: initialChainId: sepolia.id to ensure connection to the Sepolia network

This change improves the consistency of network connections across environments.

packages/enclave-sdk/Cargo.toml (2)

8-12:

Details

✅ Verification successful

Dependencies updated and expanded

The dependencies have been reorganized and expanded with:

  • Explicit versioning for anyhow (1.0.86)
  • Addition of alloy with features for EVM interaction
  • Addition of eyre for error handling

These changes support the new SDK structure and blockchain interaction capabilities.


🏁 Script executed:

#!/bin/bash
# Check for version consistency of the alloy package across the project
rg "alloy = \{" --type toml

Length of output: 741


Approve dependency updates – versions are consistent across the workspace

The dependency block in packages/enclave-sdk/Cargo.toml has been updated as follows:

  • anyhow = "1.0.86" (explicit pin)
  • fhe-traits and fhe_rs pulled from the feature/greco-integration branch
  • alloy = "0.8.3" with ["full", "rpc-types-eth"]
  • eyre = "0.6.12"

Verification confirms that alloy = "0.8.3" is used uniformly in all relevant Cargo.toml files (enclave-sdk, ciphernode, examples), and other crates either refer to it via the workspace. No inconsistencies found. Ready to merge.


2-2:

Details

✅ Verification successful

Package renamed from "commons" to "enclave-sdk"

This rename is part of the broader architectural restructuring of the SDK components. Ensure that all imports across the codebase have been updated to use the new package name.


🏁 Script executed:

#!/bin/bash
# Check if there are any remaining references to the old "commons" package
rg "use commons" --type rust

Length of output: 30


I’ll perform a broader search for any lingering “commons” references across all files to be certain.

#!/bin/bash
# Search for any references to "commons" in the entire codebase
rg "commons" -n

I’ll perform a comprehensive search for any remaining “commons” references across all files.


🏁 Script executed:

#!/bin/bash
# Search for any occurrences of "commons" in code and manifests
rg "commons" -n

Length of output: 15


All references to commons have been removed
No occurrences of “commons” were found across the codebase. The rename to enclave-sdk is complete and all imports have been updated.

examples/CRISP/apps/server/src/server/routes/rounds.rs (2)

10-11: Updated import paths for SDK restructuring

The imports have been updated to use the new package structure:

  • commons::bfvenclave_sdk_isomorphic::bfv
  • Local module → enclave_sdk::evm::contracts for EnclaveContract

This change is consistent with the codebase-wide migration to the new enclave-sdk architecture.


118-123: Contract initialization updated to use explicit configuration

Similar to the changes in the sync.rs file, the EnclaveContract initialization has been updated to use the new three-parameter async constructor that takes explicit HTTP RPC URL, private key, and enclave address from the server configuration. This makes the contract configuration more explicit and maintainable.

packages/evm/test/Enclave.spec.ts (1)

830-830: Test updated to accommodate contract implementation changes

The test for E3Activated event has been relaxed to use anyValue for the second argument instead of asserting a specific value for expiration. This aligns with the refactoring in the Enclave contract where expiration timestamp handling was modified.

packages/evm/deployments/sepolia/NaiveRegistryFilter.json (1)

2-2: Updated deployment metadata for NaiveRegistryFilter contract

This reflects a new deployment of the NaiveRegistryFilter contract on Sepolia (increasing deployment count from 2 to 3). The contract address, transaction hash, block details, and registry address have all been updated accordingly.

Also applies to: 300-304, 307-309, 312-315, 322-323, 326-328, 334-335, 338-339, 345-345, 347-347

examples/CRISP/apps/program/README.md (1)

1-31: Clear documentation of the Program component architecture

The README provides a succinct overview of the Program component's responsibilities and includes a helpful Mermaid diagram illustrating its role in the system architecture. This documentation clearly explains how this component interacts with the blockchain, RISC-0 computations, and event persistence - making it easier for developers to understand the system design.

packages/enclave-sdk/src/evm/contracts.rs (2)

54-54: Improved API design with explicit configuration parameters

The EnclaveContract::new constructor has been refactored to accept explicit parameters (http_rpc_url, private_key, and contract_address) instead of relying on a global configuration object. This change:

  1. Makes the contract initialization more explicit and customizable
  2. Removes global state dependencies
  3. Allows multiple contract instances to connect to different chains or with different credentials

The CRISPProvider type alias is now public to support this improved interface.

Also applies to: 73-84


73-90:

Details

✅ Verification successful

Verify that error handling is sufficient for the new constructor

While the refactoring improves the API design, ensure that consumer code properly handles potential errors from parsing the private key or contract address strings.


🏁 Script executed:

#!/bin/bash
# Check how the EnclaveContract is instantiated and error handling in consumer code

# Look for instances of EnclaveContract::new being called
rg -A 5 "EnclaveContract::new" --type rust

Length of output: 5094


Error handling for EnclaveContract::new is already in place
All usages in the examples (e.g., commands.rs, routes/*.rs, blockchain/*.rs) invoke

EnclaveContract::new(...).await?;

which propagates any parse errors for the private key or contract address. No additional error‐handling changes are needed.

examples/CRISP/apps/server/src/server/blockchain/handlers.rs (1)

132-133: Possible lost status update when vote_count == 0

e3.status is set to "Finished" and the updated object is re-inserted, but the earlier call to update_e3_status already wrote "Expired".
At high concurrency another task might have modified the record between these two operations, and this blind overwrite would silently drop those changes.

If the only field changing here is status, prefer calling the dedicated helper again (update_e3_status(e3_id, "Finished").await?) or using GLOBAL_DB.update_if/GLOBAL_DB.cas (compare-and-swap) if available to avoid a race.

Comment thread .deleteme Outdated
Comment thread examples/CRISP/apps/program/app/src/main.rs Outdated
Comment thread examples/CRISP/apps/server/src/server/routes/voting.rs Outdated
Comment thread examples/CRISP/apps/server/src/server/blockchain/sync.rs Outdated
ryardley and others added 24 commits June 18, 2025 16:28
* Fix version

* Update lockfile
* Fix submodules

* Add gitignore

* Update gitignore

* Update support build

* Update control scripts to use enclave rev

* revertme

* Coordinate github build

* Add comment

* Add support build

* Add feature to avoid risc0 compilation

* Update scripts and caches

* Add support ctl

* Add simple test to program

* Update dockerignore

* Try alter dockerignore

* Add shell functionality

* Add fixtures

* Update curl test

* Move to root support curl_test

* Use correct fixtures path

* Update risc0 in Dockerfile

* Fix wrong version

* Update docker build script

* Update pnpm lock

* Add ImageID to workspace template gitignore

* Update gitignore

* Ensure we are running in dev mode
Attempt to use the branch commit
* attempts to fix docker support image tags

* attempts to fix docker support image tags pt2
* Clean up when things go wrong

* Update deps

* Accommodate macOs

* Remove bail

* Detect bsd sed

* Add comments

* Add logging
* Copy and mkdirp passes

* File filtering works

* Incorporate fs copy

* Fix sed issue

* Update Dockerfiles

* Unnecessary clone
* Use host-gateway to enable cross platform callback networking

* Listen on ipv4

* Add comment
* Add enclave purge

* Remove redundant file

* Make it explicit which package we are calling

* Update cli structure
* Rollback metamask version

* Fix Computation Flow

* Start Script

* Tutorial

* Crisp Updates

* Remove takeaways

* fix lockfile merge

---------

Co-authored-by: гλ <contact@rudiyardley.com>
Update Dockerfile

Add Missing Packages

Use Correct Addresses
* Build sdk package so that hardhat uses a separate tsconfig

* Linting

* Linting

* Update moduleResolution

* Update packages

* Ensure that LSP can respect the correct tsconfig

* Tidy up eslint

* Tidy up eslint

* Add package to Dockerfile

* Fix up issues with docker build for ciphernodes

* Update Dockerfile

* Fix up warnings

* Linting

* Fix warnings

* Update viem dependency

* Get test to pass

* Add rust to workflow

* Add compiling sdk and lwasm to be part of the build process

* Add wasm-pack

* Install with wasm

* Rename

* Fix pnpm version

* Test template integration

* update names

* Lowercase

* Actually fail when failing

* Use lines

* Build sdk before testing

* linting

* linting

* Add submodules to template

* Add submodules recursive to template

* Add permissions to folders

* Ensure ImageID.sol is writable

* Attempt to open up permissions on ImageID.sol

* Attempt to open up permissions on ImageID.sol
* Add e3-program-server

* Add package to Dockerfiles

* Provide strategy

* Tidy up support code

* Create cargo project

* Fix bad cargo toml

* Update

* Use json feature

* Update ref

* Update ref

* update to rev

* Update script

* udpate dependency

* update script

* Fix script

* Fix script

* Update all commits

* Update e3 program server

* Update e3 program server

* Update rev pin

* Dont need scriptdir

* Get init to copy dev folder

* Update scripts

* Update config

* update rev

* Fix test

* Fix config parsing

* Fix up script

* Remove redundant CI steps

* Add signal file to get correct script ordering

* Update scripts

* Ensure no callback_url_rewrite

* Add debugging

* Update support rev

* Remove logging

* Update revs

* Update actions

* Update actions

* add target to cache

* Disable all actions

* Attempt at paralellization

* Remove compilation from test

* Tidy up caching

* Use 1.85.1

* Use installed enclave for integration test

* Refactor to include integration

* Ensure folders are downloaded

* Use whole target folder

* Update fns

* Add target folder

* Update caches

* Fix waitons

* Incorporate other tests into ci yaml

* use ci name so it is rquired
* Replace old references

* Update lock

* Fix up build

* Fix import issues

* --wip-- [skip ci]

* Fix filter ethers naming conflict

* linting

* use tsx instead of ts-node

* Update bundle settings

* Use universal wasm

* Update client

* Remove from cargo workspace

* Remove wasm build stage from client

* Fix bad path

* Use tsup to solve bundling issues

* Add packages to Dockerfile

* Use build instead of just evm:build

* Remove redundant stage and add enclave-sdk dist folder

* Build SDK instead of everything

* update dependencies

* make config a module

* Add script to prebuild

* Incorporate tsup into @gnosis-guild/enclave

* Update linting

* Remove redundant comments

* Tidy up scripts

* Remove redundant file

* Fix bad task name

* Ensure types are created first

* update external list

* Remove redundant file

* Add documentation

* Add docs for wasm usage

* Readme formatting

* Fix spacing
* Add test for enclave init

* Name tasks appropriately

* Exit with code 1

* Add sdk package to init

* Add pnpm

* Add version

* Wrong position

* Add version to all packages

* Update release

* Update version

* Make packages public

* Add typechain as dependency to compiling ts

* Remove incorrect dependency

* Remove pnpm lock

* Add current branch in init test

* Use the sha

* Calculate branch
@ryardley

Copy link
Copy Markdown
Contributor Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Jul 21, 2025

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

0xjei
0xjei previously approved these changes Jul 21, 2025
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.

4 participants