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
@@ -441,7 +441,7 @@ impl BootnodeAdvertisement {
fn handle_dht_event(&mut self, event: DhtEvent) {
match event {
DhtEvent::StartedProviding(key) =>
DhtEvent::StartedProviding(key) => {
if Some(&key) == self.current_epoch_key.as_ref() {
debug!(
target: LOG_TARGET,
@@ -454,7 +454,8 @@ impl BootnodeAdvertisement {
"Successfully published provider for next epoch key {}",
hex::encode(key.as_ref()),
);
},
}
},
DhtEvent::StartProvidingFailed(key) => {
if Some(&key) == self.current_epoch_key.as_ref() {
debug!(
+5 -5
View File
@@ -180,9 +180,9 @@ impl BootnodeDiscovery {
/// Schedule bootnode discovery if needed. Returns `false` if the discovery event loop should be
/// terminated.
fn maybe_retry_discovery(&mut self) -> bool {
let discovery_in_progress = self.key_being_discovered.is_some() ||
!self.pending_responses.is_empty() ||
!self.find_node_queries.is_empty();
let discovery_in_progress = self.key_being_discovered.is_some()
|| !self.pending_responses.is_empty()
|| !self.find_node_queries.is_empty();
let discovery_scheduled = !self.pending_start_discovery.is_terminated();
if discovery_in_progress || discovery_scheduled {
@@ -310,8 +310,8 @@ impl BootnodeDiscovery {
match (response.genesis_hash, response.fork_id) {
(genesis_hash, fork_id)
if genesis_hash == self.teyrchain_genesis_hash &&
fork_id == self.teyrchain_fork_id => {},
if genesis_hash == self.teyrchain_genesis_hash
&& fork_id == self.teyrchain_fork_id => {},
(genesis_hash, fork_id) => {
warn!(
target: LOG_TARGET,
@@ -148,10 +148,11 @@ where
let paras_inherent_data = match paras_inherent_data {
Some(p) => p,
None =>
None => {
return Err(
format!("Could not create paras inherent data at {:?}", relay_parent).into()
),
)
},
};
let mut other_inherent_data = self
@@ -118,13 +118,14 @@ where
async move {
let mut collation_requests = match params.collation_request_receiver {
Some(receiver) => receiver,
None =>
None => {
pezcumulus_client_collator::relay_chain_driven::init(
params.collator_key,
params.para_id,
params.overseer_handle,
)
.await,
.await
},
};
let mut collator = {
@@ -225,8 +226,8 @@ where
//
// With https://github.com/pezkuwichain/pezkuwi-sdk/issues/127 this implementation will be
// obsolete and also the underlying issue will be fixed.
if last_processed_slot >= *claim.slot() &&
last_relay_chain_block < *relay_parent_header.number()
if last_processed_slot >= *claim.slot()
&& last_relay_chain_block < *relay_parent_header.number()
{
continue;
}
@@ -138,7 +138,7 @@ async fn check_validation_code_or_log(
};
match state_validation_code_hash {
Some(state) =>
Some(state) => {
if state != *local_validation_code_hash {
tracing::warn!(
target: super::LOG_TARGET,
@@ -148,7 +148,8 @@ async fn check_validation_code_or_log(
relay_validation_code_hash = ?state,
"Teyrchain code doesn't match validation code stored in the relay chain state.",
);
},
}
},
None => {
tracing::warn!(
target: super::LOG_TARGET,
@@ -183,8 +184,8 @@ async fn scheduling_lookahead(
)
.unwrap_or_default();
if teyrchain_host_runtime_api_version <
RuntimeApiRequest::SCHEDULING_LOOKAHEAD_RUNTIME_REQUIREMENT
if teyrchain_host_runtime_api_version
< RuntimeApiRequest::SCHEDULING_LOOKAHEAD_RUNTIME_REQUIREMENT
{
return None;
}
@@ -607,10 +607,11 @@ pub(crate) async fn determine_core<H: HeaderT, RI: RelayChainInterface + 'static
} else {
match extract_relay_parent(para_parent.digest()) {
Some(last_relay_parent) => last_relay_parent != relay_parent.hash(),
None =>
None => {
rpsr_digest::extract_relay_parent_storage_root(para_parent.digest())
.ok_or(())?
.0 != *relay_parent.state_root(),
.0 != *relay_parent.state_root()
},
}
};
@@ -101,8 +101,8 @@ fn compute_next_wake_up_time(
// we should still produce two blocks if we are scheduled on every relay block.
let mut block_production_interval = min(para_slot_duration.as_duration(), relay_slot_duration);
if assigned_core_num > para_slots_per_relay_block &&
para_slot_duration.as_duration() >= relay_slot_duration
if assigned_core_num > para_slots_per_relay_block
&& para_slot_duration.as_duration() >= relay_slot_duration
{
block_production_interval =
max(relay_slot_duration / assigned_core_num, BLOCK_PRODUCTION_MINIMUM_INTERVAL_MS);
@@ -204,8 +204,8 @@ fn adjust_authoring_duration(
// without issues.
// - Block 11: next slot change in 0.993s - skipped by the deadline
// - Block 12: next slot change in 0.493s - skipped by the deadline
if authoring_duration <
BLOCK_PRODUCTION_MINIMUM_INTERVAL_MS.saturating_sub(BLOCK_PRODUCTION_THRESHOLD_MS)
if authoring_duration
< BLOCK_PRODUCTION_MINIMUM_INTERVAL_MS.saturating_sub(BLOCK_PRODUCTION_THRESHOLD_MS)
{
tracing::debug!(
target: LOG_TARGET,
@@ -233,9 +233,9 @@ fn time_until_next_attempt(
) -> (Duration, Timestamp) {
let now = now.as_millis().saturating_sub(offset.as_millis());
let next_slot_time = ((now + block_production_interval.as_millis()) /
block_production_interval.as_millis()) *
block_production_interval.as_millis();
let next_slot_time = ((now + block_production_interval.as_millis())
/ block_production_interval.as_millis())
* block_production_interval.as_millis();
let remaining_millis = next_slot_time - now;
(Duration::from_millis(remaining_millis as u64), Timestamp::from(next_slot_time as u64))
}
@@ -177,8 +177,8 @@ where
let relay_parent =
match CumulusDigestItem::find_relay_block_identifier(pre_header.digest()) {
None => Default::default(),
Some(RelayBlockIdentifier::ByHash(h)) |
Some(RelayBlockIdentifier::ByStorageRoot {
Some(RelayBlockIdentifier::ByHash(h))
| Some(RelayBlockIdentifier::ByStorageRoot {
storage_root: h, ..
}) => h,
};
@@ -219,11 +219,12 @@ where
post_hash, slot
));
},
Err(e) =>
Err(e) => {
return Err(format!(
"Rejecting block ({:?}) with invalid seal ({:?})",
post_hash, e
)),
))
},
}
}
@@ -396,9 +396,9 @@ pub fn search_child_branches_for_parents<Block: BlockT>(
for child in backend.blockchain().children(hash).ok().into_iter().flatten() {
tracing::trace!(target: PARENT_SEARCH_LOG_TARGET, ?child, child_depth, ?pending_distance, "Looking at child.");
let aligned_with_pending = parent_aligned_with_pending &&
(pending_distance.map_or(true, |dist| child_depth > dist) ||
is_child_pending(child));
let aligned_with_pending = parent_aligned_with_pending
&& (pending_distance.map_or(true, |dist| child_depth > dist)
|| is_child_pending(child));
if ignore_alternative_branches && !aligned_with_pending {
tracing::trace!(target: PARENT_SEARCH_LOG_TARGET, ?child, "Child is not aligned with pending block.");
+5 -4
View File
@@ -290,8 +290,8 @@ where
// If the relay chain runtime does not support the new runtime API, fallback to the
// deprecated one.
let candidate_receipts = if teyrchain_host_runtime_api_version <
RuntimeApiRequest::CANDIDATES_PENDING_AVAILABILITY_RUNTIME_REQUIREMENT
let candidate_receipts = if teyrchain_host_runtime_api_version
< RuntimeApiRequest::CANDIDATES_PENDING_AVAILABILITY_RUNTIME_REQUIREMENT
{
#[allow(deprecated)]
relay_chain_interface
@@ -389,11 +389,12 @@ where
let block_announce_data = match BlockAnnounceData::decode_all(&mut data.as_slice()) {
Ok(r) => r,
Err(err) =>
Err(err) => {
return Err(Box::new(BlockAnnounceError(format!(
"Can not decode the `BlockAnnounceData`: {:?}",
err
))) as Box<_>),
))) as Box<_>)
},
};
if let Err(e) = block_announce_data.validate(header_encoded) {
+7 -6
View File
@@ -166,8 +166,8 @@ impl RelayChainInterface for DummyRelayChainInterface {
_: PHash,
_: ParaId,
) -> RelayChainResult<Option<CommittedCandidateReceiptV2>> {
if self.data.lock().runtime_version >=
RuntimeApiRequest::CANDIDATES_PENDING_AVAILABILITY_RUNTIME_REQUIREMENT
if self.data.lock().runtime_version
>= RuntimeApiRequest::CANDIDATES_PENDING_AVAILABILITY_RUNTIME_REQUIREMENT
{
panic!("Should have used candidates_pending_availability instead");
}
@@ -184,8 +184,8 @@ impl RelayChainInterface for DummyRelayChainInterface {
_: PHash,
_: ParaId,
) -> RelayChainResult<Vec<CommittedCandidateReceiptV2>> {
if self.data.lock().runtime_version <
RuntimeApiRequest::CANDIDATES_PENDING_AVAILABILITY_RUNTIME_REQUIREMENT
if self.data.lock().runtime_version
< RuntimeApiRequest::CANDIDATES_PENDING_AVAILABILITY_RUNTIME_REQUIREMENT
{
panic!("Should have used candidate_pending_availability instead");
}
@@ -289,12 +289,13 @@ impl RelayChainInterface for DummyRelayChainInterface {
async fn header(&self, block_id: BlockId) -> RelayChainResult<Option<PHeader>> {
let hash = match block_id {
BlockId::Hash(hash) => hash,
BlockId::Number(num) =>
BlockId::Number(num) => {
if let Some(hash) = self.relay_client.hash(num)? {
hash
} else {
return Ok(None);
},
}
},
};
let header = self.relay_client.header(hash)?;
+3 -2
View File
@@ -390,7 +390,7 @@ where
self.candidates_in_retry.remove(&block_hash);
pov
},
None =>
None => {
if self.candidates_in_retry.insert(block_hash) {
tracing::debug!(target: LOG_TARGET, ?block_hash, "Recovery failed, retrying.");
self.candidate_recovery_queue.push_recovery(block_hash);
@@ -404,7 +404,8 @@ where
self.candidates_in_retry.remove(&block_hash);
self.reset_candidate(block_hash);
return;
},
}
},
};
let raw_block_data =
+4 -4
View File
@@ -390,8 +390,8 @@ impl RelayChainInterface for Relaychain {
hash: PHash,
_: ParaId,
) -> RelayChainResult<Option<CommittedCandidateReceipt>> {
if self.inner.lock().expect("Poisoned lock").runtime_version >=
RuntimeApiRequest::CANDIDATES_PENDING_AVAILABILITY_RUNTIME_REQUIREMENT
if self.inner.lock().expect("Poisoned lock").runtime_version
>= RuntimeApiRequest::CANDIDATES_PENDING_AVAILABILITY_RUNTIME_REQUIREMENT
{
panic!("Should have used candidates_pending_availability instead");
}
@@ -413,8 +413,8 @@ impl RelayChainInterface for Relaychain {
hash: PHash,
_: ParaId,
) -> RelayChainResult<Vec<CommittedCandidateReceipt>> {
if self.inner.lock().expect("Poisoned lock").runtime_version <
RuntimeApiRequest::CANDIDATES_PENDING_AVAILABILITY_RUNTIME_REQUIREMENT
if self.inner.lock().expect("Poisoned lock").runtime_version
< RuntimeApiRequest::CANDIDATES_PENDING_AVAILABILITY_RUNTIME_REQUIREMENT
{
panic!("Should have used candidate_pending_availability instead");
}
@@ -109,12 +109,13 @@ impl RelayChainInterface for RelayChainInProcessInterface {
async fn header(&self, block_id: BlockId) -> RelayChainResult<Option<PHeader>> {
let hash = match block_id {
BlockId::Hash(hash) => hash,
BlockId::Number(num) =>
BlockId::Number(num) => {
if let Some(hash) = self.full_client.hash(num)? {
hash
} else {
return Ok(None);
},
}
},
};
let header = self.full_client.header(hash)?;
@@ -109,19 +109,21 @@ async fn build_interface(
let blockchain_rpc_client = Arc::new(BlockChainRpcClient::new(client.clone()));
let collator_node =
match pezkuwi_config.network.network_backend {
pezsc_network::config::NetworkBackendType::Libp2p =>
pezsc_network::config::NetworkBackendType::Libp2p => {
new_minimal_relay_chain::<
RelayBlock,
pezsc_network::NetworkWorker<RelayBlock, RelayHash>,
>(pezkuwi_config, collator_pair.clone(), blockchain_rpc_client)
.await?,
pezsc_network::config::NetworkBackendType::Litep2p =>
.await?
},
pezsc_network::config::NetworkBackendType::Litep2p => {
new_minimal_relay_chain::<RelayBlock, pezsc_network::Litep2pNetworkBackend>(
pezkuwi_config,
collator_pair.clone(),
blockchain_rpc_client,
)
.await?,
.await?
},
};
task_manager.add_child(collator_node.task_manager);
Ok((
@@ -110,8 +110,8 @@ pub(crate) fn build_collator_network<Network: NetworkBackend<Block, Hash>>(
}
fn adjust_network_config_light_in_peers(config: &mut NetworkConfiguration) {
let light_client_in_peers = (config.default_peers_set.in_peers +
config.default_peers_set.out_peers)
let light_client_in_peers = (config.default_peers_set.in_peers
+ config.default_peers_set.out_peers)
.saturating_sub(config.default_peers_set_num_full);
if light_client_in_peers > 0 {
tracing::debug!(target: crate::LOG_TARGET, "Detected {light_client_in_peers} peer slots for light clients. Since this minimal node does support\
@@ -125,8 +125,8 @@ async fn connect_next_available_rpc_server(
if current_iteration > prev_iteration {
// Safe conversion given we convert positive i32s which are lower than u64::MAX.
tokio::time::sleep(Duration::from_millis(
DEFAULT_SLEEP_TIME_MS_BETWEEN_RETRIES *
DEFAULT_SLEEP_EXP_BACKOFF_BETWEEN_RETRIES.pow(prev_iteration) as u64,
DEFAULT_SLEEP_TIME_MS_BETWEEN_RETRIES
* DEFAULT_SLEEP_EXP_BACKOFF_BETWEEN_RETRIES.pow(prev_iteration) as u64,
))
.await;
prev_iteration = current_iteration;
@@ -78,8 +78,8 @@ pub async fn pending_candidates(
// If the relay chain runtime does not support the new runtime API, fallback to the
// deprecated one.
let pending_availability_result = if teyrchain_host_runtime_api_version <
RuntimeApiRequest::CANDIDATES_PENDING_AVAILABILITY_RUNTIME_REQUIREMENT
let pending_availability_result = if teyrchain_host_runtime_api_version
< RuntimeApiRequest::CANDIDATES_PENDING_AVAILABILITY_RUNTIME_REQUIREMENT
{
#[allow(deprecated)]
client
+3 -2
View File
@@ -244,14 +244,15 @@ pub async fn build_relay_chain_interface(
task_manager,
hwbench,
),
pezcumulus_client_cli::RelayChainMode::ExternalRpc(rpc_target_urls) =>
pezcumulus_client_cli::RelayChainMode::ExternalRpc(rpc_target_urls) => {
build_minimal_relay_chain_node_with_rpc(
relay_chain_config,
teyrchain_config.prometheus_registry(),
task_manager,
rpc_target_urls,
)
.await,
.await
},
}
}