Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl BroadcastNetworkStressTestNode {
/// Determines if this node should broadcast messages based on the mode
pub fn should_broadcast(&self) -> bool {
match self.args.user.mode {
Mode::AllBroadcast => true,
Mode::AllBroadcast | Mode::RoundRobin => true,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RoundRobin mode behaves identically to AllBroadcast mode

Medium Severity

Mode::RoundRobin is grouped with Mode::AllBroadcast in should_broadcast, making all nodes broadcast simultaneously. This means selecting --mode rr produces identical behavior to --mode all — no turn-taking occurs and round_duration_seconds is never consulted anywhere. Users of this mode will get misleading behavior with no indication that round-robin isn't actually happening.

Fix in Cursor Fix in Web

Mode::OneBroadcast => {
let broadcaster_id = Self::get_broadcaster_id(&self.args);
self.args.runner.id == broadcaster_id
Expand Down
7 changes: 7 additions & 0 deletions crates/apollo_network_benchmark/src/node_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ pub enum Mode {
/// Only the node specified by --broadcaster broadcasts messages
#[value(name = "one")]
OneBroadcast,
/// Nodes take turns broadcasting in round-robin fashion
#[value(name = "rr")]
RoundRobin,
}

#[derive(Debug, Clone, ValueEnum, PartialEq, Eq, Serialize, Deserialize)]
Expand Down Expand Up @@ -83,6 +86,10 @@ pub struct UserArgs {
#[arg(long, env, required_if_eq("mode", "one"))]
pub broadcaster: Option<u64>,

/// Duration each node broadcasts before switching (in seconds) - for RoundRobin mode
#[arg(long, env, default_value = "3")]
pub round_duration_seconds: u64,

/// Size of StressTestMessage
#[arg(long, env, default_value = "1024")]
pub message_size_bytes: usize,
Expand Down
Loading