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

Prepare for network protocol version upgrades #5084

Merged
merged 26 commits into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2bd9cb1
explicitly tag network requests with version
rphmeier Mar 11, 2022
2f4464d
fmt
rphmeier Mar 11, 2022
b1ed697
make PeerSet more aware of versioning
rphmeier Mar 11, 2022
2f61e49
some generalization of the network bridge to support upgrades
rphmeier Mar 11, 2022
0593b0c
walk back some renaming
rphmeier Mar 11, 2022
5ffc622
walk back some version stuff
rphmeier Mar 11, 2022
2e4f7b0
extract version from fallback
rphmeier Mar 11, 2022
f63da6a
remove V1 from NetworkBridgeUpdate
rphmeier Mar 11, 2022
98ee4da
Merge branch 'master' into rh-network-protocol-upgrades
rphmeier Apr 14, 2022
ebb52bb
add accidentally-removed timer
rphmeier Apr 14, 2022
812da02
implement focusing for versioned messages
rphmeier Apr 14, 2022
5f3de34
fmt
rphmeier Apr 14, 2022
d84984e
fix up network bridge & tests
rphmeier Apr 15, 2022
5cbd94b
remove inaccurate version check in bridge
rphmeier Apr 15, 2022
da8f234
remove some TODO [now]s
rphmeier Apr 15, 2022
91067d6
fix fallout in statement distribution
rphmeier Apr 15, 2022
708a6d6
fmt
rphmeier Apr 15, 2022
d46a3a8
fallout in gossip-support
rphmeier Apr 15, 2022
95d4463
fix fallout in collator-protocol
rphmeier Apr 15, 2022
5c811ec
fix fallout in bitfield-distribution
rphmeier Apr 15, 2022
5fc3b9c
fix fallout in approval-distribution
rphmeier Apr 15, 2022
3e08c99
Merge branch 'master' into rh-network-protocol-upgrades
rphmeier Apr 20, 2022
f30ead9
fmt
rphmeier Apr 20, 2022
382e45e
Merge branch 'master' into rh-network-protocol-upgrades
rphmeier Apr 21, 2022
ac07199
use never!
rphmeier Apr 21, 2022
3bc077e
fmt
rphmeier Apr 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 19 additions & 18 deletions node/network/approval-distribution/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

use futures::{channel::oneshot, FutureExt as _};
use polkadot_node_network_protocol::{
v1 as protocol_v1, PeerId, UnifiedReputationChange as Rep, View,
self as net_protocol, v1 as protocol_v1, PeerId, UnifiedReputationChange as Rep, Versioned,
View,
};
use polkadot_node_primitives::approval::{
AssignmentCert, BlockApprovalMeta, IndirectAssignmentCert, IndirectSignedApprovalVote,
Expand Down Expand Up @@ -457,11 +458,11 @@ impl State {
ctx: &mut (impl SubsystemContext<Message = ApprovalDistributionMessage>
+ overseer::SubsystemContext<Message = ApprovalDistributionMessage>),
metrics: &Metrics,
event: NetworkBridgeEvent<protocol_v1::ApprovalDistributionMessage>,
event: NetworkBridgeEvent<net_protocol::ApprovalDistributionMessage>,
rng: &mut (impl CryptoRng + Rng),
) {
match event {
NetworkBridgeEvent::PeerConnected(peer_id, role, _) => {
NetworkBridgeEvent::PeerConnected(peer_id, role, _, _) => {
// insert a blank view if none already present
gum::trace!(target: LOG_TARGET, ?peer_id, ?role, "Peer connected");
self.peer_views.entry(peer_id).or_default();
Expand Down Expand Up @@ -501,7 +502,7 @@ impl State {
live
});
},
NetworkBridgeEvent::PeerMessage(peer_id, msg) => {
NetworkBridgeEvent::PeerMessage(peer_id, Versioned::V1(msg)) => {
self.process_incoming_peer_message(ctx, metrics, peer_id, msg, rng).await;
},
}
Expand Down Expand Up @@ -1068,9 +1069,9 @@ impl State {

ctx.send_message(NetworkBridgeMessage::SendValidationMessage(
peers,
protocol_v1::ValidationProtocol::ApprovalDistribution(
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
protocol_v1::ApprovalDistributionMessage::Assignments(assignments),
),
)),
))
.await;
}
Expand Down Expand Up @@ -1330,9 +1331,9 @@ impl State {

ctx.send_message(NetworkBridgeMessage::SendValidationMessage(
peers,
protocol_v1::ValidationProtocol::ApprovalDistribution(
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
protocol_v1::ApprovalDistributionMessage::Approvals(approvals),
),
)),
))
.await;
}
Expand Down Expand Up @@ -1458,9 +1459,9 @@ impl State {

ctx.send_message(NetworkBridgeMessage::SendValidationMessage(
vec![peer_id.clone()],
protocol_v1::ValidationProtocol::ApprovalDistribution(
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
protocol_v1::ApprovalDistributionMessage::Assignments(assignments_to_send),
),
)),
))
.await;
}
Expand All @@ -1474,10 +1475,10 @@ impl State {
);

ctx.send_message(NetworkBridgeMessage::SendValidationMessage(
vec![peer_id.clone()],
protocol_v1::ValidationProtocol::ApprovalDistribution(
vec![peer_id],
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
protocol_v1::ApprovalDistributionMessage::Approvals(approvals_to_send),
),
)),
))
.await;
}
Expand Down Expand Up @@ -1676,19 +1677,19 @@ async fn adjust_required_routing_and_propagate(
for (peer, assignments_packet) in peer_assignments {
ctx.send_message(NetworkBridgeMessage::SendValidationMessage(
vec![peer],
protocol_v1::ValidationProtocol::ApprovalDistribution(
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
protocol_v1::ApprovalDistributionMessage::Assignments(assignments_packet),
),
)),
))
.await;
}

for (peer, approvals_packet) in peer_approvals {
ctx.send_message(NetworkBridgeMessage::SendValidationMessage(
vec![peer],
protocol_v1::ValidationProtocol::ApprovalDistribution(
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
protocol_v1::ApprovalDistributionMessage::Approvals(approvals_packet),
),
)),
))
.await;
}
Expand Down Expand Up @@ -1779,7 +1780,7 @@ impl ApprovalDistribution {
Context: overseer::SubsystemContext<Message = ApprovalDistributionMessage>,
{
match msg {
ApprovalDistributionMessage::NetworkBridgeUpdateV1(event) => {
ApprovalDistributionMessage::NetworkBridgeUpdate(event) => {
state.handle_network_msg(ctx, metrics, event, rng).await;
},
ApprovalDistributionMessage::NewBlocks(metas) => {
Expand Down
Loading