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:
@@ -274,8 +274,8 @@ mod benchmarks {
|
||||
let caller = CandidateList::<T>::get()[0].who.clone();
|
||||
v2::whitelist!(caller);
|
||||
|
||||
let bond_amount: BalanceOf<T> = <T as pezpallet::Config>::Currency::minimum_balance() +
|
||||
<T as pezpallet::Config>::Currency::minimum_balance();
|
||||
let bond_amount: BalanceOf<T> = <T as pezpallet::Config>::Currency::minimum_balance()
|
||||
+ <T as pezpallet::Config>::Currency::minimum_balance();
|
||||
|
||||
#[extrinsic_call]
|
||||
_(RawOrigin::Signed(caller.clone()), bond_amount);
|
||||
@@ -284,8 +284,8 @@ mod benchmarks {
|
||||
Event::CandidateBondUpdated { account_id: caller, deposit: bond_amount }.into(),
|
||||
);
|
||||
assert!(
|
||||
CandidateList::<T>::get().iter().last().unwrap().deposit ==
|
||||
<T as pezpallet::Config>::Currency::minimum_balance() * 2u32.into()
|
||||
CandidateList::<T>::get().iter().last().unwrap().deposit
|
||||
== <T as pezpallet::Config>::Currency::minimum_balance() * 2u32.into()
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -352,8 +352,8 @@ pub mod pezpallet {
|
||||
fn integrity_test() {
|
||||
assert!(T::MinEligibleCollators::get() > 0, "chain must require at least one collator");
|
||||
assert!(
|
||||
T::MaxInvulnerables::get().saturating_add(T::MaxCandidates::get()) >=
|
||||
T::MinEligibleCollators::get(),
|
||||
T::MaxInvulnerables::get().saturating_add(T::MaxCandidates::get())
|
||||
>= T::MinEligibleCollators::get(),
|
||||
"invulnerables and candidates must be able to satisfy collator demand"
|
||||
);
|
||||
}
|
||||
@@ -388,8 +388,8 @@ pub mod pezpallet {
|
||||
if new.is_empty() {
|
||||
// Casting `u32` to `usize` should be safe on all machines running this.
|
||||
ensure!(
|
||||
CandidateList::<T>::decode_len().unwrap_or_default() >=
|
||||
T::MinEligibleCollators::get() as usize,
|
||||
CandidateList::<T>::decode_len().unwrap_or_default()
|
||||
>= T::MinEligibleCollators::get() as usize,
|
||||
Error::<T>::TooFewEligibleCollators
|
||||
);
|
||||
}
|
||||
@@ -696,8 +696,8 @@ pub mod pezpallet {
|
||||
} else if new_deposit < old_deposit {
|
||||
// Casting `u32` to `usize` should be safe on all machines running this.
|
||||
ensure!(
|
||||
idx.saturating_add(DesiredCandidates::<T>::get() as usize) <
|
||||
candidate_count,
|
||||
idx.saturating_add(DesiredCandidates::<T>::get() as usize)
|
||||
< candidate_count,
|
||||
Error::<T>::InvalidUnreserve
|
||||
);
|
||||
T::Currency::unreserve(&who, old_deposit - new_deposit);
|
||||
|
||||
@@ -80,8 +80,9 @@ impl Parse for Input {
|
||||
|
||||
fn crate_() -> Result<Ident, Error> {
|
||||
match crate_name("pezcumulus-pezpallet-teyrchain-system") {
|
||||
Ok(FoundCrate::Itself) =>
|
||||
Ok(syn::Ident::new("pezcumulus_pezpallet_teyrchain_system", Span::call_site())),
|
||||
Ok(FoundCrate::Itself) => {
|
||||
Ok(syn::Ident::new("pezcumulus_pezpallet_teyrchain_system", Span::call_site()))
|
||||
},
|
||||
Ok(FoundCrate::Name(name)) => Ok(Ident::new(&name, Span::call_site())),
|
||||
Err(e) => Err(Error::new(Span::call_site(), e)),
|
||||
}
|
||||
|
||||
@@ -1705,7 +1705,7 @@ impl<T: Config> UpwardMessageSender for Pezpallet<T> {
|
||||
const MAX_CODE_SIZE: u32 = 3 * 1024 * 1024;
|
||||
HostConfiguration::<T>::mutate(|cfg| match cfg {
|
||||
Some(cfg) => cfg.max_upward_message_size = MAX_UPWARD_MESSAGE_SIZE,
|
||||
None =>
|
||||
None => {
|
||||
*cfg = Some(AbridgedHostConfiguration {
|
||||
max_code_size: MAX_CODE_SIZE,
|
||||
max_head_data_size: 32 * 1024,
|
||||
@@ -1720,7 +1720,8 @@ impl<T: Config> UpwardMessageSender for Pezpallet<T> {
|
||||
allowed_ancestry_len: 0,
|
||||
max_candidate_depth: 0,
|
||||
},
|
||||
}),
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,10 +166,10 @@ impl XcmpMessageSource for FromThreadLocal {
|
||||
|
||||
let msg_len = m.1.len();
|
||||
|
||||
if !ids.contains(&m.0) &&
|
||||
taken_messages < maximum_channels &&
|
||||
msg_len <= max_size_ever &&
|
||||
taken_bytes + msg_len <= max_size_now
|
||||
if !ids.contains(&m.0)
|
||||
&& taken_messages < maximum_channels
|
||||
&& msg_len <= max_size_ever
|
||||
&& taken_bytes + msg_len <= max_size_now
|
||||
{
|
||||
ids.insert(m.0);
|
||||
taken_messages += 1;
|
||||
|
||||
@@ -43,15 +43,17 @@ impl<'a, H: trie_db::Hasher> trie_db::TrieRecorder<H::Out> for SizeOnlyRecorder<
|
||||
fn record(&mut self, access: TrieAccess<'_, H::Out>) {
|
||||
let mut encoded_size_update = 0;
|
||||
match access {
|
||||
TrieAccess::NodeOwned { hash, node_owned } =>
|
||||
TrieAccess::NodeOwned { hash, node_owned } => {
|
||||
if self.seen_nodes.insert(hash) {
|
||||
let node = node_owned.to_encoded::<NodeCodec<H>>();
|
||||
encoded_size_update += node.encoded_size();
|
||||
},
|
||||
TrieAccess::EncodedNode { hash, encoded_node } =>
|
||||
}
|
||||
},
|
||||
TrieAccess::EncodedNode { hash, encoded_node } => {
|
||||
if self.seen_nodes.insert(hash) {
|
||||
encoded_size_update += encoded_node.encoded_size();
|
||||
},
|
||||
}
|
||||
},
|
||||
TrieAccess::Value { hash, value, full_key } => {
|
||||
if self.seen_nodes.insert(hash) {
|
||||
encoded_size_update += value.encoded_size();
|
||||
|
||||
@@ -584,8 +584,8 @@ fn test_series() {
|
||||
block_weight_pre_dispatch: Weight::from_parts(1000, 1000),
|
||||
mock_ext_refund: Weight::from_parts(0, 0),
|
||||
assert_post_info_weight: None,
|
||||
assert_block_weight_post_dispatch: base_extrinsic +
|
||||
Weight::from_parts(1100, 1300 + LEN as u64),
|
||||
assert_block_weight_post_dispatch: base_extrinsic
|
||||
+ Weight::from_parts(1100, 1300 + LEN as u64),
|
||||
},
|
||||
// some tx ext refund is ignored, because post info is None.
|
||||
TestCfg {
|
||||
@@ -597,8 +597,8 @@ fn test_series() {
|
||||
block_weight_pre_dispatch: Weight::from_parts(1000, 1000),
|
||||
mock_ext_refund: Weight::from_parts(20, 20),
|
||||
assert_post_info_weight: None,
|
||||
assert_block_weight_post_dispatch: base_extrinsic +
|
||||
Weight::from_parts(1100, 1300 + LEN as u64),
|
||||
assert_block_weight_post_dispatch: base_extrinsic
|
||||
+ Weight::from_parts(1100, 1300 + LEN as u64),
|
||||
},
|
||||
// some tx ext refund is ignored on proof size because lower than actual measure.
|
||||
TestCfg {
|
||||
@@ -610,8 +610,8 @@ fn test_series() {
|
||||
block_weight_pre_dispatch: Weight::from_parts(1000, 1000),
|
||||
mock_ext_refund: Weight::from_parts(20, 20),
|
||||
assert_post_info_weight: Some(Weight::from_parts(80, 300)),
|
||||
assert_block_weight_post_dispatch: base_extrinsic +
|
||||
Weight::from_parts(1080, 1300 + LEN as u64),
|
||||
assert_block_weight_post_dispatch: base_extrinsic
|
||||
+ Weight::from_parts(1080, 1300 + LEN as u64),
|
||||
},
|
||||
// post info doesn't double refund the call and is missing some.
|
||||
TestCfg {
|
||||
@@ -624,8 +624,8 @@ fn test_series() {
|
||||
mock_ext_refund: Weight::from_parts(20, 20),
|
||||
// 50 are missed in pov because 100 is unspent in post info but it should be only 50.
|
||||
assert_post_info_weight: Some(Weight::from_parts(40, 200)),
|
||||
assert_block_weight_post_dispatch: base_extrinsic +
|
||||
Weight::from_parts(1040, 1250 + LEN as u64),
|
||||
assert_block_weight_post_dispatch: base_extrinsic
|
||||
+ Weight::from_parts(1040, 1250 + LEN as u64),
|
||||
},
|
||||
// post info doesn't double refund the call and is accurate.
|
||||
TestCfg {
|
||||
@@ -637,8 +637,8 @@ fn test_series() {
|
||||
block_weight_pre_dispatch: Weight::from_parts(1000, 1000),
|
||||
mock_ext_refund: Weight::from_parts(20, 20),
|
||||
assert_post_info_weight: Some(Weight::from_parts(40, 150)),
|
||||
assert_block_weight_post_dispatch: base_extrinsic +
|
||||
Weight::from_parts(1040, 1150 + LEN as u64),
|
||||
assert_block_weight_post_dispatch: base_extrinsic
|
||||
+ Weight::from_parts(1040, 1150 + LEN as u64),
|
||||
},
|
||||
// post info doesn't double refund the call and is accurate. Even if mock ext is refunding
|
||||
// too much.
|
||||
@@ -651,8 +651,8 @@ fn test_series() {
|
||||
block_weight_pre_dispatch: Weight::from_parts(1000, 1000),
|
||||
mock_ext_refund: Weight::from_parts(20, 300),
|
||||
assert_post_info_weight: Some(Weight::from_parts(40, 150)),
|
||||
assert_block_weight_post_dispatch: base_extrinsic +
|
||||
Weight::from_parts(1040, 1150 + LEN as u64),
|
||||
assert_block_weight_post_dispatch: base_extrinsic
|
||||
+ Weight::from_parts(1040, 1150 + LEN as u64),
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1034,11 +1034,11 @@ fn test_ref_time_weight_reclaim() {
|
||||
pezframe_system::BlockWeight::<Test>::get()
|
||||
.get(DispatchClass::Normal)
|
||||
.ref_time(),
|
||||
block_pre_dispatch +
|
||||
base_extrinsic.ref_time() +
|
||||
bench_post_dispatch_actual +
|
||||
bench_mock_ext_weight -
|
||||
bench_mock_ext_refund,
|
||||
block_pre_dispatch
|
||||
+ base_extrinsic.ref_time()
|
||||
+ bench_post_dispatch_actual
|
||||
+ bench_mock_ext_weight
|
||||
- bench_mock_ext_refund,
|
||||
);
|
||||
assert_eq!(
|
||||
pezframe_system::ExtrinsicWeightReclaimed::<Test>::get().ref_time(),
|
||||
|
||||
@@ -442,9 +442,9 @@ impl QueueConfigData {
|
||||
///
|
||||
/// Should be called prior to accepting this as new config.
|
||||
pub fn validate<T: crate::Config>(&self) -> pezsp_runtime::DispatchResult {
|
||||
if self.resume_threshold < self.suspend_threshold &&
|
||||
self.suspend_threshold <= self.drop_threshold &&
|
||||
self.resume_threshold > 0
|
||||
if self.resume_threshold < self.suspend_threshold
|
||||
&& self.suspend_threshold <= self.drop_threshold
|
||||
&& self.resume_threshold > 0
|
||||
{
|
||||
Ok(())
|
||||
} else {
|
||||
@@ -946,8 +946,8 @@ impl<T: Config> XcmpMessageHandler for Pezpallet<T> {
|
||||
}
|
||||
}
|
||||
},
|
||||
XcmpMessageFormat::ConcatenatedVersionedXcm |
|
||||
XcmpMessageFormat::ConcatenatedOpaqueVersionedXcm => {
|
||||
XcmpMessageFormat::ConcatenatedVersionedXcm
|
||||
| XcmpMessageFormat::ConcatenatedOpaqueVersionedXcm => {
|
||||
let encoding = match format {
|
||||
XcmpMessageFormat::ConcatenatedVersionedXcm => XcmEncoding::Simple,
|
||||
XcmpMessageFormat::ConcatenatedOpaqueVersionedXcm => XcmEncoding::Double,
|
||||
@@ -1223,10 +1223,12 @@ impl<T: Config> InspectMessageQueues for Pezpallet<T> {
|
||||
let mut decoded_messages = Vec::new();
|
||||
while !data.is_empty() {
|
||||
let message_bytes = match decoded_format {
|
||||
XcmpMessageFormat::ConcatenatedVersionedXcm =>
|
||||
Self::take_first_concatenated_xcm(data, &mut WeightMeter::new()),
|
||||
XcmpMessageFormat::ConcatenatedOpaqueVersionedXcm =>
|
||||
Self::take_first_concatenated_opaque_xcm(data),
|
||||
XcmpMessageFormat::ConcatenatedVersionedXcm => {
|
||||
Self::take_first_concatenated_xcm(data, &mut WeightMeter::new())
|
||||
},
|
||||
XcmpMessageFormat::ConcatenatedOpaqueVersionedXcm => {
|
||||
Self::take_first_concatenated_opaque_xcm(data)
|
||||
},
|
||||
unexpected_format => {
|
||||
panic!("Unexpected XCMP format: {unexpected_format:?}!")
|
||||
},
|
||||
|
||||
@@ -279,9 +279,9 @@ pub mod v4 {
|
||||
let pre_default = v2::QueueConfigData::default();
|
||||
// If the previous values are the default ones, let's replace them with the new
|
||||
// default.
|
||||
if pre.suspend_threshold == pre_default.suspend_threshold &&
|
||||
pre.drop_threshold == pre_default.drop_threshold &&
|
||||
pre.resume_threshold == pre_default.resume_threshold
|
||||
if pre.suspend_threshold == pre_default.suspend_threshold
|
||||
&& pre.drop_threshold == pre_default.drop_threshold
|
||||
&& pre.resume_threshold == pre_default.resume_threshold
|
||||
{
|
||||
return QueueConfigData::default();
|
||||
}
|
||||
|
||||
@@ -126,8 +126,8 @@ impl<RuntimeOrigin: OriginTrait> ConvertOrigin<RuntimeOrigin>
|
||||
kind: OriginKind,
|
||||
) -> Result<RuntimeOrigin, Location> {
|
||||
let origin = origin.into();
|
||||
if kind == OriginKind::Superuser &&
|
||||
matches!(
|
||||
if kind == OriginKind::Superuser
|
||||
&& matches!(
|
||||
origin.unpack(),
|
||||
(1, [Teyrchain(id)]) if ParaId::from(*id).is_system(),
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user