mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 11:07: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:
@@ -26,10 +26,11 @@ use error::{log_error, FatalResult, JfyiErrorResult};
|
||||
use parity_scale_codec::Encode;
|
||||
|
||||
use polkadot_node_network_protocol::{
|
||||
self as net_protocol,
|
||||
peer_set::{IsAuthority, PeerSet},
|
||||
request_response::{v1 as request_v1, IncomingRequestReceiver},
|
||||
v1::{self as protocol_v1, StatementMetadata},
|
||||
IfDisconnected, PeerId, UnifiedReputationChange as Rep, View,
|
||||
IfDisconnected, PeerId, UnifiedReputationChange as Rep, Versioned, View,
|
||||
};
|
||||
use polkadot_node_primitives::{SignedFullStatement, Statement, UncheckedSignedFullStatement};
|
||||
use polkadot_node_subsystem_util::{self as util, rand, MIN_GOSSIP_PEERS};
|
||||
@@ -961,7 +962,7 @@ fn statement_message(
|
||||
relay_parent: Hash,
|
||||
statement: SignedFullStatement,
|
||||
metrics: &Metrics,
|
||||
) -> protocol_v1::ValidationProtocol {
|
||||
) -> net_protocol::VersionedValidationProtocol {
|
||||
let (is_large, size) = is_statement_large(&statement);
|
||||
if let Some(size) = size {
|
||||
metrics.on_created_message(size);
|
||||
@@ -978,7 +979,7 @@ fn statement_message(
|
||||
protocol_v1::StatementDistributionMessage::Statement(relay_parent, statement.into())
|
||||
};
|
||||
|
||||
protocol_v1::ValidationProtocol::StatementDistribution(msg)
|
||||
protocol_v1::ValidationProtocol::StatementDistribution(msg).into()
|
||||
}
|
||||
|
||||
/// Check whether a statement should be treated as large statement.
|
||||
@@ -1603,12 +1604,12 @@ async fn handle_network_update(
|
||||
recent_outdated_heads: &RecentOutdatedHeads,
|
||||
ctx: &mut (impl SubsystemContext + overseer::SubsystemContext),
|
||||
req_sender: &mpsc::Sender<RequesterMessage>,
|
||||
update: NetworkBridgeEvent<protocol_v1::StatementDistributionMessage>,
|
||||
update: NetworkBridgeEvent<net_protocol::StatementDistributionMessage>,
|
||||
metrics: &Metrics,
|
||||
rng: &mut impl rand::Rng,
|
||||
) {
|
||||
match update {
|
||||
NetworkBridgeEvent::PeerConnected(peer, role, maybe_authority) => {
|
||||
NetworkBridgeEvent::PeerConnected(peer, role, _, maybe_authority) => {
|
||||
gum::trace!(target: LOG_TARGET, ?peer, ?role, "Peer connected");
|
||||
peers.insert(
|
||||
peer,
|
||||
@@ -1660,7 +1661,7 @@ async fn handle_network_update(
|
||||
}
|
||||
}
|
||||
},
|
||||
NetworkBridgeEvent::PeerMessage(peer, message) => {
|
||||
NetworkBridgeEvent::PeerMessage(peer, Versioned::V1(message)) => {
|
||||
handle_incoming_message_and_circulate(
|
||||
peer,
|
||||
gossip_peers,
|
||||
@@ -2056,7 +2057,7 @@ impl<R: rand::Rng> StatementDistributionSubsystem<R> {
|
||||
)
|
||||
.await;
|
||||
},
|
||||
StatementDistributionMessage::NetworkBridgeUpdateV1(event) => {
|
||||
StatementDistributionMessage::NetworkBridgeUpdate(event) => {
|
||||
handle_network_update(
|
||||
peers,
|
||||
gossip_peers,
|
||||
|
||||
@@ -107,7 +107,7 @@ pub async fn fetch(
|
||||
let (outgoing, pending_response) =
|
||||
OutgoingRequest::new(Recipient::Peer(peer), req.clone());
|
||||
if let Err(err) = sender
|
||||
.feed(RequesterMessage::SendRequest(Requests::StatementFetching(outgoing)))
|
||||
.feed(RequesterMessage::SendRequest(Requests::StatementFetchingV1(outgoing)))
|
||||
.await
|
||||
{
|
||||
gum::info!(
|
||||
|
||||
@@ -771,23 +771,23 @@ fn receiving_from_one_sends_to_another_and_to_candidate_backing() {
|
||||
// notify of peers and view
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
NetworkBridgeEvent::PeerConnected(peer_a.clone(), ObservedRole::Full, None),
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(peer_a.clone(), ObservedRole::Full, 1, None),
|
||||
),
|
||||
})
|
||||
.await;
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
NetworkBridgeEvent::PeerConnected(peer_b.clone(), ObservedRole::Full, None),
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(peer_b.clone(), ObservedRole::Full, 1, None),
|
||||
),
|
||||
})
|
||||
.await;
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_a.clone(), view![hash_a]),
|
||||
),
|
||||
})
|
||||
@@ -795,7 +795,7 @@ fn receiving_from_one_sends_to_another_and_to_candidate_backing() {
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_b.clone(), view![hash_a]),
|
||||
),
|
||||
})
|
||||
@@ -830,13 +830,13 @@ fn receiving_from_one_sends_to_another_and_to_candidate_backing() {
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerMessage(
|
||||
peer_a.clone(),
|
||||
protocol_v1::StatementDistributionMessage::Statement(
|
||||
Versioned::V1(protocol_v1::StatementDistributionMessage::Statement(
|
||||
hash_a,
|
||||
statement.clone().into(),
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
})
|
||||
@@ -861,9 +861,9 @@ fn receiving_from_one_sends_to_another_and_to_candidate_backing() {
|
||||
AllMessages::NetworkBridge(
|
||||
NetworkBridgeMessage::SendValidationMessage(
|
||||
recipients,
|
||||
protocol_v1::ValidationProtocol::StatementDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::StatementDistribution(
|
||||
protocol_v1::StatementDistributionMessage::Statement(r, s)
|
||||
),
|
||||
)),
|
||||
)
|
||||
) => {
|
||||
assert_eq!(recipients, vec![peer_b.clone()]);
|
||||
@@ -964,10 +964,11 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
// notify of peers and view
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer_a.clone(),
|
||||
ObservedRole::Full,
|
||||
1,
|
||||
Some(HashSet::from([Sr25519Keyring::Alice.public().into()])),
|
||||
),
|
||||
),
|
||||
@@ -976,10 +977,11 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer_b.clone(),
|
||||
ObservedRole::Full,
|
||||
1,
|
||||
Some(HashSet::from([Sr25519Keyring::Bob.public().into()])),
|
||||
),
|
||||
),
|
||||
@@ -987,10 +989,11 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer_c.clone(),
|
||||
ObservedRole::Full,
|
||||
1,
|
||||
Some(HashSet::from([Sr25519Keyring::Charlie.public().into()])),
|
||||
),
|
||||
),
|
||||
@@ -998,15 +1001,20 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
NetworkBridgeEvent::PeerConnected(peer_bad.clone(), ObservedRole::Full, None),
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer_bad.clone(),
|
||||
ObservedRole::Full,
|
||||
1,
|
||||
None,
|
||||
),
|
||||
),
|
||||
})
|
||||
.await;
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_a.clone(), view![hash_a]),
|
||||
),
|
||||
})
|
||||
@@ -1014,21 +1022,21 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_b.clone(), view![hash_a]),
|
||||
),
|
||||
})
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_c.clone(), view![hash_a]),
|
||||
),
|
||||
})
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_bad.clone(), view![hash_a]),
|
||||
),
|
||||
})
|
||||
@@ -1066,10 +1074,12 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerMessage(
|
||||
peer_a.clone(),
|
||||
protocol_v1::StatementDistributionMessage::LargeStatement(metadata.clone()),
|
||||
Versioned::V1(protocol_v1::StatementDistributionMessage::LargeStatement(
|
||||
metadata.clone(),
|
||||
)),
|
||||
),
|
||||
),
|
||||
})
|
||||
@@ -1084,7 +1094,7 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
) => {
|
||||
let reqs = reqs.pop().unwrap();
|
||||
let outgoing = match reqs {
|
||||
Requests::StatementFetching(outgoing) => outgoing,
|
||||
Requests::StatementFetchingV1(outgoing) => outgoing,
|
||||
_ => panic!("Unexpected request"),
|
||||
};
|
||||
let req = outgoing.payload;
|
||||
@@ -1102,10 +1112,12 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerMessage(
|
||||
peer_c.clone(),
|
||||
protocol_v1::StatementDistributionMessage::LargeStatement(metadata.clone()),
|
||||
Versioned::V1(protocol_v1::StatementDistributionMessage::LargeStatement(
|
||||
metadata.clone(),
|
||||
)),
|
||||
),
|
||||
),
|
||||
})
|
||||
@@ -1114,10 +1126,12 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
// Malicious peer:
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerMessage(
|
||||
peer_bad.clone(),
|
||||
protocol_v1::StatementDistributionMessage::LargeStatement(metadata.clone()),
|
||||
Versioned::V1(protocol_v1::StatementDistributionMessage::LargeStatement(
|
||||
metadata.clone(),
|
||||
)),
|
||||
),
|
||||
),
|
||||
})
|
||||
@@ -1133,7 +1147,7 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
) => {
|
||||
let reqs = reqs.pop().unwrap();
|
||||
let outgoing = match reqs {
|
||||
Requests::StatementFetching(outgoing) => outgoing,
|
||||
Requests::StatementFetchingV1(outgoing) => outgoing,
|
||||
_ => panic!("Unexpected request"),
|
||||
};
|
||||
let req = outgoing.payload;
|
||||
@@ -1153,7 +1167,7 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
) => {
|
||||
let reqs = reqs.pop().unwrap();
|
||||
let outgoing = match reqs {
|
||||
Requests::StatementFetching(outgoing) => outgoing,
|
||||
Requests::StatementFetchingV1(outgoing) => outgoing,
|
||||
_ => panic!("Unexpected request"),
|
||||
};
|
||||
let req = outgoing.payload;
|
||||
@@ -1174,7 +1188,7 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
) => {
|
||||
let reqs = reqs.pop().unwrap();
|
||||
let outgoing = match reqs {
|
||||
Requests::StatementFetching(outgoing) => outgoing,
|
||||
Requests::StatementFetchingV1(outgoing) => outgoing,
|
||||
_ => panic!("Unexpected request"),
|
||||
};
|
||||
let req = outgoing.payload;
|
||||
@@ -1209,7 +1223,7 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
) => {
|
||||
let reqs = reqs.pop().unwrap();
|
||||
let outgoing = match reqs {
|
||||
Requests::StatementFetching(outgoing) => outgoing,
|
||||
Requests::StatementFetchingV1(outgoing) => outgoing,
|
||||
_ => panic!("Unexpected request"),
|
||||
};
|
||||
let req = outgoing.payload;
|
||||
@@ -1230,7 +1244,7 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
) => {
|
||||
let reqs = reqs.pop().unwrap();
|
||||
let outgoing = match reqs {
|
||||
Requests::StatementFetching(outgoing) => outgoing,
|
||||
Requests::StatementFetchingV1(outgoing) => outgoing,
|
||||
_ => panic!("Unexpected request"),
|
||||
};
|
||||
let req = outgoing.payload;
|
||||
@@ -1277,9 +1291,9 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
|
||||
AllMessages::NetworkBridge(
|
||||
NetworkBridgeMessage::SendValidationMessage(
|
||||
mut recipients,
|
||||
protocol_v1::ValidationProtocol::StatementDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::StatementDistribution(
|
||||
protocol_v1::StatementDistributionMessage::LargeStatement(meta)
|
||||
),
|
||||
)),
|
||||
)
|
||||
) => {
|
||||
gum::debug!(
|
||||
@@ -1463,10 +1477,11 @@ fn share_prioritizes_backing_group() {
|
||||
for (peer, pair) in dummy_peers.clone().into_iter().zip(dummy_pairs) {
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer,
|
||||
ObservedRole::Full,
|
||||
1,
|
||||
Some(HashSet::from([pair.public().into()])),
|
||||
),
|
||||
),
|
||||
@@ -1475,7 +1490,7 @@ fn share_prioritizes_backing_group() {
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer, view![hash_a]),
|
||||
),
|
||||
})
|
||||
@@ -1485,10 +1500,11 @@ fn share_prioritizes_backing_group() {
|
||||
// notify of peers and view
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer_a.clone(),
|
||||
ObservedRole::Full,
|
||||
1,
|
||||
Some(HashSet::from([Sr25519Keyring::Alice.public().into()])),
|
||||
),
|
||||
),
|
||||
@@ -1496,10 +1512,11 @@ fn share_prioritizes_backing_group() {
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer_b.clone(),
|
||||
ObservedRole::Full,
|
||||
1,
|
||||
Some(HashSet::from([Sr25519Keyring::Bob.public().into()])),
|
||||
),
|
||||
),
|
||||
@@ -1507,10 +1524,11 @@ fn share_prioritizes_backing_group() {
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer_c.clone(),
|
||||
ObservedRole::Full,
|
||||
1,
|
||||
Some(HashSet::from([Sr25519Keyring::Charlie.public().into()])),
|
||||
),
|
||||
),
|
||||
@@ -1518,17 +1536,23 @@ fn share_prioritizes_backing_group() {
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
NetworkBridgeEvent::PeerConnected(peer_bad.clone(), ObservedRole::Full, None),
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer_bad.clone(),
|
||||
ObservedRole::Full,
|
||||
1,
|
||||
None,
|
||||
),
|
||||
),
|
||||
})
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer_other_group.clone(),
|
||||
ObservedRole::Full,
|
||||
1,
|
||||
Some(HashSet::from([Sr25519Keyring::Dave.public().into()])),
|
||||
),
|
||||
),
|
||||
@@ -1537,7 +1561,7 @@ fn share_prioritizes_backing_group() {
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_a.clone(), view![hash_a]),
|
||||
),
|
||||
})
|
||||
@@ -1545,28 +1569,28 @@ fn share_prioritizes_backing_group() {
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_b.clone(), view![hash_a]),
|
||||
),
|
||||
})
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_c.clone(), view![hash_a]),
|
||||
),
|
||||
})
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_bad.clone(), view![hash_a]),
|
||||
),
|
||||
})
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_other_group.clone(), view![hash_a]),
|
||||
),
|
||||
})
|
||||
@@ -1614,9 +1638,9 @@ fn share_prioritizes_backing_group() {
|
||||
AllMessages::NetworkBridge(
|
||||
NetworkBridgeMessage::SendValidationMessage(
|
||||
mut recipients,
|
||||
protocol_v1::ValidationProtocol::StatementDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::StatementDistribution(
|
||||
protocol_v1::StatementDistributionMessage::LargeStatement(meta)
|
||||
),
|
||||
)),
|
||||
)
|
||||
) => {
|
||||
gum::debug!(
|
||||
@@ -1746,10 +1770,11 @@ fn peer_cant_flood_with_large_statements() {
|
||||
// notify of peers and view
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer_a.clone(),
|
||||
ObservedRole::Full,
|
||||
1,
|
||||
Some(HashSet::from([Sr25519Keyring::Alice.public().into()])),
|
||||
),
|
||||
),
|
||||
@@ -1758,7 +1783,7 @@ fn peer_cant_flood_with_large_statements() {
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer_a.clone(), view![hash_a]),
|
||||
),
|
||||
})
|
||||
@@ -1795,11 +1820,13 @@ fn peer_cant_flood_with_large_statements() {
|
||||
for _ in 0..MAX_LARGE_STATEMENTS_PER_SENDER + 1 {
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerMessage(
|
||||
peer_a.clone(),
|
||||
protocol_v1::StatementDistributionMessage::LargeStatement(
|
||||
metadata.clone(),
|
||||
Versioned::V1(
|
||||
protocol_v1::StatementDistributionMessage::LargeStatement(
|
||||
metadata.clone(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -1819,7 +1846,7 @@ fn peer_cant_flood_with_large_statements() {
|
||||
)) => {
|
||||
let reqs = reqs.pop().unwrap();
|
||||
let outgoing = match reqs {
|
||||
Requests::StatementFetching(outgoing) => outgoing,
|
||||
Requests::StatementFetchingV1(outgoing) => outgoing,
|
||||
_ => panic!("Unexpected request"),
|
||||
};
|
||||
let req = outgoing.payload;
|
||||
@@ -1949,14 +1976,19 @@ fn handle_multiple_seconded_statements() {
|
||||
for peer in all_peers.iter() {
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
NetworkBridgeEvent::PeerConnected(peer.clone(), ObservedRole::Full, None),
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerConnected(
|
||||
peer.clone(),
|
||||
ObservedRole::Full,
|
||||
1,
|
||||
None,
|
||||
),
|
||||
),
|
||||
})
|
||||
.await;
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerViewChange(peer.clone(), view![relay_parent_hash]),
|
||||
),
|
||||
})
|
||||
@@ -1991,7 +2023,7 @@ fn handle_multiple_seconded_statements() {
|
||||
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::NewGossipTopology(gossip_topology),
|
||||
),
|
||||
})
|
||||
@@ -2027,13 +2059,13 @@ fn handle_multiple_seconded_statements() {
|
||||
// `PeerA` sends a `Seconded` message
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerMessage(
|
||||
peer_a.clone(),
|
||||
protocol_v1::StatementDistributionMessage::Statement(
|
||||
Versioned::V1(protocol_v1::StatementDistributionMessage::Statement(
|
||||
relay_parent_hash,
|
||||
statement.clone().into(),
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
})
|
||||
@@ -2065,9 +2097,9 @@ fn handle_multiple_seconded_statements() {
|
||||
AllMessages::NetworkBridge(
|
||||
NetworkBridgeMessage::SendValidationMessage(
|
||||
recipients,
|
||||
protocol_v1::ValidationProtocol::StatementDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::StatementDistribution(
|
||||
protocol_v1::StatementDistributionMessage::Statement(r, s)
|
||||
),
|
||||
)),
|
||||
)
|
||||
) => {
|
||||
assert!(!recipients.contains(&peer_b));
|
||||
@@ -2079,13 +2111,13 @@ fn handle_multiple_seconded_statements() {
|
||||
// `PeerB` sends a `Seconded` message: valid but known
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerMessage(
|
||||
peer_b.clone(),
|
||||
protocol_v1::StatementDistributionMessage::Statement(
|
||||
Versioned::V1(protocol_v1::StatementDistributionMessage::Statement(
|
||||
relay_parent_hash,
|
||||
statement.clone().into(),
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
})
|
||||
@@ -2130,13 +2162,13 @@ fn handle_multiple_seconded_statements() {
|
||||
// `PeerA` sends a `Valid` message
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerMessage(
|
||||
peer_a.clone(),
|
||||
protocol_v1::StatementDistributionMessage::Statement(
|
||||
Versioned::V1(protocol_v1::StatementDistributionMessage::Statement(
|
||||
relay_parent_hash,
|
||||
statement.clone().into(),
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
})
|
||||
@@ -2167,9 +2199,9 @@ fn handle_multiple_seconded_statements() {
|
||||
AllMessages::NetworkBridge(
|
||||
NetworkBridgeMessage::SendValidationMessage(
|
||||
recipients,
|
||||
protocol_v1::ValidationProtocol::StatementDistribution(
|
||||
Versioned::V1(protocol_v1::ValidationProtocol::StatementDistribution(
|
||||
protocol_v1::StatementDistributionMessage::Statement(r, s)
|
||||
),
|
||||
)),
|
||||
)
|
||||
) => {
|
||||
assert!(!recipients.contains(&peer_b));
|
||||
@@ -2181,13 +2213,13 @@ fn handle_multiple_seconded_statements() {
|
||||
// `PeerB` sends a `Valid` message
|
||||
handle
|
||||
.send(FromOverseer::Communication {
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdateV1(
|
||||
msg: StatementDistributionMessage::NetworkBridgeUpdate(
|
||||
NetworkBridgeEvent::PeerMessage(
|
||||
peer_b.clone(),
|
||||
protocol_v1::StatementDistributionMessage::Statement(
|
||||
Versioned::V1(protocol_v1::StatementDistributionMessage::Statement(
|
||||
relay_parent_hash,
|
||||
statement.clone().into(),
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user