Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send OurViewChange with priority instead of using an unbounded channel #5547

Closed
wants to merge 1 commit into from

Conversation

AndreiEres
Copy link
Contributor

@AndreiEres AndreiEres commented Sep 2, 2024

Related to #824

I assume OurViewChange was sent using unbounded channel for prioritization. Since we can send messages with a particular priority, we use it here as well.

@AndreiEres AndreiEres added T0-node This PR/Issue is related to the topic “node”. I9-optimisation An enhancement to provide better overall performance in terms of time-to-completion for a task. T8-polkadot This PR/Issue is related to/affects the Polkadot network. labels Sep 2, 2024
@@ -967,10 +968,12 @@ fn update_our_view<Context>(
finalized_number,
);

dispatch_validation_event_to_all_unbounded(
dispatch_validation_event_to_all(
Copy link
Contributor

Choose a reason for hiding this comment

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

This has unintended consequences, right now the priority is:

  1. Unbounded queue.
  2. High Priority queue
  3. Normal Priority queue.

What it means is that we process OurViewChange ahead of all the others PeerConnected/PeerDisconnected/PeerViewChange, that have been already queued.

But with this change we are going to put the OurViewChange in the same queue, so it mean all PeerViewChange already queued will be processed before OurViewChange.

I'm not saying something bad will happen, but I don't see the gain and I think most of our subsystem will benefit from processing OurViewChange as fast as it can.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, this is a good point. We need an additional priority level to keep the priorities like we have them currently.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was also thinking about that. Because we already use the unbounded queue as the highest priority, we can mix the current order. But introducing one more level of priority can bring us a prioritization hell.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally we should never use unbounded for prioritization because of potential to introduce DOS vectors. but we should be fine as is without this PR - the number of OurViewChange messages is bounded by block production.

@AndreiEres
Copy link
Contributor Author

Decided that we're good with the current state of (ab)using unbounded channels

@AndreiEres AndreiEres closed this Sep 3, 2024
@AndreiEres AndreiEres deleted the AndreiEres/stop-unbound branch September 3, 2024 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I9-optimisation An enhancement to provide better overall performance in terms of time-to-completion for a task. T0-node This PR/Issue is related to the topic “node”. T8-polkadot This PR/Issue is related to/affects the Polkadot network.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants