mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 22:41:06 +00:00
Request based PoV distribution (#2640)
* Indentation fix. * Prepare request-response for PoV fetching. * Drop old PoV distribution. * WIP: Fetch PoV directly from backing. * Backing compiles. * Runtime access and connection management for PoV distribution. * Get rid of seemingly dead code. * Implement PoV fetching. Backing does not yet use it. * Don't send `ConnectToValidators` for empty list. * Even better - no need to check over and over again. * PoV fetching implemented. + Typechecks + Should work Missing: - Guide - Tests - Do fallback fetching in case fetching from seconding validator fails. * Check PoV hash upon reception. * Implement retry of PoV fetching in backing. * Avoid pointless validation spawning. * Add jaeger span to pov requesting. * Add back tracing. * Review remarks. * Whitespace. * Whitespace again. * Cleanup + fix tests. * Log to log target in overseer. * Fix more tests. * Don't fail if group cannot be found. * Simple test for PoV fetcher. * Handle missing group membership better. * Add test for retry functionality. * Fix flaky test. * Spaces again. * Guide updates. * Spaces.
This commit is contained in:
@@ -696,7 +696,6 @@ mod tests {
|
||||
use polkadot_subsystem::messages::{
|
||||
ApprovalDistributionMessage,
|
||||
BitfieldDistributionMessage,
|
||||
PoVDistributionMessage,
|
||||
StatementDistributionMessage
|
||||
};
|
||||
use polkadot_node_subsystem_test_helpers::{
|
||||
@@ -897,13 +896,6 @@ mod tests {
|
||||
) if e == event.focus().expect("could not focus message")
|
||||
);
|
||||
|
||||
assert_matches!(
|
||||
virtual_overseer.recv().await,
|
||||
AllMessages::PoVDistribution(
|
||||
PoVDistributionMessage::NetworkBridgeUpdateV1(e)
|
||||
) if e == event.focus().expect("could not focus message")
|
||||
);
|
||||
|
||||
assert_matches!(
|
||||
virtual_overseer.recv().await,
|
||||
AllMessages::ApprovalDistribution(
|
||||
@@ -1166,13 +1158,12 @@ mod tests {
|
||||
).await;
|
||||
}
|
||||
|
||||
let pov_distribution_message = protocol_v1::PoVDistributionMessage::Awaiting(
|
||||
[0; 32].into(),
|
||||
vec![[1; 32].into()],
|
||||
let approval_distribution_message = protocol_v1::ApprovalDistributionMessage::Approvals(
|
||||
Vec::new()
|
||||
);
|
||||
|
||||
let message = protocol_v1::ValidationProtocol::PoVDistribution(
|
||||
pov_distribution_message.clone(),
|
||||
let message = protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
approval_distribution_message.clone(),
|
||||
);
|
||||
|
||||
network_handle.peer_message(
|
||||
@@ -1183,18 +1174,18 @@ mod tests {
|
||||
|
||||
network_handle.disconnect_peer(peer.clone(), PeerSet::Validation).await;
|
||||
|
||||
// PoV distribution message comes first, and the message is only sent to that subsystem.
|
||||
// Approval distribution message comes first, and the message is only sent to that subsystem.
|
||||
// then a disconnection event arises that is sent to all validation networking subsystems.
|
||||
|
||||
assert_matches!(
|
||||
virtual_overseer.recv().await,
|
||||
AllMessages::PoVDistribution(
|
||||
PoVDistributionMessage::NetworkBridgeUpdateV1(
|
||||
AllMessages::ApprovalDistribution(
|
||||
ApprovalDistributionMessage::NetworkBridgeUpdateV1(
|
||||
NetworkBridgeEvent::PeerMessage(p, m)
|
||||
)
|
||||
) => {
|
||||
assert_eq!(p, peer);
|
||||
assert_eq!(m, pov_distribution_message);
|
||||
assert_eq!(m, approval_distribution_message);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1563,13 +1554,12 @@ mod tests {
|
||||
// send a validation protocol message.
|
||||
|
||||
{
|
||||
let pov_distribution_message = protocol_v1::PoVDistributionMessage::Awaiting(
|
||||
[0; 32].into(),
|
||||
vec![[1; 32].into()],
|
||||
let approval_distribution_message = protocol_v1::ApprovalDistributionMessage::Approvals(
|
||||
Vec::new()
|
||||
);
|
||||
|
||||
let message = protocol_v1::ValidationProtocol::PoVDistribution(
|
||||
pov_distribution_message.clone(),
|
||||
let message = protocol_v1::ValidationProtocol::ApprovalDistribution(
|
||||
approval_distribution_message.clone(),
|
||||
);
|
||||
|
||||
virtual_overseer.send(FromOverseer::Communication {
|
||||
@@ -1624,7 +1614,7 @@ mod tests {
|
||||
fn spread_event_to_subsystems_is_up_to_date() {
|
||||
// Number of subsystems expected to be interested in a network event,
|
||||
// and hence the network event broadcasted to.
|
||||
const EXPECTED_COUNT: usize = 4;
|
||||
const EXPECTED_COUNT: usize = 3;
|
||||
|
||||
let mut cnt = 0_usize;
|
||||
for msg in AllMessages::dispatch_iter(NetworkBridgeEvent::PeerDisconnected(PeerId::random())) {
|
||||
@@ -1640,7 +1630,6 @@ mod tests {
|
||||
AllMessages::BitfieldDistribution(_) => { cnt += 1; }
|
||||
AllMessages::BitfieldSigning(_) => unreachable!("Not interested in network events"),
|
||||
AllMessages::Provisioner(_) => unreachable!("Not interested in network events"),
|
||||
AllMessages::PoVDistribution(_) => { cnt += 1; }
|
||||
AllMessages::RuntimeApi(_) => unreachable!("Not interested in network events"),
|
||||
AllMessages::AvailabilityStore(_) => unreachable!("Not interested in network events"),
|
||||
AllMessages::NetworkBridge(_) => unreachable!("Not interested in network events"),
|
||||
|
||||
@@ -141,6 +141,11 @@ fn multiplex_single(
|
||||
decode_with_peer::<v1::CollationFetchingRequest>(peer, payload)?,
|
||||
pending_response,
|
||||
)),
|
||||
Protocol::PoVFetching => From::from(IncomingRequest::new(
|
||||
peer,
|
||||
decode_with_peer::<v1::PoVFetchingRequest>(peer, payload)?,
|
||||
pending_response,
|
||||
)),
|
||||
Protocol::AvailableDataFetching => From::from(IncomingRequest::new(
|
||||
peer,
|
||||
decode_with_peer::<v1::AvailableDataFetchingRequest>(peer, payload)?,
|
||||
|
||||
@@ -237,14 +237,14 @@ impl Network for Arc<NetworkService<Block, Hash>> {
|
||||
Recipient::Peer(peer_id) => Some(peer_id),
|
||||
Recipient::Authority(authority) =>
|
||||
authority_discovery
|
||||
.get_addresses_by_authority_id(authority)
|
||||
.await
|
||||
.and_then(|addrs| {
|
||||
addrs
|
||||
.into_iter()
|
||||
.find_map(|addr| peer_id_from_multiaddr(&addr))
|
||||
}),
|
||||
};
|
||||
.get_addresses_by_authority_id(authority)
|
||||
.await
|
||||
.and_then(|addrs| {
|
||||
addrs
|
||||
.into_iter()
|
||||
.find_map(|addr| peer_id_from_multiaddr(&addr))
|
||||
}),
|
||||
};
|
||||
|
||||
let peer_id = match peer_id {
|
||||
None => {
|
||||
|
||||
Reference in New Issue
Block a user