mirror of
https://github.com/logos-blockchain/logos-blockchain-simulations.git
synced 2026-02-27 00:23:18 +00:00
First stage of adding the simulation engine that was living in older versions of nomos-nod. It will change in the future generalising it for better compatibility.
59 lines
1.5 KiB
Rust
59 lines
1.5 KiB
Rust
use std::collections::BTreeMap;
|
|
|
|
use crate::network::NetworkSettings;
|
|
use crate::streaming::StreamSettings;
|
|
use crate::warding::Ward;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, Default)]
|
|
pub enum RunnerSettings {
|
|
#[default]
|
|
Sync,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum OverlaySettings {
|
|
#[default]
|
|
Flat,
|
|
Tree(TreeSettings),
|
|
Branch(BranchSettings),
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
pub struct TreeSettings {
|
|
pub number_of_committees: usize,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
pub struct BranchSettings {
|
|
pub branch_depth: usize,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, Default)]
|
|
pub struct NodeSettings {
|
|
pub network_capacity_kbps: Option<u32>,
|
|
#[serde(with = "humantime_serde")]
|
|
pub timeout: std::time::Duration,
|
|
}
|
|
|
|
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
|
pub struct SimulationSettings {
|
|
#[serde(default)]
|
|
pub wards: Vec<Ward>,
|
|
#[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,
|
|
pub stream_settings: StreamSettings,
|
|
#[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>,
|
|
}
|