From 396926700354568bc27e0e1e58b8a9437fbb0db8 Mon Sep 17 00:00:00 2001 From: Gusto Date: Wed, 6 Nov 2024 03:53:31 +0200 Subject: [PATCH] Runnable empty mixnode sim --- network-runner/config/{carnot.json => mixnode.json} | 10 +--------- network-runner/src/bin/app/main.rs | 4 ++-- network-runner/src/node/mix/mod.rs | 2 ++ network-runner/src/runner/mod.rs | 3 --- network-runner/src/settings.rs | 3 --- 5 files changed, 5 insertions(+), 17 deletions(-) rename network-runner/config/{carnot.json => mixnode.json} (86%) diff --git a/network-runner/config/carnot.json b/network-runner/config/mixnode.json similarity index 86% rename from network-runner/config/carnot.json rename to network-runner/config/mixnode.json index 83bd6fd..5f32b3d 100644 --- a/network-runner/config/carnot.json +++ b/network-runner/config/mixnode.json @@ -17,9 +17,6 @@ "asia": 0.3 } }, - "overlay_settings": { - "number_of_committees": 3 - }, "node_settings": { "timeout": "1000ms" }, @@ -28,13 +25,8 @@ "stream_settings": { "path": "test.csv" }, - "node_count": 3000, - "views_count": 3, - "leaders_count": 1, + "node_count": 3, "seed": 0, - "wards": [ - {"max_view": 1} - ], "record_settings": { "node_id": true, "current_view": true, diff --git a/network-runner/src/bin/app/main.rs b/network-runner/src/bin/app/main.rs index 5032b74..bc0008a 100644 --- a/network-runner/src/bin/app/main.rs +++ b/network-runner/src/bin/app/main.rs @@ -144,14 +144,14 @@ fn create_boxed_mixnode( Box::new(MixNode::new(node_id, mixnode_settings, network_interface)) } -fn run( +fn run( network: Network, nodes: Vec>, settings: SimulationSettings, stream_type: Option, ) -> anyhow::Result<()> where - M: Clone + Send + Sync + 'static, + M: std::fmt::Debug + Clone + Send + Sync + 'static, S: 'static, T: Serialize + Clone + 'static, { diff --git a/network-runner/src/node/mix/mod.rs b/network-runner/src/node/mix/mod.rs index ddd799b..17fc021 100644 --- a/network-runner/src/node/mix/mod.rs +++ b/network-runner/src/node/mix/mod.rs @@ -63,6 +63,8 @@ impl Node for MixNode { fn step(&mut self, _: Duration) { let _messages = self.network_interface.receive_messages(); + self.state.mock_counter += 1; + println!(">>>>> Node {}, Step: {}", self.id, self.state.mock_counter); // Do stuff on the messages; // Network interface can be passed into the functions for outputting the messages: diff --git a/network-runner/src/runner/mod.rs b/network-runner/src/runner/mod.rs index ce90308..f81121e 100644 --- a/network-runner/src/runner/mod.rs +++ b/network-runner/src/runner/mod.rs @@ -134,14 +134,11 @@ where let nodes = Arc::new(RwLock::new(nodes)); let SimulationSettings { wards, - overlay_settings: _, node_settings: _, runner_settings, stream_settings: _, node_count: _, seed: _, - views_count: _, - leaders_count: _, network_settings: _, step_time, record_settings: _, diff --git a/network-runner/src/settings.rs b/network-runner/src/settings.rs index 0d3fc30..270a8fc 100644 --- a/network-runner/src/settings.rs +++ b/network-runner/src/settings.rs @@ -47,7 +47,6 @@ pub struct SimulationSettings { #[serde(default)] pub record_settings: BTreeMap, pub network_settings: NetworkSettings, - pub overlay_settings: OverlaySettings, pub node_settings: NodeSettings, #[serde(default)] pub runner_settings: RunnerSettings, @@ -55,7 +54,5 @@ pub struct SimulationSettings { #[serde(with = "humantime_serde")] pub step_time: std::time::Duration, pub node_count: usize, - pub views_count: usize, - pub leaders_count: usize, pub seed: Option, }