From 51d802904881b057955c7c5ea07f821599a64c52 Mon Sep 17 00:00:00 2001 From: Youngjoon Lee <5462944+youngjoon-lee@users.noreply.github.com> Date: Fri, 6 Dec 2024 13:21:56 +0900 Subject: [PATCH] use humantime_serde --- nomos-mix/core/Cargo.toml | 1 + nomos-mix/core/src/conn_maintenance.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/nomos-mix/core/Cargo.toml b/nomos-mix/core/Cargo.toml index 190f0bee..cdbec48d 100644 --- a/nomos-mix/core/Cargo.toml +++ b/nomos-mix/core/Cargo.toml @@ -15,6 +15,7 @@ nomos-mix-message = { path = "../message" } futures = "0.3" x25519-dalek = { version = "2", features = ["getrandom", "static_secrets"] } fixed = { version = "1", features = ["serde-str"] } +humantime-serde = "1" [dev-dependencies] diff --git a/nomos-mix/core/src/conn_maintenance.rs b/nomos-mix/core/src/conn_maintenance.rs index cc4d66c8..83540163 100644 --- a/nomos-mix/core/src/conn_maintenance.rs +++ b/nomos-mix/core/src/conn_maintenance.rs @@ -233,6 +233,7 @@ pub struct ConnectionMonitor { #[derive(Clone, Copy, Debug, Serialize, Deserialize)] pub struct ConnectionMonitorSettings { /// Time interval to measure/evaluate the number of messages sent by each peer. + #[serde(with = "humantime_serde")] pub time_window: Duration, /// The number of effective (data or cover) messages that a peer is expected to send in a given time window. /// If the measured count is greater than (expected * (1 + tolerance)), the peer is considered malicious.