Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ members = [
"crates/bfv-client",
"crates/ciphernode-builder",
"crates/cli",
"crates/committee-hash",
"crates/compute-provider",
"crates/config",
"crates/console",
Expand Down Expand Up @@ -32,6 +33,7 @@ members = [
"crates/safe",
"crates/sdk",
"crates/daemon-server",
"crates/slashing",
"crates/sortition",
"crates/support-scripts",
"crates/sync",
Expand Down Expand Up @@ -87,6 +89,7 @@ e3-data = { version = "0.1.15", path = "./crates/data" }
e3-request = { version = "0.1.15", path = "./crates/request" }
e3-sdk = { version = "0.1.15", path = "./crates/sdk" }
e3-cli = { version = "0.1.15", path = "./crates/cli" }
e3-committee-hash = { version = "0.1.15", path = "./crates/committee-hash" }
e3-entrypoint = { version = "0.1.15", path = "./crates/entrypoint" }
e3-init = { version = "0.1.15", path = "./crates/init" }
e3-events = { version = "0.1.15", path = "./crates/events" }
Expand All @@ -113,6 +116,7 @@ e3-trbfv = { version = "0.1.15", path = "./crates/trbfv" }
e3-utils = { version = "0.1.15", path = "./crates/utils" }
e3-utils-derive = { version = "0.1.15", path = "./crates/utils-derive" }
e3-safe = { version = "0.1.15", path = "./crates/safe" }
e3-slashing = { version = "0.1.15", path = "./crates/slashing" }
e3-zk-prover = { version = "0.1.15", path = "./crates/zk-prover" }
e3-zk-helpers = { version = "0.1.15", path = "./crates/zk-helpers" }
e3-parity-matrix = { version = "0.1.15", path = "./crates/parity-matrix" }
Expand Down
2 changes: 2 additions & 0 deletions crates/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ COPY crates/bfv-client/Cargo.toml ./bfv-client/Cargo.toml
COPY crates/cli/Cargo.toml ./cli/Cargo.toml
COPY crates/ciphernode-builder/Cargo.toml ./ciphernode-builder/Cargo.toml
COPY crates/compute-provider/Cargo.toml ./compute-provider/Cargo.toml
COPY crates/committee-hash/Cargo.toml ./committee-hash/Cargo.toml
COPY crates/config/Cargo.toml ./config/Cargo.toml
COPY crates/console/Cargo.toml ./console/Cargo.toml
COPY crates/crypto/Cargo.toml ./crypto/Cargo.toml
Expand Down Expand Up @@ -75,6 +76,7 @@ COPY crates/program-server/Cargo.toml ./program-server/Cargo.toml
COPY crates/request/Cargo.toml ./request/Cargo.toml
COPY crates/safe/Cargo.toml ./safe/Cargo.toml
COPY crates/sdk/Cargo.toml ./sdk/Cargo.toml
COPY crates/slashing/Cargo.toml ./slashing/Cargo.toml
COPY crates/sortition/Cargo.toml ./sortition/Cargo.toml
COPY crates/dashboard/Cargo.toml ./dashboard/Cargo.toml
COPY crates/daemon-server/Cargo.toml ./daemon-server/Cargo.toml
Expand Down
1 change: 1 addition & 0 deletions crates/aggregator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ e3-trbfv = { workspace = true }
fhe-math = { workspace = true }
num-bigint = { workspace = true }
e3-bfv-client = { workspace = true }
e3-committee-hash = { workspace = true }
e3-request = { workspace = true }
e3-sortition = { workspace = true }
e3-zk-helpers = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/aggregator/src/committee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub fn committee_addresses_in_party_order(
mod tests {
use super::*;
use alloy::primitives::address;
use e3_utils::committee_hash::hash_committee_addresses;
use e3_committee_hash::hash_committee_addresses;

#[test]
fn party_order_differs_from_address_sorted_set() {
Expand Down
2 changes: 1 addition & 1 deletion crates/aggregator/src/committee_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
// without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE.

pub use e3_utils::committee_hash::*;
pub use e3_committee_hash::*;
2 changes: 1 addition & 1 deletion crates/aggregator/src/publickey_aggregator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ impl PublicKeyAggregator {

let dkg_attestation_bundle = match dkg_aggregated_proof.as_ref() {
Some(_) => {
let bundle = e3_evm::encode_dkg_attestation_bundle(
let bundle = e3_zk_prover::encode_dkg_attestation_bundle(
&honest_party_ids,
&party_nodes,
&dkg_fold_attestations,
Expand Down
1 change: 1 addition & 0 deletions crates/ciphernode-builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ e3-fhe-params.workspace = true
e3-keyshare.workspace = true
e3-multithread.workspace = true
e3-net.workspace = true
e3-slashing.workspace = true
e3-zk-prover.workspace = true
e3-request.workspace = true
e3-sortition.workspace = true
Expand Down
44 changes: 34 additions & 10 deletions crates/ciphernode-builder/src/ciphernode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,42 @@ use e3_events::{BusHandle, EnclaveEvent, HistoryCollector};
use e3_net::NetChannelBridge;
use libp2p::PeerId;

/// A Sharable handle to a Ciphernode. NOTE: clones are available for use in the CiphernodeSystem
/// but they cannot await the task.
/// The kind of network interface backing a ciphernode.
#[derive(Debug, Clone)]
pub enum NetInterfaceKind {
/// Real libp2p networking (production).
Libp2p,
/// In-process channel bridge (tests / benchmarks).
ChannelBridge(NetChannelBridge),
}

impl NetInterfaceKind {
/// Extract the channel bridge, failing if this is a libp2p interface.
pub fn into_channel_bridge(self) -> Result<NetChannelBridge> {
match self {
NetInterfaceKind::ChannelBridge(bridge) => Ok(bridge),
NetInterfaceKind::Libp2p => Err(anyhow::anyhow!(
"No channel bridge exists — node is using libp2p networking"
)),
}
}
}

/// A sharable handle to a Ciphernode. Clones are available for use in the
/// CiphernodeSystem but they cannot await the task.
#[derive(Debug)]
pub struct CiphernodeHandle {
pub address: String,
pub store: DataStore,
pub bus: BusHandle,
/// Optional event history collector. Populated when the builder is configured
/// with [`CiphernodeBuilder::with_history_collector`].
pub history: Option<Addr<HistoryCollector<EnclaveEvent>>>,
/// Optional error event collector. Populated when the builder is configured
/// with [`CiphernodeBuilder::with_error_collector`].
pub errors: Option<Addr<HistoryCollector<EnclaveEvent>>>,
pub peer_id: PeerId,
pub channel_bridge: Option<NetChannelBridge>,
pub net_interface: NetInterfaceKind,
}

impl PartialEq for CiphernodeHandle {
Expand All @@ -40,7 +65,7 @@ impl CiphernodeHandle {
history: Option<Addr<HistoryCollector<EnclaveEvent>>>,
errors: Option<Addr<HistoryCollector<EnclaveEvent>>>,
peer_id: PeerId,
channel_bridge: Option<NetChannelBridge>,
net_interface: NetInterfaceKind,
) -> Self {
Self {
address,
Expand All @@ -49,7 +74,7 @@ impl CiphernodeHandle {
history,
errors,
peer_id,
channel_bridge,
net_interface,
}
}

Expand All @@ -73,18 +98,17 @@ impl CiphernodeHandle {
&self.store
}

/// Extract the channel bridge for test network simulation.
/// Returns an error if the node is using libp2p networking.
pub fn channel_bridge(&self) -> Result<NetChannelBridge> {
Ok(self.channel_bridge.clone().ok_or(anyhow::anyhow!(
"No channel bridge exists. We are likely not in test mode"
))?)
self.net_interface.clone().into_channel_bridge()
}

pub fn in_mem_store(&self) -> Option<&Addr<InMemStore>> {
let addr = self.store.get_addr();
if let StoreAddr::InMem(ref store) = addr {
return Some(store);
};

}
None
}
}
Loading
Loading