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 65b7f5e640
commit 4c8f281051
898 changed files with 8671 additions and 6432 deletions
@@ -82,8 +82,9 @@ where
};
match input {
IXcmCalls::send(_) | IXcmCalls::execute(_) if env.is_read_only() =>
Err(Error::Error(pezpallet_revive::Error::<Self::T>::StateChangeDenied.into())),
IXcmCalls::send(_) | IXcmCalls::execute(_) if env.is_read_only() => {
Err(Error::Error(pezpallet_revive::Error::<Self::T>::StateChangeDenied.into()))
},
IXcmCalls::send(IXcm::sendCall { destination, message }) => {
let _ = env.charge(<Runtime as Config>::WeightInfo::send())?;
@@ -671,8 +671,9 @@ mod benchmarks {
// remove `network` from inner `AccountId32` for easier matching of automatic AccountId ->
// Location conversions.
let origin_location: VersionedLocation = match origin_location.unpack() {
(0, [AccountId32 { network: _, id }]) =>
Location::new(0, [AccountId32 { network: None, id: *id }]).into(),
(0, [AccountId32 { network: _, id }]) => {
Location::new(0, [AccountId32 { network: None, id: *id }]).into()
},
_ => {
tracing::error!(
target: "xcm::benchmarking::pezpallet_xcm::remove_authorized_alias",
+37 -28
View File
@@ -1075,8 +1075,9 @@ pub mod pezpallet {
timeout,
maybe_match_querier: Some(Location::here().into()),
},
VersionNotifier { origin, is_active } =>
QueryStatus::VersionNotifier { origin, is_active },
VersionNotifier { origin, is_active } => {
QueryStatus::VersionNotifier { origin, is_active }
},
Ready { response, at } => QueryStatus::Ready { response, at },
}
}
@@ -1714,16 +1715,17 @@ pub mod pezpallet {
ensure!(origin_location != new_aliaser, Error::<T>::BadLocation);
// remove `network` from inner `AccountId32` for easier matching
let origin_location = match origin_location.unpack() {
(0, [AccountId32 { network: _, id }]) =>
Location::new(0, [AccountId32 { network: None, id: *id }]),
(0, [AccountId32 { network: _, id }]) => {
Location::new(0, [AccountId32 { network: None, id: *id }])
},
_ => return Err(Error::<T>::InvalidOrigin.into()),
};
tracing::debug!(target: "xcm::pezpallet_xcm::add_authorized_alias", ?origin_location, ?new_aliaser, ?expires);
ensure!(origin_location != new_aliaser, Error::<T>::BadLocation);
if let Some(expiry) = expires {
ensure!(
expiry >
pezframe_system::Pezpallet::<T>::current_block_number()
expiry
> pezframe_system::Pezpallet::<T>::current_block_number()
.saturated_into::<u64>(),
Error::<T>::ExpiresInPast
);
@@ -1797,8 +1799,9 @@ pub mod pezpallet {
ensure!(origin_location != to_remove, Error::<T>::BadLocation);
// remove `network` from inner `AccountId32` for easier matching
let origin_location = match origin_location.unpack() {
(0, [AccountId32 { network: _, id }]) =>
Location::new(0, [AccountId32 { network: None, id: *id }]),
(0, [AccountId32 { network: _, id }]) => {
Location::new(0, [AccountId32 { network: None, id: *id }])
},
_ => return Err(Error::<T>::InvalidOrigin.into()),
};
tracing::debug!(target: "xcm::pezpallet_xcm::remove_authorized_alias", ?origin_location, ?to_remove);
@@ -1847,8 +1850,9 @@ pub mod pezpallet {
let origin_location: Location = T::ExecuteXcmOrigin::ensure_origin(origin)?;
// remove `network` from inner `AccountId32` for easier matching
let origin_location = match origin_location.unpack() {
(0, [AccountId32 { network: _, id }]) =>
Location::new(0, [AccountId32 { network: None, id: *id }]),
(0, [AccountId32 { network: _, id }]) => {
Location::new(0, [AccountId32 { network: None, id: *id }])
},
_ => return Err(Error::<T>::InvalidOrigin.into()),
};
tracing::debug!(target: "xcm::pezpallet_xcm::remove_all_authorized_aliases", ?origin_location);
@@ -2236,8 +2240,9 @@ impl<T: Config> Pezpallet<T> {
fees,
weight_limit,
)?,
TransferType::RemoteReserve(_) =>
return Err(Error::<T>::InvalidAssetUnsupportedReserve.into()),
TransferType::RemoteReserve(_) => {
return Err(Error::<T>::InvalidAssetUnsupportedReserve.into())
},
};
FeesHandling::Separate { local_xcm, remote_xcm }
};
@@ -3460,13 +3465,13 @@ impl<T: Config> Pezpallet<T> {
Ok(Self::authorized_aliasers(target)?.into_iter().any(|aliaser| {
// `aliasers` and `origin` have already been transformed to `desired_version`, we
// can just directly compare them.
aliaser.location == origin &&
aliaser
aliaser.location == origin
&& aliaser
.expiry
.map(|expiry| {
pezframe_system::Pezpallet::<T>::current_block_number()
.saturated_into::<u64>() <
expiry
.saturated_into::<u64>()
< expiry
})
.unwrap_or(true)
}))
@@ -3631,8 +3636,8 @@ impl<T: Config> Pezpallet<T> {
// check `RemoteLockedFungibles`
ensure!(
!RemoteLockedFungibles::<T>::iter()
.any(|(key, data)| key.needs_migration(minimal_allowed_xcm_version) ||
data.needs_migration(minimal_allowed_xcm_version)),
.any(|(key, data)| key.needs_migration(minimal_allowed_xcm_version)
|| data.needs_migration(minimal_allowed_xcm_version)),
TryRuntimeError::Other(
"`RemoteLockedFungibles` data should be migrated to the higher xcm version!"
)
@@ -3966,11 +3971,12 @@ impl<T: Config> ClaimAssets for Pezpallet<T> {
) -> bool {
let mut versioned = VersionedAssets::from(assets.clone());
match ticket.unpack() {
(0, [GeneralIndex(i)]) =>
(0, [GeneralIndex(i)]) => {
versioned = match versioned.into_version(*i as u32) {
Ok(v) => v,
Err(()) => return false,
},
}
},
(0, []) => (),
_ => return false,
};
@@ -3996,15 +4002,17 @@ impl<T: Config> OnResponse for Pezpallet<T> {
querier: Option<&Location>,
) -> bool {
match Queries::<T>::get(query_id) {
Some(QueryStatus::Pending { responder, maybe_match_querier, .. }) =>
Location::try_from(responder).map_or(false, |r| origin == &r) &&
maybe_match_querier.map_or(true, |match_querier| {
Some(QueryStatus::Pending { responder, maybe_match_querier, .. }) => {
Location::try_from(responder).map_or(false, |r| origin == &r)
&& maybe_match_querier.map_or(true, |match_querier| {
Location::try_from(match_querier).map_or(false, |match_querier| {
querier.map_or(false, |q| q == &match_querier)
})
}),
Some(QueryStatus::VersionNotifier { origin: r, .. }) =>
Location::try_from(r).map_or(false, |r| origin == &r),
})
},
Some(QueryStatus::VersionNotifier { origin: r, .. }) => {
Location::try_from(r).map_or(false, |r| origin == &r)
},
_ => false,
}
}
@@ -4285,12 +4293,13 @@ where
fn try_origin(outer: O) -> Result<Self::Success, O> {
match outer.caller().try_into() {
Ok(Origin::Xcm(ref location)) =>
Ok(Origin::Xcm(ref location)) => {
if let Ok(location) = location.clone().try_into() {
if F::contains(&location) {
return Ok(location);
}
},
}
},
_ => (),
}
+18 -14
View File
@@ -80,16 +80,19 @@ pub mod data {
fn needs_migration(&self, minimal_allowed_xcm_version: XcmVersion) -> bool {
match &self {
QueryStatus::Pending { responder, maybe_match_querier, .. } =>
responder.identify_version() < minimal_allowed_xcm_version ||
maybe_match_querier
QueryStatus::Pending { responder, maybe_match_querier, .. } => {
responder.identify_version() < minimal_allowed_xcm_version
|| maybe_match_querier
.as_ref()
.map(|v| v.identify_version() < minimal_allowed_xcm_version)
.unwrap_or(false),
QueryStatus::VersionNotifier { origin, .. } =>
origin.identify_version() < minimal_allowed_xcm_version,
QueryStatus::Ready { response, .. } =>
response.identify_version() < minimal_allowed_xcm_version,
.unwrap_or(false)
},
QueryStatus::VersionNotifier { origin, .. } => {
origin.identify_version() < minimal_allowed_xcm_version
},
QueryStatus::Ready { response, .. } => {
response.identify_version() < minimal_allowed_xcm_version
},
}
}
@@ -131,8 +134,8 @@ pub mod data {
type MigratedData = Self;
fn needs_migration(&self, minimal_allowed_xcm_version: XcmVersion) -> bool {
self.0 < minimal_allowed_xcm_version ||
self.2.identify_version() < minimal_allowed_xcm_version
self.0 < minimal_allowed_xcm_version
|| self.2.identify_version() < minimal_allowed_xcm_version
}
fn try_migrate(self, to_xcm_version: XcmVersion) -> Result<Option<Self::MigratedData>, ()> {
@@ -152,8 +155,8 @@ pub mod data {
type MigratedData = Self;
fn needs_migration(&self, minimal_allowed_xcm_version: XcmVersion) -> bool {
self.owner.identify_version() < minimal_allowed_xcm_version ||
self.locker.identify_version() < minimal_allowed_xcm_version
self.owner.identify_version() < minimal_allowed_xcm_version
|| self.locker.identify_version() < minimal_allowed_xcm_version
}
fn try_migrate(self, to_xcm_version: XcmVersion) -> Result<Option<Self::MigratedData>, ()> {
@@ -177,8 +180,9 @@ pub mod data {
type MigratedData = (VersionedLocation, AuthorizedAliasesEntry<TicketOf<T>, M>);
fn needs_migration(&self, required_version: XcmVersion) -> bool {
self.0.identify_version() != required_version ||
self.1
self.0.identify_version() != required_version
|| self
.1
.aliasers
.iter()
.any(|alias| alias.location.identify_version() != required_version)
@@ -77,9 +77,9 @@ impl<T: Config> Pezpallet<T> {
// is being attempted.
let is_reserve_transfer = matches!(
transfer_type,
TransferType::LocalReserve |
TransferType::DestinationReserve |
TransferType::RemoteReserve(_)
TransferType::LocalReserve
| TransferType::DestinationReserve
| TransferType::RemoteReserve(_)
);
if !is_reserve_transfer {
@@ -122,9 +122,9 @@ impl<T: Config> Pezpallet<T> {
NetworkId::Pezkuwi | NetworkId::Kusama => true,
NetworkId::ByGenesis(genesis_hash) => {
// Check if this is Zagros by genesis hash
*genesis_hash == xcm::v5::ZAGROS_GENESIS_HASH ||
*genesis_hash == PASEO_GENESIS_HASH ||
*genesis_hash == xcm::v5::PEZKUWICHAIN_GENESIS_HASH // Used in tests.
*genesis_hash == xcm::v5::ZAGROS_GENESIS_HASH
|| *genesis_hash == PASEO_GENESIS_HASH
|| *genesis_hash == xcm::v5::PEZKUWICHAIN_GENESIS_HASH // Used in tests.
},
_ => false,
};
@@ -144,9 +144,9 @@ impl<T: Config> Pezpallet<T> {
NetworkId::Pezkuwi | NetworkId::Kusama => true,
NetworkId::ByGenesis(genesis_hash) => {
// Check if this is Zagros by genesis hash
*genesis_hash == xcm::v5::ZAGROS_GENESIS_HASH ||
*genesis_hash == PASEO_GENESIS_HASH ||
*genesis_hash == xcm::v5::PEZKUWICHAIN_GENESIS_HASH // Used in tests.
*genesis_hash == xcm::v5::ZAGROS_GENESIS_HASH
|| *genesis_hash == PASEO_GENESIS_HASH
|| *genesis_hash == xcm::v5::PEZKUWICHAIN_GENESIS_HASH // Used in tests.
},
_ => false,
};