Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Collator connection management #5388

Conversation

eskimor
Copy link
Member

@eskimor eskimor commented Apr 25, 2022

Still WIP

Goals:

  • Improve pre-connect to also imake it possible to issue an early AdvertiseCollation messages, so we can do that round trip while preparing the collation already.
  • Proper connection management, so collations don't steal connections from each other.
  • Make collator protocol fit for asynchronous backing

cumulus companion: paritytech/cumulus#1255

eskimor added 3 commits April 22, 2022 13:49
With this more precise information, we can also trigger an early
announcement of a collation. (Not yet implemented)
@github-actions github-actions bot added the A3-in_progress Pull request is in progress. No review needed at this stage. label Apr 25, 2022
eskimor added 3 commits April 25, 2022 15:35
- Basic connection management logic, at least data wise.
- "Prepared" for async backing already
///
/// The values of this map are the group/session combinations we want to be connected for the
/// given block height.
required_connections: HashMap<BlockNumber, HashSet<(SessionIndex, GroupIndex)>>,
Copy link
Contributor

Choose a reason for hiding this comment

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

indentation

///
/// The values of this map are the group/session combinations we want to be connected for the
/// given block height.
required_connections: HashMap<BlockNumber, HashSet<(SessionIndex, GroupIndex)>>,
Copy link
Contributor

Choose a reason for hiding this comment

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

could this be a BTreeMap? might make pruning easier (prune all up to X)

Copy link
Member Author

Choose a reason for hiding this comment

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

I was thinking about that, but for the time it looks like it is not needed.

//
// - insert message
// - send to all already connected peers if in view.
// -> View still relevant with async backing? Likely only when it comes to height.
Copy link
Contributor

Choose a reason for hiding this comment

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

View is still relevant - view determines their 'implicit view', which is the view-head + some ancestry (described in more detail here: #5054 (comment))

/// If the above is not possible, but a collator is aware it's going to produce a candidate
/// based **on relay parent**, should also return `true`.
/// 1. Collators who can't know in advance whether they are going to have a collation, shall
/// return `None` on every call.
Copy link
Member

Choose a reason for hiding this comment

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

Why not have something like CollationForecast::Uknown? Then we don't need the option?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think, I just liked the explicit separation between supporting collators and those which don't. Anyhow, flattening might indeed be the better option.

@slumber slumber closed this Aug 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A3-in_progress Pull request is in progress. No review needed at this stage.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants