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:
@@ -173,8 +173,9 @@ impl<C: Chain> RpcClient<C> {
|
||||
// same and we need to abort if actual version is > than expected
|
||||
let actual = SimpleRuntimeVersion::from_runtime_version(&env.runtime_version().await?);
|
||||
match actual.spec_version.cmp(&expected.spec_version) {
|
||||
Ordering::Less =>
|
||||
Err(Error::WaitingForRuntimeUpgrade { chain: C::NAME.into(), expected, actual }),
|
||||
Ordering::Less => {
|
||||
Err(Error::WaitingForRuntimeUpgrade { chain: C::NAME.into(), expected, actual })
|
||||
},
|
||||
Ordering::Equal => Ok(()),
|
||||
Ordering::Greater => {
|
||||
tracing::error!(
|
||||
|
||||
@@ -126,8 +126,8 @@ impl<C: Chain, Clnt: Client<C>, V: FloatStorageValue> StandaloneMetric
|
||||
.await?;
|
||||
self.value_converter.decode(maybe_storage_value).map(|maybe_fixed_point_value| {
|
||||
maybe_fixed_point_value.map(|fixed_point_value| {
|
||||
fixed_point_value.into_inner().unique_saturated_into() as f64 /
|
||||
V::Value::DIV.unique_saturated_into() as f64
|
||||
fixed_point_value.into_inner().unique_saturated_into() as f64
|
||||
/ V::Value::DIV.unique_saturated_into() as f64
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -121,10 +121,12 @@ impl<C: Chain, E: Environment<C>> TransactionTracker<C, E> {
|
||||
(TrackedTransactionStatus::Lost, None)
|
||||
},
|
||||
Either::Right((invalidation_status, _)) => match invalidation_status {
|
||||
InvalidationStatus::Finalized(at_block) =>
|
||||
(TrackedTransactionStatus::Finalized(at_block), Some(invalidation_status)),
|
||||
InvalidationStatus::Invalid =>
|
||||
(TrackedTransactionStatus::Lost, Some(invalidation_status)),
|
||||
InvalidationStatus::Finalized(at_block) => {
|
||||
(TrackedTransactionStatus::Finalized(at_block), Some(invalidation_status))
|
||||
},
|
||||
InvalidationStatus::Invalid => {
|
||||
(TrackedTransactionStatus::Lost, Some(invalidation_status))
|
||||
},
|
||||
InvalidationStatus::Lost => {
|
||||
// wait for the rest of stall timeout - this way we'll be sure that the
|
||||
// transaction is actually dead if it has been crafted properly
|
||||
@@ -228,9 +230,9 @@ async fn watch_transaction_status<
|
||||
);
|
||||
return InvalidationStatus::Invalid;
|
||||
},
|
||||
Some(TransactionStatusOf::<C>::Future) |
|
||||
Some(TransactionStatusOf::<C>::Ready) |
|
||||
Some(TransactionStatusOf::<C>::Broadcast(_)) => {
|
||||
Some(TransactionStatusOf::<C>::Future)
|
||||
| Some(TransactionStatusOf::<C>::Ready)
|
||||
| Some(TransactionStatusOf::<C>::Broadcast(_)) => {
|
||||
// nothing important (for us) has happened
|
||||
},
|
||||
Some(TransactionStatusOf::<C>::InBlock(block_hash)) => {
|
||||
|
||||
@@ -39,8 +39,9 @@ impl<P: EquivocationDetectionPipeline> ReadSyncedHeaders<P> {
|
||||
target_client: &mut TC,
|
||||
) -> Result<ReadContext<P>, Self> {
|
||||
match target_client.synced_headers_finality_info(self.target_block_num).await {
|
||||
Ok(synced_headers) =>
|
||||
Ok(ReadContext { target_block_num: self.target_block_num, synced_headers }),
|
||||
Ok(synced_headers) => {
|
||||
Ok(ReadContext { target_block_num: self.target_block_num, synced_headers })
|
||||
},
|
||||
Err(e) => {
|
||||
tracing::error!(
|
||||
target: "bridge",
|
||||
@@ -127,13 +128,14 @@ impl<P: EquivocationDetectionPipeline> FindEquivocations<P> {
|
||||
&synced_header.finality_proof,
|
||||
finality_proofs_buf.buf().as_slice(),
|
||||
) {
|
||||
Ok(equivocations) =>
|
||||
Ok(equivocations) => {
|
||||
if !equivocations.is_empty() {
|
||||
result.push(ReportEquivocations {
|
||||
source_block_hash: self.context.synced_header_hash,
|
||||
equivocations,
|
||||
})
|
||||
},
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
tracing::error!(
|
||||
target: "bridge",
|
||||
@@ -272,23 +274,23 @@ mod tests {
|
||||
|
||||
impl PartialEq for ReadContext<TestEquivocationDetectionPipeline> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.target_block_num == other.target_block_num &&
|
||||
self.synced_headers == other.synced_headers
|
||||
self.target_block_num == other.target_block_num
|
||||
&& self.synced_headers == other.synced_headers
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for FindEquivocations<TestEquivocationDetectionPipeline> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.target_block_num == other.target_block_num &&
|
||||
self.synced_headers == other.synced_headers &&
|
||||
self.context == other.context
|
||||
self.target_block_num == other.target_block_num
|
||||
&& self.synced_headers == other.synced_headers
|
||||
&& self.context == other.context
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for ReportEquivocations<TestEquivocationDetectionPipeline> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.source_block_hash == other.source_block_hash &&
|
||||
self.equivocations == other.equivocations
|
||||
self.source_block_hash == other.source_block_hash
|
||||
&& self.equivocations == other.equivocations
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -289,11 +289,11 @@ impl<P: FinalitySyncPipeline, SC: SourceClient<P>, TC: TargetClient<P>> Finality
|
||||
let (prev_time, prev_best_number_at_target) = self.progress;
|
||||
let now = Instant::now();
|
||||
|
||||
let needs_update = now - prev_time > Duration::from_secs(10) ||
|
||||
prev_best_number_at_target
|
||||
let needs_update = now - prev_time > Duration::from_secs(10)
|
||||
|| prev_best_number_at_target
|
||||
.map(|prev_best_number_at_target| {
|
||||
info.best_number_at_target.saturating_sub(prev_best_number_at_target) >
|
||||
10.into()
|
||||
info.best_number_at_target.saturating_sub(prev_best_number_at_target)
|
||||
> 10.into()
|
||||
})
|
||||
.unwrap_or(true);
|
||||
|
||||
|
||||
@@ -128,8 +128,9 @@ impl<P: FinalitySyncPipeline> JustifiedHeaderSelector<P> {
|
||||
) -> Option<JustifiedHeader<P>> {
|
||||
let (unjustified_headers, maybe_justified_header) = match self {
|
||||
JustifiedHeaderSelector::Mandatory(justified_header) => return Some(justified_header),
|
||||
JustifiedHeaderSelector::Regular(unjustified_headers, justified_header) =>
|
||||
(unjustified_headers, Some(justified_header)),
|
||||
JustifiedHeaderSelector::Regular(unjustified_headers, justified_header) => {
|
||||
(unjustified_headers, Some(justified_header))
|
||||
},
|
||||
JustifiedHeaderSelector::None(unjustified_headers) => (unjustified_headers, None),
|
||||
};
|
||||
|
||||
@@ -194,14 +195,15 @@ fn need_to_relay<P: FinalitySyncPipeline>(
|
||||
match headers_to_relay {
|
||||
HeadersToRelay::All => true,
|
||||
HeadersToRelay::Mandatory => header.is_mandatory(),
|
||||
HeadersToRelay::Free =>
|
||||
header.is_mandatory() ||
|
||||
free_headers_interval
|
||||
HeadersToRelay::Free => {
|
||||
header.is_mandatory()
|
||||
|| free_headers_interval
|
||||
.map(|free_headers_interval| {
|
||||
header.number().saturating_sub(info.best_number_at_target) >=
|
||||
free_headers_interval
|
||||
header.number().saturating_sub(info.best_number_at_target)
|
||||
>= free_headers_interval
|
||||
})
|
||||
.unwrap_or(false),
|
||||
.unwrap_or(false)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -213,13 +213,14 @@ where
|
||||
let max_messages_size_in_single_batch = P::TargetChain::max_extrinsic_size() / 3;
|
||||
let limits = match params.limits {
|
||||
Some(limits) => limits,
|
||||
None =>
|
||||
None => {
|
||||
select_delivery_transaction_limits_rpc(
|
||||
¶ms,
|
||||
P::TargetChain::max_extrinsic_weight(),
|
||||
P::SourceChain::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX,
|
||||
)
|
||||
.await?,
|
||||
.await?
|
||||
},
|
||||
};
|
||||
let (max_messages_in_single_batch, max_messages_weight_in_single_batch) =
|
||||
(limits.max_messages_in_single_batch / 2, limits.max_messages_weight_in_single_batch / 2);
|
||||
@@ -706,8 +707,9 @@ mod tests {
|
||||
impl From<MockUtilityCall<RuntimeCall>> for RuntimeCall {
|
||||
fn from(value: MockUtilityCall<RuntimeCall>) -> RuntimeCall {
|
||||
match value {
|
||||
MockUtilityCall::batch_all(calls) =>
|
||||
RuntimeCall::Utility(UtilityCall::<RuntimeCall>::batch_all(calls)),
|
||||
MockUtilityCall::batch_all(calls) => {
|
||||
RuntimeCall::Utility(UtilityCall::<RuntimeCall>::batch_all(calls))
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,8 +197,9 @@ where
|
||||
let storage_value: Option<ParaStoredHeaderData> =
|
||||
self.target_client.storage_value(at_block.hash(), storage_key).await?;
|
||||
let para_head_number = match storage_value {
|
||||
Some(para_head_data) =>
|
||||
para_head_data.decode_teyrchain_head_data::<P::SourceTeyrchain>()?.number,
|
||||
Some(para_head_data) => {
|
||||
para_head_data.decode_teyrchain_head_data::<P::SourceTeyrchain>()?.number
|
||||
},
|
||||
None => return Ok(None),
|
||||
};
|
||||
|
||||
|
||||
@@ -1068,8 +1068,8 @@ pub(crate) mod tests {
|
||||
data.source_state.best_finalized_self = data.source_state.best_self;
|
||||
// syncing target headers -> source chain
|
||||
if let Some(last_requirement) = data.target_to_source_header_requirements.last() {
|
||||
if *last_requirement !=
|
||||
data.source_state.best_finalized_peer_at_best_self.unwrap()
|
||||
if *last_requirement
|
||||
!= data.source_state.best_finalized_peer_at_best_self.unwrap()
|
||||
{
|
||||
data.source_state.best_finalized_peer_at_best_self =
|
||||
Some(*last_requirement);
|
||||
@@ -1091,8 +1091,8 @@ pub(crate) mod tests {
|
||||
data.target_state.best_finalized_self = data.target_state.best_self;
|
||||
// syncing source headers -> target chain
|
||||
if let Some(last_requirement) = data.source_to_target_header_requirements.last() {
|
||||
if *last_requirement !=
|
||||
data.target_state.best_finalized_peer_at_best_self.unwrap()
|
||||
if *last_requirement
|
||||
!= data.target_state.best_finalized_peer_at_best_self.unwrap()
|
||||
{
|
||||
data.target_state.best_finalized_peer_at_best_self =
|
||||
Some(*last_requirement);
|
||||
@@ -1148,15 +1148,15 @@ pub(crate) mod tests {
|
||||
// headers relay must only be started when we need new target headers at source node
|
||||
if data.target_to_source_header_required.is_some() {
|
||||
assert!(
|
||||
data.source_state.best_finalized_peer_at_best_self.unwrap().0 <
|
||||
data.target_state.best_self.0
|
||||
data.source_state.best_finalized_peer_at_best_self.unwrap().0
|
||||
< data.target_state.best_self.0
|
||||
);
|
||||
data.target_to_source_header_required = None;
|
||||
}
|
||||
// syncing target headers -> source chain
|
||||
if let Some(last_requirement) = data.target_to_source_header_requirements.last() {
|
||||
if *last_requirement !=
|
||||
data.source_state.best_finalized_peer_at_best_self.unwrap()
|
||||
if *last_requirement
|
||||
!= data.source_state.best_finalized_peer_at_best_self.unwrap()
|
||||
{
|
||||
data.source_state.best_finalized_peer_at_best_self =
|
||||
Some(*last_requirement);
|
||||
@@ -1172,15 +1172,15 @@ pub(crate) mod tests {
|
||||
// headers relay must only be started when we need new source headers at target node
|
||||
if data.source_to_target_header_required.is_some() {
|
||||
assert!(
|
||||
data.target_state.best_finalized_peer_at_best_self.unwrap().0 <
|
||||
data.source_state.best_self.0
|
||||
data.target_state.best_finalized_peer_at_best_self.unwrap().0
|
||||
< data.source_state.best_self.0
|
||||
);
|
||||
data.source_to_target_header_required = None;
|
||||
}
|
||||
// syncing source headers -> target chain
|
||||
if let Some(last_requirement) = data.source_to_target_header_requirements.last() {
|
||||
if *last_requirement !=
|
||||
data.target_state.best_finalized_peer_at_best_self.unwrap()
|
||||
if *last_requirement
|
||||
!= data.target_state.best_finalized_peer_at_best_self.unwrap()
|
||||
{
|
||||
data.target_state.best_finalized_peer_at_best_self =
|
||||
Some(*last_requirement);
|
||||
|
||||
@@ -411,10 +411,10 @@ where
|
||||
// "unrewarded relayers" set. If we are unable to prove new rewards to the target node, then
|
||||
// we should wait for confirmations race.
|
||||
let unrewarded_limit_reached =
|
||||
target_nonces.nonces_data.unrewarded_relayers.unrewarded_relayer_entries >=
|
||||
self.max_unrewarded_relayer_entries_at_target ||
|
||||
target_nonces.nonces_data.unrewarded_relayers.total_messages >=
|
||||
self.max_unconfirmed_nonces_at_target;
|
||||
target_nonces.nonces_data.unrewarded_relayers.unrewarded_relayer_entries
|
||||
>= self.max_unrewarded_relayer_entries_at_target
|
||||
|| target_nonces.nonces_data.unrewarded_relayers.total_messages
|
||||
>= self.max_unconfirmed_nonces_at_target;
|
||||
if unrewarded_limit_reached {
|
||||
// so there are already too many unrewarded relayer entries in the set
|
||||
//
|
||||
@@ -422,8 +422,8 @@ where
|
||||
// be paid
|
||||
let number_of_rewards_being_proved =
|
||||
latest_confirmed_nonce_at_source.saturating_sub(latest_confirmed_nonce_at_target);
|
||||
let enough_rewards_being_proved = number_of_rewards_being_proved >=
|
||||
target_nonces.nonces_data.unrewarded_relayers.messages_in_oldest_entry;
|
||||
let enough_rewards_being_proved = number_of_rewards_being_proved
|
||||
>= target_nonces.nonces_data.unrewarded_relayers.messages_in_oldest_entry;
|
||||
if !enough_rewards_being_proved {
|
||||
return None;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,9 @@ impl MessageRaceLimits {
|
||||
Some(new_selected_weight)
|
||||
if new_selected_weight
|
||||
.all_lte(reference.max_messages_weight_in_single_batch) =>
|
||||
new_selected_weight,
|
||||
{
|
||||
new_selected_weight
|
||||
},
|
||||
new_selected_weight if selected_count == 0 => {
|
||||
tracing::warn!(
|
||||
target: "bridge",
|
||||
@@ -132,7 +134,9 @@ impl MessageRaceLimits {
|
||||
let new_selected_size = match relay_reference.selected_size.checked_add(details.size) {
|
||||
Some(new_selected_size)
|
||||
if new_selected_size <= reference.max_messages_size_in_single_batch =>
|
||||
new_selected_size,
|
||||
{
|
||||
new_selected_size
|
||||
},
|
||||
new_selected_size if selected_count == 0 => {
|
||||
tracing::warn!(
|
||||
target: "bridge",
|
||||
|
||||
@@ -221,8 +221,9 @@ where
|
||||
fn best_at_source(&self) -> Option<MessageNonce> {
|
||||
let best_in_queue = self.source_queue.back().map(|(_, range)| range.end());
|
||||
match (best_in_queue, self.best_target_nonce) {
|
||||
(Some(best_in_queue), Some(best_target_nonce)) if best_in_queue > best_target_nonce =>
|
||||
Some(best_in_queue),
|
||||
(Some(best_in_queue), Some(best_target_nonce)) if best_in_queue > best_target_nonce => {
|
||||
Some(best_in_queue)
|
||||
},
|
||||
(_, Some(best_target_nonce)) => Some(best_target_nonce),
|
||||
(_, None) => None,
|
||||
}
|
||||
|
||||
@@ -359,8 +359,8 @@ where
|
||||
// find last free relay chain header in the range that we are interested in
|
||||
let scan_range_begin = relay_of_head_at_target.number();
|
||||
let scan_range_end = best_finalized_relay_block_at_target.number();
|
||||
if scan_range_end.saturating_sub(scan_range_begin) <
|
||||
free_source_relay_headers_interval
|
||||
if scan_range_end.saturating_sub(scan_range_begin)
|
||||
< free_source_relay_headers_interval
|
||||
{
|
||||
// there are no new **free** relay chain headers in the range
|
||||
tracing::trace!(
|
||||
@@ -647,7 +647,9 @@ impl<P: TeyrchainsPipeline> SubmittedHeadsTracker<P> {
|
||||
let is_head_updated = match (self.submitted_head, head_at_target) {
|
||||
(AvailableHeader::Available(submitted_head), Some(head_at_target))
|
||||
if head_at_target.number() >= submitted_head.number() =>
|
||||
true,
|
||||
{
|
||||
true
|
||||
},
|
||||
(AvailableHeader::Missing, None) => true,
|
||||
_ => false,
|
||||
};
|
||||
@@ -669,8 +671,9 @@ impl<P: TeyrchainsPipeline> SubmittedHeadsTracker<P> {
|
||||
// then restart our sync
|
||||
let transaction_tracker = self.transaction_tracker.clone();
|
||||
match poll!(transaction_tracker) {
|
||||
Poll::Ready(TrackedTransactionStatus::Lost) =>
|
||||
return SubmittedHeadStatus::Final(TrackedTransactionStatus::Lost),
|
||||
Poll::Ready(TrackedTransactionStatus::Lost) => {
|
||||
return SubmittedHeadStatus::Final(TrackedTransactionStatus::Lost)
|
||||
},
|
||||
Poll::Ready(TrackedTransactionStatus::Finalized(_)) => {
|
||||
// so we are here and our transaction is mined+finalized, but some of heads were not
|
||||
// updated => we're considering our loop as stalled
|
||||
|
||||
Reference in New Issue
Block a user