Skip to content

Conversation

BrendanChou
Copy link
Collaborator

@BrendanChou BrendanChou commented Aug 8, 2025

Fixes #1380

@patrick-ogrady
Copy link
Contributor

patrick-ogrady commented Aug 11, 2025

I think I should create a futures::CancelablePool for code-reuse purposes

Makes sense to me (after doing a quick scan here)

@BrendanChou BrendanChou marked this pull request as ready for review August 11, 2025 20:47
Copy link
Contributor

@patrick-ogrady patrick-ogrady left a comment

Choose a reason for hiding this comment

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

Logic/architecture looks solid. Left some small questions/nits.

///
/// If the pool is empty, the future will never resolve.
/// Returns `Ok(T)` for successful completion or `Err(Aborted)` for aborted futures.
pub fn next_completed(
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: next()

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

next_completed for consistency with futures::Pool above. I did originally consider next() for this, but decided not to for some reason (maybe too close to stream next?)

Copy link
Contributor

Choose a reason for hiding this comment

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

I think next() in Rust for this is pretty generic (at least I interpret as the correct method name for something like this...we can change in the future but 🤷 ).

let (tx, rx) = oneshot::channel();
buffer.subscribe_prepared(None, commitment, None, tx).await;
entry.insert(Waiter::new(rx, response));
let hook = waiters.push(async move {
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if it makes sense to make a "wrapper" struct that handles the waiters and listeners?

The logic you introduced here looks solid but seems it could be simplified if we introduced one additional util (unless the generics get too bad)?

Copy link
Collaborator Author

@BrendanChou BrendanChou Aug 11, 2025

Choose a reason for hiding this comment

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

I agree there could be (?) room for a util here but not yet confident that I have an idea for one that's general enough yet to be useful in multiple places. In the future I think

(schemes, peers, identity, shares)
}

async fn setup_network_links(oracle: &mut Oracle<P>, peers: &[P], link: Link) {
Copy link
Contributor

Choose a reason for hiding this comment

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

JFYI I asked Denis to make some of these helpers exported functions in p2p::simulated to avoid further duplication of these utils: #1344 (comment)

@patrick-ogrady patrick-ogrady merged commit e55f08a into main Aug 11, 2025
35 checks passed
@patrick-ogrady patrick-ogrady deleted the bc/1380-marshal-fix branch August 11, 2025 23:45
Copy link

codecov bot commented Aug 12, 2025

Codecov Report

❌ Patch coverage is 98.65471% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.50%. Comparing base (63c3255) to head (1170a63).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
utils/src/futures.rs 93.54% 6 Missing ⚠️
@@            Coverage Diff             @@
##             main    #1381      +/-   ##
==========================================
+ Coverage   91.34%   91.50%   +0.16%     
==========================================
  Files         265      265              
  Lines       66706    67023     +317     
==========================================
+ Hits        60930    61330     +400     
+ Misses       5776     5693      -83     
Files with missing lines Coverage Δ
consensus/src/marshal/actor.rs 87.73% <100.00%> (+9.52%) ⬆️
consensus/src/marshal/mod.rs 99.75% <100.00%> (+0.27%) ⬆️
utils/src/futures.rs 94.37% <93.54%> (-0.50%) ⬇️

... and 27 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 63c3255...1170a63. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

[consensus::marshal] subscribe can "hang" from the perspective of the application

2 participants