From 26f7db8322127f36c5e31a9e40c9fe0fe7c00836 Mon Sep 17 00:00:00 2001 From: Youngjoon Lee <5462944+youngjoon-lee@users.noreply.github.com> Date: Fri, 8 Nov 2024 08:15:18 +0700 Subject: [PATCH] use num_messages_broadcasted for warding; (#28) Co-authored-by: Gusto --- simlib/mixnet-sims/src/node/mix/mod.rs | 12 +++++------- simlib/mixnet-sims/src/node/mix/state.rs | 1 - 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/simlib/mixnet-sims/src/node/mix/mod.rs b/simlib/mixnet-sims/src/node/mix/mod.rs index 241d3e5..0530772 100644 --- a/simlib/mixnet-sims/src/node/mix/mod.rs +++ b/simlib/mixnet-sims/src/node/mix/mod.rs @@ -1,6 +1,6 @@ -pub mod consensus_streams; -pub mod lottery; -pub mod scheduler; +mod consensus_streams; +mod lottery; +mod scheduler; pub mod state; pub mod stream_wrapper; @@ -163,7 +163,6 @@ impl MixNode { settings, state: MixnodeState { node_id: id, - mock_counter: 0, step_id: 0, num_messages_broadcasted: 0, }, @@ -262,14 +261,13 @@ impl Node for MixNode { } self.state.step_id += 1; - self.state.mock_counter += 1; } fn analyze(&self, ward: &mut WardCondition) -> bool { match ward { - WardCondition::Max(condition) => self.state.mock_counter >= condition.max_count, + WardCondition::Max(_) => false, WardCondition::Sum(condition) => { - *condition.step_result.borrow_mut() += self.state.mock_counter; + *condition.step_result.borrow_mut() += self.state.num_messages_broadcasted; false } } diff --git a/simlib/mixnet-sims/src/node/mix/state.rs b/simlib/mixnet-sims/src/node/mix/state.rs index c1d57f2..644b011 100644 --- a/simlib/mixnet-sims/src/node/mix/state.rs +++ b/simlib/mixnet-sims/src/node/mix/state.rs @@ -12,7 +12,6 @@ use netrunner::{ #[derive(Debug, Clone, Serialize)] pub struct MixnodeState { pub node_id: NodeId, - pub mock_counter: usize, pub step_id: usize, pub num_messages_broadcasted: usize, }