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:
@@ -363,8 +363,8 @@ pub mod pezpallet {
|
||||
lease_count: 0,
|
||||
};
|
||||
|
||||
if lease_period_start == SlotLeasePeriodStart::Current &&
|
||||
ActiveTemporarySlotCount::<T>::get() < T::MaxTemporarySlotPerLeasePeriod::get()
|
||||
if lease_period_start == SlotLeasePeriodStart::Current
|
||||
&& ActiveTemporarySlotCount::<T>::get() < T::MaxTemporarySlotPerLeasePeriod::get()
|
||||
{
|
||||
// Try to allocate slot directly
|
||||
match Self::configure_slot_lease(
|
||||
@@ -520,8 +520,8 @@ impl<T: Config> Pezpallet<T> {
|
||||
});
|
||||
|
||||
let mut newly_created_lease = 0u32;
|
||||
if active_temp_slots < T::MaxTemporarySlotPerLeasePeriod::get() &&
|
||||
!pending_temp_slots.is_empty()
|
||||
if active_temp_slots < T::MaxTemporarySlotPerLeasePeriod::get()
|
||||
&& !pending_temp_slots.is_empty()
|
||||
{
|
||||
// Sort by lease_count, favoring slots that had no or less turns first
|
||||
// (then by last_lease index, and then Para ID)
|
||||
@@ -625,8 +625,8 @@ impl<T: Config> Pezpallet<T> {
|
||||
err
|
||||
);
|
||||
}
|
||||
<T as slots::Config>::WeightInfo::force_lease() *
|
||||
(T::MaxTemporarySlotPerLeasePeriod::get() as u64)
|
||||
<T as slots::Config>::WeightInfo::force_lease()
|
||||
* (T::MaxTemporarySlotPerLeasePeriod::get() as u64)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -494,8 +494,8 @@ impl<T: Config> Pezpallet<T> {
|
||||
let mut outgoing_winner = Some((bidder.clone(), para, amount));
|
||||
swap(&mut current_winning[range_index], &mut outgoing_winner);
|
||||
if let Some((who, para, _amount)) = outgoing_winner {
|
||||
if auction_status.is_starting() &&
|
||||
current_winning
|
||||
if auction_status.is_starting()
|
||||
&& current_winning
|
||||
.iter()
|
||||
.filter_map(Option::as_ref)
|
||||
.all(|&(ref other, other_para, _)| other != &who || other_para != para)
|
||||
@@ -545,8 +545,8 @@ impl<T: Config> Pezpallet<T> {
|
||||
&mut raw_offset.as_ref(),
|
||||
)
|
||||
.expect("secure hashes should always be bigger than the block number; qed");
|
||||
let offset = (raw_offset_block_number % ending_period) /
|
||||
T::SampleLength::get().max(One::one());
|
||||
let offset = (raw_offset_block_number % ending_period)
|
||||
/ T::SampleLength::get().max(One::one());
|
||||
|
||||
let auction_counter = AuctionCounter::<T>::get();
|
||||
Self::deposit_event(Event::<T>::WinningOffset {
|
||||
@@ -594,9 +594,9 @@ impl<T: Config> Pezpallet<T> {
|
||||
let period_count = LeasePeriodOf::<T>::from(range.len() as u32);
|
||||
|
||||
match T::Leaser::lease_out(para, &leaser, amount, period_begin, period_count) {
|
||||
Err(LeaseError::ReserveFailed) |
|
||||
Err(LeaseError::AlreadyEnded) |
|
||||
Err(LeaseError::NoLeasePeriod) => {
|
||||
Err(LeaseError::ReserveFailed)
|
||||
| Err(LeaseError::AlreadyEnded)
|
||||
| Err(LeaseError::NoLeasePeriod) => {
|
||||
// Should never happen since we just unreserved this amount (and our offset is
|
||||
// from the present period). But if it does, there's not much we can do.
|
||||
},
|
||||
|
||||
@@ -107,14 +107,16 @@ impl StatementKind {
|
||||
/// Convert this to the (English) statement it represents.
|
||||
fn to_text(self) -> &'static [u8] {
|
||||
match self {
|
||||
StatementKind::Regular =>
|
||||
StatementKind::Regular => {
|
||||
&b"I hereby agree to the terms of the statement whose SHA-256 multihash is \
|
||||
Qmc1XYqT6S39WNp2UeiRUrZichUWUPpGEThDE6dAb3f6Ny. (This may be found at the URL: \
|
||||
https://statement.polkadot.network/regular.html)"[..],
|
||||
StatementKind::Saft =>
|
||||
https://statement.polkadot.network/regular.html)"[..]
|
||||
},
|
||||
StatementKind::Saft => {
|
||||
&b"I hereby agree to the terms of the statement whose SHA-256 multihash is \
|
||||
QmXEkMahfhHJPzT3RjkXiZVFi77ZeVeuxtAjhojGRNYckz. (This may be found at the URL: \
|
||||
https://statement.polkadot.network/saft.html)"[..],
|
||||
https://statement.polkadot.network/saft.html)"[..]
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,13 +178,15 @@ impl TryConvert<VersionedLocatableAsset, xcm_builder::LocatableAssetId>
|
||||
asset_id: v4_asset_id.try_into().map_err(|_| asset.clone())?,
|
||||
})
|
||||
},
|
||||
VersionedLocatableAsset::V4 { ref location, ref asset_id } =>
|
||||
VersionedLocatableAsset::V4 { ref location, ref asset_id } => {
|
||||
Ok(xcm_builder::LocatableAssetId {
|
||||
location: location.clone().try_into().map_err(|_| asset.clone())?,
|
||||
asset_id: asset_id.clone().try_into().map_err(|_| asset.clone())?,
|
||||
}),
|
||||
VersionedLocatableAsset::V5 { location, asset_id } =>
|
||||
Ok(xcm_builder::LocatableAssetId { location, asset_id }),
|
||||
})
|
||||
},
|
||||
VersionedLocatableAsset::V5 { location, asset_id } => {
|
||||
Ok(xcm_builder::LocatableAssetId { location, asset_id })
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -936,8 +936,8 @@ fn basic_swap_works() {
|
||||
// ----------------------------------------- para deposit --- crowdloan
|
||||
let crowdloan_deposit = 100;
|
||||
let para_id_deposit = <Test as paras_registrar::Config>::ParaDeposit::get();
|
||||
let code_deposit = configuration::ActiveConfig::<Test>::get().max_code_size *
|
||||
<Test as paras_registrar::Config>::DataDepositPerByte::get();
|
||||
let code_deposit = configuration::ActiveConfig::<Test>::get().max_code_size
|
||||
* <Test as paras_registrar::Config>::DataDepositPerByte::get();
|
||||
|
||||
// Para 2000 has a genesis head size of 10.
|
||||
assert_eq!(
|
||||
|
||||
@@ -163,8 +163,9 @@ impl<T: pezframe_system::Config> Registrar for TestRegistrar<T> {
|
||||
PARATHREADS.with(|x| {
|
||||
let mut parathreads = x.borrow_mut();
|
||||
match parathreads.binary_search(&id) {
|
||||
Ok(_) =>
|
||||
Err(DispatchError::Other("already parathread, so cannot `make_parathread`")),
|
||||
Ok(_) => {
|
||||
Err(DispatchError::Other("already parathread, so cannot `make_parathread`"))
|
||||
},
|
||||
Err(i) => {
|
||||
parathreads.insert(i, id);
|
||||
Ok(())
|
||||
|
||||
@@ -341,16 +341,16 @@ pub mod pezpallet {
|
||||
paras::Pezpallet::<T>::lifecycle(other).ok_or(Error::<T>::NotRegistered)?;
|
||||
// identify which is a lease holding teyrchain and which is a parathread (on-demand
|
||||
// teyrchain)
|
||||
if id_lifecycle == ParaLifecycle::Teyrchain &&
|
||||
other_lifecycle == ParaLifecycle::Parathread
|
||||
if id_lifecycle == ParaLifecycle::Teyrchain
|
||||
&& other_lifecycle == ParaLifecycle::Parathread
|
||||
{
|
||||
Self::do_thread_and_chain_swap(id, other);
|
||||
} else if id_lifecycle == ParaLifecycle::Parathread &&
|
||||
other_lifecycle == ParaLifecycle::Teyrchain
|
||||
} else if id_lifecycle == ParaLifecycle::Parathread
|
||||
&& other_lifecycle == ParaLifecycle::Teyrchain
|
||||
{
|
||||
Self::do_thread_and_chain_swap(other, id);
|
||||
} else if id_lifecycle == ParaLifecycle::Teyrchain &&
|
||||
other_lifecycle == ParaLifecycle::Teyrchain
|
||||
} else if id_lifecycle == ParaLifecycle::Teyrchain
|
||||
&& other_lifecycle == ParaLifecycle::Teyrchain
|
||||
{
|
||||
// If both chains are currently teyrchains, there is nothing funny we
|
||||
// need to do for their lifecycle management, just swap the underlying
|
||||
|
||||
@@ -157,8 +157,9 @@ pub mod pezpallet {
|
||||
let config = configuration::ActiveConfig::<T>::get();
|
||||
dmp::Pezpallet::<T>::queue_downward_message(&config, id, xcm.encode()).map_err(|e| {
|
||||
match e {
|
||||
dmp::QueueDownwardMessageError::ExceedsMaxMessageSize =>
|
||||
Error::<T>::ExceedsMaxMessageSize.into(),
|
||||
dmp::QueueDownwardMessageError::ExceedsMaxMessageSize => {
|
||||
Error::<T>::ExceedsMaxMessageSize.into()
|
||||
},
|
||||
dmp::QueueDownwardMessageError::Unroutable => Error::<T>::Unroutable.into(),
|
||||
}
|
||||
})
|
||||
|
||||
@@ -314,10 +314,11 @@ impl<T: Config> Pezpallet<T> {
|
||||
let mut tracker = alloc::collections::btree_map::BTreeMap::new();
|
||||
Leases::<T>::get(para).into_iter().for_each(|lease| match lease {
|
||||
Some((who, amount)) => match tracker.get(&who) {
|
||||
Some(prev_amount) =>
|
||||
Some(prev_amount) => {
|
||||
if amount > *prev_amount {
|
||||
tracker.insert(who, amount);
|
||||
},
|
||||
}
|
||||
},
|
||||
None => {
|
||||
tracker.insert(who, amount);
|
||||
},
|
||||
@@ -432,12 +433,13 @@ impl<T: Config> Leaser<BlockNumberFor<T>> for Pezpallet<T> {
|
||||
Leases::<T>::get(para)
|
||||
.into_iter()
|
||||
.map(|lease| match lease {
|
||||
Some((who, amount)) =>
|
||||
Some((who, amount)) => {
|
||||
if &who == leaser {
|
||||
amount
|
||||
} else {
|
||||
Zero::zero()
|
||||
},
|
||||
}
|
||||
},
|
||||
None => Zero::zero(),
|
||||
})
|
||||
.max()
|
||||
|
||||
@@ -83,12 +83,13 @@ where
|
||||
maybe_fast_unstake_event
|
||||
})
|
||||
.for_each(|e: pezpallet_fast_unstake::Event<T>| match e {
|
||||
pezpallet_fast_unstake::Event::<T>::Unstaked { result, .. } =>
|
||||
pezpallet_fast_unstake::Event::<T>::Unstaked { result, .. } => {
|
||||
if result.is_ok() {
|
||||
unstaked_ok += 1;
|
||||
} else {
|
||||
unstaked_err += 1
|
||||
},
|
||||
}
|
||||
},
|
||||
pezpallet_fast_unstake::Event::<T>::Slashed { .. } => unstaked_slashed += 1,
|
||||
pezpallet_fast_unstake::Event::<T>::InternalError => unreachable!(),
|
||||
_ => {},
|
||||
|
||||
Reference in New Issue
Block a user