Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade substrate to v0.9.37 #2072

Merged
merged 22 commits into from
Feb 13, 2023
Merged
Prev Previous commit
Next Next commit
remove dev_mode, add call_index
  • Loading branch information
nbaztec committed Feb 10, 2023
commit e7fe53edfcd2a2e7a4318ebfa08b25f4b5d70cc3
10 changes: 9 additions & 1 deletion pallets/asset-manager/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub mod mock;
pub mod tests;
pub mod weights;

#[pallet(dev_mode)]
#[pallet]
pub mod pallet {

use crate::weights::WeightInfo;
Expand Down Expand Up @@ -316,6 +316,7 @@ pub mod pallet {
#[pallet::call]
impl<T: Config> Pallet<T> {
/// Register new asset with the asset manager
#[pallet::call_index(0)]
#[pallet::weight(T::WeightInfo::register_foreign_asset())]
pub fn register_foreign_asset(
origin: OriginFor<T>,
Expand Down Expand Up @@ -356,6 +357,7 @@ pub mod pallet {

/// Change the amount of units we are charging per execution second
/// for a given ForeignAssetType
#[pallet::call_index(1)]
#[pallet::weight(T::WeightInfo::set_asset_units_per_second(*num_assets_weight_hint))]
pub fn set_asset_units_per_second(
origin: OriginFor<T>,
Expand Down Expand Up @@ -397,6 +399,7 @@ pub mod pallet {
/// Change the xcm type mapping for a given assetId
/// We also change this if the previous units per second where pointing at the old
/// assetType
#[pallet::call_index(2)]
#[pallet::weight(T::WeightInfo::change_existing_asset_type(*num_assets_weight_hint))]
pub fn change_existing_asset_type(
origin: OriginFor<T>,
Expand Down Expand Up @@ -451,6 +454,7 @@ pub mod pallet {
Ok(())
}

#[pallet::call_index(3)]
#[pallet::weight(T::WeightInfo::remove_supported_asset(*num_assets_weight_hint))]
pub fn remove_supported_asset(
origin: OriginFor<T>,
Expand Down Expand Up @@ -483,6 +487,7 @@ pub mod pallet {
}

/// Remove a given assetId -> assetType association
#[pallet::call_index(4)]
#[pallet::weight(T::WeightInfo::remove_existing_asset_type(*num_assets_weight_hint))]
pub fn remove_existing_asset_type(
origin: OriginFor<T>,
Expand Down Expand Up @@ -528,6 +533,7 @@ pub mod pallet {
/// The reason is that we dont need to hold a mapping between the multilocation
/// and the local asset, as this conversion is deterministic
/// Further, we dont allow xcm fee payment in local assets
#[pallet::call_index(5)]
#[pallet::weight(T::WeightInfo::register_local_asset())]
pub fn register_local_asset(
origin: OriginFor<T>,
Expand Down Expand Up @@ -595,6 +601,7 @@ pub mod pallet {
/// The weight in this case is the one returned by the trait
/// plus the db writes and reads from removing all the associated
/// data
#[pallet::call_index(6)]
#[pallet::weight({
let dispatch_info_weight = T::AssetRegistrar::destroy_asset_dispatch_info_weight(
*asset_id
Expand Down Expand Up @@ -648,6 +655,7 @@ pub mod pallet {
/// We do not store anything related to local assets in this pallet other than the counter
/// and the counter is not used for destroying the asset, so no additional db reads/writes
/// to be counter here
#[pallet::call_index(7)]
#[pallet::weight({
T::AssetRegistrar::destroy_asset_dispatch_info_weight(
*asset_id
Expand Down
7 changes: 6 additions & 1 deletion pallets/author-mapping/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ mod tests;

pub mod migrations;

#[pallet(dev_mode)]
#[pallet]
pub mod pallet {
use crate::WeightInfo;
use frame_support::pallet_prelude::*;
Expand Down Expand Up @@ -143,6 +143,7 @@ pub mod pallet {
///
/// Users who have been (or will soon be) elected active collators in staking,
/// should submit this extrinsic to have their blocks accepted and earn rewards.
#[pallet::call_index(0)]
#[pallet::weight(<T as Config>::WeightInfo::add_association())]
pub fn add_association(origin: OriginFor<T>, nimbus_id: NimbusId) -> DispatchResult {
let account_id = ensure_signed(origin)?;
Expand All @@ -155,6 +156,7 @@ pub mod pallet {
/// This is useful for normal key rotation or for when switching from one physical collator
/// machine to another. No new security deposit is required.
/// This sets keys to new_nimbus_id.into() by default.
#[pallet::call_index(1)]
#[pallet::weight(<T as Config>::WeightInfo::update_association())]
pub fn update_association(
origin: OriginFor<T>,
Expand All @@ -175,6 +177,7 @@ pub mod pallet {
///
/// This is useful when you are no longer an author and would like to re-claim your security
/// deposit.
#[pallet::call_index(2)]
#[pallet::weight(<T as Config>::WeightInfo::clear_association())]
pub fn clear_association(origin: OriginFor<T>, nimbus_id: NimbusId) -> DispatchResult {
let account_id = ensure_signed(origin)?;
Expand All @@ -186,6 +189,7 @@ pub mod pallet {
///
/// This is useful when you are no longer an author and would like to re-claim your security
/// deposit.
#[pallet::call_index(3)]
#[pallet::weight(<T as Config>::WeightInfo::remove_keys())]
pub fn remove_keys(origin: OriginFor<T>) -> DispatchResult {
let account_id = ensure_signed(origin)?;
Expand All @@ -200,6 +204,7 @@ pub mod pallet {
/// This is useful for key rotation to update Nimbus and VRF keys in one call.
/// No new security deposit is required. Will replace `update_association` which is kept
/// now for backwards compatibility reasons.
#[pallet::call_index(4)]
#[pallet::weight(<T as Config>::WeightInfo::set_keys())]
pub fn set_keys(origin: OriginFor<T>, keys: Vec<u8>) -> DispatchResult {
let account_id = ensure_signed(origin)?;
Expand Down
4 changes: 3 additions & 1 deletion pallets/maintenance-mode/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ use frame_support::pallet;

pub use pallet::*;

#[pallet(dev_mode)]
#[pallet]
pub mod pallet {
#[cfg(feature = "xcm-support")]
use cumulus_primitives_core::{
Expand Down Expand Up @@ -153,6 +153,7 @@ pub mod pallet {
/// Weight cost is:
/// * One DB read to ensure we're not already in maintenance mode
/// * Three DB writes - 1 for the mode, 1 for suspending xcm execution, 1 for the event
#[pallet::call_index(0)]
#[pallet::weight(T::DbWeight::get().read + 3 * T::DbWeight::get().write)]
pub fn enter_maintenance_mode(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
// Ensure Origin
Expand Down Expand Up @@ -184,6 +185,7 @@ pub mod pallet {
/// Weight cost is:
/// * One DB read to ensure we're in maintenance mode
/// * Three DB writes - 1 for the mode, 1 for resuming xcm execution, 1 for the event
#[pallet::call_index(1)]
#[pallet::weight(T::DbWeight::get().read + 3 * T::DbWeight::get().write)]
pub fn resume_normal_operation(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
// Ensure Origin
Expand Down
3 changes: 2 additions & 1 deletion pallets/migrations/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl GetMigrations for Tuple {
}
}

#[pallet(dev_mode)]
#[pallet]
pub mod pallet {
use super::*;
use crate::weights::WeightInfo;
Expand Down Expand Up @@ -306,6 +306,7 @@ pub mod pallet {

#[pallet::call]
impl<T: Config> Pallet<T> {
#[pallet::call_index(0)]
#[pallet::weight(
<T as Config>::WeightInfo::migrate_democracy_preimage(*proposal_len_upper_bound)
)]
Expand Down
9 changes: 8 additions & 1 deletion pallets/moonbeam-orbiters/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub use weights::WeightInfo;
use frame_support::pallet;
use nimbus_primitives::{AccountLookup, NimbusId};

#[pallet(dev_mode)]
#[pallet]
pub mod pallet {
use super::*;
use frame_support::pallet_prelude::*;
Expand Down Expand Up @@ -263,6 +263,7 @@ pub mod pallet {
#[pallet::call]
impl<T: Config> Pallet<T> {
/// Add an orbiter in a collator pool
#[pallet::call_index(0)]
#[pallet::weight(T::WeightInfo::collator_add_orbiter())]
pub fn collator_add_orbiter(
origin: OriginFor<T>,
Expand Down Expand Up @@ -302,6 +303,7 @@ pub mod pallet {
}

/// Remove an orbiter from the caller collator pool
#[pallet::call_index(1)]
#[pallet::weight(T::WeightInfo::collator_remove_orbiter())]
pub fn collator_remove_orbiter(
origin: OriginFor<T>,
Expand All @@ -314,6 +316,7 @@ pub mod pallet {
}

/// Remove the caller from the specified collator pool
#[pallet::call_index(2)]
#[pallet::weight(T::WeightInfo::orbiter_leave_collator_pool())]
pub fn orbiter_leave_collator_pool(
origin: OriginFor<T>,
Expand All @@ -326,6 +329,7 @@ pub mod pallet {
}

/// Registering as an orbiter
#[pallet::call_index(3)]
#[pallet::weight(T::WeightInfo::orbiter_register())]
pub fn orbiter_register(origin: OriginFor<T>) -> DispatchResult {
let orbiter = ensure_signed(origin)?;
Expand All @@ -350,6 +354,7 @@ pub mod pallet {
}

/// Deregistering from orbiters
#[pallet::call_index(4)]
#[pallet::weight(T::WeightInfo::orbiter_unregister(*collators_pool_count))]
pub fn orbiter_unregister(
origin: OriginFor<T>,
Expand Down Expand Up @@ -379,6 +384,7 @@ pub mod pallet {
}

/// Add a collator to orbiters program.
#[pallet::call_index(5)]
#[pallet::weight(T::WeightInfo::add_collator())]
pub fn add_collator(
origin: OriginFor<T>,
Expand All @@ -398,6 +404,7 @@ pub mod pallet {
}

/// Remove a collator from orbiters program.
#[pallet::call_index(6)]
#[pallet::weight(T::WeightInfo::remove_collator())]
pub fn remove_collator(
origin: OriginFor<T>,
Expand Down
Loading