Skip to content

Commit

Permalink
Update Rust version (#473)
Browse files Browse the repository at this point in the history
Fixes #470

- Fixed formatting
- Doc comments were split making first doc comment not too long
- Fixed lists in doc comments
- Unreachable patterns silenced with `#[allow(unreachable_patterns)]`
(controversial)
- `time` updated to 0.3.36

<!-- Remember that you can run `/merge` to enable auto-merge in the PR
-->

<!-- Remember to modify the changelog. If you don't need to modify it,
you can check the following box.
Instead, if you have already modified it, simply delete the following
line. -->

- [x] Does not require a CHANGELOG entry

---------

Co-authored-by: Bastian Köcher <[email protected]>
Co-authored-by: fellowship-merge-bot[bot] <151052383+fellowship-merge-bot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 17, 2024
1 parent e8e59d6 commit 123f8f4
Show file tree
Hide file tree
Showing 30 changed files with 168 additions and 114 deletions.
6 changes: 3 additions & 3 deletions .github/env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
RUST_STABLE_VERSION=1.77.0
RUST_NIGHTLY_VERSION=2024-04-14
TAPLO_VERSION=0.8.1
RUST_STABLE_VERSION=1.81.0
RUST_NIGHTLY_VERSION=2024-09-11
TAPLO_VERSION=0.9.3
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,9 @@ fn limited_teleport_native_assets_from_system_para_to_relay_fails() {
let delivery_fees = AssetHubKusama::execute_with(|| {
xcm_helpers::teleport_assets_delivery_fees::<
<AssetHubKusamaXcmConfig as xcm_executor::Config>::XcmSender,
>(test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest)
>(
test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest
)
});

// Sender's balance is reduced
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,9 @@ fn limited_teleport_native_assets_from_system_para_to_relay_fails() {
let delivery_fees = AssetHubPolkadot::execute_with(|| {
xcm_helpers::teleport_assets_delivery_fees::<
<AssetHubPolkadotXcmConfig as xcm_executor::Config>::XcmSender,
>(test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest)
>(
test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest
)
});

// Sender's balance is reduced
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ fn limited_teleport_native_assets_from_system_para_to_relay_fails() {
let delivery_fees = PeopleKusama::execute_with(|| {
xcm_helpers::teleport_assets_delivery_fees::<
<PeopleKusamaXcmConfig as xcm_executor::Config>::XcmSender,
>(test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest)
>(
test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest
)
});

// Sender's balance is reduced
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ fn limited_teleport_native_assets_from_system_para_to_relay_fails() {
let delivery_fees = PeoplePolkadot::execute_with(|| {
xcm_helpers::teleport_assets_delivery_fees::<
<PeoplePolkadotXcmConfig as xcm_executor::Config>::XcmSender,
>(test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest)
>(
test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest
)
});

// Sender's balance is reduced
Expand Down
1 change: 1 addition & 0 deletions relay/kusama/src/governance/origins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
pub use pallet_custom_origins::*;

#[allow(unreachable_patterns)]
#[frame_support::pallet]
pub mod pallet_custom_origins {
use crate::{Balance, GRAND, QUID};
Expand Down
18 changes: 10 additions & 8 deletions relay/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,8 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
matches!(
c,
RuntimeCall::Staking(..) |
RuntimeCall::Session(..) | RuntimeCall::Utility(..) |
RuntimeCall::Session(..) |
RuntimeCall::Utility(..) |
RuntimeCall::FastUnstake(..) |
RuntimeCall::VoterList(..) |
RuntimeCall::NominationPools(..)
Expand Down Expand Up @@ -1617,8 +1618,10 @@ impl pallet_nomination_pools::Config for Runtime {
}

/// The [frame_support::traits::tokens::ConversionFromAssetBalance] implementation provided by the
/// `AssetRate` pallet instance, with additional decoration to identify different IDs/locations of
/// native asset and provide a one-to-one balance conversion for them.
/// `AssetRate` pallet instance.
///
/// With additional decoration to identify different IDs/locations of native asset and provide a
/// one-to-one balance conversion for them.
pub type AssetRateWithNative = UnityOrOuterConversion<
ContainsLocationParts<
FromContains<
Expand Down Expand Up @@ -1828,10 +1831,10 @@ pub mod migrations {
///
/// It consists of:
/// * Call into `pallet_staking::Pallet::<T>::restore_ledger` with:
/// * Root origin;
/// * Default `None` paramters.
/// * Root origin;
/// * Default `None` paramters.
/// * Forces unstake of recovered ledger if the final restored ledger has higher stake than the
/// stash's free balance.
/// stash's free balance.
///
/// The stashes associated with corrupted ledgers that will be "migrated" are set in
/// [`CorruptedStashes`].
Expand Down Expand Up @@ -1914,14 +1917,13 @@ pub(crate) mod restore_corrupted_ledgers {
stash_account.clone(),
slashing_spans,
)
.map_err(|err| {
.inspect_err(|err| {
log::error!(
target: LOG_TARGET,
"migrations::corrupted_ledgers: error force unstaking ledger, unexpected. {:?}",
err
);
err_migration += 1;
err
});

log::info!(
Expand Down
1 change: 1 addition & 0 deletions relay/polkadot/src/governance/origins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
pub use pallet_custom_origins::*;

#[allow(unreachable_patterns)]
#[frame_support::pallet]
pub mod pallet_custom_origins {
use crate::{Balance, DOLLARS, GRAND};
Expand Down
26 changes: 14 additions & 12 deletions relay/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,8 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
matches!(
c,
RuntimeCall::Staking(..) |
RuntimeCall::Session(..) | RuntimeCall::Utility(..) |
RuntimeCall::Session(..) |
RuntimeCall::Utility(..) |
RuntimeCall::FastUnstake(..) |
RuntimeCall::VoterList(..) |
RuntimeCall::NominationPools(..)
Expand Down Expand Up @@ -1573,8 +1574,10 @@ impl pallet_state_trie_migration::Config for Runtime {
}

/// The [frame_support::traits::tokens::ConversionFromAssetBalance] implementation provided by the
/// `AssetRate` pallet instance, with additional decoration to identify different IDs/locations of
/// native asset and provide a one-to-one balance conversion for them.
/// `AssetRate` pallet instance.
///
/// With additional decoration to identify different IDs/locations of native asset and provide a
/// one-to-one balance conversion for them.
pub type AssetRateWithNative = UnityOrOuterConversion<
ContainsLocationParts<
FromContains<
Expand Down Expand Up @@ -1997,10 +2000,10 @@ pub mod migrations {
///
/// Safety:
///
/// - After coretime is launched, there are no auctions anymore. So if this forgotten to
/// be removed after the runtime upgrade, running this again on the next one is harmless.
/// - I am assuming scheduler `TaskName`s are unique, so removal of the scheduled entry
/// multiple times should also be fine.
/// - After coretime is launched, there are no auctions anymore. So if this forgotten to be
/// removed after the runtime upgrade, running this again on the next one is harmless.
/// - I am assuming scheduler `TaskName`s are unique, so removal of the scheduled entry multiple
/// times should also be fine.
pub struct CancelAuctions;
impl OnRuntimeUpgrade for CancelAuctions {
fn on_runtime_upgrade() -> Weight {
Expand Down Expand Up @@ -2059,10 +2062,10 @@ pub mod migrations {
///
/// It consists of:
/// * Call into `pallet_staking::Pallet::<T>::restore_ledger` with:
/// * Root origin;
/// * Default `None` paramters.
/// * Root origin;
/// * Default `None` paramters.
/// * Forces unstake of recovered ledger if the final restored ledger has higher stake than the
/// stash's free balance.
/// stash's free balance.
///
/// The stashes associated with corrupted ledgers that will be "migrated" are set in
/// [`CorruptedStashes`].
Expand Down Expand Up @@ -2147,14 +2150,13 @@ pub(crate) mod restore_corrupted_ledgers {
stash_account.clone(),
slashing_spans,
)
.map_err(|err| {
.inspect_err(|err| {
log::error!(
target: LOG_TARGET,
"migrations::corrupted_ledgers: error force unstaking ledger, unexpected. {:?}",
err
);
err_migration += 1;
err
});

log::info!(
Expand Down
13 changes: 8 additions & 5 deletions system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,12 @@ parameter_types! {
pub const ForeignAssetsMetadataDepositPerByte: Balance = MetadataDepositPerByte::get();
}

/// Assets managed by some foreign location. Note: we do not declare a `ForeignAssetsCall` type, as
/// this type is used in proxy definitions. We assume that a foreign location would not want to set
/// an individual, local account as a proxy for the issuance of their assets. This issuance should
/// be managed by the foreign location's governance.
/// Assets managed by some foreign location.
///
/// Note: we do not declare a `ForeignAssetsCall` type, as this type is used in proxy definitions.
/// We assume that a foreign location would not want to set an individual, local account as a proxy
/// for the issuance of their assets. This issuance should be managed by the foreign location's
/// governance.
pub type ForeignAssetsInstance = pallet_assets::Instance2;
impl pallet_assets::Config<ForeignAssetsInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;
Expand Down Expand Up @@ -568,7 +570,8 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
RuntimeCall::Utility { .. } |
RuntimeCall::Multisig { .. } |
RuntimeCall::NftFractionalization { .. } |
RuntimeCall::Nfts { .. } | RuntimeCall::Uniques { .. }
RuntimeCall::Nfts { .. } |
RuntimeCall::Uniques { .. }
)
},
ProxyType::AssetOwner => matches!(
Expand Down
15 changes: 9 additions & 6 deletions system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@ parameter_types! {
.unwrap_or(TreasuryAccount::get());
}

/// Type for specifying how a `Location` can be converted into an `AccountId`. This is used
/// when determining ownership of accounts for asset transacting and when attempting to use XCM
/// `Transact` in order to determine the dispatch Origin.
/// Type for specifying how a `Location` can be converted into an `AccountId`.
///
/// This is used when determining ownership of accounts for asset transacting and when attempting to
/// use XCM `Transact` in order to determine the dispatch Origin.
pub type LocationToAccountId = (
// The parent (Relay-chain) origin converts to the parent `AccountId`.
ParentIsPreset<AccountId>,
Expand Down Expand Up @@ -199,8 +200,9 @@ pub type AssetTransactors =
(FungibleTransactor, FungiblesTransactor, ForeignFungiblesTransactor, PoolFungiblesTransactor);

/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,
/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can
/// biases the kind of local `Origin` it will become.
/// ready for dispatching a transaction with Xcm's `Transact`.
///
/// There is an `OriginKind` which can biases the kind of local `Origin` it will become.
pub type XcmOriginToTransactDispatchOrigin = (
// Sovereign account converter; this attempts to derive an `AccountId` from the origin location
// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for
Expand Down Expand Up @@ -603,7 +605,8 @@ pub mod bridging {
}
}
impl<AssetsAllowedNetworks: Contains<Location>, OriginLocation: Get<Location>>
ContainsPair<Asset, Location> for RemoteAssetFromLocation<AssetsAllowedNetworks, OriginLocation>
ContainsPair<Asset, Location>
for RemoteAssetFromLocation<AssetsAllowedNetworks, OriginLocation>
{
fn contains(asset: &Asset, origin: &Location) -> bool {
<Self as ContainsPair<Location, Location>>::contains(&asset.id.0, origin)
Expand Down
13 changes: 8 additions & 5 deletions system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,12 @@ parameter_types! {
pub const ForeignAssetsMetadataDepositPerByte: Balance = MetadataDepositPerByte::get();
}

/// Assets managed by some foreign location. Note: we do not declare a `ForeignAssetsCall` type, as
/// this type is used in proxy definitions. We assume that a foreign location would not want to set
/// an individual, local account as a proxy for the issuance of their assets. This issuance should
/// be managed by the foreign location's governance.
/// Assets managed by some foreign location.
///
/// Note: we do not declare a `ForeignAssetsCall` type, as this type is used in proxy definitions.
/// We assume that a foreign location would not want to set an individual, local account as a proxy
/// for the issuance of their assets. This issuance should be managed by the foreign location's
/// governance.
pub type ForeignAssetsInstance = pallet_assets::Instance2;
impl pallet_assets::Config<ForeignAssetsInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;
Expand Down Expand Up @@ -492,7 +494,8 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
RuntimeCall::Assets { .. } |
RuntimeCall::Utility { .. } |
RuntimeCall::Multisig { .. } |
RuntimeCall::Nfts { .. } | RuntimeCall::Uniques { .. }
RuntimeCall::Nfts { .. } |
RuntimeCall::Uniques { .. }
)
},
ProxyType::AssetOwner => matches!(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@ parameter_types! {
.unwrap_or(TreasuryAccount::get());
}

/// Type for specifying how a `Location` can be converted into an `AccountId`. This is used
/// when determining ownership of accounts for asset transacting and when attempting to use XCM
/// `Transact` in order to determine the dispatch Origin.
/// Type for specifying how a `Location` can be converted into an `AccountId`.
///
/// This is used when determining ownership of accounts for asset transacting and when attempting to
/// use XCM `Transact` in order to determine the dispatch Origin.
pub type LocationToAccountId = (
// The parent (Relay-chain) origin converts to the parent `AccountId`.
ParentIsPreset<AccountId>,
Expand Down Expand Up @@ -199,8 +200,9 @@ pub type AssetTransactors =
(FungibleTransactor, FungiblesTransactor, ForeignFungiblesTransactor, PoolFungiblesTransactor);

/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,
/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can
/// biases the kind of local `Origin` it will become.
/// ready for dispatching a transaction with Xcm's `Transact`.
///
/// There is an `OriginKind` which can biases the kind of local `Origin` it will become.
pub type XcmOriginToTransactDispatchOrigin = (
// Sovereign account converter; this attempts to derive an `AccountId` from the origin location
// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for
Expand Down Expand Up @@ -671,7 +673,8 @@ pub mod bridging {
}
}
impl<AssetsAllowedNetworks: Contains<Location>, OriginLocation: Get<Location>>
ContainsPair<Asset, Location> for RemoteAssetFromLocation<AssetsAllowedNetworks, OriginLocation>
ContainsPair<Asset, Location>
for RemoteAssetFromLocation<AssetsAllowedNetworks, OriginLocation>
{
fn contains(asset: &Asset, origin: &Location) -> bool {
<Self as ContainsPair<Location, Location>>::contains(&asset.id.0, origin)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ parameter_types! {
pub StakingPot: AccountId = CollatorSelection::account_id();
}

/// Type for specifying how a `Location` can be converted into an `AccountId`. This is used
/// when determining ownership of accounts for asset transacting and when attempting to use XCM
/// `Transact` in order to determine the dispatch Origin.
/// Type for specifying how a `Location` can be converted into an `AccountId`.
///
/// This is used when determining ownership of accounts for asset transacting and when attempting to
/// use XCM `Transact` in order to determine the dispatch Origin.
pub type LocationToAccountId = (
// The parent (Relay-chain) origin converts to the parent `AccountId`.
ParentIsPreset<AccountId>,
Expand All @@ -95,8 +96,9 @@ pub type FungibleTransactor = FungibleAdapter<
>;

/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,
/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can
/// biases the kind of local `Origin` it will become.
/// ready for dispatching a transaction with Xcm's `Transact`.
///
/// There is an `OriginKind` which can biases the kind of local `Origin` it will become.
pub type XcmOriginToTransactDispatchOrigin = (
// Sovereign account converter; this attempts to derive an `AccountId` from the origin location
// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ parameter_types! {
pub StakingPot: AccountId = CollatorSelection::account_id();
}

/// Type for specifying how a `Location` can be converted into an `AccountId`. This is used
/// when determining ownership of accounts for asset transacting and when attempting to use XCM
/// `Transact` in order to determine the dispatch Origin.
/// Type for specifying how a `Location` can be converted into an `AccountId`.
///
/// This is used when determining ownership of accounts for asset transacting and when attempting to
/// use XCM `Transact` in order to determine the dispatch Origin.
pub type LocationToAccountId = (
// The parent (Relay-chain) origin converts to the parent `AccountId`.
ParentIsPreset<AccountId>,
Expand All @@ -102,8 +103,9 @@ pub type FungibleTransactor = FungibleAdapter<
>;

/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,
/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can
/// biases the kind of local `Origin` it will become.
/// ready for dispatching a transaction with Xcm's `Transact`.
///
/// There is an `OriginKind` which can biases the kind of local `Origin` it will become.
pub type XcmOriginToTransactDispatchOrigin = (
// Sovereign account converter; this attempts to derive an `AccountId` from the origin location
// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for
Expand Down Expand Up @@ -301,6 +303,7 @@ impl cumulus_pallet_xcm::Config for Runtime {
}

/// A `FeeManager` implementation that forces fees for any message delivered to Ethereum.
///
/// Otherwise, it permits the specified `WaivedLocations` to not pay for fees and uses the provided
/// `HandleFee` implementation.
pub struct XcmFeeManagerFromComponentsBridgeHub<WaivedLocations, HandleFee>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
//!
//! The module defines the following on-chain functionality of the Ambassador Program:
//!
//! - Managed set of program members, where every member has a [rank](ranks)
//! (via [AmbassadorCollective](pallet_ranked_collective)).
//! - Referendum functionality for the program members to propose, vote on, and execute
//! proposals on behalf of the members of a certain [rank](Origin)
//! (via [AmbassadorReferenda](pallet_referenda)).
//! - Promotion and demotion periods, register of members' activity, and rank based salaries
//! (via [AmbassadorCore](pallet_core_fellowship)).
//! - Members' salaries (via [AmbassadorSalary](pallet_salary), requiring a member to be
//! imported or inducted into [AmbassadorCore](pallet_core_fellowship)).
//! - Managed set of program members, where every member has a [rank](ranks) (via
//! [AmbassadorCollective](pallet_ranked_collective)).
//! - Referendum functionality for the program members to propose, vote on, and execute proposals on
//! behalf of the members of a certain [rank](Origin) (via
//! [AmbassadorReferenda](pallet_referenda)).
//! - Promotion and demotion periods, register of members' activity, and rank based salaries (via
//! [AmbassadorCore](pallet_core_fellowship)).
//! - Members' salaries (via [AmbassadorSalary](pallet_salary), requiring a member to be imported or
//! inducted into [AmbassadorCore](pallet_core_fellowship)).
//! - Ambassador Program Sub-Treasury (via [AmbassadorTreasury](pallet_treasury)).
pub mod migrations;
Expand Down
Loading

0 comments on commit 123f8f4

Please sign in to comment.