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:
@@ -1052,8 +1052,8 @@ async fn handle_incoming_peer_message<Context>(
|
||||
))
|
||||
.await;
|
||||
},
|
||||
CollationProtocols::V1(V1::AdvertiseCollation(_)) |
|
||||
CollationProtocols::V2(V2::AdvertiseCollation { .. }) => {
|
||||
CollationProtocols::V1(V1::AdvertiseCollation(_))
|
||||
| CollationProtocols::V2(V2::AdvertiseCollation { .. }) => {
|
||||
gum::trace!(
|
||||
target: LOG_TARGET,
|
||||
?origin,
|
||||
@@ -1174,8 +1174,9 @@ async fn handle_incoming_request<Context>(
|
||||
};
|
||||
|
||||
let collation_with_core = match &req {
|
||||
VersionedCollationRequest::V2(req) =>
|
||||
per_relay_parent.collations.get_mut(&req.payload.candidate_hash),
|
||||
VersionedCollationRequest::V2(req) => {
|
||||
per_relay_parent.collations.get_mut(&req.payload.candidate_hash)
|
||||
},
|
||||
};
|
||||
let (receipt, pov, parent_head_data) =
|
||||
if let Some(collation_with_core) = collation_with_core {
|
||||
@@ -1634,7 +1635,7 @@ fn process_out_of_view_collation(
|
||||
let candidate_hash = collation.receipt.hash();
|
||||
|
||||
match collation.status {
|
||||
CollationStatus::Created =>
|
||||
CollationStatus::Created => {
|
||||
if is_same_session {
|
||||
gum::warn!(
|
||||
target: LOG_TARGET,
|
||||
@@ -1649,7 +1650,8 @@ fn process_out_of_view_collation(
|
||||
pov_hash = ?collation.pov.hash(),
|
||||
"Collation wasn't advertised because it was built on a relay chain block that is now part of an old session.",
|
||||
)
|
||||
},
|
||||
}
|
||||
},
|
||||
CollationStatus::Advertised => gum::debug!(
|
||||
target: LOG_TARGET,
|
||||
?candidate_hash,
|
||||
|
||||
@@ -548,8 +548,9 @@ fn decode_collation_response(bytes: &[u8]) -> (CandidateReceipt, PoV) {
|
||||
CollationFetchingResponse::Collation(_, _) => {
|
||||
panic!("Expected to always receive CollationWithParentHeadData")
|
||||
},
|
||||
CollationFetchingResponse::CollationWithParentHeadData { receipt, pov, .. } =>
|
||||
(receipt, pov),
|
||||
CollationFetchingResponse::CollationWithParentHeadData { receipt, pov, .. } => {
|
||||
(receipt, pov)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -151,14 +151,16 @@ impl<Context> CollatorProtocolSubsystem {
|
||||
.boxed()
|
||||
},
|
||||
#[cfg(feature = "experimental-collator-protocol")]
|
||||
ProtocolSide::ValidatorExperimental { keystore, metrics } =>
|
||||
ProtocolSide::ValidatorExperimental { keystore, metrics } => {
|
||||
validator_side_experimental::run(ctx, keystore, metrics)
|
||||
.map_err(|e| SubsystemError::with_origin("collator-protocol", e))
|
||||
.boxed(),
|
||||
ProtocolSide::Collator { peer_id, collator_pair, request_receiver_v2, metrics } =>
|
||||
.boxed()
|
||||
},
|
||||
ProtocolSide::Collator { peer_id, collator_pair, request_receiver_v2, metrics } => {
|
||||
collator_side::run(ctx, peer_id, collator_pair, request_receiver_v2, metrics)
|
||||
.map_err(|e| SubsystemError::with_origin("collator-protocol", e))
|
||||
.boxed(),
|
||||
.boxed()
|
||||
},
|
||||
ProtocolSide::None => return DummySubsystem.start(ctx),
|
||||
};
|
||||
|
||||
|
||||
@@ -98,13 +98,13 @@ impl SecondingError {
|
||||
use SecondingError::*;
|
||||
matches!(
|
||||
self,
|
||||
PersistedValidationDataMismatch |
|
||||
CandidateHashMismatch |
|
||||
RelayParentMismatch |
|
||||
ParentHeadDataMismatch |
|
||||
InvalidCoreIndex(_, _) |
|
||||
InvalidSessionIndex(_, _) |
|
||||
InvalidReceiptVersion(_)
|
||||
PersistedValidationDataMismatch
|
||||
| CandidateHashMismatch
|
||||
| RelayParentMismatch
|
||||
| ParentHeadDataMismatch
|
||||
| InvalidCoreIndex(_, _)
|
||||
| InvalidSessionIndex(_, _)
|
||||
| InvalidReceiptVersion(_)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,8 +335,9 @@ impl PeerData {
|
||||
fn is_inactive(&self, policy: &crate::CollatorEvictionPolicy) -> bool {
|
||||
match self.state {
|
||||
PeerState::Connected(connected_at) => connected_at.elapsed() >= policy.undeclared,
|
||||
PeerState::Collating(ref state) =>
|
||||
state.last_active.elapsed() >= policy.inactive_collator,
|
||||
PeerState::Collating(ref state) => {
|
||||
state.last_active.elapsed() >= policy.inactive_collator
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -540,8 +541,8 @@ impl State {
|
||||
acc + blocked_collations
|
||||
.iter()
|
||||
.filter(|pc| {
|
||||
pc.candidate_receipt.descriptor.para_id() == *para_id &&
|
||||
pc.candidate_receipt.descriptor.relay_parent() == *relay_parent
|
||||
pc.candidate_receipt.descriptor.para_id() == *para_id
|
||||
&& pc.candidate_receipt.descriptor.relay_parent() == *relay_parent
|
||||
})
|
||||
.count()
|
||||
});
|
||||
@@ -747,14 +748,16 @@ async fn notify_collation_seconded(
|
||||
) {
|
||||
let statement = statement.into();
|
||||
let wire_message = match version {
|
||||
CollationVersion::V1 =>
|
||||
CollationVersion::V1 => {
|
||||
CollationProtocols::V1(protocol_v1::CollationProtocol::CollatorProtocol(
|
||||
protocol_v1::CollatorProtocolMessage::CollationSeconded(relay_parent, statement),
|
||||
)),
|
||||
CollationVersion::V2 =>
|
||||
))
|
||||
},
|
||||
CollationVersion::V2 => {
|
||||
CollationProtocols::V2(protocol_v2::CollationProtocol::CollatorProtocol(
|
||||
protocol_v2::CollatorProtocolMessage::CollationSeconded(relay_parent, statement),
|
||||
)),
|
||||
))
|
||||
},
|
||||
};
|
||||
sender
|
||||
.send_message(NetworkBridgeTxMessage::SendCollationMessage(vec![peer_id], wire_message))
|
||||
@@ -879,8 +882,8 @@ async fn process_incoming_peer_message<Context>(
|
||||
use protocol_v2::CollatorProtocolMessage as V2;
|
||||
|
||||
match msg {
|
||||
CollationProtocols::V1(V1::Declare(collator_id, para_id, signature)) |
|
||||
CollationProtocols::V2(V2::Declare(collator_id, para_id, signature)) => {
|
||||
CollationProtocols::V1(V1::Declare(collator_id, para_id, signature))
|
||||
| CollationProtocols::V2(V2::Declare(collator_id, para_id, signature)) => {
|
||||
if collator_peer_id(&state.peer_data, &collator_id).is_some() {
|
||||
modify_reputation(
|
||||
&mut state.reputation,
|
||||
@@ -1022,8 +1025,8 @@ async fn process_incoming_peer_message<Context>(
|
||||
}
|
||||
}
|
||||
},
|
||||
CollationProtocols::V1(V1::CollationSeconded(..)) |
|
||||
CollationProtocols::V2(V2::CollationSeconded(..)) => {
|
||||
CollationProtocols::V1(V1::CollationSeconded(..))
|
||||
| CollationProtocols::V2(V2::CollationSeconded(..)) => {
|
||||
gum::warn!(
|
||||
target: LOG_TARGET,
|
||||
peer_id = ?origin,
|
||||
@@ -1053,9 +1056,9 @@ fn hold_off_asset_hub_collation_if_needed(
|
||||
let peer_is_invulnerable = state.ah_invulnerables.contains(&peer_id);
|
||||
let invulnerables_set_is_empty = state.ah_invulnerables.is_empty();
|
||||
|
||||
if maybe_para_id != Some(ASSET_HUB_PARA_ID) ||
|
||||
peer_is_invulnerable ||
|
||||
invulnerables_set_is_empty
|
||||
if maybe_para_id != Some(ASSET_HUB_PARA_ID)
|
||||
|| peer_is_invulnerable
|
||||
|| invulnerables_set_is_empty
|
||||
{
|
||||
gum::trace!(
|
||||
target: LOG_TARGET,
|
||||
@@ -1269,8 +1272,8 @@ fn ensure_seconding_limit_is_respected(
|
||||
for path in paths {
|
||||
let mut cq_state = ClaimQueueState::new();
|
||||
for ancestor in &path {
|
||||
let seconded_and_pending = state.seconded_and_pending_for_para(&ancestor, ¶_id) +
|
||||
state.in_waiting_queue_for_para(relay_parent, ¶_id);
|
||||
let seconded_and_pending = state.seconded_and_pending_for_para(&ancestor, ¶_id)
|
||||
+ state.in_waiting_queue_for_para(relay_parent, ¶_id);
|
||||
cq_state.add_leaf(
|
||||
&ancestor,
|
||||
&state
|
||||
@@ -1847,9 +1850,11 @@ async fn process_msg<Context>(
|
||||
let candidate_hash = fetched_collation.candidate_hash;
|
||||
let id = match state.fetched_candidates.entry(fetched_collation) {
|
||||
Entry::Occupied(entry)
|
||||
if entry.get().pending_collation.commitments_hash ==
|
||||
Some(candidate_receipt.commitments_hash) =>
|
||||
entry.remove().collator_id,
|
||||
if entry.get().pending_collation.commitments_hash
|
||||
== Some(candidate_receipt.commitments_hash) =>
|
||||
{
|
||||
entry.remove().collator_id
|
||||
},
|
||||
Entry::Occupied(_) => {
|
||||
gum::error!(
|
||||
target: LOG_TARGET,
|
||||
@@ -2400,10 +2405,10 @@ async fn handle_collation_fetch_response(
|
||||
Err(None)
|
||||
},
|
||||
Ok(
|
||||
request_v1::CollationFetchingResponse::Collation(receipt, _) |
|
||||
request_v2::CollationFetchingResponse::Collation(receipt, _) |
|
||||
request_v1::CollationFetchingResponse::CollationWithParentHeadData { receipt, .. } |
|
||||
request_v2::CollationFetchingResponse::CollationWithParentHeadData { receipt, .. },
|
||||
request_v1::CollationFetchingResponse::Collation(receipt, _)
|
||||
| request_v2::CollationFetchingResponse::Collation(receipt, _)
|
||||
| request_v1::CollationFetchingResponse::CollationWithParentHeadData { receipt, .. }
|
||||
| request_v2::CollationFetchingResponse::CollationWithParentHeadData { receipt, .. },
|
||||
) if receipt.descriptor().para_id() != pending_collation.para_id => {
|
||||
gum::debug!(
|
||||
target: LOG_TARGET,
|
||||
@@ -2550,8 +2555,8 @@ fn get_next_collation_to_fetch(
|
||||
// to replace it.
|
||||
if let Some((collator_id, maybe_candidate_hash)) = rp_state.collations.fetching_from.as_ref() {
|
||||
// If a candidate hash was saved previously, `finished_one` must include this too.
|
||||
if collator_id != &finished_one.0 &&
|
||||
maybe_candidate_hash.map_or(true, |hash| Some(&hash) != finished_one.1.as_ref())
|
||||
if collator_id != &finished_one.0
|
||||
&& maybe_candidate_hash.map_or(true, |hash| Some(&hash) != finished_one.1.as_ref())
|
||||
{
|
||||
gum::trace!(
|
||||
target: LOG_TARGET,
|
||||
|
||||
@@ -416,18 +416,20 @@ async fn connect_and_declare_collator(
|
||||
.await;
|
||||
|
||||
let wire_message = match version {
|
||||
CollationVersion::V1 =>
|
||||
CollationVersion::V1 => {
|
||||
CollationProtocols::V1(protocol_v1::CollatorProtocolMessage::Declare(
|
||||
collator.public(),
|
||||
para_id,
|
||||
collator.sign(&protocol_v1::declare_signature_payload(&peer)),
|
||||
)),
|
||||
CollationVersion::V2 =>
|
||||
))
|
||||
},
|
||||
CollationVersion::V2 => {
|
||||
CollationProtocols::V2(protocol_v2::CollatorProtocolMessage::Declare(
|
||||
collator.public(),
|
||||
para_id,
|
||||
collator.sign(&protocol_v1::declare_signature_payload(&peer)),
|
||||
)),
|
||||
))
|
||||
},
|
||||
};
|
||||
|
||||
overseer_send(
|
||||
@@ -448,12 +450,13 @@ async fn advertise_collation(
|
||||
candidate: Option<(CandidateHash, Hash)>, // Candidate hash + parent head data hash.
|
||||
) {
|
||||
let wire_message = match candidate {
|
||||
Some((candidate_hash, parent_head_data_hash)) =>
|
||||
Some((candidate_hash, parent_head_data_hash)) => {
|
||||
CollationProtocols::V2(protocol_v2::CollatorProtocolMessage::AdvertiseCollation {
|
||||
relay_parent,
|
||||
candidate_hash,
|
||||
parent_head_data_hash,
|
||||
}),
|
||||
})
|
||||
},
|
||||
None => CollationProtocols::V1(protocol_v1::CollatorProtocolMessage::AdvertiseCollation(
|
||||
relay_parent,
|
||||
)),
|
||||
|
||||
+30
-20
@@ -104,12 +104,13 @@ impl ConnectedPeers {
|
||||
outcome = outcome.combine(res);
|
||||
}
|
||||
},
|
||||
PeerState::Connected =>
|
||||
PeerState::Connected => {
|
||||
for (para_id, per_para) in self.per_para.iter_mut() {
|
||||
let past_reputation = reputation_query_fn(peer_id, *para_id).await;
|
||||
let res = per_para.try_accept(peer_id, past_reputation);
|
||||
outcome = outcome.combine(res);
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
match outcome {
|
||||
@@ -567,12 +568,15 @@ mod tests {
|
||||
let rep_query_fn = |peer_id, para_id| async move {
|
||||
match (peer_id, para_id) {
|
||||
(peer_id, para_id) if peer_id == first_peer => Score::new(10).unwrap(),
|
||||
(peer_id, para_id) if peer_id == second_peer && para_id == para_1 =>
|
||||
Score::new(20).unwrap(),
|
||||
(peer_id, para_id) if peer_id == third_peer && para_id == para_2 =>
|
||||
Score::new(20).unwrap(),
|
||||
(peer_id, para_id) if peer_id == new_peer && para_id == para_1 =>
|
||||
Score::new(5).unwrap(),
|
||||
(peer_id, para_id) if peer_id == second_peer && para_id == para_1 => {
|
||||
Score::new(20).unwrap()
|
||||
},
|
||||
(peer_id, para_id) if peer_id == third_peer && para_id == para_2 => {
|
||||
Score::new(20).unwrap()
|
||||
},
|
||||
(peer_id, para_id) if peer_id == new_peer && para_id == para_1 => {
|
||||
Score::new(5).unwrap()
|
||||
},
|
||||
|
||||
(_, _) => Score::default(),
|
||||
}
|
||||
@@ -714,12 +718,15 @@ mod tests {
|
||||
let rep_query_fn = |peer_id, para_id| async move {
|
||||
match (peer_id, para_id) {
|
||||
(peer_id, para_id) if peer_id == first_peer => Score::new(10).unwrap(),
|
||||
(peer_id, para_id) if peer_id == second_peer && para_id == para_1 =>
|
||||
Score::new(20).unwrap(),
|
||||
(peer_id, para_id) if peer_id == third_peer && para_id == para_2 =>
|
||||
Score::new(20).unwrap(),
|
||||
(peer_id, para_id) if peer_id == fourth_peer && para_id == para_2 =>
|
||||
Score::new(15).unwrap(),
|
||||
(peer_id, para_id) if peer_id == second_peer && para_id == para_1 => {
|
||||
Score::new(20).unwrap()
|
||||
},
|
||||
(peer_id, para_id) if peer_id == third_peer && para_id == para_2 => {
|
||||
Score::new(20).unwrap()
|
||||
},
|
||||
(peer_id, para_id) if peer_id == fourth_peer && para_id == para_2 => {
|
||||
Score::new(15).unwrap()
|
||||
},
|
||||
(peer_id, para_id) if peer_id == new_peer => Score::new(30).unwrap(),
|
||||
|
||||
(_, _) => Score::default(),
|
||||
@@ -863,12 +870,15 @@ mod tests {
|
||||
let rep_query_fn = |peer_id, para_id| async move {
|
||||
match (peer_id, para_id) {
|
||||
(peer_id, para_id) if peer_id == first_peer => Score::new(10).unwrap(),
|
||||
(peer_id, para_id) if peer_id == second_peer && para_id == para_1 =>
|
||||
Score::new(5).unwrap(),
|
||||
(peer_id, para_id) if peer_id == third_peer && para_id == para_2 =>
|
||||
Score::new(5).unwrap(),
|
||||
(peer_id, para_id) if peer_id == new_peer && para_id == para_1 =>
|
||||
Score::new(8).unwrap(),
|
||||
(peer_id, para_id) if peer_id == second_peer && para_id == para_1 => {
|
||||
Score::new(5).unwrap()
|
||||
},
|
||||
(peer_id, para_id) if peer_id == third_peer && para_id == para_2 => {
|
||||
Score::new(5).unwrap()
|
||||
},
|
||||
(peer_id, para_id) if peer_id == new_peer && para_id == para_1 => {
|
||||
Score::new(8).unwrap()
|
||||
},
|
||||
|
||||
(_, _) => Score::default(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user