mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 10:57:56 +00:00
Prepare for network protocol version upgrades (#5084)
* explicitly tag network requests with version * fmt * make PeerSet more aware of versioning * some generalization of the network bridge to support upgrades * walk back some renaming * walk back some version stuff * extract version from fallback * remove V1 from NetworkBridgeUpdate * add accidentally-removed timer * implement focusing for versioned messages * fmt * fix up network bridge & tests * remove inaccurate version check in bridge * remove some TODO [now]s * fix fallout in statement distribution * fmt * fallout in gossip-support * fix fallout in collator-protocol * fix fallout in bitfield-distribution * fix fallout in approval-distribution * fmt * use never! * fmt
This commit is contained in:
@@ -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,
|
||||
@@ -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();
|
||||
@@ -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;
|
||||
},
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -1676,9 +1677,9 @@ 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;
|
||||
}
|
||||
@@ -1686,9 +1687,9 @@ async fn adjust_required_routing_and_propagate(
|
||||
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;
|
||||
}
|
||||
@@ -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) => {
|
||||
|
||||
@@ -157,7 +157,7 @@ async fn setup_gossip_topology(
|
||||
) {
|
||||
overseer_send(
|
||||
virtual_overseer,
|
||||
ApprovalDistributionMessage::NetworkBridgeUpdateV1(NetworkBridgeEvent::NewGossipTopology(
|
||||
ApprovalDistributionMessage::NetworkBridgeUpdate(NetworkBridgeEvent::NewGossipTopology(
|
||||
gossip_topology,
|
||||
)),
|
||||
)
|
||||
@@ -171,16 +171,17 @@ async fn setup_peer_with_view(
|
||||
) {
|
||||
overseer_send(
|
||||
virtual_overseer,
|
||||
ApprovalDistributionMessage::NetworkBridgeUpdateV1(NetworkBridgeEvent::PeerConnected(
|
||||
ApprovalDistributionMessage::NetworkBridgeUpdate(NetworkBridgeEvent::PeerConnected(
|
||||
peer_id.clone(),
|
||||
ObservedRole::Full,
|
||||
1,
|
||||
None,
|
||||
)),
|
||||
)
|
||||
.await;
|
||||
overseer_send(
|
||||
virtual_overseer,
|
||||
ApprovalDistributionMessage::NetworkBridgeUpdateV1(NetworkBridgeEvent::PeerViewChange(
|
||||
ApprovalDistributionMessage::NetworkBridgeUpdate(NetworkBridgeEvent::PeerViewChange(
|
||||
peer_id.clone(),
|
||||
view,
|
||||
)),
|
||||
@@ -195,9 +196,9 @@ async fn send_message_from_peer(
|
||||
) {
|
||||
overseer_send(
|
||||
virtual_overseer,
|
||||
ApprovalDistributionMessage::NetworkBridgeUpdateV1(NetworkBridgeEvent::PeerMessage(
|
||||
ApprovalDistributionMessage::NetworkBridgeUpdate(NetworkBridgeEvent::PeerMessage(
|
||||
peer_id.clone(),
|
||||
msg,
|
||||
Versioned::V1(msg),
|
||||
)),
|
||||
)
|
||||
.await;
|
||||
@@ -300,9 +301,9 @@ fn try_import_the_same_assignment() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Assignments(assignments)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
assert_eq!(peers.len(), 2);
|
||||
assert_eq!(assignments.len(), 1);
|
||||
@@ -390,7 +391,7 @@ fn spam_attack_results_in_negative_reputation_change() {
|
||||
// send a view update that removes block B from peer's view by bumping the finalized_number
|
||||
overseer_send(
|
||||
overseer,
|
||||
ApprovalDistributionMessage::NetworkBridgeUpdateV1(NetworkBridgeEvent::PeerViewChange(
|
||||
ApprovalDistributionMessage::NetworkBridgeUpdate(NetworkBridgeEvent::PeerViewChange(
|
||||
peer.clone(),
|
||||
View::with_finalized(2),
|
||||
)),
|
||||
@@ -450,7 +451,7 @@ fn peer_sending_us_the_same_we_just_sent_them_is_ok() {
|
||||
// update peer view to include the hash
|
||||
overseer_send(
|
||||
overseer,
|
||||
ApprovalDistributionMessage::NetworkBridgeUpdateV1(NetworkBridgeEvent::PeerViewChange(
|
||||
ApprovalDistributionMessage::NetworkBridgeUpdate(NetworkBridgeEvent::PeerViewChange(
|
||||
peer.clone(),
|
||||
view![hash],
|
||||
)),
|
||||
@@ -462,9 +463,9 @@ fn peer_sending_us_the_same_we_just_sent_them_is_ok() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Assignments(assignments)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
assert_eq!(peers.len(), 1);
|
||||
assert_eq!(assignments.len(), 1);
|
||||
@@ -529,9 +530,9 @@ fn import_approval_happy_path() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Assignments(assignments)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
assert_eq!(peers.len(), 2);
|
||||
assert_eq!(assignments.len(), 1);
|
||||
@@ -565,9 +566,9 @@ fn import_approval_happy_path() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Approvals(approvals)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
assert_eq!(peers.len(), 1);
|
||||
assert_eq!(approvals.len(), 1);
|
||||
@@ -788,9 +789,9 @@ fn update_peer_view() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Assignments(assignments)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
assert_eq!(peers.len(), 1);
|
||||
assert_eq!(assignments.len(), 1);
|
||||
@@ -819,7 +820,7 @@ fn update_peer_view() {
|
||||
// update peer's view
|
||||
overseer_send(
|
||||
overseer,
|
||||
ApprovalDistributionMessage::NetworkBridgeUpdateV1(NetworkBridgeEvent::PeerViewChange(
|
||||
ApprovalDistributionMessage::NetworkBridgeUpdate(NetworkBridgeEvent::PeerViewChange(
|
||||
peer.clone(),
|
||||
View::new(vec![hash_b, hash_c, hash_d], 2),
|
||||
)),
|
||||
@@ -839,9 +840,9 @@ fn update_peer_view() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Assignments(assignments)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
assert_eq!(peers.len(), 1);
|
||||
assert_eq!(assignments.len(), 1);
|
||||
@@ -872,7 +873,7 @@ fn update_peer_view() {
|
||||
// update peer's view
|
||||
overseer_send(
|
||||
overseer,
|
||||
ApprovalDistributionMessage::NetworkBridgeUpdateV1(NetworkBridgeEvent::PeerViewChange(
|
||||
ApprovalDistributionMessage::NetworkBridgeUpdate(NetworkBridgeEvent::PeerViewChange(
|
||||
peer.clone(),
|
||||
View::with_finalized(finalized_number),
|
||||
)),
|
||||
@@ -1026,9 +1027,9 @@ fn sends_assignments_even_when_state_is_approved() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Assignments(sent_assignments)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
assert_eq!(peers, vec![peer.clone()]);
|
||||
assert_eq!(sent_assignments, assignments);
|
||||
@@ -1039,9 +1040,9 @@ fn sends_assignments_even_when_state_is_approved() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Approvals(sent_approvals)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
assert_eq!(peers, vec![peer.clone()]);
|
||||
assert_eq!(sent_approvals, approvals);
|
||||
@@ -1086,7 +1087,7 @@ fn race_condition_in_local_vs_remote_view_update() {
|
||||
// Send our view update to include a new head
|
||||
overseer_send(
|
||||
overseer,
|
||||
ApprovalDistributionMessage::NetworkBridgeUpdateV1(NetworkBridgeEvent::OurViewChange(
|
||||
ApprovalDistributionMessage::NetworkBridgeUpdate(NetworkBridgeEvent::OurViewChange(
|
||||
our_view![hash_b],
|
||||
)),
|
||||
)
|
||||
@@ -1201,9 +1202,9 @@ fn propagates_locally_generated_assignment_to_both_dimensions() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
sent_peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Assignments(sent_assignments)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
assert_eq!(sent_peers.len(), expected_indices.len() + 4);
|
||||
for &i in &expected_indices {
|
||||
@@ -1222,9 +1223,9 @@ fn propagates_locally_generated_assignment_to_both_dimensions() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
sent_peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Approvals(sent_approvals)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
// Random sampling is reused from the assignment.
|
||||
assert_eq!(sent_peers, assignment_sent_peers);
|
||||
@@ -1305,9 +1306,9 @@ fn propagates_assignments_along_unshared_dimension() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
sent_peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Assignments(sent_assignments)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
assert_eq!(sent_peers.len(), expected_y.len() + 4);
|
||||
for &i in &expected_y {
|
||||
@@ -1354,9 +1355,9 @@ fn propagates_assignments_along_unshared_dimension() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
sent_peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Assignments(sent_assignments)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
assert_eq!(sent_peers.len(), expected_x.len() + 4);
|
||||
for &i in &expected_x {
|
||||
@@ -1449,9 +1450,9 @@ fn propagates_to_required_after_connect() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
sent_peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Assignments(sent_assignments)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
assert_eq!(sent_peers.len(), expected_indices.len() + 4);
|
||||
for &i in &expected_indices {
|
||||
@@ -1470,9 +1471,9 @@ fn propagates_to_required_after_connect() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
sent_peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Approvals(sent_approvals)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
// Random sampling is reused from the assignment.
|
||||
assert_eq!(sent_peers, assignment_sent_peers);
|
||||
@@ -1487,9 +1488,9 @@ fn propagates_to_required_after_connect() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
sent_peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Assignments(sent_assignments)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
assert_eq!(sent_peers.len(), 1);
|
||||
assert_eq!(&sent_peers[0], &peers[i].0);
|
||||
@@ -1501,9 +1502,9 @@ fn propagates_to_required_after_connect() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
sent_peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Approvals(sent_approvals)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
assert_eq!(sent_peers.len(), 1);
|
||||
assert_eq!(&sent_peers[0], &peers[i].0);
|
||||
@@ -1575,9 +1576,9 @@ fn sends_to_more_peers_after_getting_topology() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
sent_peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Assignments(sent_assignments)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
// Only sends to random peers.
|
||||
assert_eq!(sent_peers.len(), 4);
|
||||
@@ -1597,9 +1598,9 @@ fn sends_to_more_peers_after_getting_topology() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
sent_peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Approvals(sent_approvals)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
// Random sampling is reused from the assignment.
|
||||
assert_eq!(sent_peers, assignment_sent_peers);
|
||||
@@ -1622,9 +1623,9 @@ fn sends_to_more_peers_after_getting_topology() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
sent_peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Assignments(sent_assignments)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
// Sends to all expected peers.
|
||||
assert_eq!(sent_peers.len(), 1);
|
||||
@@ -1643,9 +1644,9 @@ fn sends_to_more_peers_after_getting_topology() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
sent_peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Approvals(sent_approvals)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
// Sends to all expected peers.
|
||||
assert_eq!(sent_peers.len(), 1);
|
||||
@@ -1733,9 +1734,9 @@ fn originator_aggression_l1() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
sent_peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Assignments(_)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
sent_peers.into_iter()
|
||||
.filter_map(|sp| peers.iter().position(|p| &p.0 == &sp))
|
||||
@@ -1747,9 +1748,9 @@ fn originator_aggression_l1() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
_,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Approvals(_)
|
||||
)
|
||||
))
|
||||
)) => { }
|
||||
);
|
||||
|
||||
@@ -1783,9 +1784,9 @@ fn originator_aggression_l1() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
sent_peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Assignments(sent_assignments)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
// Sends to all expected peers.
|
||||
assert_eq!(sent_peers.len(), 1);
|
||||
@@ -1803,9 +1804,9 @@ fn originator_aggression_l1() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
sent_peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Approvals(sent_approvals)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
// Sends to all expected peers.
|
||||
assert_eq!(sent_peers.len(), 1);
|
||||
@@ -1892,9 +1893,9 @@ fn non_originator_aggression_l1() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
_,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Assignments(_)
|
||||
)
|
||||
))
|
||||
)) => { }
|
||||
);
|
||||
|
||||
@@ -1997,9 +1998,9 @@ fn non_originator_aggression_l2() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
sent_peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Assignments(_)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
sent_peers.into_iter()
|
||||
.filter_map(|sp| peers.iter().position(|p| &p.0 == &sp))
|
||||
@@ -2067,9 +2068,9 @@ fn non_originator_aggression_l2() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
sent_peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Assignments(sent_assignments)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
// Sends to all expected peers.
|
||||
assert_eq!(sent_peers.len(), 1);
|
||||
@@ -2158,9 +2159,9 @@ fn resends_messages_periodically() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
sent_peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Assignments(sent_assignments)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
assert_eq!(sent_peers.len(), expected_y.len() + 4);
|
||||
for &i in &expected_y {
|
||||
@@ -2207,9 +2208,9 @@ fn resends_messages_periodically() {
|
||||
overseer_recv(overseer).await,
|
||||
AllMessages::NetworkBridge(NetworkBridgeMessage::SendValidationMessage(
|
||||
sent_peers,
|
||||
protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
protocol_v1::ApprovalDistributionMessage::Assignments(sent_assignments)
|
||||
)
|
||||
))
|
||||
)) => {
|
||||
assert_eq!(sent_peers.len(), 1);
|
||||
let expected_pos = expected_y.iter()
|
||||
|
||||
Reference in New Issue
Block a user