feat: trbfv integration test [skip-line-limit]#969
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughAdd an Changes
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Areas needing extra attention:
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 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_MAXandE3_THRESHOLD_MINshould be ordered alphabetically beforeE3_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=160packages/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
.gitignoreand 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
ArcBytesimplementsDeref<Target = [u8]>(line 38-44), calling.len()on anArcBytesinstance already works through deref coercion. The newsize()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 theDerefimplementation.tests/integration/fns.sh (1)
124-127: Remove commented code if no longer needed.The commented-out
enclave_nodes_upfunction appears to be the previous version without the--experimental-trbfvflag. 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_fromconversions 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
externalboolean field extends the event payload to distinguish threshold share sources. Creation sites properly initialize this field (e.g.,external: falsein threshold_keyshare.rs).Consider a more descriptive name like
is_externalorfrom_networkto 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 returnsResult) todecode_bytes_to_vec_u64(which returnsVec<u64>directly and can panic viaunwrap()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
⛔ Files ignored due to path filters (2)
Cargo.lockis excluded by!**/*.lockexamples/CRISP/Cargo.lockis 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.rscrates/wasm/src/lib.rscrates/aggregator/src/threshold_plaintext_aggregator.rscrates/fhe/src/fhe.rscrates/test-helpers/src/bin/fake_encrypt.rscrates/net/src/dialer.rscrates/utils/Cargo.tomlcrates/tests/tests/integration_legacy.rscrates/test-helpers/src/lib.rsexamples/CRISP/server/src/server/indexer.rscrates/trbfv/tests/integration.rscrates/bfv-helpers/src/client.rscrates/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.rscrates/trbfv/src/calculate_threshold_decryption.rscrates/fhe/src/fhe.rscrates/test-helpers/src/bin/fake_encrypt.rscrates/tests/tests/integration_legacy.rsexamples/CRISP/server/src/cli/commands.rscrates/trbfv/tests/integration.rscrates/bfv-helpers/src/client.rstemplates/default/program/src/lib.rscrates/tests/tests/integration.rscrates/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.rscrates/aggregator/src/threshold_plaintext_aggregator.rscrates/test-helpers/src/plaintext_writer.rscrates/fhe/src/fhe.rscrates/test-helpers/src/bin/fake_encrypt.rstests/integration/persist.shcrates/tests/tests/integration_legacy.rscrates/test-helpers/src/lib.rscrates/net/src/document_publisher.rscrates/trbfv/tests/integration.rscrates/bfv-helpers/src/client.rstemplates/default/program/src/lib.rscrates/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.rscrates/fhe/src/fhe.rscrates/evm/src/enclave_sol_reader.rscrates/test-helpers/src/lib.rsexamples/CRISP/server/src/server/indexer.rscrates/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.rscrates/aggregator/src/threshold_plaintext_aggregator.rscrates/tests/tests/integration_legacy.rscrates/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.tspackages/enclave-contracts/deployed_contracts.jsonpackages/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.rscrates/tests/tests/integration_legacy.rscrates/keyshare/src/threshold_keyshare.rscrates/trbfv/tests/integration.rstemplates/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.rscrates/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.rscrates/events/src/enclave_event/threshold_share_created.rscrates/tests/tests/integration_legacy.rscrates/test-helpers/src/lib.rscrates/net/src/document_publisher.rscrates/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.shtemplates/default/scripts/dev_ciphernodes.shexamples/CRISP/scripts/dev_cipher.shtests/integration/base.shtests/integration/persist.shtests/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.shtemplates/default/scripts/dev_ciphernodes.shexamples/CRISP/scripts/dev_cipher.shtests/integration/base.shtests/integration/persist.shtests/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.shtests/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.shcrates/test-helpers/src/bin/fake_encrypt.rstemplates/default/scripts/dev_ciphernodes.shexamples/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.shcrates/test-helpers/src/bin/fake_encrypt.rstests/integration/base.shcrates/tests/tests/integration_legacy.rstemplates/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.shtemplates/default/scripts/dev_ciphernodes.shexamples/CRISP/.gitignoretests/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.shscripts/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.rscrates/entrypoint/src/start/aggregator_start.rscrates/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.rscrates/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.tomlcrates/test-helpers/Cargo.tomlexamples/CRISP/.gitignorecrates/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.tomlcrates/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.shtests/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.shtests/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.rsexamples/CRISP/server/src/server/indexer.rscrates/net/src/document_publisher.rsexamples/CRISP/server/src/server/routes/voting.rscrates/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.rsexamples/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.rscrates/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.rscrates/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.rscrates/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.rscrates/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.rscrates/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
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
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_u64is 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
📒 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.rscrates/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.rscrates/tests/tests/integration_legacy.rscrates/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::setupcall using borrowed references and Arc-wrapped receivers avoids unnecessary clones and enables efficient shared ownership. This is a good API design improvement.
Closes: #785
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Tests / Examples