Skip to content

apollo_network_benchmark: implement RoundRobin broadcasting logic#11560

Open
sirandreww-starkware wants to merge 1 commit into01-08-apollo_network_benchmark_add_seconds_since_epoch_helper_functionfrom
01-08-apollo_network_benchmark_implement_roundrobin_broadcasting_logic
Open

apollo_network_benchmark: implement RoundRobin broadcasting logic#11560
sirandreww-starkware wants to merge 1 commit into01-08-apollo_network_benchmark_add_seconds_since_epoch_helper_functionfrom
01-08-apollo_network_benchmark_implement_roundrobin_broadcasting_logic

Conversation

@sirandreww-starkware
Copy link
Contributor

@sirandreww-starkware sirandreww-starkware commented Jan 8, 2026

Note

Medium Risk
Changes message-sending behavior in the stress test node by gating broadcasts on time-based round-robin selection, which can affect benchmark validity and relies on consistent clocks and non-empty bootstrap lists.

Overview
Adds a new RoundRobin broadcast mode to broadcast_network_stress_test_node so only the selected node for the current time slice sends messages, while other modes continue broadcasting every heartbeat.

Implements time-based round selection via seconds_since_epoch()/round_duration_seconds and emits a trace! log when a node sends in a given mode.

Written by Cursor Bugbot for commit 53ed810. This will update automatically on new commits. Configure here.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor Author

sirandreww-starkware commented Jan 8, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link

github-actions bot commented Feb 8, 2026

There hasn't been any activity on this pull request recently, and in order to prioritize active work, it has been marked as stale.
This PR will be closed and locked in 7 days if no further activity occurs.
Thank you for your contributions!

@github-actions github-actions bot added the stale label Feb 8, 2026
@github-actions github-actions bot closed this Feb 16, 2026
let now_seconds = seconds_since_epoch();
let round_duration_seconds = args.user.round_duration_seconds;
let num_nodes: u64 = args.runner.bootstrap.len().try_into().unwrap();
let current_round = (now_seconds / round_duration_seconds) % num_nodes;
Copy link

Choose a reason for hiding this comment

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

Round-robin uses wrong node count source

Medium Severity

should_broadcast_round_robin derives num_nodes from args.runner.bootstrap.len(), but bootstrap represents known bootstrap peers, not the cluster size. In RoundRobin, this can pick broadcasters from the wrong ID range, and when bootstrap is empty it evaluates % 0, causing a runtime panic.

Fix in Cursor Fix in Web

let now_seconds = seconds_since_epoch();
let round_duration_seconds = args.user.round_duration_seconds;
let num_nodes: u64 = args.runner.bootstrap.len().try_into().unwrap();
let current_round = (now_seconds / round_duration_seconds) % num_nodes;
Copy link

Choose a reason for hiding this comment

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

Zero round duration triggers panic

Medium Severity

should_broadcast_round_robin divides by args.user.round_duration_seconds without validating it is nonzero. Passing --round-duration-seconds 0 causes a runtime panic in now_seconds / round_duration_seconds, so RoundRobin can crash immediately from valid CLI parsing.

Fix in Cursor Fix in Web

@sirandreww-starkware sirandreww-starkware force-pushed the 01-08-apollo_network_benchmark_add_seconds_since_epoch_helper_function branch from 6e7d057 to ffaea93 Compare February 16, 2026 09:10
@sirandreww-starkware sirandreww-starkware force-pushed the 01-08-apollo_network_benchmark_implement_roundrobin_broadcasting_logic branch from 662465b to 5ad7f33 Compare February 16, 2026 09:10
@github-actions github-actions bot removed the stale label Feb 17, 2026
@sirandreww-starkware sirandreww-starkware force-pushed the 01-08-apollo_network_benchmark_add_seconds_since_epoch_helper_function branch from ffaea93 to c686f08 Compare February 19, 2026 07:24
@sirandreww-starkware sirandreww-starkware force-pushed the 01-08-apollo_network_benchmark_implement_roundrobin_broadcasting_logic branch from 5ad7f33 to 5b95193 Compare February 19, 2026 07:24
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

let now_seconds = seconds_since_epoch();
let round_duration_seconds = args.user.round_duration_seconds;
let num_nodes: u64 = args.runner.bootstrap.len().try_into().unwrap();
let current_round = (now_seconds / round_duration_seconds) % num_nodes;
Copy link

Choose a reason for hiding this comment

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

Division by zero in round-robin scheduling arithmetic

Medium Severity

should_broadcast_round_robin has two unguarded division operations on u64 values that can be zero. num_nodes is derived from args.runner.bootstrap.len(), which is zero when no --bootstrap flag is provided. round_duration_seconds is a CLI argument that a user could explicitly set to 0. Either case causes a panic. The RoundRobin path in should_broadcast unconditionally returns true, so the send loop starts and calls this function even with an empty bootstrap list.

Fix in Cursor Fix in Web

@sirandreww-starkware sirandreww-starkware force-pushed the 01-08-apollo_network_benchmark_add_seconds_since_epoch_helper_function branch from c686f08 to a5e0165 Compare February 19, 2026 08:04
@sirandreww-starkware sirandreww-starkware force-pushed the 01-08-apollo_network_benchmark_implement_roundrobin_broadcasting_logic branch from 5b95193 to 588daee Compare February 19, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants