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 3208f208c0
commit abc4c3989b
898 changed files with 8671 additions and 6432 deletions
@@ -185,9 +185,9 @@ impl Candidates {
let mut reckoning = PostConfirmationReckoning::default();
for (leaf_hash, x) in u.unconfirmed_importable_under {
if x.relay_parent == relay_parent &&
x.parent_hash == parent_hash &&
x.para_id == para_id
if x.relay_parent == relay_parent
&& x.parent_hash == parent_hash
&& x.para_id == para_id
{
new_confirmed.importable_under.insert(leaf_hash);
}
@@ -296,8 +296,9 @@ impl Candidates {
) {
for (c_hash, candidate) in i {
match candidate {
CandidateState::Unconfirmed(u) =>
u.extend_hypotheticals(*c_hash, v, maybe_required_parent),
CandidateState::Unconfirmed(u) => {
u.extend_hypotheticals(*c_hash, v, maybe_required_parent)
},
CandidateState::Confirmed(c) => v.push(c.to_hypothetical(*c_hash)),
}
}
@@ -335,7 +336,7 @@ impl Candidates {
}
};
self.candidates.retain(|c_hash, state| match state {
CandidateState::Confirmed(ref mut c) =>
CandidateState::Confirmed(ref mut c) => {
if !relay_parent_live(&c.relay_parent()) {
remove_parent_claims(*c_hash, c.parent_head_data_hash(), c.para_id());
false
@@ -344,7 +345,8 @@ impl Candidates {
c.importable_under.remove(leaf_hash);
}
true
},
}
},
CandidateState::Unconfirmed(ref mut c) => {
c.on_deactivate_leaves(
leaves,
@@ -393,9 +395,9 @@ impl CandidateClaims {
parent_hash: Hash,
para_id: ParaId,
) -> bool {
self.relay_parent == relay_parent &&
self.group_index == group_index &&
self.parent_hash_and_id.map_or(true, |p| p == (parent_hash, para_id))
self.relay_parent == relay_parent
&& self.group_index == group_index
&& self.parent_hash_and_id.map_or(true, |p| p == (parent_hash, para_id))
}
}
@@ -320,16 +320,16 @@ impl ClusterTracker {
) -> bool {
// we sent, they sent, or they signed and we received from someone else.
self.we_sent_seconded(validator, candidate_hash) ||
self.they_sent_seconded(validator, candidate_hash) ||
self.validator_seconded(validator, candidate_hash)
self.we_sent_seconded(validator, candidate_hash)
|| self.they_sent_seconded(validator, candidate_hash)
|| self.validator_seconded(validator, candidate_hash)
}
/// Whether a validator can request a candidate from us.
pub fn can_request(&self, target: ValidatorIndex, candidate_hash: CandidateHash) -> bool {
self.validators.contains(&target) &&
self.we_sent_seconded(target, candidate_hash) &&
!self.they_sent_seconded(target, candidate_hash)
self.validators.contains(&target)
&& self.we_sent_seconded(target, candidate_hash)
&& !self.they_sent_seconded(target, candidate_hash)
}
/// Returns a Vec of pending statements to be sent to a particular validator
@@ -283,11 +283,13 @@ impl GridTracker {
// * They are in the sending set for the group AND we have sent them a manifest AND
// the received manifest is partial.
ManifestKind::Full => receiving_from,
ManifestKind::Acknowledgement =>
sending_to &&
self.confirmed_backed
ManifestKind::Acknowledgement => {
sending_to
&& self
.confirmed_backed
.get(&candidate_hash)
.map_or(false, |c| c.has_sent_manifest_to(sender)),
.map_or(false, |c| c.has_sent_manifest_to(sender))
},
};
if !manifest_allowed {
@@ -1083,10 +1085,10 @@ impl KnownBackedCandidate {
.filter(|k| k.local_knowledge.is_some())
.and_then(|k| k.remote_knowledge.as_ref())
.map(|remote| StatementFilter {
seconded_in_group: full_local.seconded_in_group.clone() &
!remote.seconded_in_group.clone(),
validated_in_group: full_local.validated_in_group.clone() &
!remote.validated_in_group.clone(),
seconded_in_group: full_local.seconded_in_group.clone()
& !remote.seconded_in_group.clone(),
validated_in_group: full_local.validated_in_group.clone()
& !remote.validated_in_group.clone(),
})
}
}
@@ -494,7 +494,7 @@ pub(crate) async fn handle_network_update<Context>(
NetworkBridgeEvent::PeerMessage(peer_id, message) => match message {
net_protocol::StatementDistributionMessage::V3(
protocol_v3::StatementDistributionMessage::Statement(relay_parent, statement),
) =>
) => {
handle_incoming_statement(
ctx,
state,
@@ -504,18 +504,21 @@ pub(crate) async fn handle_network_update<Context>(
reputation,
metrics,
)
.await,
.await
},
net_protocol::StatementDistributionMessage::V3(
protocol_v3::StatementDistributionMessage::BackedCandidateManifest(inner),
) => handle_incoming_manifest(ctx, state, peer_id, inner, reputation, metrics).await,
net_protocol::StatementDistributionMessage::V3(
protocol_v3::StatementDistributionMessage::BackedCandidateKnown(inner),
) =>
) => {
handle_incoming_acknowledgement(ctx, state, peer_id, inner, reputation, metrics)
.await,
.await
},
},
NetworkBridgeEvent::PeerViewChange(peer_id, view) => {
handle_peer_view_update(ctx, state, peer_id, view, metrics).await
},
NetworkBridgeEvent::PeerViewChange(peer_id, view) =>
handle_peer_view_update(ctx, state, peer_id, view, metrics).await,
NetworkBridgeEvent::OurViewChange(_view) => {
// handled by `handle_activated_leaf`
},
@@ -1161,10 +1164,12 @@ pub(crate) async fn share_local_statement<Context>(
// Two possibilities: either the statement is `Seconded` or we already
// have the candidate. Sanity: check the para-id is valid.
let expected = match statement.payload() {
FullStatementWithPVD::Seconded(ref c, _) =>
Some((c.descriptor.para_id(), c.descriptor.relay_parent())),
FullStatementWithPVD::Valid(hash) =>
state.candidates.get_confirmed(&hash).map(|c| (c.para_id(), c.relay_parent())),
FullStatementWithPVD::Seconded(ref c, _) => {
Some((c.descriptor.para_id(), c.descriptor.relay_parent()))
},
FullStatementWithPVD::Valid(hash) => {
state.candidates.get_confirmed(&hash).map(|c| (c.para_id(), c.relay_parent()))
},
};
let is_seconded = match statement.payload() {
@@ -1183,8 +1188,8 @@ pub(crate) async fn share_local_statement<Context>(
let seconding_limit = local_assignments.len();
if is_seconded &&
per_relay_parent.statement_store.seconded_count(&local_index) >= seconding_limit
if is_seconded
&& per_relay_parent.statement_store.seconded_count(&local_index) >= seconding_limit
{
gum::warn!(
target: LOG_TARGET,
@@ -1789,8 +1794,9 @@ fn handle_cluster_statement(
Ok(ClusterAccept::Ok) => true,
Ok(ClusterAccept::WithPrejudice) => false,
Err(ClusterRejectIncoming::ExcessiveSeconded) => return Err(COST_EXCESSIVE_SECONDED),
Err(ClusterRejectIncoming::CandidateUnknown | ClusterRejectIncoming::Duplicate) =>
return Err(COST_UNEXPECTED_STATEMENT_CLUSTER_REJECTED),
Err(ClusterRejectIncoming::CandidateUnknown | ClusterRejectIncoming::Duplicate) => {
return Err(COST_UNEXPECTED_STATEMENT_CLUSTER_REJECTED)
},
Err(ClusterRejectIncoming::NotInGroup) => {
// sanity: shouldn't be possible; we already filtered this
// out above.
@@ -1989,12 +1995,13 @@ async fn provide_candidate_to_grid<Context>(
for (v, action) in actions {
let p = match connected_validator_peer(authorities, per_session, v) {
None => continue,
Some(p) =>
Some(p) => {
if peers.get(&p).map_or(false, |d| d.knows_relay_parent(&relay_parent)) {
(p, peers.get(&p).expect("Qed, was checked above").protocol_version.into())
} else {
continue;
},
}
},
};
match action {
@@ -2940,8 +2947,9 @@ pub(crate) async fn receive_response(response_manager: &mut ResponseManager) ->
/// this API must call `dispatch_requests`.
pub(crate) async fn next_retry(request_manager: &mut RequestManager) {
match request_manager.next_retry_time() {
Some(instant) =>
futures_timer::Delay::new(instant.saturating_duration_since(Instant::now())).await,
Some(instant) => {
futures_timer::Delay::new(instant.saturating_duration_since(Instant::now())).await
},
None => futures::future::pending().await,
}
}
@@ -583,12 +583,13 @@ impl UnhandledResponse {
// it could also happen in the case that we had a request in-flight
// and the request entry was garbage-collected on outdated relay parent.
let entry = match manager.requests.get_mut(&identifier) {
None =>
None => {
return ResponseValidationOutput {
requested_peer,
reputation_changes: Vec::new(),
request_status: CandidateRequestStatus::Outdated,
},
}
},
Some(e) => e,
};
@@ -710,8 +711,8 @@ fn validate_complete_response(
return invalid_candidate_output(COST_INVALID_RESPONSE);
}
if response.candidate_receipt.descriptor.persisted_validation_data_hash() !=
response.persisted_validation_data.hash()
if response.candidate_receipt.descriptor.persisted_validation_data_hash()
!= response.persisted_validation_data.hash()
{
return invalid_candidate_output(COST_INVALID_RESPONSE);
}
@@ -730,8 +731,8 @@ fn validate_complete_response(
let candidate_hash = response.candidate_receipt.hash();
// V2 descriptors are invalid if not enabled by runtime.
if !allow_v2_descriptors &&
response.candidate_receipt.descriptor.version() == CandidateDescriptorVersion::V2
if !allow_v2_descriptors
&& response.candidate_receipt.descriptor.version() == CandidateDescriptorVersion::V2
{
gum::debug!(
target: LOG_TARGET,
@@ -794,8 +795,8 @@ fn validate_complete_response(
};
// ensure statement is on the correct candidate hash.
if unchecked_statement.unchecked_payload().candidate_hash() !=
&identifier.candidate_hash
if unchecked_statement.unchecked_payload().candidate_hash()
!= &identifier.candidate_hash
{
rep_changes.push((requested_peer, COST_UNREQUESTED_RESPONSE_STATEMENT));
continue;
@@ -914,7 +914,7 @@ fn next_group_index(
group_size: usize,
) -> GroupIndex {
let next_group = group_index.0 + 1;
let num_groups =
validator_count / group_size + if !validator_count.is_multiple_of(group_size) { 1 } else { 0 };
let num_groups = validator_count / group_size
+ if !validator_count.is_multiple_of(group_size) { 1 } else { 0 };
GroupIndex::from(next_group % num_groups as u32)
}