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
+3 -3
View File
@@ -240,9 +240,9 @@ mod tests {
let mut header = ChainBuilder::new(20).append_finalized_header().to_header();
header.customize_signatures(|signatures| {
let first_signature_idx = signatures.iter().position(Option::is_some).unwrap();
let last_signature_idx = signatures.len() -
signatures.iter().rev().position(Option::is_some).unwrap() -
1;
let last_signature_idx = signatures.len()
- signatures.iter().rev().position(Option::is_some).unwrap()
- 1;
signatures[first_signature_idx] = signatures[last_signature_idx].clone();
});
assert_noop!(
+3 -2
View File
@@ -248,8 +248,9 @@ pub trait CallSubType<T: Config<I, RuntimeCall = Self>, I: 'static>:
let result = SubmitFinalityProofHelper::<T, I>::check_obsolete_from_extension(&call_info);
match result {
Ok(improved_by) =>
Ok(Some(VerifiedSubmitFinalityProofInfo { base: call_info, improved_by })),
Ok(improved_by) => {
Ok(Some(VerifiedSubmitFinalityProofInfo { base: call_info, improved_by }))
},
Err(Error::<T, I>::OldHeader) => Err(InvalidTransaction::Stale.into()),
Err(_) => Err(InvalidTransaction::Call.into()),
}
@@ -196,8 +196,8 @@ mod benchmarks {
//
fn max_msgs<T: Config<I>, I: 'static>() -> u32 {
T::BridgedChain::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX as u32 -
ReceiveMessagesProofSetup::<T, I>::LATEST_RECEIVED_NONCE as u32
T::BridgedChain::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX as u32
- ReceiveMessagesProofSetup::<T, I>::LATEST_RECEIVED_NONCE as u32
}
// Benchmark `receive_messages_proof` extrinsic with single minimal-weight message and following
+4 -4
View File
@@ -53,8 +53,8 @@ impl<T: Config<I>, I: 'static> CallHelper<T, I> {
// `is_obsolete` and every relayer has delivered at least one message,
// so if relayer slots are released, then message slots are also
// released
return post_occupation.free_message_slots >
info.unrewarded_relayers.free_message_slots;
return post_occupation.free_message_slots
> info.unrewarded_relayers.free_message_slots;
}
inbound_lane_data.last_delivered_nonce() == *info.base.bundled_range.end()
@@ -154,8 +154,8 @@ impl<
// confirmation. Because of that, we can't assume that our state has been confirmed
// to the bridged chain. So we are accepting any proof that brings new
// confirmations.
bundled_range: outbound_lane_data.latest_received_nonce + 1..=
relayers_state.last_delivered_nonce,
bundled_range: outbound_lane_data.latest_received_nonce + 1
..=relayers_state.last_delivered_nonce,
best_stored_nonce: outbound_lane_data.latest_received_nonce,
}));
}
+7 -7
View File
@@ -223,8 +223,8 @@ pub mod pezpallet {
// reject transactions that are declaring too many messages
ensure!(
MessageNonce::from(messages_count) <=
BridgedChainOf::<T, I>::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX,
MessageNonce::from(messages_count)
<= BridgedChainOf::<T, I>::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX,
Error::<T, I>::TooManyMessagesInTheProof
);
@@ -320,9 +320,9 @@ pub mod pezpallet {
valid_messages += 1;
dispatch_result.unspent_weight
},
ReceptionResult::InvalidNonce |
ReceptionResult::TooManyUnrewardedRelayers |
ReceptionResult::TooManyUnconfirmedMessages => message_dispatch_weight,
ReceptionResult::InvalidNonce
| ReceptionResult::TooManyUnrewardedRelayers
| ReceptionResult::TooManyUnconfirmedMessages => message_dispatch_weight,
};
messages_received_status.push(message.key.nonce, receival_result);
@@ -733,8 +733,8 @@ where
/// Ensure that the pezpallet is in normal operational mode.
fn ensure_normal_operating_mode<T: Config<I>, I: 'static>() -> Result<(), Error<T, I>> {
if PalletOperatingMode::<T, I>::get() ==
MessagesOperatingMode::Basic(BasicOperatingMode::Normal)
if PalletOperatingMode::<T, I>::get()
== MessagesOperatingMode::Basic(BasicOperatingMode::Normal)
{
return Ok(());
}
@@ -78,12 +78,13 @@ where
for (i, nonce) in message_nonces.into_iter().enumerate() {
let message_key = MessageKey { lane_id: lane, nonce };
let message_payload = match encode_message(nonce, &generate_message(nonce)) {
Some(message_payload) =>
Some(message_payload) => {
if i == 0 {
grow_storage_value(message_payload, &proof_params)
} else {
message_payload
},
}
},
None => continue,
};
let storage_key = storage_keys::message_key(
@@ -411,8 +411,8 @@ pub trait WeightInfoExt: WeightInfo {
/// is less than that cost).
fn storage_proof_size_overhead(proof_size: u32) -> Weight {
let proof_size_in_bytes = proof_size;
let byte_weight = Self::receive_single_n_bytes_message_proof(2) -
Self::receive_single_n_bytes_message_proof(1);
let byte_weight = Self::receive_single_n_bytes_message_proof(2)
- Self::receive_single_n_bytes_message_proof(1);
proof_size_in_bytes * byte_weight
}
@@ -109,8 +109,9 @@ where
calls.next().transpose()?.and_then(|c| c.submit_finality_proof_info());
Ok(match (total_calls, relay_finality_call, msgs_call) {
(2, Some(relay_finality_call), Some(msgs_call)) =>
Some(ExtensionCallInfo::RelayFinalityAndMsgs(relay_finality_call, msgs_call)),
(2, Some(relay_finality_call), Some(msgs_call)) => {
Some(ExtensionCallInfo::RelayFinalityAndMsgs(relay_finality_call, msgs_call))
},
(1, None, Some(msgs_call)) => Some(ExtensionCallInfo::Msgs(msgs_call)),
_ => None,
})
@@ -129,8 +130,8 @@ where
call_data: &mut ExtensionCallData,
relayer: &R::AccountId,
) -> bool {
verify_submit_finality_proof_succeeded::<Self, GI>(call_info, call_data, relayer) &&
verify_messages_call_succeeded::<Self>(call_info, call_data, relayer)
verify_submit_finality_proof_succeeded::<Self, GI>(call_info, call_data, relayer)
&& verify_messages_call_succeeded::<Self>(call_info, call_data, relayer)
}
}
@@ -407,11 +407,12 @@ where
"Has registered reward"
);
},
RelayerAccountAction::Slash(relayer, slash_account) =>
RelayerAccountAction::Slash(relayer, slash_account) => {
RelayersPallet::<R, C::BridgeRelayersPalletInstance>::slash_and_deregister(
&relayer,
ExplicitOrAccountParams::Params(slash_account),
),
)
},
}
Ok(Weight::zero())
@@ -676,8 +677,8 @@ mod tests {
test_lane_id(),
)
.unwrap()
.last_delivered_nonce() +
1,
.last_delivered_nonce()
+ 1,
nonces_end: best_message,
}),
messages_count: 1,
@@ -98,9 +98,9 @@ mod integrity_tests {
let priority_with_tip = estimate_priority(1, tip);
const ERROR_MARGIN: TransactionPriority = 5; // 5%
if priority_with_boost.abs_diff(priority_with_tip).saturating_mul(100) /
priority_with_tip >
ERROR_MARGIN
if priority_with_boost.abs_diff(priority_with_tip).saturating_mul(100)
/ priority_with_tip
> ERROR_MARGIN
{
panic!(
"The {param_name} value ({}) must be fixed to: {}",
@@ -122,14 +122,16 @@ where
let relay_finality_call =
calls.next().transpose()?.and_then(|c| c.submit_finality_proof_info());
Ok(match (total_calls, relay_finality_call, para_finality_call, msgs_call) {
(3, Some(relay_finality_call), Some(para_finality_call), Some(msgs_call)) =>
(3, Some(relay_finality_call), Some(para_finality_call), Some(msgs_call)) => {
Some(ExtensionCallInfo::AllFinalityAndMsgs(
relay_finality_call,
para_finality_call,
msgs_call,
)),
(2, None, Some(para_finality_call), Some(msgs_call)) =>
Some(ExtensionCallInfo::TeyrchainFinalityAndMsgs(para_finality_call, msgs_call)),
))
},
(2, None, Some(para_finality_call), Some(msgs_call)) => {
Some(ExtensionCallInfo::TeyrchainFinalityAndMsgs(para_finality_call, msgs_call))
},
(1, None, None, Some(msgs_call)) => Some(ExtensionCallInfo::Msgs(msgs_call)),
_ => None,
})
@@ -151,8 +153,8 @@ where
) -> bool {
verify_submit_finality_proof_succeeded::<Self, R::BridgesGrandpaPalletInstance>(
call_info, call_data, relayer,
) && verify_submit_teyrchain_head_succeeded::<Self, PI>(call_info, call_data, relayer) &&
verify_messages_call_succeeded::<Self>(call_info, call_data, relayer)
) && verify_submit_teyrchain_head_succeeded::<Self, PI>(call_info, call_data, relayer)
&& verify_messages_call_succeeded::<Self>(call_info, call_data, relayer)
}
}
+2 -2
View File
@@ -381,8 +381,8 @@ impl MessageDispatch for DummyMessageDispatch {
type LaneId = TestLaneIdType;
fn is_active(lane: Self::LaneId) -> bool {
pezframe_support::storage::unhashed::take::<bool>(&(b"inactive", lane).encode()[..]) !=
Some(false)
pezframe_support::storage::unhashed::take::<bool>(&(b"inactive", lane).encode()[..])
!= Some(false)
}
fn dispatch_weight(
@@ -158,12 +158,13 @@ impl<T: Config<I>, I: 'static> SubmitTeyrchainHeadsHelper<T, I> {
/// Check if the `SubmitTeyrchainHeads` was successfully executed.
pub fn was_successful(update: &SubmitTeyrchainHeadsInfo) -> bool {
match crate::ParasInfo::<T, I>::get(update.para_id) {
Some(stored_best_head) =>
stored_best_head.best_head_hash ==
BestParaHeadHash {
Some(stored_best_head) => {
stored_best_head.best_head_hash
== BestParaHeadHash {
at_relay_block_number: update.at_relay_block.0,
head_hash: update.para_head_hash,
},
}
},
None => false,
}
}
+8 -6
View File
@@ -526,14 +526,16 @@ pub mod pezpallet {
let update_result: Result<_, ()> =
ParasInfo::<T, I>::try_mutate(teyrchain, |stored_best_head| {
let is_free = teyrchain_head_size <
T::ParaStoredHeaderDataBuilder::max_free_head_size() as usize &&
match stored_best_head {
let is_free = teyrchain_head_size
< T::ParaStoredHeaderDataBuilder::max_free_head_size() as usize
&& match stored_best_head {
Some(ref best_head)
if at_relay_block.0.saturating_sub(
best_head.best_head_hash.at_relay_block_number,
) >= free_headers_interval =>
true,
{
true
},
Some(_) => false,
None => true,
};
@@ -699,8 +701,8 @@ pub mod pezpallet {
at_relay_block_number: new_at_relay_block.0,
head_hash: new_head_hash,
},
next_imported_hash_position: (next_imported_hash_position + 1) %
T::HeadsToKeep::get(),
next_imported_hash_position: (next_imported_hash_position + 1)
% T::HeadsToKeep::get(),
};
ImportedParaHashes::<T, I>::insert(
teyrchain,
@@ -104,9 +104,9 @@ pub trait WeightInfoExt: WeightInfo {
/// Returns weight that needs to be accounted when storage proof of given size is received.
fn storage_proof_size_overhead(extra_proof_bytes: u32) -> Weight {
let extra_byte_weight = (Self::submit_teyrchain_heads_with_16kb_proof() -
Self::submit_teyrchain_heads_with_1kb_proof()) /
(15 * 1024);
let extra_byte_weight = (Self::submit_teyrchain_heads_with_16kb_proof()
- Self::submit_teyrchain_heads_with_1kb_proof())
/ (15 * 1024);
extra_byte_weight.saturating_mul(extra_proof_bytes as u64)
}
}
@@ -279,7 +279,9 @@ impl<T: Config<I>, I: 'static> ExporterFor for Pezpallet<T, I> {
match T::Bridges::exporter_for(network, remote_location, message) {
Some((bridge_hub_location, maybe_payment))
if bridge_hub_location.eq(&T::SiblingBridgeHubLocation::get()) =>
(bridge_hub_location, maybe_payment),
{
(bridge_hub_location, maybe_payment)
},
_ => {
tracing::trace!(
target: LOG_TARGET,
@@ -504,8 +506,8 @@ mod tests {
Bridge::<TestRuntime, ()>::put(uncongested_bridge(initial_fee_factor));
// it should eventually decrease to one
while XcmBridgeHubRouter::bridge().delivery_fee_factor >
Pezpallet::<TestRuntime, ()>::MIN_FEE_FACTOR
while XcmBridgeHubRouter::bridge().delivery_fee_factor
> Pezpallet::<TestRuntime, ()>::MIN_FEE_FACTOR
{
XcmBridgeHubRouter::on_initialize(One::one());
}
@@ -637,10 +639,10 @@ mod tests {
let factor = FixedU128::from_rational(125, 100);
Bridge::<TestRuntime, ()>::put(uncongested_bridge(factor));
let expected_fee =
(FixedU128::saturating_from_integer(BASE_FEE + BYTE_FEE * (msg_size as u128)) *
factor)
.into_inner() / FixedU128::DIV +
HRMP_FEE;
(FixedU128::saturating_from_integer(BASE_FEE + BYTE_FEE * (msg_size as u128))
* factor)
.into_inner() / FixedU128::DIV
+ HRMP_FEE;
assert_eq!(
XcmBridgeHubRouter::validate(&mut Some(dest), &mut Some(xcm)).unwrap().1.get(0),
Some(&(BridgeFeeAsset::get(), expected_fee).into()),
+3 -2
View File
@@ -767,8 +767,9 @@ pub mod pezpallet {
let lane_id = match maybe_lane_id {
Some(lane_id) => *lane_id,
None =>
locations.calculate_lane_id(xcm::latest::VERSION).expect("Valid locations"),
None => {
locations.calculate_lane_id(xcm::latest::VERSION).expect("Valid locations")
},
};
Pezpallet::<T, I>::do_open_bridge(locations, lane_id, true)
@@ -643,8 +643,8 @@ impl MessageDispatch for TestMessageDispatch {
type LaneId = TestLaneIdType;
fn is_active(lane: Self::LaneId) -> bool {
pezframe_support::storage::unhashed::take::<bool>(&(b"inactive", lane).encode()[..]) !=
Some(false)
pezframe_support::storage::unhashed::take::<bool>(&(b"inactive", lane).encode()[..])
!= Some(false)
}
fn dispatch_weight(