Add number_of_hops (for cover traffic) in config (#45)

This commit is contained in:
Youngjoon Lee 2024-11-09 09:36:09 +07:00 committed by GitHub
parent fbb37a4317
commit a25bc27d09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 4 deletions

View File

@ -38,11 +38,12 @@
"stake_proportion": 1.0,
"epoch_duration": "432000s",
"slot_duration": "1s",
"slots_per_epoch": 432000,
"number_of_hops": 1,
"persistent_transmission": {
"max_emission_frequency": 1.0,
"drop_message_probability": 0.0
},
"number_of_mix_layers": 1,
"max_delay_seconds": 10,
"slots_per_epoch": 432000
"max_delay_seconds": 10
}

View File

@ -123,7 +123,7 @@ impl SimulationApp {
},
cover_traffic_settings: CoverTrafficSettings {
node_id: node_id.0,
number_of_hops: settings.number_of_mix_layers,
number_of_hops: settings.number_of_hops,
slots_per_epoch: settings.slots_per_epoch,
network_size: node_ids.len(),
},

View File

@ -11,14 +11,18 @@ pub struct SimSettings {
#[serde(deserialize_with = "deserialize_duration_with_human_time")]
pub data_message_lottery_interval: Duration,
pub stake_proportion: f64,
// For tier 3: cover traffic
#[serde(deserialize_with = "deserialize_duration_with_human_time")]
pub epoch_duration: Duration,
#[serde(deserialize_with = "deserialize_duration_with_human_time")]
pub slot_duration: Duration,
pub slots_per_epoch: usize,
pub number_of_hops: usize,
// For tier 1
pub persistent_transmission: PersistentTransmissionSettings,
// For tier 2
pub number_of_mix_layers: usize,
pub max_delay_seconds: u64,
pub slots_per_epoch: usize,
}
fn deserialize_duration_with_human_time<'de, D>(deserializer: D) -> Result<Duration, D::Error>