Infrastructure improvements (#2897)

* Factor out runtime module into utils.

* Add maybe_authority information to `PeerConnected` event.

We already gather this information in authority discovery, so we might
as well share it with others.

This opens up an easy path to trigger validators differently from normal
nodes, e.g. for prioritization. This change has become more important
now, that we just connect to all validators and therefore just have a
long peer list without any information about those nodes.

* Test fix.
This commit is contained in:
Robert Klotzner authored and GitHub committed 2021-04-16 21:42:20 +02:00
1 parent 23db3479a0
commit dacde443f7
19 files changed
+175 -76

No files matched your search

@@ -191,7 +191,7 @@ impl State {
event: NetworkBridgeEvent<protocol_v1::ApprovalDistributionMessage>,
) {
match event {
NetworkBridgeEvent::PeerConnected(peer_id, role) => {
NetworkBridgeEvent::PeerConnected(peer_id, role, _) => {
// insert a blank view if none already present
tracing::trace!(
target: LOG_TARGET,
@@ -117,7 +117,7 @@ async fn setup_peer_with_view(
overseer_send(
virtual_overseer,
ApprovalDistributionMessage::NetworkBridgeUpdateV1(
NetworkBridgeEvent::PeerConnected(peer_id.clone(), ObservedRole::Full)
NetworkBridgeEvent::PeerConnected(peer_id.clone(), ObservedRole::Full, None)
)
).await;
overseer_send(