Skip to content

feat: trbfv integration test [skip-line-limit]#969

Merged
ryardley merged 67 commits into
devfrom
ry/785-integration
Nov 8, 2025
Merged

feat: trbfv integration test [skip-line-limit]#969
ryardley merged 67 commits into
devfrom
ry/785-integration

Conversation

@ryardley

@ryardley ryardley commented Nov 5, 2025

Copy link
Copy Markdown
Contributor

Closes: #785

  • Added experimental TrBFV (threshold BFV) support across the codebase with --experimental-trbfv flag
  • Update document publisher system for sharing threshold shares via Kademlia DHT
  • EventConverter to handle ThresholdShareCreated ↔ DocumentReceived conversions
  • Updated BFV helpers with utility functions for encoding/decoding plaintexts and Vec
  • Increased default Kademlia payload size to 10MB and gossip message size to 700KB
  • Updated CRISP example to use 5 ciphernodes with 2-of-5 threshold
  • Added retry utilities moved from net crate to utils crate
  • Fixed various test configurations to support larger ciphertext arrays
  • Added proper e3_id logging throughout for better debugging
  • Updated integration tests with new BFV parameters for threshold mode
  • NetEventTranslator::setup_with_interface now returns a tuple with optional DocumentPublisher
  • Some encrypt functions now handle Vec<Vec> instead of Vec

Summary by CodeRabbit

  • New Features

    • Experimental TRBFV mode with a global CLI flag and a CLI command to check E3 activation (prints E3 ID).
    • Optional document-publisher bridge to convert threshold-share and document events.
    • E3 activation accepts a public-key file.
  • Improvements

    • Default document expiry set to 30 days.
    • E3 defaults updated: threshold_min=2, threshold_max=5.
    • Startup flows now surface generated E3 IDs.
  • Bug Fixes

    • Ignore irrelevant decryption-share events to reduce noisy processing.
  • Tests / Examples

    • E2E tests, examples, and dev scripts updated for TRBFV, public-key-file flow, and new nodes.

@vercel

vercel Bot commented Nov 5, 2025

Copy link
Copy Markdown

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

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
crisp Skipped Skipped Nov 8, 2025 2:19am
enclave-docs Skipped Skipped Nov 8, 2025 2:19am

@coderabbitai

coderabbitai Bot commented Nov 5, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Add an experimental_trbfv feature flag propagated from CLI through entrypoint/startup to network; introduce TRBFV builder paths, BFV encode/decode helpers and multi-moduli typing; add EventConverter/DocumentPublisher to translate threshold shares ↔ publish events; update net/kad/gossip configs, tests, scripts, templates, and contract deployment artifacts.

Changes

Cohort / File(s) Summary
CLI flag propagation
crates/cli/src/cli.rs, crates/cli/src/start.rs, crates/cli/src/nodes.rs, crates/cli/src/nodes_up.rs, crates/cli/src/nodes_daemon.rs
Replace hidden Option<String> with experimental_trbfv: bool and thread the flag through start/nodes/up/daemon call sites.
Entrypoint / startup builders
crates/entrypoint/src/start/start.rs, crates/entrypoint/src/start/aggregator_start.rs
Defer builder.build(), choose TRBFV-specific builder methods (with_trbfv / with_threshold_plaintext_aggregation) when flag true, and pass flag into NetEventTranslator setup.
Node launch param propagation
crates/entrypoint/src/nodes/up.rs, crates/entrypoint/src/nodes/daemon.rs
Add experimental_trbfv: bool param; append --experimental-trbfv to enclave args when true.
Aggregator guard
crates/aggregator/src/threshold_plaintext_aggregator.rs
Import tracing::debug and early-return with debug log in DecryptionshareCreated handler when state != Collecting.
Event conversion & document publishing
crates/net/src/document_publisher.rs, crates/net/src/events.rs
Add EventConverter to convert ThresholdShareCreatedPublishDocumentRequested/DocumentReceived, add ReceivableDocument helpers, KADEMLIA_TIMEOUT constants, wire converter into DocumentPublisher lifecycle; minor event API helpers added.
Net translator & interface changes
crates/net/src/net_event_translator.rs, crates/net/src/net_interface.rs, crates/net/src/lib.rs, crates/net/src/dialer.rs
NetEventTranslator::setup now borrows bus & accepts &Arc<Receiver>; setup_with_interface accepts experimental_trbfv and returns Option<Addr<DocumentPublisher>>; Kademlia/Gossipsub configs and limits added; retry utilities moved to e3_utils; removed forwarding of ThresholdShareCreated.
Document meta & events
crates/events/src/enclave_event/publish_document/mod.rs, crates/events/src/enclave_event/threshold_share_created.rs
DocumentMeta.expires_at becomes Option<DateTime<Utc>> with 30-day default; PublishDocumentRequested::new added; ThresholdShareCreated gains pub external: bool.
BFV helpers & plaintext utils
crates/bfv-helpers/Cargo.toml, crates/bfv-helpers/src/lib.rs, crates/bfv-helpers/src/client.rs, crates/fhe/src/fhe.rs, crates/trbfv/src/calculate_threshold_decryption.rs, crates/keyshare/src/threshold_keyshare.rs
Add thiserror dep; introduce Error type and helpers decode_plaintext_to_vec_u64, encode_vec_u64_to_bytes, decode_bytes_to_vec_u64 (note: duplicated defs present); change BFV moduli parameter types (slices / Vec<u64>), replace manual decode/encode calls with helpers; set external: false when constructing ThresholdShare.
WASM & SDK moduli / TRBFV
crates/wasm/src/lib.rs, packages/enclave-sdk/src/types.ts, packages/enclave-sdk/src/utils.ts, packages/enclave-sdk/src/enclave-sdk.ts
Expose BFV moduli as Vec<u64> for wasm functions; add TRBFV protocol and BFV_THRESHOLD/SET_8192_1000_4 parameter set; wrap moduli with BigUint64Array for wasm calls.
EVM / contracts
crates/evm-helpers/src/contracts.rs, crates/evm/src/enclave_sol_reader.rs
EnclaveWrite::request_e3 now returns (TransactionReceipt, U256) and queries nexte3Id before sending the request; adjust a hard-coded error_size constant in sol reader.
Test helpers & tests
crates/test-helpers/*, crates/tests/*, crates/trbfv/tests/*, tests/integration/*
Add hex dep and hex parsing for fake_encrypt; encrypt_ciphertext now accepts multiple plaintext vectors and returns vectors of ciphertexts/plaintexts; many tests updated to use BFV decode helpers, nested plaintext vectors, and Arc-wrapped receivers.
Utilities & retry
crates/utils/Cargo.toml, crates/utils/src/lib.rs, crates/utils/src/utility_types.rs
Reorder/add workspace deps; add pub mod retry and re-export; add ArcBytes::size() helper.
CRISP example & server
examples/CRISP/**, examples/CRISP/server/src/cli/*, examples/CRISP/server/src/server/*, examples/CRISP/test/crisp.spec.ts
Add CN4/CN5 nodes and readiness file integration; default E3 thresholds changed (min 2, max 5); initialize_crisp_round now returns an E3 id; add check_e3_activated and test-side polling/wait-for-activation logic.
Templates, scripts, infra
templates/default/**, scripts/*, examples/CRISP/scripts/*, tests/integration/*
Preflight checks, pnpm build step, readiness file handling, public-key-file activation flow, multi-moduli ENCODED_PARAMS, threshold quorum/total wiring, and template updates for new BFV builder API.
Contracts artifacts & deployment
packages/enclave-contracts/**
Update artifact buildInfoIds; add/mock deployments (Enclave, CiphernodeRegistryOwnable, Mock*), increase sortition submissionWindow (5→10), and add --publicKeyFile activation option.

Sequence Diagram(s)

%%{init: {"themeVariables":{"actorBorder":"#2b6cb0","signal":"#2f855a"}} }%%
sequenceDiagram
    participant CLI
    participant Entrypoint
    participant Aggregator
    participant NetTranslator
    participant EventConverter
    participant DocPublisher

    CLI->>Entrypoint: start(config, peers, experimental_trbfv=true)
    Entrypoint->>Aggregator: build builder (deferred)
    alt experimental_trbfv == true
        Entrypoint->>Aggregator: with_trbfv / with_threshold_plaintext_aggregation()
    else
        Entrypoint->>Aggregator: with_keyshare / with_plaintext_aggregation()
    end
    Entrypoint->>NetTranslator: setup_with_interface(..., experimental_trbfv)
    alt experimental_trbfv == true
        NetTranslator->>EventConverter: create & setup
        NetTranslator-->>Entrypoint: return Some(DocPublisher)
    else
        NetTranslator-->>Entrypoint: return None
    end

    Aggregator->>Aggregator: on DecryptionshareCreated
    alt state != Collecting
        Aggregator->>Aggregator: debug log and return
    else
        Aggregator->>EventConverter: emit ThresholdShareCreated
        EventConverter->>DocPublisher: PublishDocumentRequested -> triggers DHT publish
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Areas needing extra attention:

  • crates/net/src/document_publisher.rs — EventConverter serialization, DHT put/get/broadcast timeouts and error flows.
  • crates/net/src/net_event_translator.rs — updated signatures/return types (Option<Addr>) and all callers.
  • Cross-crate BFV moduli/type shifts (wasm, bfv-helpers, trbfv, enclave-sdk) — verify WASM typing and BigUint64Array wrapping and duplicated helper definitions in bfv-helpers.
  • crates/aggregator/src/threshold_plaintext_aggregator.rs — early-return guard: confirm state visibility and race conditions.
  • Integration scripts/templates — ENCODED_PARAMS, public-key-file activation, and readiness-file sequencing.

Possibly related PRs

Suggested labels

ciphernode

Suggested reviewers

  • hmzakhalid
  • ctrlc03

Poem

🐇 I nudged a tiny flag at dawn,

Builders paused and chose a new lawn,
Shares hopped to papers, bytes took flight,
Tests waited patient for enclave light,
A quiet thump — the network stitched tonight.

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: trbfv integration test' accurately describes the main objective of adding TrBFV (Threshold BFV) support via integration testing, which is the primary change in this PR.
Linked Issues check ✅ Passed The PR comprehensively implements the requirements from issue #785: promotes TrBFV to the ciphernode CLI via an --experimental-trbfv flag, ensures integration tests work in switching mode, and includes EventConverter for document sharing via DHT.
Out of Scope Changes check ✅ Passed While the PR includes supporting changes (BFV helpers API refactoring, Kademlia optimizations, CRISP example updates, retry utilities relocation), these are all necessary prerequisites for TrBFV integration and directly support the main objective.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ 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 ry/785-integration

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.

@ryardley ryardley changed the title trbfv integration test feat: trbfv integration test Nov 5, 2025
@vercel vercel Bot temporarily deployed to Preview – crisp November 6, 2025 00:36 Inactive
@vercel vercel Bot temporarily deployed to Preview – enclave-docs November 6, 2025 00:36 Inactive

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

♻️ Duplicate comments (2)
packages/enclave-contracts/artifacts/contracts/interfaces/IEnclave.sol/IEnclave.json (1)

980-980: Consider auto-generating contract artifacts rather than committing them.

Same concern as ICiphernodeRegistry: line 980 shows a buildInfoId metadata update with no functional changes. Artifact JSON files should ideally be auto-generated during build, not committed to the repository.

packages/enclave-contracts/artifacts/contracts/interfaces/IBondingRegistry.sol/IBondingRegistry.json (1)

854-854: Consider auto-generating contract artifacts rather than committing them.

Line 854 shows the same buildInfoId metadata update pattern as the other interface artifacts in this PR. All three artifact files are regenerated with consistent metadata but no functional changes. Recommend treating these as build artifacts, not source files.

🧹 Nitpick comments (8)
examples/CRISP/server/.env.example (1)

22-25: Reorder E3 configuration keys alphabetically.

The dotenv-linter has flagged that E3_THRESHOLD_MAX and E3_THRESHOLD_MIN should be ordered alphabetically before E3_WINDOW_SIZE. Reorder these keys for consistency:

  # E3 Config
+ E3_THRESHOLD_MAX=5
+ E3_THRESHOLD_MIN=2
  E3_WINDOW_SIZE=40
- E3_THRESHOLD_MIN=2
- E3_THRESHOLD_MAX=5
  E3_DURATION=160
packages/enclave-contracts/artifacts/contracts/interfaces/ICiphernodeRegistry.sol/ICiphernodeRegistry.json (1)

538-538: Consider auto-generating contract artifacts rather than committing them.

Line 538 shows a buildInfoId update (compiler metadata change), with no functional changes to the ABI or bytecode. Committing generated artifact files to version control can cause unnecessary merge conflicts and noise in diffs.

Recommended approach: Add artifact JSON files to .gitignore and regenerate them as part of the build/CI pipeline.

crates/utils/src/utility_types.rs (1)

33-35: Consider whether this method is necessary.

Since ArcBytes implements Deref<Target = [u8]> (line 38-44), calling .len() on an ArcBytes instance already works through deref coercion. The new size() method provides the same functionality, creating redundancy in the API.

If the intent is to provide an explicit, self-documenting method, that's reasonable. Otherwise, you might consider removing this in favor of the existing .len() from the Deref implementation.

tests/integration/fns.sh (1)

124-127: Remove commented code if no longer needed.

The commented-out enclave_nodes_up function appears to be the previous version without the --experimental-trbfv flag. If this is no longer needed, consider removing it to keep the codebase clean.

Apply this diff to remove the commented code:

-# enclave_nodes_up() {
-#    $ENCLAVE_BIN nodes up -v \
-#      --config "$SCRIPT_DIR/enclave.config.yaml" & 
-# }
-
examples/CRISP/server/src/cli/commands.rs (1)

192-192: Consider overflow handling for U256 to u64 conversions.

The try_from conversions at lines 192 and 204 will return an error if the U256 value exceeds u64::MAX. While E3 IDs should realistically fit in u64, explicitly handling the conversion error with a descriptive message would improve error diagnostics.

Example for line 192:

-    let e3_id_u64 = u64::try_from(e3_id)?;
+    let e3_id_u64 = u64::try_from(e3_id)
+        .map_err(|_| format!("E3 ID {} exceeds u64 range", e3_id))?;

Also applies to: 204-204

crates/bfv-helpers/src/lib.rs (1)

361-366: Avoid cloning the entire slice here.

value.to_vec() allocates a fresh buffer on every call even though we only need to iterate the existing slice. Iterate over the slice directly instead.

-    for num in &value.to_vec() {
-        bytes.extend_from_slice(&num.to_le_bytes());
-    }
+    for &num in value {
+        bytes.extend_from_slice(&num.to_le_bytes());
+    }
crates/events/src/enclave_event/threshold_share_created.rs (1)

41-41: Field addition looks correct.

The external boolean field extends the event payload to distinguish threshold share sources. Creation sites properly initialize this field (e.g., external: false in threshold_keyshare.rs).

Consider a more descriptive name like is_external or from_network to make the boolean's purpose immediately clear at call sites.

crates/trbfv/tests/integration.rs (1)

147-148: Consider error handling implications.

The refactoring from bincode::deserialize (which returns Result) to decode_bytes_to_vec_u64 (which returns Vec<u64> directly and can panic via unwrap() on malformed input) removes explicit error handling. While acceptable in a test context, ensure that all test inputs are well-formed or that panic behavior is intended.

📜 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 1968881 and 505dd2e.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock
  • examples/CRISP/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (69)
  • crates/aggregator/src/threshold_plaintext_aggregator.rs (2 hunks)
  • crates/bfv-helpers/Cargo.toml (1 hunks)
  • crates/bfv-helpers/src/client.rs (6 hunks)
  • crates/bfv-helpers/src/lib.rs (2 hunks)
  • crates/cli/src/cli.rs (3 hunks)
  • crates/cli/src/nodes.rs (1 hunks)
  • crates/cli/src/nodes_daemon.rs (1 hunks)
  • crates/cli/src/nodes_up.rs (1 hunks)
  • crates/cli/src/start.rs (2 hunks)
  • crates/entrypoint/src/nodes/daemon.rs (6 hunks)
  • crates/entrypoint/src/nodes/up.rs (2 hunks)
  • crates/entrypoint/src/start/aggregator_start.rs (1 hunks)
  • crates/entrypoint/src/start/start.rs (2 hunks)
  • crates/events/src/enclave_event/publish_document/mod.rs (5 hunks)
  • crates/events/src/enclave_event/threshold_share_created.rs (1 hunks)
  • crates/evm-helpers/src/contracts.rs (3 hunks)
  • crates/evm/src/enclave_sol_reader.rs (1 hunks)
  • crates/fhe/src/fhe.rs (2 hunks)
  • crates/keyshare/src/threshold_keyshare.rs (1 hunks)
  • crates/net/src/dialer.rs (1 hunks)
  • crates/net/src/document_publisher.rs (12 hunks)
  • crates/net/src/events.rs (3 hunks)
  • crates/net/src/lib.rs (0 hunks)
  • crates/net/src/net_event_translator.rs (6 hunks)
  • crates/net/src/net_interface.rs (6 hunks)
  • crates/test-helpers/Cargo.toml (1 hunks)
  • crates/test-helpers/src/bin/fake_encrypt.rs (3 hunks)
  • crates/test-helpers/src/lib.rs (3 hunks)
  • crates/test-helpers/src/plaintext_writer.rs (2 hunks)
  • crates/tests/tests/integration.rs (2 hunks)
  • crates/tests/tests/integration_legacy.rs (8 hunks)
  • crates/trbfv/src/calculate_threshold_decryption.rs (2 hunks)
  • crates/trbfv/tests/integration.rs (2 hunks)
  • crates/utils/Cargo.toml (1 hunks)
  • crates/utils/src/lib.rs (1 hunks)
  • crates/utils/src/utility_types.rs (1 hunks)
  • crates/wasm/src/lib.rs (4 hunks)
  • examples/CRISP/.gitignore (1 hunks)
  • examples/CRISP/enclave.config.yaml (1 hunks)
  • examples/CRISP/packages/crisp-contracts/deployed_contracts.json (2 hunks)
  • examples/CRISP/playwright.config.ts (1 hunks)
  • examples/CRISP/scripts/dev_cipher.sh (1 hunks)
  • examples/CRISP/scripts/dev_services.sh (1 hunks)
  • examples/CRISP/server/.env.example (1 hunks)
  • examples/CRISP/server/src/cli/commands.rs (4 hunks)
  • examples/CRISP/server/src/cli/main.rs (4 hunks)
  • examples/CRISP/server/src/server/indexer.rs (15 hunks)
  • examples/CRISP/server/src/server/routes/rounds.rs (2 hunks)
  • examples/CRISP/server/src/server/routes/voting.rs (4 hunks)
  • examples/CRISP/test/crisp.spec.ts (1 hunks)
  • packages/enclave-contracts/artifacts/contracts/interfaces/IBondingRegistry.sol/IBondingRegistry.json (1 hunks)
  • packages/enclave-contracts/artifacts/contracts/interfaces/ICiphernodeRegistry.sol/ICiphernodeRegistry.json (1 hunks)
  • packages/enclave-contracts/artifacts/contracts/interfaces/IEnclave.sol/IEnclave.json (1 hunks)
  • packages/enclave-contracts/deployed_contracts.json (1 hunks)
  • packages/enclave-contracts/scripts/deployEnclave.ts (1 hunks)
  • packages/enclave-contracts/tasks/enclave.ts (1 hunks)
  • packages/enclave-sdk/src/enclave-sdk.ts (28 hunks)
  • packages/enclave-sdk/src/types.ts (3 hunks)
  • packages/enclave-sdk/src/utils.ts (9 hunks)
  • scripts/compile-circuits.sh (2 hunks)
  • scripts/run-crisp-test.sh (1 hunks)
  • templates/default/enclave.config.yaml (1 hunks)
  • templates/default/program/src/lib.rs (2 hunks)
  • templates/default/scripts/dev_ciphernodes.sh (1 hunks)
  • templates/default/tests/integration.spec.ts (3 hunks)
  • tests/integration/base.sh (3 hunks)
  • tests/integration/enclave.config.yaml (1 hunks)
  • tests/integration/fns.sh (2 hunks)
  • tests/integration/persist.sh (4 hunks)
💤 Files with no reviewable changes (1)
  • crates/net/src/lib.rs
🧰 Additional context used
🧠 Learnings (44)
📚 Learning: 2024-10-08T19:45:18.209Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 107
File: packages/ciphernode/sortition/src/distance.rs:1-1
Timestamp: 2024-10-08T19:45:18.209Z
Learning: In `packages/ciphernode/core/src/events.rs`, the import statements use the correct and updated `alloy::primitives` module.

Applied to files:

  • crates/utils/src/lib.rs
  • crates/wasm/src/lib.rs
  • crates/aggregator/src/threshold_plaintext_aggregator.rs
  • crates/fhe/src/fhe.rs
  • crates/test-helpers/src/bin/fake_encrypt.rs
  • crates/net/src/dialer.rs
  • crates/utils/Cargo.toml
  • crates/tests/tests/integration_legacy.rs
  • crates/test-helpers/src/lib.rs
  • examples/CRISP/server/src/server/indexer.rs
  • crates/trbfv/tests/integration.rs
  • crates/bfv-helpers/src/client.rs
  • crates/net/src/events.rs
📚 Learning: 2025-05-07T15:18:20.056Z
Learnt from: 0xjei
Repo: gnosisguild/enclave PR: 388
File: packages/commons/src/bfv/mod.rs:38-48
Timestamp: 2025-05-07T15:18:20.056Z
Learning: The `build_bfv_params` and related functions in the commons BFV utilities intentionally use panic for error handling as a temporary solution. The team plans to refactor these to use proper Result-based error handling in the future.

Applied to files:

  • crates/wasm/src/lib.rs
  • crates/trbfv/src/calculate_threshold_decryption.rs
  • crates/fhe/src/fhe.rs
  • crates/test-helpers/src/bin/fake_encrypt.rs
  • crates/tests/tests/integration_legacy.rs
  • examples/CRISP/server/src/cli/commands.rs
  • crates/trbfv/tests/integration.rs
  • crates/bfv-helpers/src/client.rs
  • templates/default/program/src/lib.rs
  • crates/tests/tests/integration.rs
  • crates/bfv-helpers/src/lib.rs
📚 Learning: 2024-10-22T02:10:34.864Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 145
File: packages/ciphernode/tests/tests/test_aggregation_and_decryption.rs:82-83
Timestamp: 2024-10-22T02:10:34.864Z
Learning: In the file `packages/ciphernode/tests/tests/test_aggregation_and_decryption.rs`, when reviewing test functions like `generate_pk_share`, minor performance optimizations (e.g., minimizing mutex locks) are not a priority.

Applied to files:

  • crates/trbfv/src/calculate_threshold_decryption.rs
  • crates/aggregator/src/threshold_plaintext_aggregator.rs
  • crates/test-helpers/src/plaintext_writer.rs
  • crates/fhe/src/fhe.rs
  • crates/test-helpers/src/bin/fake_encrypt.rs
  • tests/integration/persist.sh
  • crates/tests/tests/integration_legacy.rs
  • crates/test-helpers/src/lib.rs
  • crates/net/src/document_publisher.rs
  • crates/trbfv/tests/integration.rs
  • crates/bfv-helpers/src/client.rs
  • templates/default/program/src/lib.rs
  • crates/tests/tests/integration.rs
📚 Learning: 2025-04-18T09:26:41.728Z
Learnt from: 0xjei
Repo: gnosisguild/enclave PR: 345
File: packages/ciphernode/fhe/src/fhe.rs:47-91
Timestamp: 2025-04-18T09:26:41.728Z
Learning: The team wants to follow DRY principles and avoid duplicate implementation of functions like `decode_bfv_parameters` across different files in the codebase, preferring to centralize such utility functions.

Applied to files:

  • crates/trbfv/src/calculate_threshold_decryption.rs
📚 Learning: 2024-11-05T06:49:46.285Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 173
File: packages/ciphernode/enclave_node/src/datastore.rs:14-16
Timestamp: 2024-11-05T06:49:46.285Z
Learning: In `packages/ciphernode/enclave_node/src/datastore.rs`, for internal functions like `get_in_mem_store`, adding extensive documentation and error handling may not be necessary if they are not client-facing.

Applied to files:

  • crates/trbfv/src/calculate_threshold_decryption.rs
  • crates/fhe/src/fhe.rs
  • crates/evm/src/enclave_sol_reader.rs
  • crates/test-helpers/src/lib.rs
  • examples/CRISP/server/src/server/indexer.rs
  • crates/bfv-helpers/src/lib.rs
📚 Learning: 2025-10-04T14:00:17.916Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 660
File: crates/events/src/enclave_event/decryptionshare_created.rs:23-26
Timestamp: 2025-10-04T14:00:17.916Z
Learning: In the enclave codebase using threshold BFV cryptography, decryption shares (as in DecryptionshareCreated events) are not sensitive data and can be safely logged or displayed, as individual shares reveal nothing without reaching the threshold number of shares.

Applied to files:

  • crates/trbfv/src/calculate_threshold_decryption.rs
  • crates/aggregator/src/threshold_plaintext_aggregator.rs
  • crates/tests/tests/integration_legacy.rs
  • crates/net/src/net_event_translator.rs
📚 Learning: 2025-09-19T11:16:53.825Z
Learnt from: cedoor
Repo: gnosisguild/enclave PR: 752
File: packages/enclave-contracts/contracts/Enclave.sol:15-17
Timestamp: 2025-09-19T11:16:53.825Z
Learning: The Enclave contract in the gnosisguild/enclave repository has not been deployed yet as of September 2025, so storage layout considerations for upgradeable contracts don't apply to current changes.

Applied to files:

  • packages/enclave-contracts/scripts/deployEnclave.ts
  • packages/enclave-contracts/deployed_contracts.json
  • packages/enclave-contracts/artifacts/contracts/interfaces/IEnclave.sol/IEnclave.json
📚 Learning: 2024-10-08T19:45:18.209Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 133
File: packages/ciphernode/tests/tests/test_aggregation_and_decryption.rs:137-139
Timestamp: 2024-10-08T19:45:18.209Z
Learning: In `packages/ciphernode/tests/tests/test_aggregation_and_decryption.rs`, using the same RNG instance `rng_test` for generating multiple key shares without advancing its state is acceptable.

Applied to files:

  • crates/aggregator/src/threshold_plaintext_aggregator.rs
  • crates/tests/tests/integration_legacy.rs
  • crates/keyshare/src/threshold_keyshare.rs
  • crates/trbfv/tests/integration.rs
  • templates/default/program/src/lib.rs
📚 Learning: 2024-10-23T02:35:07.689Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 156
File: packages/ciphernode/keyshare/src/keyshare.rs:58-65
Timestamp: 2024-10-23T02:35:07.689Z
Learning: In `packages/ciphernode/keyshare/src/keyshare.rs`, the data being decrypted in the `get_secret` method of the `Keyshare` struct is not sensitive, so wrapping it with `Zeroizing` is unnecessary.

Applied to files:

  • crates/test-helpers/src/plaintext_writer.rs
  • crates/keyshare/src/threshold_keyshare.rs
📚 Learning: 2025-04-30T06:25:14.721Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 372
File: packages/ciphernode/events/src/eventbus.rs:15-15
Timestamp: 2025-04-30T06:25:14.721Z
Learning: EnclaveEvent implements Display in packages/ciphernode/events/src/enclave_event/mod.rs, which satisfies the Event trait requirement. Static analysis tools may incorrectly flag implementations as missing when they do exist.

Applied to files:

  • crates/test-helpers/src/plaintext_writer.rs
  • crates/events/src/enclave_event/threshold_share_created.rs
  • crates/tests/tests/integration_legacy.rs
  • crates/test-helpers/src/lib.rs
  • crates/net/src/document_publisher.rs
  • crates/net/src/net_event_translator.rs
📚 Learning: 2024-09-26T04:12:09.345Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 107
File: tests/basic_integration/test.sh:103-114
Timestamp: 2024-09-26T04:12:09.345Z
Learning: In `tests/basic_integration/test.sh`, the user prefers not to refactor the ciphernode addition section to reduce duplication.

Applied to files:

  • tests/integration/fns.sh
  • templates/default/scripts/dev_ciphernodes.sh
  • examples/CRISP/scripts/dev_cipher.sh
  • tests/integration/base.sh
  • tests/integration/persist.sh
  • tests/integration/enclave.config.yaml
📚 Learning: 2024-10-23T01:59:27.215Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 156
File: tests/basic_integration/test.sh:21-21
Timestamp: 2024-10-23T01:59:27.215Z
Learning: In `tests/basic_integration/test.sh`, the hardcoded `CIPHERNODE_SECRET` is acceptable for testing purposes and does not need to be changed.

Applied to files:

  • tests/integration/fns.sh
  • templates/default/scripts/dev_ciphernodes.sh
  • examples/CRISP/scripts/dev_cipher.sh
  • tests/integration/base.sh
  • tests/integration/persist.sh
  • tests/integration/enclave.config.yaml
📚 Learning: 2024-11-25T09:47:48.863Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 184
File: packages/ciphernode/net/tests/entrypoint.sh:4-8
Timestamp: 2024-11-25T09:47:48.863Z
Learning: When reviewing test scripts like `packages/ciphernode/net/tests/entrypoint.sh`, avoid suggesting additional error handling and cleanup for `iptables` commands, as it may not be necessary.

Applied to files:

  • tests/integration/fns.sh
📚 Learning: 2024-10-08T19:45:18.209Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 107
File: tests/basic_integration/test.sh:92-102
Timestamp: 2024-10-08T19:45:18.209Z
Learning: In the `tests/basic_integration/test.sh` script, it's acceptable not to redirect output of background `ciphernode` processes to log files.

Applied to files:

  • tests/integration/fns.sh
  • tests/integration/base.sh
📚 Learning: 2024-10-23T02:03:02.008Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 156
File: packages/ciphernode/keyshare/src/encryption.rs:45-45
Timestamp: 2024-10-23T02:03:02.008Z
Learning: In the `packages/ciphernode/keyshare/src/encryption.rs` file, the environment variable `CIPHERNODE_SECRET` is used for the encryption password. A secure secret management solution is not currently available, but may be considered in future iterations.

Applied to files:

  • tests/integration/fns.sh
  • crates/test-helpers/src/bin/fake_encrypt.rs
  • templates/default/scripts/dev_ciphernodes.sh
  • examples/CRISP/scripts/dev_cipher.sh
📚 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:

  • tests/integration/fns.sh
  • crates/test-helpers/src/bin/fake_encrypt.rs
  • tests/integration/base.sh
  • crates/tests/tests/integration_legacy.rs
  • templates/default/program/src/lib.rs
📚 Learning: 2025-10-10T12:56:40.538Z
Learnt from: 0xjei
Repo: gnosisguild/enclave PR: 830
File: templates/default/README.md:123-128
Timestamp: 2025-10-10T12:56:40.538Z
Learning: In the Enclave repository, the hard-coded Hardhat development private key `0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80` is acceptable in template README files and documentation for local testing/interaction purposes.

Applied to files:

  • tests/integration/fns.sh
  • templates/default/scripts/dev_ciphernodes.sh
  • examples/CRISP/.gitignore
  • tests/integration/persist.sh
📚 Learning: 2024-10-28T11:35:41.176Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 156
File: tests/basic_integration/lib/clean_folders.sh:1-3
Timestamp: 2024-10-28T11:35:41.176Z
Learning: In the file `tests/basic_integration/lib/clean_folders.sh`, the `clean_folders` function does not require argument validation for `SCRIPT_DIR` as per the user's preference.

Applied to files:

  • tests/integration/fns.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:

  • tests/integration/fns.sh
  • scripts/run-crisp-test.sh
📚 Learning: 2024-09-26T05:01:46.024Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 107
File: tests/basic_integration/test.sh:27-31
Timestamp: 2024-09-26T05:01:46.024Z
Learning: In the scripts, quoting the command substitution in the `kill` command within the `cleanup` function can cause the script to fail, so it's acceptable to leave it unquoted.

Applied to files:

  • tests/integration/fns.sh
📚 Learning: 2024-10-28T12:04:26.578Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 156
File: packages/ciphernode/enclave_node/src/ciphernode.rs:26-28
Timestamp: 2024-10-28T12:04:26.578Z
Learning: In the `setup_ciphernode` function in `packages/ciphernode/enclave_node/src/ciphernode.rs`, panicking on errors during setup is acceptable.

Applied to files:

  • crates/cli/src/start.rs
  • crates/entrypoint/src/start/aggregator_start.rs
  • crates/entrypoint/src/start/start.rs
📚 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:

  • crates/entrypoint/src/nodes/daemon.rs
📚 Learning: 2025-09-11T13:21:31.031Z
Learnt from: ctrlc03
Repo: gnosisguild/enclave PR: 677
File: packages/enclave-contracts/tasks/utils.ts:7-8
Timestamp: 2025-09-11T13:21:31.031Z
Learning: In Hardhat v3, the task API syntax has changed significantly from v2. The new syntax uses:
- `.addOption({ name, description, defaultValue, type })` instead of `.addOptionalParam()`
- `.setAction(async () => ({ default: (args, hre) => { ... } }))` instead of direct `.setAction((args, hre) => { ... })`
- `.build()` is required to finalize task definitions
- `ArgumentType.STRING` is used for option types instead of `types.string`

Applied to files:

  • packages/enclave-contracts/tasks/enclave.ts
📚 Learning: 2024-10-22T03:39:29.448Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 145
File: packages/ciphernode/evm/src/enclave_sol_reader.rs:87-89
Timestamp: 2024-10-22T03:39:29.448Z
Learning: In the `ciphernode` project, specifically in `packages/ciphernode/evm/src/enclave_sol_reader.rs`, the method `EnclaveSolReader::attach` should be retained even if it directly calls `EvmEventReader::attach` without additional processing. Avoid suggesting its removal in future reviews.

Applied to files:

  • crates/evm/src/enclave_sol_reader.rs
  • crates/evm-helpers/src/contracts.rs
📚 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:

  • crates/utils/Cargo.toml
  • crates/test-helpers/Cargo.toml
  • examples/CRISP/.gitignore
  • crates/bfv-helpers/Cargo.toml
📚 Learning: 2024-10-22T02:36:01.448Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 145
File: packages/ciphernode/data/Cargo.toml:0-0
Timestamp: 2024-10-22T02:36:01.448Z
Learning: In `packages/ciphernode/data/Cargo.toml`, `actix-rt` is only used in tests and should remain in `[dev-dependencies]`.

Applied to files:

  • crates/utils/Cargo.toml
  • crates/test-helpers/Cargo.toml
📚 Learning: 2024-11-25T09:48:29.068Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 184
File: packages/ciphernode/net/tests/run.sh:5-8
Timestamp: 2024-11-25T09:48:29.068Z
Learning: In the `run.sh` script in `packages/ciphernode/net/tests`, adding programmatic validation of test results is not appropriate.

Applied to files:

  • tests/integration/base.sh
📚 Learning: 2024-09-26T04:24:54.011Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 107
File: tests/basic_integration/test.sh:129-129
Timestamp: 2024-09-26T04:24:54.011Z
Learning: In `tests/basic_integration/test.sh`, it's acceptable to not add error handling for the `fake_encrypt.sh` script.

Applied to files:

  • tests/integration/base.sh
  • tests/integration/persist.sh
📚 Learning: 2024-10-08T19:45:18.209Z
Learnt from: samepant
Repo: gnosisguild/enclave PR: 107
File: tests/basic_integration/test.sh:157-161
Timestamp: 2024-10-08T19:45:18.209Z
Learning: In `tests/basic_integration/test.sh`, it's acceptable to use simple plaintext verification logic; more complex verification is considered overkill and unnecessary.

Applied to files:

  • tests/integration/base.sh
  • tests/integration/persist.sh
📚 Learning: 2024-11-05T06:51:46.701Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 173
File: packages/ciphernode/evm/src/event_reader.rs:270-286
Timestamp: 2024-11-05T06:51:46.701Z
Learning: In `packages/ciphernode/evm/src/event_reader.rs`, the `state.ids` HashSet is intended to grow indefinitely to store all processed event IDs for deduplication purposes until an alternative like a bloom filter is implemented.

Applied to files:

  • crates/test-helpers/src/lib.rs
📚 Learning: 2024-10-10T23:24:43.341Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 143
File: packages/ciphernode/sortition/src/sortition.rs:4-9
Timestamp: 2024-10-10T23:24:43.341Z
Learning: In the `Sortition` module (`packages/ciphernode/sortition/src/sortition.rs`), errors are sent to the event bus using `self.bus.err`, which handles logging and printing. Therefore, explicit use of the `tracing` crate for logging errors may not be necessary in this context.

Applied to files:

  • crates/test-helpers/src/lib.rs
  • examples/CRISP/server/src/server/indexer.rs
  • crates/net/src/document_publisher.rs
  • examples/CRISP/server/src/server/routes/voting.rs
  • crates/net/src/net_event_translator.rs
📚 Learning: 2024-10-16T09:51:10.038Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 145
File: packages/ciphernode/router/src/committee_meta.rs:43-43
Timestamp: 2024-10-16T09:51:10.038Z
Learning: In `packages/ciphernode/router/src/committee_meta.rs`, avoid suggesting making the `on_event` method in `CommitteMetaFeature` asynchronous or adding error handling for the `write` operation to the data store.

Applied to files:

  • examples/CRISP/server/src/server/indexer.rs
📚 Learning: 2024-11-05T06:48:58.177Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 173
File: packages/ciphernode/config/src/app_config.rs:13-21
Timestamp: 2024-11-05T06:48:58.177Z
Learning: In the `packages/ciphernode/config/src/app_config.rs` file, for the `Contract` enum, the team prefers to use `String` type for `address` fields, relying on parsing to handle validation, instead of using the `Address` type.

Applied to files:

  • examples/CRISP/server/src/server/indexer.rs
  • examples/CRISP/server/src/cli/commands.rs
📚 Learning: 2024-10-22T03:44:33.301Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 145
File: packages/ciphernode/router/src/e3_request_router.rs:126-133
Timestamp: 2024-10-22T03:44:33.301Z
Learning: In `E3RequestRouter::handle` method in `e3_request_router.rs`, `self.repository()` cannot fail, so it's not necessary to handle errors when accessing repositories via `self.repository().repositories()`.

Applied to files:

  • examples/CRISP/server/src/server/indexer.rs
📚 Learning: 2024-10-22T03:30:03.606Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 145
File: packages/ciphernode/enclave_node/src/shutdown.rs:21-26
Timestamp: 2024-10-22T03:30:03.606Z
Learning: In `packages/ciphernode/enclave_node/src/shutdown.rs`, the sleep duration after aborting the task is necessary to wait for other processes to complete during shutdown.

Applied to files:

  • examples/CRISP/server/src/server/indexer.rs
📚 Learning: 2024-11-05T03:56:22.254Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 170
File: packages/ciphernode/evm/tests/evm_reader.rs:63-63
Timestamp: 2024-11-05T03:56:22.254Z
Learning: In the Rust test function `test_logs` in `packages/ciphernode/evm/tests/evm_reader.rs`, a sleep duration of 1 millisecond is sufficient for reliable event processing, even in CI environments.

Applied to files:

  • examples/CRISP/server/src/server/indexer.rs
  • crates/net/src/document_publisher.rs
📚 Learning: 2024-10-22T03:47:04.014Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 145
File: packages/ciphernode/router/src/e3_request_router.rs:202-235
Timestamp: 2024-10-22T03:47:04.014Z
Learning: In `packages/ciphernode/router/src/e3_request_router.rs`, within the `E3RequestRouter::from_snapshot` method, errors during context restoration propagate upwards due to the `?` operator, and skipping contexts when `repositories.context(&e3_id).read().await?` returns `Ok(None)` is acceptable, as missing snapshots are expected.

Applied to files:

  • examples/CRISP/server/src/server/indexer.rs
📚 Learning: 2024-11-25T09:42:22.024Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 184
File: packages/ciphernode/Cargo.toml:57-65
Timestamp: 2024-11-25T09:42:22.024Z
Learning: When using Kademlia for peer discovery with libp2p in this project, the `kad` feature does not need to be explicitly enabled in the dependency configuration.

Applied to files:

  • crates/net/src/net_interface.rs
📚 Learning: 2024-10-10T11:26:47.259Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 143
File: packages/ciphernode/p2p/src/libp2p_router.rs:154-154
Timestamp: 2024-10-10T11:26:47.259Z
Learning: In `packages/ciphernode/p2p/src/libp2p_router.rs`, logging the entire message data using `trace!("{:?}", message);` is acceptable at this point.

Applied to files:

  • crates/net/src/net_interface.rs
  • crates/net/src/events.rs
📚 Learning: 2024-10-29T01:04:19.137Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 156
File: packages/ciphernode/keyshare/src/keyshare.rs:53-70
Timestamp: 2024-10-29T01:04:19.137Z
Learning: In the `Keyshare` struct within `packages/ciphernode/keyshare/src/keyshare.rs`, the `self.secret` field is stored in encrypted form and is not considered sensitive.

Applied to files:

  • crates/keyshare/src/threshold_keyshare.rs
📚 Learning: 2025-10-27T15:37:59.138Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 904
File: crates/net/src/bin/p2p_test.rs:22-45
Timestamp: 2025-10-27T15:37:59.138Z
Learning: In test files (especially integration test binaries like p2p_test.rs), suggesting correlation ID filtering for DHT events may be unnecessarily complex since test environments are typically more controlled and false positives are less of a concern.

Applied to files:

  • crates/net/src/document_publisher.rs
  • crates/net/src/events.rs
📚 Learning: 2024-10-22T03:42:14.057Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 145
File: packages/ciphernode/router/src/context.rs:94-97
Timestamp: 2024-10-22T03:42:14.057Z
Learning: In `packages/ciphernode/router/src/context.rs`, avoid adding complexity for batching checkpoint operations in code; rely on the database's batching capabilities instead.

Applied to files:

  • crates/trbfv/tests/integration.rs
  • crates/tests/tests/integration.rs
📚 Learning: 2024-10-08T01:48:49.778Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 139
File: packages/ciphernode/aggregator/src/publickey_aggregator.rs:46-46
Timestamp: 2024-10-08T01:48:49.778Z
Learning: In `packages/ciphernode/router/src/hooks.rs`, the `src_chain_id` parameter in `PublicKeyAggregator::new` is correctly handled, even if not explicitly provided during instantiation.

Applied to files:

  • crates/entrypoint/src/start/aggregator_start.rs
📚 Learning: 2024-11-25T09:56:11.195Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 184
File: packages/ciphernode/net/src/network_relay.rs:0-0
Timestamp: 2024-11-25T09:56:11.195Z
Learning: In `NetworkPeer::new` in `packages/ciphernode/net/src/network_peer.rs`, peers are converted to multiaddrs, and validation of the address format occurs during this conversion. Duplicate addresses are managed as connections are deduplicated.

Applied to files:

  • crates/net/src/net_event_translator.rs
  • crates/entrypoint/src/start/start.rs
🧬 Code graph analysis (35)
crates/wasm/src/lib.rs (1)
crates/bfv-helpers/src/client.rs (2)
  • bfv_encrypt (33-57)
  • bfv_verifiable_encrypt (84-124)
crates/trbfv/src/calculate_threshold_decryption.rs (1)
crates/bfv-helpers/src/lib.rs (2)
  • decode_plaintext_to_vec_u64 (353-358)
  • encode_vec_u64_to_bytes (361-367)
crates/test-helpers/src/plaintext_writer.rs (1)
crates/bfv-helpers/src/lib.rs (1)
  • decode_bytes_to_vec_u64 (370-375)
crates/fhe/src/fhe.rs (1)
crates/bfv-helpers/src/lib.rs (2)
  • decode_plaintext_to_vec_u64 (353-358)
  • encode_vec_u64_to_bytes (361-367)
crates/cli/src/nodes_daemon.rs (4)
crates/cli/src/nodes.rs (1)
  • execute (75-117)
crates/cli/src/nodes_up.rs (1)
  • execute (11-30)
crates/entrypoint/src/nodes/daemon.rs (1)
  • execute (133-168)
crates/entrypoint/src/nodes/up.rs (1)
  • execute (15-45)
crates/cli/src/start.rs (3)
crates/entrypoint/src/start/aggregator_start.rs (1)
  • execute (26-74)
crates/entrypoint/src/start/start.rs (1)
  • execute (26-65)
crates/cli/src/cli.rs (1)
  • execute (84-198)
crates/test-helpers/src/bin/fake_encrypt.rs (1)
crates/bfv-helpers/src/lib.rs (2)
  • decode_bfv_params (264-328)
  • build_bfv_params_from_set_arc (123-130)
crates/net/src/dialer.rs (1)
crates/utils/src/retry.rs (2)
  • retry_with_backoff (33-76)
  • to_retry (17-19)
crates/cli/src/nodes_up.rs (5)
crates/cli/src/cli.rs (1)
  • execute (84-198)
crates/cli/src/nodes.rs (1)
  • execute (75-117)
crates/cli/src/nodes_daemon.rs (1)
  • execute (11-28)
crates/entrypoint/src/nodes/daemon.rs (1)
  • execute (133-168)
crates/entrypoint/src/nodes/up.rs (1)
  • execute (15-45)
crates/evm/src/enclave_sol_reader.rs (2)
crates/utils/src/utility_types.rs (1)
  • from_bytes (25-27)
crates/trbfv/src/calculate_decryption_share.rs (1)
  • from (91-99)
crates/entrypoint/src/nodes/up.rs (5)
crates/cli/src/cli.rs (1)
  • execute (84-198)
crates/cli/src/nodes.rs (1)
  • execute (75-117)
crates/cli/src/nodes_daemon.rs (1)
  • execute (11-28)
crates/cli/src/nodes_up.rs (1)
  • execute (11-30)
crates/entrypoint/src/nodes/daemon.rs (1)
  • execute (133-168)
tests/integration/base.sh (1)
tests/integration/fns.sh (3)
  • enclave_wallet_set (133-141)
  • heading (53-60)
  • waiton (66-71)
tests/integration/persist.sh (1)
tests/integration/fns.sh (2)
  • enclave_wallet_set (133-141)
  • heading (53-60)
crates/tests/tests/integration_legacy.rs (4)
crates/bfv-helpers/src/lib.rs (2)
  • decode_bytes_to_vec_u64 (370-375)
  • decode_plaintext_to_vec_u64 (353-358)
crates/utils/src/utility_types.rs (1)
  • from_bytes (25-27)
crates/test-helpers/src/lib.rs (3)
  • new (167-173)
  • raw_plaintext (196-199)
  • encrypt_ciphertext (190-210)
crates/net/src/net_event_translator.rs (1)
  • setup (63-95)
crates/test-helpers/src/lib.rs (3)
crates/net/src/document_publisher.rs (1)
  • is_document_publisher_event (73-80)
crates/tests/tests/integration.rs (1)
  • plaintext (341-344)
crates/trbfv/tests/integration.rs (1)
  • plaintext (145-148)
examples/CRISP/server/src/server/indexer.rs (2)
crates/bfv-helpers/src/lib.rs (1)
  • decode_bytes_to_vec_u64 (370-375)
examples/CRISP/server/src/server/token_holders/etherscan.rs (1)
  • get_mock_token_holders (553-596)
crates/events/src/enclave_event/publish_document/mod.rs (1)
crates/utils/src/utility_types.rs (1)
  • size (33-35)
examples/CRISP/server/src/cli/main.rs (1)
examples/CRISP/server/src/cli/commands.rs (2)
  • check_e3_activated (198-205)
  • initialize_crisp_round (73-196)
crates/net/src/document_publisher.rs (6)
crates/utils/src/retry.rs (2)
  • retry_with_backoff (33-76)
  • to_retry (17-19)
crates/net/src/net_event_translator.rs (4)
  • setup (63-95)
  • new (50-61)
  • handle (164-174)
  • handle (179-217)
crates/net/src/net_interface.rs (4)
  • new (71-98)
  • new (521-525)
  • tx (104-106)
  • rx (100-102)
crates/events/src/enclave_event/publish_document/mod.rs (2)
  • new (45-59)
  • new (84-87)
crates/net/src/events.rs (5)
  • new (163-165)
  • to_bytes (34-36)
  • to_bytes (167-169)
  • from_bytes (38-40)
  • from_bytes (171-173)
crates/events/src/enclave_event/mod.rs (4)
  • get_e3_id (273-292)
  • to_bytes (198-200)
  • from_bytes (202-204)
  • from (240-269)
templates/default/tests/integration.spec.ts (2)
templates/default/client/src/context/WizardContext.tsx (1)
  • E3State (25-34)
packages/enclave-sdk/src/types.ts (1)
  • AllEventTypes (124-124)
crates/cli/src/cli.rs (6)
crates/entrypoint/src/start/aggregator_start.rs (1)
  • execute (26-74)
crates/entrypoint/src/start/start.rs (1)
  • execute (26-65)
crates/cli/src/nodes.rs (1)
  • execute (75-117)
crates/cli/src/nodes_daemon.rs (1)
  • execute (11-28)
crates/cli/src/nodes_up.rs (1)
  • execute (11-30)
crates/cli/src/start.rs (1)
  • execute (14-59)
crates/cli/src/nodes.rs (5)
crates/cli/src/cli.rs (1)
  • execute (84-198)
crates/cli/src/nodes_daemon.rs (1)
  • execute (11-28)
crates/cli/src/nodes_up.rs (1)
  • execute (11-30)
crates/entrypoint/src/nodes/daemon.rs (1)
  • execute (133-168)
crates/entrypoint/src/nodes/up.rs (1)
  • execute (15-45)
examples/CRISP/server/src/cli/commands.rs (4)
packages/enclave-sdk/src/types.ts (1)
  • E3 (127-142)
crates/evm-helpers/src/contracts.rs (1)
  • read_only (213-218)
examples/CRISP/server/src/server/indexer.rs (1)
  • e3 (313-313)
examples/CRISP/server/src/server/models.rs (1)
  • from (191-201)
crates/trbfv/tests/integration.rs (1)
crates/bfv-helpers/src/lib.rs (4)
  • build_bfv_params_arc (195-217)
  • decode_bytes_to_vec_u64 (370-375)
  • decode_plaintext_to_vec_u64 (353-358)
  • encode_bfv_params (231-245)
crates/bfv-helpers/src/client.rs (2)
crates/trbfv/src/trbfv_config.rs (1)
  • params (34-36)
crates/bfv-helpers/src/lib.rs (1)
  • build_bfv_params_arc (195-217)
templates/default/program/src/lib.rs (2)
crates/bfv-helpers/src/lib.rs (2)
  • build_bfv_params_arc (195-217)
  • encode_bfv_params (231-245)
packages/enclave-sdk/src/utils.ts (1)
  • SET_2048_1032193_1 (65-70)
crates/net/src/events.rs (1)
crates/events/src/correlation_id.rs (1)
  • new (23-26)
crates/tests/tests/integration.rs (1)
crates/bfv-helpers/src/lib.rs (3)
  • build_bfv_params_arc (195-217)
  • decode_bytes_to_vec_u64 (370-375)
  • encode_bfv_params (231-245)
examples/CRISP/server/src/server/routes/voting.rs (1)
examples/CRISP/server/src/server/repo.rs (1)
  • has_voted (207-210)
crates/entrypoint/src/start/aggregator_start.rs (1)
crates/net/src/net_event_translator.rs (2)
  • new (50-61)
  • setup_with_interface (113-159)
packages/enclave-sdk/src/utils.ts (2)
packages/enclave-sdk/src/index.ts (4)
  • BFV_PARAMS_SET (64-64)
  • encodeCustomParams (69-69)
  • calculateStartWindow (70-70)
  • DEFAULT_E3_CONFIG (66-66)
crates/trbfv/src/trbfv_config.rs (1)
  • params (34-36)
crates/net/src/net_event_translator.rs (3)
crates/ciphernode-builder/src/ciphernode.rs (1)
  • bus (37-39)
crates/net/src/net_interface.rs (4)
  • tx (104-106)
  • rx (100-102)
  • new (71-98)
  • new (521-525)
crates/net/src/document_publisher.rs (4)
  • new (57-70)
  • new (402-404)
  • setup (83-113)
  • setup (405-410)
crates/entrypoint/src/start/start.rs (1)
crates/net/src/net_event_translator.rs (2)
  • new (50-61)
  • setup_with_interface (113-159)
crates/bfv-helpers/src/lib.rs (1)
crates/trbfv/src/calculate_threshold_decryption.rs (2)
  • value (60-67)
  • value (114-122)
packages/enclave-sdk/src/enclave-sdk.ts (3)
packages/enclave-sdk/src/utils.ts (2)
  • isValidAddress (19-21)
  • SDKError (9-17)
packages/enclave-sdk/src/event-listener.ts (1)
  • EventListener (22-278)
packages/enclave-sdk/src/types.ts (3)
  • BfvProtocolParams (325-354)
  • EncryptedValueAndPublicInputs (359-369)
  • EventCallback (255-257)
🪛 dotenv-linter (4.0.0)
examples/CRISP/server/.env.example

[warning] 23-23: [UnorderedKey] The E3_THRESHOLD_MIN key should go before the E3_WINDOW_SIZE key

(UnorderedKey)


[warning] 24-24: [UnorderedKey] The E3_THRESHOLD_MAX key should go before the E3_THRESHOLD_MIN key

(UnorderedKey)

🪛 Gitleaks (8.28.0)
tests/integration/fns.sh

[high] 22-22: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 23-23: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

templates/default/scripts/dev_ciphernodes.sh

[high] 31-31: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 32-32: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

packages/enclave-contracts/deployed_contracts.json

[high] 138-138: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 156-156: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 157-157: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 182-182: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

examples/CRISP/scripts/dev_cipher.sh

[high] 11-11: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 12-12: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 13-13: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 14-14: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 15-15: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 16-16: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🪛 Shellcheck (0.11.0)
tests/integration/fns.sh

[warning] 22-22: PRIVATE_KEY_CN4 appears unused. Verify use (or export if used externally).

(SC2034)


[warning] 23-23: PRIVATE_KEY_CN5 appears unused. Verify use (or export if used externally).

(SC2034)


[warning] 24-24: CIPHERNODE_SECRET appears unused. Verify use (or export if used externally).

(SC2034)


[warning] 27-27: CIPHERNODE_ADDRESS_1 appears unused. Verify use (or export if used externally).

(SC2034)


[warning] 28-28: CIPHERNODE_ADDRESS_2 appears unused. Verify use (or export if used externally).

(SC2034)


[warning] 29-29: CIPHERNODE_ADDRESS_3 appears unused. Verify use (or export if used externally).

(SC2034)


[warning] 30-30: CIPHERNODE_ADDRESS_4 appears unused. Verify use (or export if used externally).

(SC2034)


[warning] 31-31: CIPHERNODE_ADDRESS_5 appears unused. Verify use (or export if used externally).

(SC2034)

⏰ 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). (1)
  • GitHub Check: crisp_e2e

Comment thread crates/evm-helpers/src/contracts.rs
Comment thread crates/trbfv/tests/integration.rs Outdated
Comment thread examples/CRISP/server/src/server/indexer.rs
Comment thread examples/CRISP/server/src/server/indexer.rs Outdated
Comment thread examples/CRISP/server/src/server/routes/voting.rs Outdated
Comment thread examples/CRISP/server/src/server/routes/voting.rs
Comment thread examples/CRISP/test/crisp.spec.ts
Comment thread packages/enclave-sdk/src/enclave-sdk.ts
Comment thread packages/enclave-sdk/src/enclave-sdk.ts Outdated

@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 (2)
crates/bfv-helpers/src/lib.rs (1)

363-369: Remove unnecessary allocation in the loop.

Line 365 calls to_vec() on a slice reference, creating an unnecessary temporary vector. Iterate directly over the input slice instead.

Apply this diff:

 pub fn encode_vec_u64_to_bytes(value: &[u64]) -> Vec<u8> {
     let mut bytes = Vec::new();
-    for num in &value.to_vec() {
+    for num in value {
         bytes.extend_from_slice(&num.to_le_bytes());
     }
     bytes
 }
crates/tests/tests/integration.rs (1)

341-344: Consider a more descriptive error message.

The deserialization change from bincode to decode_bytes_to_vec_u64 is correct and aligns with the new BFV helper API. However, the error message could be more specific to aid debugging if the decode fails.

Apply this diff:

     let results = plaintext
         .into_iter()
-        .map(|a| decode_bytes_to_vec_u64(&a.extract_bytes()).expect("error decoding bytes"))
+        .map(|a| decode_bytes_to_vec_u64(&a.extract_bytes()).expect("Failed to decode plaintext output bytes to Vec<u64>"))
         .collect::<Vec<Vec<u64>>>();
📜 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 9b4ffb0 and d33885d.

📒 Files selected for processing (6)
  • crates/bfv-helpers/src/lib.rs (2 hunks)
  • crates/test-helpers/src/plaintext_writer.rs (2 hunks)
  • crates/tests/tests/integration.rs (3 hunks)
  • crates/tests/tests/integration_legacy.rs (8 hunks)
  • crates/trbfv/tests/integration.rs (2 hunks)
  • examples/CRISP/server/src/server/indexer.rs (15 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • crates/test-helpers/src/plaintext_writer.rs
  • crates/trbfv/tests/integration.rs
  • examples/CRISP/server/src/server/indexer.rs
🧰 Additional context used
🧠 Learnings (14)
📓 Common learnings
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 969
File: packages/enclave-sdk/src/enclave-sdk.ts:101-103
Timestamp: 2025-11-08T01:31:47.484Z
Learning: In packages/enclave-sdk/src/enclave-sdk.ts, the TRBFV protocol parameter setup is intentionally incomplete as of PR #969. The constructor sets BFV_THRESHOLD parameters for TRBFV, but the encryption methods (encryptNumber, encryptVector, encryptNumberAndGenInputs, encryptVectorAndGenInputs) intentionally only support BFV and will throw "Protocol not supported" for TRBFV until future implementation is completed.
📚 Learning: 2024-10-22T03:42:14.057Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 145
File: packages/ciphernode/router/src/context.rs:94-97
Timestamp: 2024-10-22T03:42:14.057Z
Learning: In `packages/ciphernode/router/src/context.rs`, avoid adding complexity for batching checkpoint operations in code; rely on the database's batching capabilities instead.

Applied to files:

  • crates/tests/tests/integration.rs
📚 Learning: 2024-10-08T19:45:18.209Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 107
File: packages/ciphernode/sortition/src/distance.rs:1-1
Timestamp: 2024-10-08T19:45:18.209Z
Learning: In `packages/ciphernode/core/src/events.rs`, the import statements use the correct and updated `alloy::primitives` module.

Applied to files:

  • crates/tests/tests/integration.rs
  • crates/tests/tests/integration_legacy.rs
📚 Learning: 2024-10-28T12:04:26.578Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 156
File: packages/ciphernode/enclave_node/src/ciphernode.rs:26-28
Timestamp: 2024-10-28T12:04:26.578Z
Learning: In the `setup_ciphernode` function in `packages/ciphernode/enclave_node/src/ciphernode.rs`, panicking on errors during setup is acceptable.

Applied to files:

  • crates/tests/tests/integration.rs
📚 Learning: 2024-10-08T07:15:06.690Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 139
File: packages/ciphernode/evm/src/ciphernode_registry_sol.rs:133-143
Timestamp: 2024-10-08T07:15:06.690Z
Learning: In `packages/ciphernode/evm/src/ciphernode_registry_sol.rs`, the function `helpers::stream_from_evm` in Rust returns `()`, not a `Result`, so error handling with `if let Err(e) = ...` is not applicable.

Applied to files:

  • crates/tests/tests/integration.rs
📚 Learning: 2025-05-07T15:18:20.056Z
Learnt from: 0xjei
Repo: gnosisguild/enclave PR: 388
File: packages/commons/src/bfv/mod.rs:38-48
Timestamp: 2025-05-07T15:18:20.056Z
Learning: The `build_bfv_params` and related functions in the commons BFV utilities intentionally use panic for error handling as a temporary solution. The team plans to refactor these to use proper Result-based error handling in the future.

Applied to files:

  • crates/tests/tests/integration.rs
  • crates/tests/tests/integration_legacy.rs
  • crates/bfv-helpers/src/lib.rs
📚 Learning: 2024-10-22T02:10:34.864Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 145
File: packages/ciphernode/tests/tests/test_aggregation_and_decryption.rs:82-83
Timestamp: 2024-10-22T02:10:34.864Z
Learning: In the file `packages/ciphernode/tests/tests/test_aggregation_and_decryption.rs`, when reviewing test functions like `generate_pk_share`, minor performance optimizations (e.g., minimizing mutex locks) are not a priority.

Applied to files:

  • crates/tests/tests/integration_legacy.rs
📚 Learning: 2025-10-27T15:37:59.138Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 904
File: crates/net/src/bin/p2p_test.rs:22-45
Timestamp: 2025-10-27T15:37:59.138Z
Learning: In test files (especially integration test binaries like p2p_test.rs), suggesting correlation ID filtering for DHT events may be unnecessarily complex since test environments are typically more controlled and false positives are less of a concern.

Applied to files:

  • crates/tests/tests/integration_legacy.rs
📚 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:

  • crates/tests/tests/integration_legacy.rs
📚 Learning: 2024-10-08T19:45:18.209Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 133
File: packages/ciphernode/tests/tests/test_aggregation_and_decryption.rs:137-139
Timestamp: 2024-10-08T19:45:18.209Z
Learning: In `packages/ciphernode/tests/tests/test_aggregation_and_decryption.rs`, using the same RNG instance `rng_test` for generating multiple key shares without advancing its state is acceptable.

Applied to files:

  • crates/tests/tests/integration_legacy.rs
📚 Learning: 2025-10-04T14:00:17.916Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 660
File: crates/events/src/enclave_event/decryptionshare_created.rs:23-26
Timestamp: 2025-10-04T14:00:17.916Z
Learning: In the enclave codebase using threshold BFV cryptography, decryption shares (as in DecryptionshareCreated events) are not sensitive data and can be safely logged or displayed, as individual shares reveal nothing without reaching the threshold number of shares.

Applied to files:

  • crates/tests/tests/integration_legacy.rs
📚 Learning: 2025-04-30T06:25:14.721Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 372
File: packages/ciphernode/events/src/eventbus.rs:15-15
Timestamp: 2025-04-30T06:25:14.721Z
Learning: EnclaveEvent implements Display in packages/ciphernode/events/src/enclave_event/mod.rs, which satisfies the Event trait requirement. Static analysis tools may incorrectly flag implementations as missing when they do exist.

Applied to files:

  • crates/tests/tests/integration_legacy.rs
📚 Learning: 2024-11-05T06:49:46.285Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 173
File: packages/ciphernode/enclave_node/src/datastore.rs:14-16
Timestamp: 2024-11-05T06:49:46.285Z
Learning: In `packages/ciphernode/enclave_node/src/datastore.rs`, for internal functions like `get_in_mem_store`, adding extensive documentation and error handling may not be necessary if they are not client-facing.

Applied to files:

  • crates/bfv-helpers/src/lib.rs
📚 Learning: 2025-11-08T01:31:47.484Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 969
File: packages/enclave-sdk/src/enclave-sdk.ts:101-103
Timestamp: 2025-11-08T01:31:47.484Z
Learning: In packages/enclave-sdk/src/enclave-sdk.ts, the TRBFV protocol parameter setup is intentionally incomplete as of PR #969. The constructor sets BFV_THRESHOLD parameters for TRBFV, but the encryption methods (encryptNumber, encryptVector, encryptNumberAndGenInputs, encryptVectorAndGenInputs) intentionally only support BFV and will throw "Protocol not supported" for TRBFV until future implementation is completed.

Applied to files:

  • crates/bfv-helpers/src/lib.rs
🧬 Code graph analysis (3)
crates/tests/tests/integration.rs (1)
crates/bfv-helpers/src/lib.rs (3)
  • build_bfv_params_arc (197-219)
  • decode_bytes_to_vec_u64 (372-381)
  • encode_bfv_params (233-247)
crates/tests/tests/integration_legacy.rs (4)
crates/bfv-helpers/src/lib.rs (2)
  • decode_bytes_to_vec_u64 (372-381)
  • decode_plaintext_to_vec_u64 (355-360)
crates/utils/src/utility_types.rs (1)
  • from_bytes (25-27)
crates/test-helpers/src/lib.rs (3)
  • new (167-173)
  • raw_plaintext (196-199)
  • encrypt_ciphertext (190-210)
crates/net/src/net_event_translator.rs (1)
  • setup (63-95)
crates/bfv-helpers/src/lib.rs (1)
crates/trbfv/src/calculate_threshold_decryption.rs (2)
  • value (60-67)
  • value (114-122)
⏰ 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)
  • GitHub Check: build_sdk
  • GitHub Check: build_enclave_cli
  • GitHub Check: integration_prebuild
  • GitHub Check: test_net
  • GitHub Check: test_contracts
  • GitHub Check: Build & Push Image
  • GitHub Check: rust_integration
  • GitHub Check: Build & Push Image
  • GitHub Check: rust_unit
🔇 Additional comments (6)
crates/bfv-helpers/src/lib.rs (3)

17-27: LGTM: Error handling scaffold aligns with planned refactoring.

The new Error enum and Result type alias provide a good foundation for proper error handling in BFV helper functions. This aligns with the team's plan to move away from panic-based error handling.

Based on learnings


354-360: LGTM: Clean plaintext decoding helper.

The function correctly decodes Plaintext using polynomial encoding and provides appropriate error mapping.


372-381: LGTM: Safe byte-to-u64 decoding.

The function correctly validates input length and uses chunks_exact(8) to guarantee safe unwrapping during conversion. Error handling is appropriate.

crates/tests/tests/integration_legacy.rs (3)

171-178: LGTM: Helpful tracing setup for integration tests.

The tracing subscriber setup with info-level logging and test_writer output will aid in debugging these integration tests.


252-291: LGTM: Consistent test updates for multi-moduli support.

The changes from flat vectors to nested Vec<Vec<u64>> structures align with the PR's support for multi-moduli BFV parameters. The test assertions correctly use the new decoding helpers to validate outputs.


459-461: LGTM: Improved NetEventTranslator API with borrowed references.

The updated NetEventTranslator::setup call using borrowed references and Arc-wrapped receivers avoids unnecessary clones and enables efficient shared ownership. This is a good API design improvement.

@hmzakhalid hmzakhalid left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

tACK

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