style: Migrate to stable-only rustfmt configuration
- Remove nightly-only features from .rustfmt.toml and vendor/ss58-registry/rustfmt.toml - Removed features: imports_granularity, wrap_comments, comment_width, reorder_impl_items, spaces_around_ranges, binop_separator, match_arm_blocks, trailing_semicolon, trailing_comma - Format all 898 affected files with stable rustfmt - Ensures long-term reliability without nightly toolchain dependency
This commit is contained in:
@@ -259,7 +259,7 @@ async fn test_once() {
|
||||
|
||||
let state = known_nodes.get_mut(&peer_id).unwrap();
|
||||
match *state {
|
||||
State::Incoming(incoming_index) =>
|
||||
State::Incoming(incoming_index) => {
|
||||
if n.0 < incoming_index.0 {
|
||||
log::info!(
|
||||
"Ignoring obsolete Accept for {:?} while awaiting {:?} for peer {}",
|
||||
@@ -271,7 +271,8 @@ async fn test_once() {
|
||||
"Received {:?} while awaiting {:?} for peer {}",
|
||||
n, incoming_index, peer_id,
|
||||
);
|
||||
},
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
||||
@@ -290,7 +291,7 @@ async fn test_once() {
|
||||
|
||||
let state = known_nodes.get_mut(&peer_id).unwrap();
|
||||
match *state {
|
||||
State::Incoming(incoming_index) =>
|
||||
State::Incoming(incoming_index) => {
|
||||
if n.0 < incoming_index.0 {
|
||||
log::info!(
|
||||
"Ignoring obsolete Reject for {:?} while awaiting {:?} for peer {}",
|
||||
@@ -302,7 +303,8 @@ async fn test_once() {
|
||||
"Received {:?} while awaiting {:?} for peer {}",
|
||||
n, incoming_index, peer_id,
|
||||
);
|
||||
},
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
||||
@@ -326,15 +328,16 @@ async fn test_once() {
|
||||
},
|
||||
|
||||
// If we generate 2, adjust a random reputation.
|
||||
2 =>
|
||||
2 => {
|
||||
if let Some(id) = known_nodes.keys().choose(&mut rng) {
|
||||
let val = Uniform::new_inclusive(i32::MIN, i32::MAX).sample(&mut rng);
|
||||
let peer: pezsc_network_types::PeerId = id.into();
|
||||
peer_store_handle.report_peer(peer, ReputationChange::new(val, ""));
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
// If we generate 3, disconnect from a random node.
|
||||
3 =>
|
||||
3 => {
|
||||
if let Some(id) = connected_nodes.iter().choose(&mut rng).cloned() {
|
||||
log::info!("Disconnected from {}", id);
|
||||
connected_nodes.remove(&id);
|
||||
@@ -347,15 +350,16 @@ async fn test_once() {
|
||||
|
||||
current_peer = Some(id);
|
||||
current_event = Some(Event::Disconnected);
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
// If we generate 4, connect to a random node.
|
||||
4 => {
|
||||
if let Some(id) = known_nodes
|
||||
.keys()
|
||||
.filter(|n| {
|
||||
incoming_nodes.values().all(|m| m != *n) &&
|
||||
!connected_nodes.contains(*n)
|
||||
incoming_nodes.values().all(|m| m != *n)
|
||||
&& !connected_nodes.contains(*n)
|
||||
})
|
||||
.choose(&mut rng)
|
||||
.cloned()
|
||||
@@ -395,12 +399,13 @@ async fn test_once() {
|
||||
reserved_nodes.insert(*id);
|
||||
}
|
||||
},
|
||||
8 =>
|
||||
8 => {
|
||||
if let Some(id) = reserved_nodes.iter().choose(&mut rng).cloned() {
|
||||
log::info!("Remove reserved: {}", id);
|
||||
reserved_nodes.remove(&id);
|
||||
protocol_handle.remove_reserved_peer(id);
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
@@ -768,8 +768,8 @@ pub trait TestNetFactory: Default + Sized + Send {
|
||||
*genesis_extra_storage = storage;
|
||||
}
|
||||
|
||||
if !config.force_genesis &&
|
||||
matches!(config.sync_mode, SyncMode::LightState { .. } | SyncMode::Warp)
|
||||
if !config.force_genesis
|
||||
&& matches!(config.sync_mode, SyncMode::LightState { .. } | SyncMode::Warp)
|
||||
{
|
||||
test_client_builder = test_client_builder.set_no_genesis();
|
||||
}
|
||||
@@ -1040,8 +1040,8 @@ pub trait TestNetFactory: Default + Sized + Send {
|
||||
let peers = self.peers_mut();
|
||||
|
||||
for peer in peers {
|
||||
if peer.sync_service.is_major_syncing() ||
|
||||
peer.sync_service.status().await.unwrap().queued_blocks != 0
|
||||
if peer.sync_service.is_major_syncing()
|
||||
|| peer.sync_service.status().await.unwrap().queued_blocks != 0
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -392,10 +392,12 @@ async fn notifications_state_consistent() {
|
||||
// forever while nothing at all happens on the network.
|
||||
let continue_test = futures_timer::Delay::new(Duration::from_millis(20));
|
||||
match future::select(future::select(next1, next2), continue_test).await {
|
||||
future::Either::Left((future::Either::Left((Some(ev), _)), _)) =>
|
||||
future::Either::Left(ev),
|
||||
future::Either::Left((future::Either::Right((Some(ev), _)), _)) =>
|
||||
future::Either::Right(ev),
|
||||
future::Either::Left((future::Either::Left((Some(ev), _)), _)) => {
|
||||
future::Either::Left(ev)
|
||||
},
|
||||
future::Either::Left((future::Either::Right((Some(ev), _)), _)) => {
|
||||
future::Either::Right(ev)
|
||||
},
|
||||
future::Either::Right(_) => continue,
|
||||
_ => break,
|
||||
}
|
||||
|
||||
@@ -44,9 +44,9 @@ async fn sync_peers_works() {
|
||||
pezsp_tracing::try_init_simple();
|
||||
let mut net = TestNet::new(3);
|
||||
|
||||
while net.peer(0).num_peers().await != 2 &&
|
||||
net.peer(1).num_peers().await != 2 &&
|
||||
net.peer(2).num_peers().await != 2
|
||||
while net.peer(0).num_peers().await != 2
|
||||
&& net.peer(1).num_peers().await != 2
|
||||
&& net.peer(2).num_peers().await != 2
|
||||
{
|
||||
futures::future::poll_fn::<(), _>(|cx| {
|
||||
net.poll(cx);
|
||||
@@ -280,13 +280,13 @@ async fn sync_justifications() {
|
||||
net.poll(cx);
|
||||
|
||||
for height in (10..21).step_by(5) {
|
||||
if net.peer(0).client().justifications(hashes[height - 1]).unwrap() !=
|
||||
Some(Justifications::from((*b"FRNK", Vec::new())))
|
||||
if net.peer(0).client().justifications(hashes[height - 1]).unwrap()
|
||||
!= Some(Justifications::from((*b"FRNK", Vec::new())))
|
||||
{
|
||||
return Poll::Pending;
|
||||
}
|
||||
if net.peer(1).client().justifications(hashes[height - 1]).unwrap() !=
|
||||
Some(Justifications::from((*b"FRNK", Vec::new())))
|
||||
if net.peer(1).client().justifications(hashes[height - 1]).unwrap()
|
||||
!= Some(Justifications::from((*b"FRNK", Vec::new())))
|
||||
{
|
||||
return Poll::Pending;
|
||||
}
|
||||
@@ -320,10 +320,10 @@ async fn sync_justifications_across_forks() {
|
||||
futures::future::poll_fn::<(), _>(|cx| {
|
||||
net.poll(cx);
|
||||
|
||||
if net.peer(0).client().justifications(f1_best).unwrap() ==
|
||||
Some(Justifications::from((*b"FRNK", Vec::new()))) &&
|
||||
net.peer(1).client().justifications(f1_best).unwrap() ==
|
||||
Some(Justifications::from((*b"FRNK", Vec::new())))
|
||||
if net.peer(0).client().justifications(f1_best).unwrap()
|
||||
== Some(Justifications::from((*b"FRNK", Vec::new())))
|
||||
&& net.peer(1).client().justifications(f1_best).unwrap()
|
||||
== Some(Justifications::from((*b"FRNK", Vec::new())))
|
||||
{
|
||||
Poll::Ready(())
|
||||
} else {
|
||||
@@ -896,9 +896,9 @@ async fn block_announce_data_is_propagated() {
|
||||
});
|
||||
|
||||
// Wait until peer 1 is connected to both nodes.
|
||||
while net.peer(1).num_peers().await != 2 ||
|
||||
net.peer(0).num_peers().await != 1 ||
|
||||
net.peer(2).num_peers().await != 1
|
||||
while net.peer(1).num_peers().await != 2
|
||||
|| net.peer(0).num_peers().await != 1
|
||||
|| net.peer(2).num_peers().await != 1
|
||||
{
|
||||
futures::future::poll_fn::<(), _>(|cx| {
|
||||
net.poll(cx);
|
||||
@@ -1000,8 +1000,8 @@ async fn multiple_requests_are_accepted_as_long_as_they_are_not_fulfilled() {
|
||||
futures::future::poll_fn::<(), _>(|cx| {
|
||||
net.poll(cx);
|
||||
|
||||
if net.peer(1).client().justifications(hashof10).unwrap() !=
|
||||
Some(Justifications::from((*b"FRNK", Vec::new())))
|
||||
if net.peer(1).client().justifications(hashof10).unwrap()
|
||||
!= Some(Justifications::from((*b"FRNK", Vec::new())))
|
||||
{
|
||||
return Poll::Pending;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user