Skip to content

Commit

Permalink
".git/.scripts/commands/fmt/fmt.sh"
Browse files Browse the repository at this point in the history
  • Loading branch information
command-bot committed Sep 9, 2024
1 parent 3dd3834 commit f194e5f
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ use crate::{
ErasureTask, PostRecoveryCheck, LOG_TARGET,
};

use futures::{channel::oneshot, SinkExt};
use polkadot_node_network_protocol::request_response::{
self as req_res, outgoing::RequestError, OutgoingRequest, Recipient, Requests,
};
use polkadot_node_primitives::AvailableData;
use polkadot_node_subsystem::{messages::NetworkBridgeTxMessage, overseer, RecoveryError};
use polkadot_primitives::ValidatorIndex;
use sc_network::{IfDisconnected, OutboundFailure, RequestFailure};
use sc_network::request_responses::CustomOutboundFailure;
use futures::{channel::oneshot, SinkExt};
use rand::seq::SliceRandom;
use sc_network::{
request_responses::CustomOutboundFailure, IfDisconnected, OutboundFailure, RequestFailure,
};

/// Parameters specific to the `FetchFull` strategy.
pub struct FetchFullParams {
Expand Down Expand Up @@ -153,7 +154,9 @@ impl<Sender: overseer::AvailabilityRecoverySenderTrait> RecoveryStrategy<Sender>
RequestError::InvalidResponse(_) =>
common_params.metrics.on_full_request_invalid(),
RequestError::NetworkError(req_failure) => {
if let RequestFailure::Network(CustomOutboundFailure::Timeout) = req_failure {
if let RequestFailure::Network(CustomOutboundFailure::Timeout) =
req_failure
{
common_params.metrics.on_full_request_timeout();
} else {
common_params.metrics.on_full_request_error();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ use crate::{
};

use codec::Decode;
use sc_network::request_responses::CustomOutboundFailure;
use futures::{channel::oneshot, SinkExt};
use polkadot_erasure_coding::branch_hash;
#[cfg(not(test))]
Expand All @@ -44,7 +43,10 @@ use polkadot_node_subsystem::{
overseer, RecoveryError,
};
use polkadot_primitives::{AuthorityDiscoveryId, BlakeTwo256, ChunkIndex, HashT, ValidatorIndex};
use sc_network::{IfDisconnected, OutboundFailure, ProtocolName, RequestFailure};
use sc_network::{
request_responses::CustomOutboundFailure, IfDisconnected, OutboundFailure, ProtocolName,
RequestFailure,
};
use std::{
collections::{BTreeMap, HashMap, VecDeque},
time::Duration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2413,8 +2413,7 @@ mod tests {
}

fn development_notifs(
) -> (Notifications, ProtocolController, Box<dyn crate::service::traits::NotificationService>)
{
) -> (Notifications, ProtocolController, Box<dyn crate::service::traits::NotificationService>) {
let (protocol_handle_pair, notif_service) =
crate::protocol::notifications::service::notification_service("/proto/1".into());
let (to_notifications, from_controller) =
Expand Down
5 changes: 3 additions & 2 deletions substrate/client/network/src/request_responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ impl NetworkBehaviour for RequestResponsesBehaviour {
}

let mut fallback_requests = vec![];

// Poll request-responses protocols.
for (protocol, (ref mut behaviour, ref mut resp_builder)) in &mut self.protocols {
'poll_protocol: while let Poll::Ready(ev) = behaviour.poll(cx, params) {
Expand Down Expand Up @@ -909,7 +909,8 @@ impl NetworkBehaviour for RequestResponsesBehaviour {
// Try using the fallback request if the protocol was not
// supported.
if let OutboundFailure::UnsupportedProtocols = error {
let error_bis_out = CustomOutboundFailure::UnsupportedProtocols;
let error_bis_out =
CustomOutboundFailure::UnsupportedProtocols;
if let Some((fallback_request, fallback_protocol)) =
fallback_request
{
Expand Down
20 changes: 14 additions & 6 deletions substrate/client/network/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1702,18 +1702,26 @@ where
SwarmEvent::Behaviour(BehaviourOut::None) => {
// Ignored event from lower layers.
},
SwarmEvent::Behaviour(BehaviourOut::Message{ peer, message }) => {
SwarmEvent::Behaviour(BehaviourOut::Message { peer, message }) => {
// Ignored event from lower layers.
},
SwarmEvent::Behaviour(BehaviourOut::CustomOutboundFailure{ peer,request_id,error }) => {
},
SwarmEvent::Behaviour(BehaviourOut::CustomOutboundFailure {
peer,
request_id,
error,
}) => {
// Ignored event from lower layers.
},
SwarmEvent::Behaviour(BehaviourOut::CustomInboundFailure{ peer,request_id,error }) => {
SwarmEvent::Behaviour(BehaviourOut::CustomInboundFailure {
peer,
request_id,
error,
}) => {
// Ignored event from lower layers.
},
SwarmEvent::Behaviour(BehaviourOut::CustomResponseSent{ peer,request_id }) => {
SwarmEvent::Behaviour(BehaviourOut::CustomResponseSent { peer, request_id }) => {
// Ignored event from lower layers.
},
},
SwarmEvent::ConnectionEstablished {
peer_id,
endpoint,
Expand Down
2 changes: 1 addition & 1 deletion substrate/client/network/sync/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ use sc_consensus::{import_queue::ImportQueueService, IncomingBlock};
use sc_network::{
config::{FullNetworkConfiguration, NotificationHandshake, ProtocolId, SetConfig},
peer_store::PeerStoreProvider,
request_responses::{IfDisconnected, RequestFailure, CustomOutboundFailure},
request_responses::{CustomOutboundFailure, IfDisconnected, RequestFailure},
service::{
traits::{Direction, NotificationConfig, NotificationEvent, ValidationResult},
NotificationMetrics,
Expand Down

0 comments on commit f194e5f

Please sign in to comment.