Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ryardley committed Oct 8, 2024
1 parent 1153cef commit 805ac1a
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 17 deletions.
6 changes: 3 additions & 3 deletions packages/ciphernode/aggregator/src/publickey_aggregator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub struct PublicKeyAggregator {
sortition: Addr<Sortition>,
e3_id: E3id,
state: PublicKeyAggregatorState,
src_chain_id: u64
src_chain_id: u64,
}

/// Aggregate PublicKey for a committee of nodes. This actor listens for KeyshareCreated events
Expand All @@ -60,7 +60,7 @@ impl PublicKeyAggregator {
e3_id: E3id,
threshold_m: usize,
seed: Seed,
src_chain_id: u64
src_chain_id: u64,
) -> Self {
PublicKeyAggregator {
fhe,
Expand Down Expand Up @@ -211,7 +211,7 @@ impl Handler<NotifyNetwork> for PublicKeyAggregator {
pubkey: msg.pubkey.clone(),
e3_id: msg.e3_id.clone(),
nodes: OrderedSet::from(nodes),
src_chain_id: act.src_chain_id
src_chain_id: act.src_chain_id,
});
act.bus.do_send(event);
Ok(())
Expand Down
15 changes: 7 additions & 8 deletions packages/ciphernode/core/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ pub struct PublicKeyAggregated {
pub pubkey: Vec<u8>,
pub e3_id: E3id,
pub nodes: OrderedSet<String>,
pub src_chain_id: u64
pub src_chain_id: u64,
}

#[derive(Message, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
Expand All @@ -320,12 +320,11 @@ pub struct E3Requested {
pub threshold_m: usize,
pub seed: Seed,
pub params: Vec<u8>,
pub src_chain_id: u64
// threshold: usize, // TODO:
// computation_type: ??, // TODO:
// execution_model_type: ??, // TODO:
// input_deadline: ??, // TODO:
// availability_duration: ??, // TODO:
pub src_chain_id: u64, // threshold: usize, // TODO:
// computation_type: ??, // TODO:
// execution_model_type: ??, // TODO:
// input_deadline: ??, // TODO:
// availability_duration: ??, // TODO:
}

#[derive(Message, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
Expand All @@ -347,7 +346,7 @@ pub struct CiphertextOutputPublished {
pub struct PlaintextAggregated {
pub e3_id: E3id,
pub decrypted_output: Vec<u8>,
pub src_chain_id: u64
pub src_chain_id: u64,
}

#[derive(Message, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
Expand Down
2 changes: 1 addition & 1 deletion packages/ciphernode/evm/src/ciphernode_registry_sol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl From<CiphernodeRemoved> for EnclaveEvent {
}
}

fn extractor(data: &LogData, topic: Option<&B256>, _:u64) -> Option<EnclaveEvent> {
fn extractor(data: &LogData, topic: Option<&B256>, _: u64) -> Option<EnclaveEvent> {
match topic {
Some(&CiphernodeAdded::SIGNATURE_HASH) => {
let Ok(event) = CiphernodeAdded::decode_log_data(data, true) else {
Expand Down
2 changes: 1 addition & 1 deletion packages/ciphernode/evm/src/enclave_sol_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl From<E3RequestedWithChainId> for enclave_core::E3Requested {
threshold_m: value.0.e3.threshold[0] as usize,
seed: value.0.e3.seed.into(),
e3_id: value.0.e3Id.to_string().into(),
src_chain_id: value.1
src_chain_id: value.1,
}
}
}
Expand Down
8 changes: 5 additions & 3 deletions packages/ciphernode/evm/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,23 @@ use anyhow::{Context, Result};
use enclave_core::{BusError, EnclaveErrorType, EnclaveEvent};
use futures_util::stream::StreamExt;

pub async fn stream_from_evm<P:Provider>(
pub async fn stream_from_evm<P: Provider>(
provider: WithChainId<P>,
filter: Filter,
bus: Recipient<EnclaveEvent>,
extractor: fn(&LogData, Option<&B256>, u64) -> Option<EnclaveEvent>,
) {
match provider.get_provider()
match provider
.get_provider()
.subscribe_logs(&filter)
.await
.context("Could not subscribe to stream")
{
Ok(subscription) => {
let mut stream = subscription.into_stream();
while let Some(log) = stream.next().await {
let Some(event) = extractor(log.data(), log.topic0(),provider.get_chain_id()) else {
let Some(event) = extractor(log.data(), log.topic0(), provider.get_chain_id())
else {
continue;
};
bus.do_send(event);
Expand Down
2 changes: 1 addition & 1 deletion packages/ciphernode/router/src/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl LazyPublicKeyAggregator {
data.e3_id,
meta.threshold_m,
meta.seed,
meta.src_chain_id
meta.src_chain_id,
)
.start(),
);
Expand Down

0 comments on commit 805ac1a

Please sign in to comment.