mirror of
https://github.com/logos-blockchain/logos-blockchain-simulations.git
synced 2026-01-03 13:43:08 +00:00
Runnable empty mixnode sim
This commit is contained in:
parent
f63db0e46f
commit
3969267003
@ -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,
|
||||
@ -144,14 +144,14 @@ fn create_boxed_mixnode(
|
||||
Box::new(MixNode::new(node_id, mixnode_settings, network_interface))
|
||||
}
|
||||
|
||||
fn run<M: std::fmt::Debug, S, T>(
|
||||
fn run<M, S, T>(
|
||||
network: Network<M>,
|
||||
nodes: Vec<BoxedNode<S, T>>,
|
||||
settings: SimulationSettings,
|
||||
stream_type: Option<StreamType>,
|
||||
) -> anyhow::Result<()>
|
||||
where
|
||||
M: Clone + Send + Sync + 'static,
|
||||
M: std::fmt::Debug + Clone + Send + Sync + 'static,
|
||||
S: 'static,
|
||||
T: Serialize + Clone + 'static,
|
||||
{
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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: _,
|
||||
|
||||
@ -47,7 +47,6 @@ pub struct SimulationSettings {
|
||||
#[serde(default)]
|
||||
pub record_settings: BTreeMap<String, bool>,
|
||||
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<u64>,
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user