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

Comments

Companion PR for refactoring priority groups#2095

Merged
16 commits merged intomasterfrom
tka-companion-rm-prio-groups
Jan 7, 2021
Merged

Companion PR for refactoring priority groups#2095
16 commits merged intomasterfrom
tka-companion-rm-prio-groups

Conversation

@tomaka
Copy link
Contributor

@tomaka tomaka commented Dec 9, 2020

@tomaka tomaka added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. labels Dec 9, 2020
PRIORITY_GROUP.to_owned(),
// from them until removed from the set
if let Err(e) = network_service.add_peers_set_reserved(
super::COLLATION_PROTOCOL_NAME.into(),
Copy link

Choose a reason for hiding this comment

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

Here we use the same set for collation peer set and validation peer set, I assume this is not intentional. In the initial design we passed the peer set id in the request (would be a parameter in this on_request function), we can bring it back.
But I still don't understand how validators are supposed to have a collators peer set without knowing their addresses. IIUC a request with COLLATION_PROTOCOL_NAME means that we are collators trying to connect to validators. so that would create a peer set on the collator side, not validator side.

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 still don't understand how validators are supposed to have a collators peer set without knowing their addresses

If by "address" you mean a multiaddr (IP address/port), it's contained in the second parameter of add_peers_set_reserved.

Copy link

Choose a reason for hiding this comment

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

I still don't understand how validators are supposed to have a collators peer set without knowing their addresses

If by "address" you mean a multiaddr (IP address/port), it's contained in the second parameter of add_peers_set_reserved.

I thought for some reason these multiaddresses are of validators participating in the collation protocol, not collators. Is that wrong? Do we run authority discovery on all collators?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, these are the addresses of the validators, not of the collators. The code is correct when run from the collator's point of view. From the validator's point of view, we rely on inbound slots to accept incoming connections from collators.

The code should eventually change so that in the future validators don't connect to other validators through this protocol, but only through collators.

in_peers: 0,
out_peers: 0,
reserved_nodes: Vec::new(),
non_reserved_mode: sc_network::config::NonReservedPeerMode::Deny,
Copy link
Member

Choose a reason for hiding this comment

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

We definitely need to split this into more fine grained protocols. For availability distribution to be able to connect to lots of peers, but also because of this. NonReservedPeerMode is not appropriate for availability recovery, which might be used by collators or other full nodes as well. Obviously this should not block this PR, as this is work that will build on this.

tracing::warn!(target: LOG_TARGET, err = ?e, "AuthorityDiscoveryService returned an invalid multiaddress");
}
if let Err(e) = network_service.add_peers_set_reserved(
super::VALIDATION_PROTOCOL_NAME.into(),
Copy link
Member

Choose a reason for hiding this comment

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

@ordian We also add the authorities to the reserved nodes of the validator set here. It makes sense to me to add the authorities to both the collation protocol peer set and the validation protocol peer set.

Copy link

@ordian ordian Jan 5, 2021

Choose a reason for hiding this comment

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

The way it is currently implemented, we will have two identical sets (COLLATION_PROTOCOL_NAME and VALIDATION_PROTOCOL_NAME). I think the intention is to pass the PeerSet here from the bridge and add to only one set depending on the PeerSet.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, got it. Depending on whether the node is a validator or collator it suffices if the authorities are added to one of those sets. That makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I understand, this on_request function is called only in response to a NetworkBridgeMessage::ConnectToValidators. Right now this ConnectToValidators message is only ever emitted indirectly from here. Am I supposed to send two messages, once for PeerSet::Collation and once for PeerSet::Validation?

Copy link

@ordian ordian Jan 7, 2021

Choose a reason for hiding this comment

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

We can pass the peerset as part of the ConnectToValidators message and connect_to_validators* functions, I think this was the initial design.

@tomaka
Copy link
Contributor Author

tomaka commented Jan 5, 2021

The collation integration test is failing. I don't really know if the logic of what I'm doing in this PR is correct, so debugging it is kind of tricky for me. If someone has an idea, I'd appreciate.

@ordian
Copy link

ordian commented Jan 6, 2021

I'd like to see #2095 (comment) addressed, otherwise looks good.

@tomaka
Copy link
Contributor Author

tomaka commented Jan 7, 2021

I'd like to see #2095 (comment) addressed, otherwise looks good.

Since this PR doesn't modify the existing behaviour nor API, I'd suggest to do this afterwards?

@ordian
Copy link

ordian commented Jan 7, 2021

I'd like to see #2095 (comment) addressed, otherwise looks good.

Since this PR doesn't modify the existing behaviour nor API, I'd suggest to do this afterwards?

Sure, we can do it in a separate PR. Technically, we used only one peerset/priority group previously, but behavior should be the same.

@ordian ordian added the A4-companion A PR that needs a companion PR to merge in parallel for one of its downstream dependencies. label Jan 7, 2021
@ghost
Copy link

ghost commented Jan 7, 2021

Waiting for commit status.

@ghost ghost merged commit c594080 into master Jan 7, 2021
@ghost ghost deleted the tka-companion-rm-prio-groups branch January 7, 2021 14:25
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A0-please_review Pull request needs code review. A4-companion A PR that needs a companion PR to merge in parallel for one of its downstream dependencies. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants