Skip to content

apollo_propeller: add backpressure flood test#13345

Closed
sirandreww-starkware wants to merge 1 commit into
03-18-apollo_propeller_wake_poll_from_on_behaviour_eventfrom
03-19-apollo_propeller_add_backpressure_flood_test
Closed

apollo_propeller: add backpressure flood test#13345
sirandreww-starkware wants to merge 1 commit into
03-18-apollo_propeller_wake_poll_from_on_behaviour_eventfrom
03-19-apollo_propeller_add_backpressure_flood_test

Conversation

@sirandreww-starkware

@sirandreww-starkware sirandreww-starkware commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

Note

Medium Risk
Mostly test-only, but it expands the crate’s public API by exposing protocol, which could create unintended external dependencies and future compatibility obligations.

Overview
Adds a new integration test (tests/backpressure_test.rs) that spins up a custom libp2p FloodHandler to send many PropellerUnitBatch frames as fast as yamux allows, asserting the sender can complete without being blocked (documenting the current lack of end-to-end back-pressure).

Makes protocol a public module (pub mod protocol) so the test can construct PropellerProtocol/PropellerCodec and write raw frames into the receiver’s real Behaviour.

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

@reviewable-StarkWare

Copy link
Copy Markdown

This change is Reviewable

@guy-starkware guy-starkware left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@guy-starkware reviewed 2 files and all commit messages, and made 2 comments.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on ShahakShama and sirandreww-starkware).


crates/apollo_propeller/tests/backpressure_test.rs line 9 at r1 (raw file):

//! When full back-pressure is implemented (handler + behaviour), the sender's writes will return
//! Pending (yamux window closes because the receiver stops reading) and the assertion should be
//! flipped to verify the sender was blocked.

👍 💯

BTW if this didn't have an M-dash I would be more impressed.

Code quote:

//! Tests that demonstrate the lack of inbound back-pressure in the propeller stack.
//!
//! A custom FloodHandler writes raw PropellerUnitBatch frames as fast as yamux allows on a
//! propeller substream. The receiver runs the real propeller Behaviour. The test asserts that the
//! sender was able to write all batches without being slowed — documenting the vulnerability.
//!
//! When full back-pressure is implemented (handler + behaviour), the sender's writes will return
//! Pending (yamux window closes because the receiver stops reading) and the assertion should be
//! flipped to verify the sender was blocked.

crates/apollo_propeller/tests/backpressure_test.rs line 132 at r1 (raw file):

                unreachable!();
            };
            let mut framed = framed;

Suggestion:

            let FloodOutboundState::Sending(mut framed) =
                std::mem::replace(&mut self.outbound, FloodOutboundState::Done)
            else {
                unreachable!();
            };

@sirandreww-starkware sirandreww-starkware force-pushed the 03-18-apollo_propeller_wake_poll_from_on_behaviour_event branch from 8969808 to 8dda1ff Compare March 26, 2026 19:15
@sirandreww-starkware sirandreww-starkware force-pushed the 03-19-apollo_propeller_add_backpressure_flood_test branch 2 times, most recently from 0d9a9b4 to faeab50 Compare March 29, 2026 10:51
@sirandreww-starkware sirandreww-starkware force-pushed the 03-18-apollo_propeller_wake_poll_from_on_behaviour_event branch 2 times, most recently from e58cba4 to 82f7eb8 Compare March 29, 2026 14:54
@sirandreww-starkware sirandreww-starkware force-pushed the 03-19-apollo_propeller_add_backpressure_flood_test branch from faeab50 to 638b968 Compare March 29, 2026 14:54
@sirandreww-starkware sirandreww-starkware force-pushed the 03-18-apollo_propeller_wake_poll_from_on_behaviour_event branch from 82f7eb8 to f340c33 Compare March 30, 2026 11:08
@sirandreww-starkware sirandreww-starkware force-pushed the 03-19-apollo_propeller_add_backpressure_flood_test branch from 638b968 to 159516a Compare March 30, 2026 11:08
@sirandreww-starkware sirandreww-starkware force-pushed the 03-18-apollo_propeller_wake_poll_from_on_behaviour_event branch from f340c33 to c6fe4d2 Compare April 30, 2026 07:00
@sirandreww-starkware sirandreww-starkware force-pushed the 03-19-apollo_propeller_add_backpressure_flood_test branch from 159516a to 3b4fb1d Compare April 30, 2026 07:00
@cursor

cursor Bot commented Apr 30, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes are mostly test-only, but the new time/throughput-based integration test may be flaky in CI and the newly public protocol module expands the crate’s public API surface.

Overview
Makes apollo_propeller::protocol public so external code/tests can use PropellerProtocol/PropellerCodec.

Adds backpressure_test.rs, an integration test that spins up a custom libp2p FloodHandler to rapidly send PropellerUnitBatch frames to a real Behaviour and asserts the sender can complete TARGET_BATCHES within a timeout, explicitly documenting the current lack of inbound backpressure (and noting the assertion should flip once backpressure is implemented).

Reviewed by Cursor Bugbot for commit 0aa1086. Bugbot is set up for automated code reviews on this repo. Configure here.

@sirandreww-starkware sirandreww-starkware changed the base branch from 03-18-apollo_propeller_wake_poll_from_on_behaviour_event to graphite-base/13345 April 30, 2026 07:17
@sirandreww-starkware sirandreww-starkware force-pushed the 03-19-apollo_propeller_add_backpressure_flood_test branch from 3b4fb1d to a6b2d65 Compare April 30, 2026 09:42
@sirandreww-starkware sirandreww-starkware changed the base branch from graphite-base/13345 to 03-18-apollo_propeller_wake_poll_from_on_behaviour_event April 30, 2026 09:42
@sirandreww-starkware sirandreww-starkware changed the base branch from 03-18-apollo_propeller_wake_poll_from_on_behaviour_event to graphite-base/13345 April 30, 2026 09:45

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a6b2d65. Configure here.

pub mod metrics;
pub mod padding;
mod protocol;
pub mod protocol;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Internal module made unconditionally public for test

Low Severity

The protocol module was the only deliberately private non-test module in this crate. It's now made unconditionally pub solely so the integration test can import PropellerCodec and PropellerProtocol. The crate already defines an unused testing feature in Cargo.toml that could gate this visibility, avoiding leaking wire-level implementation details to all downstream consumers.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a6b2d65. Configure here.

@sirandreww-starkware sirandreww-starkware force-pushed the 03-19-apollo_propeller_add_backpressure_flood_test branch from a6b2d65 to 0aa1086 Compare April 30, 2026 09:47
@sirandreww-starkware sirandreww-starkware changed the base branch from graphite-base/13345 to 03-18-apollo_propeller_wake_poll_from_on_behaviour_event April 30, 2026 09:47
@github-actions

Copy link
Copy Markdown

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 May 31, 2026
@github-actions github-actions Bot closed this Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants