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:
2025-12-22 17:12:58 +03:00
parent 65b7f5e640
commit 4c8f281051
898 changed files with 8671 additions and 6432 deletions
@@ -418,8 +418,8 @@ async fn handle_recover<Context>(
let mut small_pov_size = true;
match recovery_strategy_kind {
RecoveryStrategyKind::BackersFirstIfSizeLower(fetch_chunks_threshold) |
RecoveryStrategyKind::BackersFirstIfSizeLowerThenSystematicChunks(
RecoveryStrategyKind::BackersFirstIfSizeLower(fetch_chunks_threshold)
| RecoveryStrategyKind::BackersFirstIfSizeLowerThenSystematicChunks(
fetch_chunks_threshold,
) => {
// Get our own chunk size to get an estimate of the PoV size.
@@ -448,16 +448,17 @@ async fn handle_recover<Context>(
};
match (&recovery_strategy_kind, small_pov_size) {
(RecoveryStrategyKind::BackersFirstAlways, _) |
(RecoveryStrategyKind::BackersFirstIfSizeLower(_), true) |
(
(RecoveryStrategyKind::BackersFirstAlways, _)
| (RecoveryStrategyKind::BackersFirstIfSizeLower(_), true)
| (
RecoveryStrategyKind::BackersFirstIfSizeLowerThenSystematicChunks(_),
true,
) |
(RecoveryStrategyKind::BackersThenSystematicChunks, _) =>
)
| (RecoveryStrategyKind::BackersThenSystematicChunks, _) => {
recovery_strategies.push_back(Box::new(FetchFull::new(
FetchFullParams { validators: backing_validators.to_vec() },
))),
)))
},
_ => {},
};
@@ -479,9 +480,9 @@ async fn handle_recover<Context>(
if let Some(core_index) = maybe_core_index {
if matches!(
recovery_strategy_kind,
RecoveryStrategyKind::BackersThenSystematicChunks |
RecoveryStrategyKind::SystematicChunks |
RecoveryStrategyKind::BackersFirstIfSizeLowerThenSystematicChunks(_)
RecoveryStrategyKind::BackersThenSystematicChunks
| RecoveryStrategyKind::SystematicChunks
| RecoveryStrategyKind::BackersFirstIfSizeLowerThenSystematicChunks(_)
) && chunk_mapping_enabled
{
let chunk_indices =
@@ -507,8 +508,8 @@ async fn handle_recover<Context>(
.into_iter()
.filter(|(c_index, _)| {
usize::try_from(c_index.0)
.expect("usize is at least u32 bytes on all modern targets.") <
systematic_threshold
.expect("usize is at least u32 bytes on all modern targets.")
< systematic_threshold
})
.collect();
@@ -158,7 +158,7 @@ where
let res = current_strategy.run(&mut self.state, &mut self.sender, &self.params).await;
match res {
Err(RecoveryError::Unavailable) =>
Err(RecoveryError::Unavailable) => {
if self.strategies.front().is_some() {
gum::debug!(
target: LOG_TARGET,
@@ -167,11 +167,13 @@ where
display_name
);
continue;
},
}
},
Err(err) => {
match &err {
RecoveryError::Invalid =>
self.params.metrics.on_recovery_invalid(strategy_type),
RecoveryError::Invalid => {
self.params.metrics.on_recovery_invalid(strategy_type)
},
_ => self.params.metrics.on_recovery_failed(strategy_type),
}
return Err(err);
@@ -191,8 +191,8 @@ impl<Sender: overseer::AvailabilityRecoverySenderTrait> RecoveryStrategy<Sender>
// No need to query the validators that have the chunks we already received or that we know
// don't have the data from previous strategies.
self.validators.retain(|v_index| {
!state.received_chunks.values().any(|c| v_index == &c.validator_index) &&
state.can_retry_request(
!state.received_chunks.values().any(|c| v_index == &c.validator_index)
&& state.can_retry_request(
&(common_params.validator_authority_keys[v_index.0 as usize].clone(), *v_index),
REGULAR_CHUNKS_REQ_RETRY_LIMIT,
)
@@ -279,8 +279,8 @@ impl<Sender: overseer::AvailabilityRecoverySenderTrait> RecoveryStrategy<Sender>
in_flight_reqs,
chunk_count,
_systematic_chunk_count| {
chunk_count >= common_params.threshold ||
Self::is_unavailable(
chunk_count >= common_params.threshold
|| Self::is_unavailable(
unrequested_validators,
in_flight_reqs,
chunk_count,
@@ -113,8 +113,9 @@ impl<Sender: overseer::AvailabilityRecoverySenderTrait> RecoveryStrategy<Sender>
reencode_rx.await.map_err(|_| RecoveryError::ChannelClosed)?
},
PostRecoveryCheck::PovHash =>
(data.pov.hash() == common_params.pov_hash).then_some(data),
PostRecoveryCheck::PovHash => {
(data.pov.hash() == common_params.pov_hash).then_some(data)
},
};
match maybe_data {
@@ -150,8 +151,9 @@ impl<Sender: overseer::AvailabilityRecoverySenderTrait> RecoveryStrategy<Sender>
Err(e) => {
match &e {
RequestError::Canceled(_) => common_params.metrics.on_full_request_error(),
RequestError::InvalidResponse(_) =>
common_params.metrics.on_full_request_invalid(),
RequestError::InvalidResponse(_) => {
common_params.metrics.on_full_request_invalid()
},
RequestError::NetworkError(req_failure) => {
if let RequestFailure::Network(OutboundFailure::Timeout) = req_failure {
common_params.metrics.on_full_request_timeout();
@@ -385,10 +385,12 @@ impl State {
Ok((bytes, protocol)) => {
if v2_protocol_name == protocol {
match req_res::v2::ChunkFetchingResponse::decode(&mut &bytes[..]) {
Ok(req_res::v2::ChunkFetchingResponse::Chunk(chunk)) =>
Ok((Some(chunk.into()), protocol)),
Ok(req_res::v2::ChunkFetchingResponse::NoSuchChunk) =>
Ok((None, protocol)),
Ok(req_res::v2::ChunkFetchingResponse::Chunk(chunk)) => {
Ok((Some(chunk.into()), protocol))
},
Ok(req_res::v2::ChunkFetchingResponse::NoSuchChunk) => {
Ok((None, protocol))
},
Err(e) => Err(RequestError::InvalidResponse(e)),
}
} else if v1_protocol_name == protocol {
@@ -413,8 +415,9 @@ impl State {
Some(chunk.recombine_into_chunk(&raw_request_v1)),
protocol,
)),
Ok(req_res::v1::ChunkFetchingResponse::NoSuchChunk) =>
Ok((None, protocol)),
Ok(req_res::v1::ChunkFetchingResponse::NoSuchChunk) => {
Ok((None, protocol))
},
Err(e) => Err(RequestError::InvalidResponse(e)),
}
} else {
@@ -485,10 +488,12 @@ impl State {
match request_result {
Ok((maybe_chunk, protocol)) => {
match protocol {
name if name == params.req_v1_protocol_name =>
params.metrics.on_chunk_response_v1(),
name if name == params.req_v2_protocol_name =>
params.metrics.on_chunk_response_v2(),
name if name == params.req_v1_protocol_name => {
params.metrics.on_chunk_response_v1()
},
name if name == params.req_v2_protocol_name => {
params.metrics.on_chunk_response_v2()
},
_ => {},
}
@@ -104,8 +104,8 @@ impl FetchSystematicChunks {
let chunks = state
.received_chunks
.range(
ChunkIndex(0)..
ChunkIndex(
ChunkIndex(0)
..ChunkIndex(
u32::try_from(self.threshold)
.expect("validator count should not exceed u32"),
),
@@ -180,8 +180,8 @@ impl<Sender: overseer::AvailabilityRecoverySenderTrait> RecoveryStrategy<Sender>
for (_, our_c_index) in &local_chunk_indices {
// If we are among the systematic validators but hold an invalid chunk, we cannot
// perform the systematic recovery. Fall through to the next strategy.
if self.validators.iter().any(|(c_index, _)| c_index == our_c_index) &&
!state.received_chunks.contains_key(our_c_index)
if self.validators.iter().any(|(c_index, _)| c_index == our_c_index)
&& !state.received_chunks.contains_key(our_c_index)
{
gum::debug!(
target: LOG_TARGET,
@@ -201,8 +201,8 @@ impl<Sender: overseer::AvailabilityRecoverySenderTrait> RecoveryStrategy<Sender>
// No need to query the validators that have the chunks we already received or that we know
// don't have the data from previous strategies.
self.validators.retain(|(c_index, v_index)| {
!state.received_chunks.contains_key(c_index) &&
state.can_retry_request(
!state.received_chunks.contains_key(c_index)
&& state.can_retry_request(
&(common_params.validator_authority_keys[v_index.0 as usize].clone(), *v_index),
SYSTEMATIC_CHUNKS_REQ_RETRY_LIMIT,
)
@@ -2499,8 +2499,8 @@ fn systematic_chunks_are_not_requested_again_in_regular_recovery() {
&mut virtual_overseer,
1,
|i| {
if (test_state.chunks.get(i).unwrap().index.0 as usize) <
test_state.systematic_threshold()
if (test_state.chunks.get(i).unwrap().index.0 as usize)
< test_state.systematic_threshold()
{
panic!("Already requested")
} else {