feat!: implement simple fake sequencer [skip-line-limit]#1073
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
WalkthroughReplaces typed Changes
Sequence Diagram(s)sequenceDiagram
participant Producer as Producer (local/remote)
participant Bus as BusHandle (producer/consumer)
participant Consumer as EventBus (consumer)
participant Sequencer as Sequencer
participant Handler as Worker/Extension
Note over Producer,Bus: Create EnclaveEvent<Unsequenced>
Producer->>Bus: publish / publish_from_remote (EnclaveEvent<Unsequenced>)
Bus->>Consumer: deliver to EventBus consumer
Consumer->>Sequencer: EnclaveEvent<Unsequenced>
Sequencer->>Sequencer: assign seq (seq++)
Sequencer->>Consumer: forward EnclaveEvent<Sequenced>
Consumer->>Handler: dispatch sequenced event to handlers
alt handler error
Handler->>Bus: trap(EType, ...) -> bus.err(EType, error)
else handler success
Handler->>Bus: bus.publish(...)? (may emit further events)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Points to review closely:
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (6)📓 Common learnings📚 Learning: 2024-10-10T23:24:43.341ZApplied to files:
📚 Learning: 2025-10-27T15:37:59.138ZApplied to files:
📚 Learning: 2024-10-22T02:10:34.864ZApplied to files:
📚 Learning: 2024-10-08T19:45:18.209ZApplied to files:
📚 Learning: 2024-10-03T23:02:41.732ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
🔇 Additional comments (4)
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 |
|
❌ License Header Check Failed Some files are missing the required SPDX license header. Please add the following header to the beginning of all You can run Or run |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (6)
crates/evm/src/enclave_sol_writer.rs (1)
146-147: Consider making the propagation delay configurable.The hardcoded 1-second delay for transaction propagation may be insufficient under high network latency or congestion. Consider making this configurable or implementing a more robust retry/polling mechanism in a future iteration.
crates/aggregator/src/committee_finalizer.rs (1)
107-107: Minor redundancy:act.busis cloned twice.Line 107 clones
act.busintobus, but line 115 clonesact.busagain for thetrapcall. Consider reusing the already-clonedbusvariable:- trap(EType::Sortition, &act.bus.clone(), || { + trap(EType::Sortition, &bus, || { bus.publish(CommitteeFinalizeRequested { e3_id: e3_id_clone.clone(), })?; Ok(()) });Also applies to: 115-120
crates/sortition/src/ciphernode_selector.rs (1)
112-119: Consider removing redundantbus.clone()in trap calls.The
trap()calls clone the bus handle unnecessarily:trap(EType::Sortition, &bus.clone(), || { bus.publish(...)?; Ok(()) })Since
busis already cloned in the outer scope and available in the closure, you can pass&busdirectly:-trap(EType::Sortition, &bus.clone(), || { +trap(EType::Sortition, &bus, || { bus.publish(...)?; Ok(()) })Also applies to: 171-183
crates/events/src/bus_handle.rs (1)
139-149: Consider using From instead of Into for idiomatic Rust.The
Into<BusHandle>implementations work but Rust convention prefers implementingFromand letting the compiler deriveInto.-impl Into<BusHandle> for Addr<EventBus<EnclaveEvent>> { - fn into(self) -> BusHandle { +impl From<Addr<EventBus<EnclaveEvent>>> for BusHandle { + fn from(value: Addr<EventBus<EnclaveEvent>>) -> BusHandle { - BusHandle::new_from_consumer(self) + BusHandle::new_from_consumer(value) } } -impl Into<BusHandle> for &Addr<EventBus<EnclaveEvent>> { - fn into(self) -> BusHandle { +impl From<&Addr<EventBus<EnclaveEvent>>> for BusHandle { + fn from(value: &Addr<EventBus<EnclaveEvent>>) -> BusHandle { - BusHandle::new_from_consumer(self.clone()) + BusHandle::new_from_consumer(value.clone()) } }crates/net/src/document_publisher.rs (2)
145-162: Avoid double-logging when usingbus.errin async handlersIn both handlers, you log with
error!(...)and then callbus.err(EType::IO, e). Given prior patterns thatbus.erris responsible for logging and printing errors, this will likely emit duplicate logs for the same failure. Based on learnings, consider removing the expliciterror!calls here and rely solely onbus.err(...)for these paths.Also applies to: 189-211
375-444: EventConverter’s BusHandle integration and publish calls are correct; consider unified error routingStoring a cloned
BusHandleand using it topublish(PublishDocumentRequested::new(...))?andpublish(event)?correctly adapts to the falliblepublishAPI and ensures type-safe conversion between events. In the handler impls, errors are currently only logged witherror!("{err}"); if you want EventConverter failures to appear on the error bus (likeDocumentPublisherdoes), you could optionally route them throughself.bus.err(...)instead of (or in addition to) tracing.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (50)
crates/aggregator/src/committee_finalizer.rs(3 hunks)crates/aggregator/src/ext.rs(11 hunks)crates/aggregator/src/plaintext_aggregator.rs(2 hunks)crates/aggregator/src/publickey_aggregator.rs(3 hunks)crates/aggregator/src/threshold_plaintext_aggregator.rs(2 hunks)crates/ciphernode-builder/src/ciphernode.rs(3 hunks)crates/ciphernode-builder/src/ciphernode_builder.rs(2 hunks)crates/data/src/sled_store.rs(5 hunks)crates/entrypoint/src/helpers/datastore.rs(1 hunks)crates/entrypoint/src/helpers/shutdown.rs(2 hunks)crates/entrypoint/src/start/aggregator_start.rs(2 hunks)crates/entrypoint/src/start/start.rs(3 hunks)crates/events/Cargo.toml(2 hunks)crates/events/src/bus_handle.rs(1 hunks)crates/events/src/enclave_event/enclave_error.rs(3 hunks)crates/events/src/enclave_event/mod.rs(6 hunks)crates/events/src/enclave_event/test_event.rs(1 hunks)crates/events/src/eventbus.rs(3 hunks)crates/events/src/eventbus_factory.rs(2 hunks)crates/events/src/hlc.rs(3 hunks)crates/events/src/lib.rs(1 hunks)crates/events/src/sequencer.rs(1 hunks)crates/events/src/traits.rs(4 hunks)crates/evm/src/bonding_registry_sol.rs(3 hunks)crates/evm/src/ciphernode_registry_sol.rs(9 hunks)crates/evm/src/enclave_sol.rs(1 hunks)crates/evm/src/enclave_sol_reader.rs(2 hunks)crates/evm/src/enclave_sol_writer.rs(5 hunks)crates/evm/src/event_reader.rs(10 hunks)crates/evm/src/historical_event_coordinator.rs(6 hunks)crates/evm/tests/integration.rs(1 hunks)crates/fhe/src/ext.rs(3 hunks)crates/keyshare/src/ext.rs(6 hunks)crates/keyshare/src/keyshare.rs(5 hunks)crates/keyshare/src/threshold_keyshare.rs(4 hunks)crates/logger/src/logger.rs(2 hunks)crates/net/src/document_publisher.rs(18 hunks)crates/net/src/events.rs(3 hunks)crates/net/src/net_event_translator.rs(7 hunks)crates/net/src/net_interface.rs(1 hunks)crates/request/src/router.rs(5 hunks)crates/sortition/src/ciphernode_selector.rs(5 hunks)crates/sortition/src/sortition.rs(15 hunks)crates/test-helpers/src/ciphernode_system.rs(1 hunks)crates/test-helpers/src/lib.rs(4 hunks)crates/test-helpers/src/plaintext_writer.rs(1 hunks)crates/test-helpers/src/public_key_writer.rs(1 hunks)crates/tests/Cargo.toml(1 hunks)crates/tests/tests/integration.rs(9 hunks)crates/tests/tests/integration_legacy.rs(20 hunks)
🚧 Files skipped from review as they are similar to previous changes (14)
- crates/aggregator/src/threshold_plaintext_aggregator.rs
- crates/net/src/net_interface.rs
- crates/events/src/eventbus_factory.rs
- crates/entrypoint/src/helpers/shutdown.rs
- crates/events/src/sequencer.rs
- crates/tests/Cargo.toml
- crates/fhe/src/ext.rs
- crates/events/src/hlc.rs
- crates/keyshare/src/threshold_keyshare.rs
- crates/events/src/enclave_event/test_event.rs
- crates/aggregator/src/publickey_aggregator.rs
- crates/events/Cargo.toml
- crates/aggregator/src/plaintext_aggregator.rs
- crates/evm/src/enclave_sol_reader.rs
🧰 Additional context used
🧠 Learnings (32)
📓 Common learnings
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.
📚 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/logger/src/logger.rscrates/evm/src/bonding_registry_sol.rscrates/data/src/sled_store.rscrates/events/src/enclave_event/enclave_error.rscrates/net/src/events.rscrates/entrypoint/src/start/aggregator_start.rscrates/test-helpers/src/ciphernode_system.rscrates/aggregator/src/committee_finalizer.rscrates/evm/src/enclave_sol_writer.rscrates/evm/tests/integration.rscrates/sortition/src/sortition.rscrates/events/src/traits.rscrates/entrypoint/src/start/start.rscrates/evm/src/ciphernode_registry_sol.rscrates/events/src/eventbus.rscrates/aggregator/src/ext.rscrates/request/src/router.rscrates/evm/src/historical_event_coordinator.rscrates/tests/tests/integration_legacy.rscrates/events/src/enclave_event/mod.rscrates/net/src/document_publisher.rscrates/net/src/net_event_translator.rscrates/evm/src/event_reader.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/logger/src/logger.rscrates/evm/src/bonding_registry_sol.rscrates/sortition/src/ciphernode_selector.rscrates/events/src/lib.rscrates/ciphernode-builder/src/ciphernode.rscrates/data/src/sled_store.rscrates/entrypoint/src/helpers/datastore.rscrates/events/src/enclave_event/enclave_error.rscrates/net/src/events.rscrates/entrypoint/src/start/aggregator_start.rscrates/keyshare/src/keyshare.rscrates/test-helpers/src/ciphernode_system.rscrates/aggregator/src/committee_finalizer.rscrates/evm/src/enclave_sol_writer.rscrates/sortition/src/sortition.rscrates/events/src/traits.rscrates/entrypoint/src/start/start.rscrates/evm/src/ciphernode_registry_sol.rscrates/events/src/eventbus.rscrates/aggregator/src/ext.rscrates/tests/tests/integration_legacy.rscrates/ciphernode-builder/src/ciphernode_builder.rscrates/events/src/enclave_event/mod.rscrates/net/src/document_publisher.rscrates/net/src/net_event_translator.rscrates/evm/src/event_reader.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/logger/src/logger.rscrates/events/src/enclave_event/enclave_error.rscrates/net/src/events.rscrates/entrypoint/src/start/aggregator_start.rscrates/evm/src/enclave_sol_writer.rscrates/entrypoint/src/start/start.rscrates/events/src/eventbus.rscrates/evm/src/historical_event_coordinator.rscrates/net/src/document_publisher.rs
📚 Learning: 2024-10-16T09:52:53.807Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 145
File: packages/ciphernode/data/src/data_store.rs:74-75
Timestamp: 2024-10-16T09:52:53.807Z
Learning: In this project, the actor model handles potential errors internally, so methods like `checkpoint` in the `Checkpoint` trait do not need to explicitly handle or propagate errors.
Applied to files:
crates/logger/src/logger.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/logger/src/logger.rscrates/evm/src/bonding_registry_sol.rscrates/sortition/src/ciphernode_selector.rscrates/ciphernode-builder/src/ciphernode.rscrates/data/src/sled_store.rscrates/events/src/enclave_event/enclave_error.rscrates/net/src/events.rscrates/entrypoint/src/start/aggregator_start.rscrates/keyshare/src/keyshare.rscrates/test-helpers/src/ciphernode_system.rscrates/aggregator/src/committee_finalizer.rscrates/evm/src/enclave_sol_writer.rscrates/evm/tests/integration.rscrates/sortition/src/sortition.rscrates/test-helpers/src/lib.rscrates/entrypoint/src/start/start.rscrates/evm/src/ciphernode_registry_sol.rscrates/events/src/eventbus.rscrates/keyshare/src/ext.rscrates/aggregator/src/ext.rscrates/request/src/router.rscrates/evm/src/historical_event_coordinator.rscrates/tests/tests/integration_legacy.rscrates/ciphernode-builder/src/ciphernode_builder.rscrates/tests/tests/integration.rscrates/events/src/enclave_event/mod.rscrates/net/src/document_publisher.rscrates/events/src/bus_handle.rscrates/net/src/net_event_translator.rscrates/evm/src/event_reader.rs
📚 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/bonding_registry_sol.rscrates/sortition/src/ciphernode_selector.rscrates/ciphernode-builder/src/ciphernode.rscrates/entrypoint/src/start/aggregator_start.rscrates/test-helpers/src/ciphernode_system.rscrates/aggregator/src/committee_finalizer.rscrates/evm/src/enclave_sol_writer.rscrates/test-helpers/src/public_key_writer.rscrates/evm/tests/integration.rscrates/evm/src/enclave_sol.rscrates/evm/src/ciphernode_registry_sol.rscrates/evm/src/historical_event_coordinator.rscrates/test-helpers/src/plaintext_writer.rscrates/evm/src/event_reader.rs
📚 Learning: 2024-11-05T06:56:49.157Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 173
File: packages/ciphernode/enclave_node/src/aggregator.rs:0-0
Timestamp: 2024-11-05T06:56:49.157Z
Learning: `RegistryFilterSol` does not have a reader and does not require a repository reader or deploy block when calling `RegistryFilterSol::attach` in `packages/ciphernode/enclave_node/src/aggregator.rs`.
Applied to files:
crates/evm/src/bonding_registry_sol.rscrates/evm/src/enclave_sol.rscrates/evm/src/ciphernode_registry_sol.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:
crates/evm/src/bonding_registry_sol.rscrates/evm/src/ciphernode_registry_sol.rscrates/request/src/router.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/evm/src/bonding_registry_sol.rscrates/keyshare/src/keyshare.rscrates/evm/src/enclave_sol_writer.rscrates/evm/src/ciphernode_registry_sol.rscrates/evm/src/historical_event_coordinator.rscrates/evm/src/event_reader.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:
crates/sortition/src/ciphernode_selector.rscrates/test-helpers/src/ciphernode_system.rscrates/aggregator/src/committee_finalizer.rscrates/test-helpers/src/lib.rscrates/evm/src/ciphernode_registry_sol.rscrates/keyshare/src/ext.rscrates/request/src/router.rscrates/ciphernode-builder/src/ciphernode_builder.rs
📚 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:
crates/sortition/src/ciphernode_selector.rscrates/keyshare/src/keyshare.rscrates/keyshare/src/ext.rscrates/tests/tests/integration_legacy.rscrates/net/src/net_event_translator.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/sortition/src/ciphernode_selector.rscrates/ciphernode-builder/src/ciphernode.rscrates/events/src/enclave_event/enclave_error.rscrates/entrypoint/src/start/aggregator_start.rscrates/keyshare/src/keyshare.rscrates/evm/src/enclave_sol_writer.rscrates/entrypoint/src/start/start.rscrates/tests/tests/integration_legacy.rscrates/net/src/document_publisher.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:
crates/ciphernode-builder/src/ciphernode.rscrates/entrypoint/src/start/start.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/ciphernode-builder/src/ciphernode.rscrates/data/src/sled_store.rscrates/entrypoint/src/helpers/datastore.rscrates/test-helpers/src/ciphernode_system.rscrates/evm/tests/integration.rscrates/net/src/document_publisher.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/events.rscrates/tests/tests/integration_legacy.rscrates/tests/tests/integration.rscrates/events/src/bus_handle.rscrates/evm/src/event_reader.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:
crates/net/src/events.rscrates/evm/tests/integration.rscrates/events/src/bus_handle.rs
📚 Learning: 2024-10-03T23:02:41.732Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 133
File: packages/ciphernode/tests/tests/test_aggregation_and_decryption.rs:137-139
Timestamp: 2024-10-03T23:02:41.732Z
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/net/src/events.rscrates/keyshare/src/keyshare.rscrates/keyshare/src/ext.rscrates/tests/tests/integration_legacy.rscrates/tests/tests/integration.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/entrypoint/src/start/aggregator_start.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/keyshare.rscrates/keyshare/src/ext.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/keyshare/src/keyshare.rscrates/keyshare/src/ext.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/keyshare/src/keyshare.rscrates/tests/tests/integration_legacy.rscrates/tests/tests/integration.rs
📚 Learning: 2024-10-22T03:17:41.617Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 145
File: packages/ciphernode/router/src/hooks.rs:0-0
Timestamp: 2024-10-22T03:17:41.617Z
Learning: In `packages/ciphernode/router/src/hooks.rs`, in the `hydrate` methods of the `E3Feature` implementations, it's acceptable to return `Ok(())` when dependencies are missing, as the error is reported to the bus.
Applied to files:
crates/keyshare/src/keyshare.rscrates/test-helpers/src/ciphernode_system.rscrates/sortition/src/sortition.rscrates/keyshare/src/ext.rscrates/aggregator/src/ext.rscrates/request/src/router.rscrates/ciphernode-builder/src/ciphernode_builder.rscrates/net/src/document_publisher.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/keyshare/src/keyshare.rs
📚 Learning: 2024-10-22T03:30:21.818Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 145
File: packages/ciphernode/enclave_node/src/shutdown.rs:12-12
Timestamp: 2024-10-22T03:30:21.818Z
Learning: In shutdown code (e.g., in `packages/ciphernode/enclave_node/src/shutdown.rs`), if signal creation fails, it's acceptable to panic rather than handle the error gracefully.
Applied to files:
crates/evm/src/enclave_sol_writer.rscrates/tests/tests/integration_legacy.rscrates/net/src/document_publisher.rscrates/evm/src/event_reader.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:
crates/evm/src/enclave_sol_writer.rscrates/evm/tests/integration.rscrates/tests/tests/integration_legacy.rs
📚 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/sortition/src/sortition.rscrates/events/src/eventbus.rscrates/request/src/router.rscrates/evm/src/historical_event_coordinator.rscrates/events/src/enclave_event/mod.rscrates/net/src/document_publisher.rscrates/net/src/net_event_translator.rscrates/evm/src/event_reader.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/sortition/src/sortition.rscrates/net/src/document_publisher.rs
📚 Learning: 2024-10-08T01:50:45.185Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 139
File: packages/ciphernode/core/src/events.rs:323-323
Timestamp: 2024-10-08T01:50:45.185Z
Learning: When suggesting that instances of `E3Requested` should include `src_chain_id`, double-check to ensure that the field is actually missing before making the suggestion.
Applied to files:
crates/keyshare/src/ext.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:
crates/request/src/router.rs
📚 Learning: 2024-10-12T10:24:07.572Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 139
File: packages/ciphernode/aggregator/src/publickey_aggregator.rs:46-46
Timestamp: 2024-10-12T10:24:07.572Z
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/request/src/router.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/tests/tests/integration_legacy.rscrates/net/src/document_publisher.rscrates/net/src/net_event_translator.rs
🧬 Code graph analysis (24)
crates/evm/src/bonding_registry_sol.rs (1)
crates/ciphernode-builder/src/ciphernode.rs (1)
bus(37-39)
crates/sortition/src/ciphernode_selector.rs (1)
crates/events/src/enclave_event/enclave_error.rs (1)
trap(64-72)
crates/data/src/sled_store.rs (2)
crates/events/src/bus_handle.rs (2)
new(41-51)err(85-90)crates/events/src/traits.rs (1)
err(78-78)
crates/entrypoint/src/helpers/datastore.rs (4)
crates/events/src/eventbus_factory.rs (1)
get_enclave_bus_handle(96-99)crates/config/src/app_config.rs (1)
db_file(246-248)crates/events/src/bus_handle.rs (1)
new(41-51)crates/data/src/sled_store.rs (2)
new(30-43)new(160-173)
crates/events/src/enclave_event/enclave_error.rs (3)
crates/events/src/enclave_event/mod.rs (1)
from_error(248-261)crates/events/src/traits.rs (1)
from_error(33-37)crates/events/src/bus_handle.rs (1)
new(41-51)
crates/entrypoint/src/start/aggregator_start.rs (3)
crates/events/src/eventbus_factory.rs (1)
get_enclave_bus_handle(96-99)crates/events/src/bus_handle.rs (1)
new(41-51)crates/ciphernode-builder/src/ciphernode_builder.rs (2)
new(92-114)new(526-532)
crates/test-helpers/src/ciphernode_system.rs (2)
crates/ciphernode-builder/src/ciphernode.rs (1)
bus(37-39)crates/events/src/bus_handle.rs (1)
new_from_consumer(35-39)
crates/evm/src/enclave_sol_writer.rs (3)
crates/events/src/bus_handle.rs (1)
new(41-51)crates/aggregator/src/plaintext_aggregator.rs (1)
new(89-100)crates/evm/src/ciphernode_registry_sol.rs (1)
new(257-267)
crates/test-helpers/src/public_key_writer.rs (2)
crates/evm/src/enclave_sol_writer.rs (1)
attach(54-62)crates/test-helpers/src/plaintext_writer.rs (1)
attach(20-27)
crates/evm/tests/integration.rs (1)
crates/events/src/enclave_event/mod.rs (1)
new_stored_event(213-215)
crates/sortition/src/sortition.rs (3)
crates/ciphernode-builder/src/ciphernode.rs (1)
bus(37-39)crates/events/src/bus_handle.rs (1)
err(85-90)crates/events/src/traits.rs (1)
err(78-78)
crates/evm/src/enclave_sol.rs (10)
crates/aggregator/src/committee_finalizer.rs (1)
attach(31-40)crates/evm/src/bonding_registry_sol.rs (2)
attach(146-173)attach(180-203)crates/evm/src/ciphernode_registry_sol.rs (3)
attach(219-246)attach(269-297)attach(512-535)crates/evm/src/enclave_sol_reader.rs (1)
attach(108-135)crates/evm/src/enclave_sol_writer.rs (1)
attach(54-62)crates/evm/src/event_reader.rs (1)
attach(110-142)crates/sortition/src/ciphernode_selector.rs (1)
attach(46-59)crates/test-helpers/src/plaintext_writer.rs (1)
attach(20-27)crates/test-helpers/src/public_key_writer.rs (1)
attach(19-26)crates/ciphernode-builder/src/ciphernode.rs (1)
bus(37-39)
crates/test-helpers/src/lib.rs (3)
crates/events/src/bus_handle.rs (1)
new(41-51)crates/net/src/document_publisher.rs (1)
new(57-70)crates/ciphernode-builder/src/ciphernode.rs (2)
new(21-35)bus(37-39)
crates/events/src/traits.rs (3)
crates/events/src/enclave_event/enclave_error.rs (2)
from_error(14-14)from_error(54-59)crates/events/src/enclave_event/mod.rs (1)
from_error(248-261)crates/events/src/bus_handle.rs (5)
event_from(94-100)event_from_remote_source(102-112)event_from_error(116-123)publish(67-71)publish_from_remote(73-77)
crates/entrypoint/src/start/start.rs (2)
crates/events/src/eventbus_factory.rs (1)
get_enclave_bus_handle(96-99)crates/ciphernode-builder/src/ciphernode.rs (1)
bus(37-39)
crates/evm/src/ciphernode_registry_sol.rs (3)
crates/events/src/bus_handle.rs (2)
new(41-51)err(85-90)crates/evm/src/enclave_sol_writer.rs (1)
new(42-52)crates/events/src/traits.rs (1)
err(78-78)
crates/keyshare/src/ext.rs (2)
crates/aggregator/src/ext.rs (3)
create(36-41)create(155-157)create(256-266)crates/fhe/src/ext.rs (1)
create(25-30)
crates/aggregator/src/ext.rs (3)
crates/keyshare/src/ext.rs (2)
create(29-35)create(123-135)crates/fhe/src/ext.rs (1)
create(25-30)crates/ciphernode-builder/src/ciphernode.rs (1)
bus(37-39)
crates/evm/src/historical_event_coordinator.rs (1)
crates/events/src/bus_handle.rs (1)
new(41-51)
crates/tests/tests/integration_legacy.rs (3)
crates/net/src/net_event_translator.rs (1)
new(57-64)crates/events/src/bus_handle.rs (3)
new(41-51)into(140-142)into(146-148)crates/events/src/eventbus.rs (7)
new(55-61)new(155-160)new(164-169)new(205-213)new(238-240)new(251-256)new(283-285)
crates/tests/tests/integration.rs (2)
crates/events/src/bus_handle.rs (1)
new(41-51)crates/test-helpers/src/lib.rs (1)
new(168-174)
crates/net/src/document_publisher.rs (1)
crates/events/src/bus_handle.rs (3)
new(41-51)consumer(61-63)new_from_consumer(35-39)
crates/net/src/net_event_translator.rs (2)
crates/events/src/enclave_event/enclave_error.rs (1)
trap(64-72)crates/events/src/enclave_event/mod.rs (2)
event_type(120-123)event_type(227-229)
crates/evm/src/event_reader.rs (3)
crates/ciphernode-builder/src/ciphernode.rs (1)
bus(37-39)crates/events/src/bus_handle.rs (1)
err(85-90)crates/events/src/traits.rs (1)
err(78-78)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: build_sdk
- GitHub Check: build_ciphernode_image
- GitHub Check: crisp_unit
- GitHub Check: integration_prebuild
- GitHub Check: test_net
- GitHub Check: build_enclave_cli
- GitHub Check: rust_unit
- GitHub Check: test_contracts
- GitHub Check: build_e3_support_dev
- GitHub Check: rust_integration
hmzakhalid
left a comment
There was a problem hiding this comment.
Sorry for this @ryardley, I reviewed this last week and thought I had already approved it, but I think my network dropped or something and it didn’t submit. My only comment, if I recall correctly, was to add a test, but after a second look, we can wait for the real sequencer test instead.
Part of #1050
Sorry for another large PR—had to touch every call site again... hopefully last time for a bit
Changes
EnclaveEvent<Sequenced>/EnclaveEvent<Unsequenced>viaevent.into_sequenced(seq).EnclaveEventisSequencedby default to avoid being too noisey so we only need to specify when we needEnclaveEvent<Unsequenced>EnclaveEvent::new_stored_event(...)for creating stored events (typesystem + flag prevent production misuse—only the sequencer can sequence events)bus.publish()now returnsResult<()>to surface HLC errors...trapfunction to catch errors and route them toBusHandle—provides a general framework for error handling beyond just HLCEnclaveEventType→ETypefor brevityBusHandleis no longer generic (we don't need it)Opinion on async in Actix
I think we should avoid async in Actix handlers going forward (style guide WIP). I am coming to the opinion that the
rtyperesponse pattern is an anti-pattern outside of querying actors from outside the system and we should migrate away from. Some spots here wrap a singlepublishcall with thetrapfunnction, which isn't ideal—we should isolate async code and favor handler-wrapped traps instead. I have refactored the async handler onNetEventTranslatoras an example.Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Tests
✏️ Tip: You can customize this high-level summary in your review settings.