Use explicit call indices (#6449)

* cargo update -p sp-io

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Use explicit call indices

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Oliver Tale-Yazdi
2022-12-19 23:13:34 +01:00
committed by GitHub
parent b9a55985bd
commit d387338fb0
21 changed files with 309 additions and 180 deletions
+180 -180
View File
File diff suppressed because it is too large Load Diff
@@ -200,6 +200,7 @@ pub mod pallet {
impl<T: Config> Pallet<T> { impl<T: Config> Pallet<T> {
// TODO: Benchmark this // TODO: Benchmark this
/// Assign a permanent parachain slot and immediately create a lease for it. /// Assign a permanent parachain slot and immediately create a lease for it.
#[pallet::call_index(0)]
#[pallet::weight(((MAXIMUM_BLOCK_WEIGHT / 10) as Weight, DispatchClass::Operational))] #[pallet::weight(((MAXIMUM_BLOCK_WEIGHT / 10) as Weight, DispatchClass::Operational))]
pub fn assign_perm_parachain_slot(origin: OriginFor<T>, id: ParaId) -> DispatchResult { pub fn assign_perm_parachain_slot(origin: OriginFor<T>, id: ParaId) -> DispatchResult {
T::AssignSlotOrigin::ensure_origin(origin)?; T::AssignSlotOrigin::ensure_origin(origin)?;
@@ -258,6 +259,7 @@ pub mod pallet {
/// Assign a temporary parachain slot. The function tries to create a lease for it /// Assign a temporary parachain slot. The function tries to create a lease for it
/// immediately if `SlotLeasePeriodStart::Current` is specified, and if the number /// immediately if `SlotLeasePeriodStart::Current` is specified, and if the number
/// of currently active temporary slots is below `MaxTemporarySlotPerLeasePeriod`. /// of currently active temporary slots is below `MaxTemporarySlotPerLeasePeriod`.
#[pallet::call_index(1)]
#[pallet::weight(((MAXIMUM_BLOCK_WEIGHT / 10) as Weight, DispatchClass::Operational))] #[pallet::weight(((MAXIMUM_BLOCK_WEIGHT / 10) as Weight, DispatchClass::Operational))]
pub fn assign_temp_parachain_slot( pub fn assign_temp_parachain_slot(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -341,6 +343,7 @@ pub mod pallet {
// TODO: Benchmark this // TODO: Benchmark this
/// Unassign a permanent or temporary parachain slot /// Unassign a permanent or temporary parachain slot
#[pallet::call_index(2)]
#[pallet::weight(((MAXIMUM_BLOCK_WEIGHT / 10) as Weight, DispatchClass::Operational))] #[pallet::weight(((MAXIMUM_BLOCK_WEIGHT / 10) as Weight, DispatchClass::Operational))]
pub fn unassign_parachain_slot(origin: OriginFor<T>, id: ParaId) -> DispatchResult { pub fn unassign_parachain_slot(origin: OriginFor<T>, id: ParaId) -> DispatchResult {
T::AssignSlotOrigin::ensure_origin(origin.clone())?; T::AssignSlotOrigin::ensure_origin(origin.clone())?;
+3
View File
@@ -253,6 +253,7 @@ pub mod pallet {
/// This can only happen when there isn't already an auction in progress and may only be /// This can only happen when there isn't already an auction in progress and may only be
/// called by the root origin. Accepts the `duration` of this auction and the /// called by the root origin. Accepts the `duration` of this auction and the
/// `lease_period_index` of the initial lease period of the four that are to be auctioned. /// `lease_period_index` of the initial lease period of the four that are to be auctioned.
#[pallet::call_index(0)]
#[pallet::weight((T::WeightInfo::new_auction(), DispatchClass::Operational))] #[pallet::weight((T::WeightInfo::new_auction(), DispatchClass::Operational))]
pub fn new_auction( pub fn new_auction(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -279,6 +280,7 @@ pub mod pallet {
/// absolute lease period index value, not an auction-specific offset. /// absolute lease period index value, not an auction-specific offset.
/// - `amount` is the amount to bid to be held as deposit for the parachain should the /// - `amount` is the amount to bid to be held as deposit for the parachain should the
/// bid win. This amount is held throughout the range. /// bid win. This amount is held throughout the range.
#[pallet::call_index(1)]
#[pallet::weight(T::WeightInfo::bid())] #[pallet::weight(T::WeightInfo::bid())]
pub fn bid( pub fn bid(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -296,6 +298,7 @@ pub mod pallet {
/// Cancel an in-progress auction. /// Cancel an in-progress auction.
/// ///
/// Can only be called by Root origin. /// Can only be called by Root origin.
#[pallet::call_index(2)]
#[pallet::weight(T::WeightInfo::cancel_auction())] #[pallet::weight(T::WeightInfo::cancel_auction())]
pub fn cancel_auction(origin: OriginFor<T>) -> DispatchResult { pub fn cancel_auction(origin: OriginFor<T>) -> DispatchResult {
ensure_root(origin)?; ensure_root(origin)?;
+5
View File
@@ -305,6 +305,7 @@ pub mod pallet {
/// ///
/// Total Complexity: O(1) /// Total Complexity: O(1)
/// </weight> /// </weight>
#[pallet::call_index(0)]
#[pallet::weight(T::WeightInfo::claim())] #[pallet::weight(T::WeightInfo::claim())]
pub fn claim( pub fn claim(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -337,6 +338,7 @@ pub mod pallet {
/// ///
/// Total Complexity: O(1) /// Total Complexity: O(1)
/// </weight> /// </weight>
#[pallet::call_index(1)]
#[pallet::weight(T::WeightInfo::mint_claim())] #[pallet::weight(T::WeightInfo::mint_claim())]
pub fn mint_claim( pub fn mint_claim(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -384,6 +386,7 @@ pub mod pallet {
/// ///
/// Total Complexity: O(1) /// Total Complexity: O(1)
/// </weight> /// </weight>
#[pallet::call_index(2)]
#[pallet::weight(T::WeightInfo::claim_attest())] #[pallet::weight(T::WeightInfo::claim_attest())]
pub fn claim_attest( pub fn claim_attest(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -420,6 +423,7 @@ pub mod pallet {
/// ///
/// Total Complexity: O(1) /// Total Complexity: O(1)
/// </weight> /// </weight>
#[pallet::call_index(3)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::attest(), T::WeightInfo::attest(),
DispatchClass::Normal, DispatchClass::Normal,
@@ -436,6 +440,7 @@ pub mod pallet {
Ok(()) Ok(())
} }
#[pallet::call_index(4)]
#[pallet::weight(T::WeightInfo::move_claim())] #[pallet::weight(T::WeightInfo::move_claim())]
pub fn move_claim( pub fn move_claim(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -372,6 +372,7 @@ pub mod pallet {
/// ///
/// This applies a lock to your parachain configuration, ensuring that it cannot be changed /// This applies a lock to your parachain configuration, ensuring that it cannot be changed
/// by the parachain manager. /// by the parachain manager.
#[pallet::call_index(0)]
#[pallet::weight(T::WeightInfo::create())] #[pallet::weight(T::WeightInfo::create())]
pub fn create( pub fn create(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -449,6 +450,7 @@ pub mod pallet {
/// Contribute to a crowd sale. This will transfer some balance over to fund a parachain /// Contribute to a crowd sale. This will transfer some balance over to fund a parachain
/// slot. It will be withdrawable when the crowdloan has ended and the funds are unused. /// slot. It will be withdrawable when the crowdloan has ended and the funds are unused.
#[pallet::call_index(1)]
#[pallet::weight(T::WeightInfo::contribute())] #[pallet::weight(T::WeightInfo::contribute())]
pub fn contribute( pub fn contribute(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -477,6 +479,7 @@ pub mod pallet {
/// ///
/// - `who`: The account whose contribution should be withdrawn. /// - `who`: The account whose contribution should be withdrawn.
/// - `index`: The parachain to whose crowdloan the contribution was made. /// - `index`: The parachain to whose crowdloan the contribution was made.
#[pallet::call_index(2)]
#[pallet::weight(T::WeightInfo::withdraw())] #[pallet::weight(T::WeightInfo::withdraw())]
pub fn withdraw( pub fn withdraw(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -510,6 +513,7 @@ pub mod pallet {
/// times to fully refund all users. We will refund `RemoveKeysLimit` users at a time. /// times to fully refund all users. We will refund `RemoveKeysLimit` users at a time.
/// ///
/// Origin must be signed, but can come from anyone. /// Origin must be signed, but can come from anyone.
#[pallet::call_index(3)]
#[pallet::weight(T::WeightInfo::refund(T::RemoveKeysLimit::get()))] #[pallet::weight(T::WeightInfo::refund(T::RemoveKeysLimit::get()))]
pub fn refund( pub fn refund(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -555,6 +559,7 @@ pub mod pallet {
} }
/// Remove a fund after the retirement period has ended and all funds have been returned. /// Remove a fund after the retirement period has ended and all funds have been returned.
#[pallet::call_index(4)]
#[pallet::weight(T::WeightInfo::dissolve())] #[pallet::weight(T::WeightInfo::dissolve())]
pub fn dissolve(origin: OriginFor<T>, #[pallet::compact] index: ParaId) -> DispatchResult { pub fn dissolve(origin: OriginFor<T>, #[pallet::compact] index: ParaId) -> DispatchResult {
let who = ensure_signed(origin)?; let who = ensure_signed(origin)?;
@@ -582,6 +587,7 @@ pub mod pallet {
/// Edit the configuration for an in-progress crowdloan. /// Edit the configuration for an in-progress crowdloan.
/// ///
/// Can only be called by Root origin. /// Can only be called by Root origin.
#[pallet::call_index(5)]
#[pallet::weight(T::WeightInfo::edit())] #[pallet::weight(T::WeightInfo::edit())]
pub fn edit( pub fn edit(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -619,6 +625,7 @@ pub mod pallet {
/// Add an optional memo to an existing crowdloan contribution. /// Add an optional memo to an existing crowdloan contribution.
/// ///
/// Origin must be Signed, and the user must have contributed to the crowdloan. /// Origin must be Signed, and the user must have contributed to the crowdloan.
#[pallet::call_index(6)]
#[pallet::weight(T::WeightInfo::add_memo())] #[pallet::weight(T::WeightInfo::add_memo())]
pub fn add_memo(origin: OriginFor<T>, index: ParaId, memo: Vec<u8>) -> DispatchResult { pub fn add_memo(origin: OriginFor<T>, index: ParaId, memo: Vec<u8>) -> DispatchResult {
let who = ensure_signed(origin)?; let who = ensure_signed(origin)?;
@@ -637,6 +644,7 @@ pub mod pallet {
/// Poke the fund into `NewRaise` /// Poke the fund into `NewRaise`
/// ///
/// Origin must be Signed, and the fund has non-zero raise. /// Origin must be Signed, and the fund has non-zero raise.
#[pallet::call_index(7)]
#[pallet::weight(T::WeightInfo::poke())] #[pallet::weight(T::WeightInfo::poke())]
pub fn poke(origin: OriginFor<T>, index: ParaId) -> DispatchResult { pub fn poke(origin: OriginFor<T>, index: ParaId) -> DispatchResult {
ensure_signed(origin)?; ensure_signed(origin)?;
@@ -650,6 +658,7 @@ pub mod pallet {
/// Contribute your entire balance to a crowd sale. This will transfer the entire balance of a user over to fund a parachain /// Contribute your entire balance to a crowd sale. This will transfer the entire balance of a user over to fund a parachain
/// slot. It will be withdrawable when the crowdloan has ended and the funds are unused. /// slot. It will be withdrawable when the crowdloan has ended and the funds are unused.
#[pallet::call_index(8)]
#[pallet::weight(T::WeightInfo::contribute())] #[pallet::weight(T::WeightInfo::contribute())]
pub fn contribute_all( pub fn contribute_all(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -228,6 +228,7 @@ pub mod pallet {
/// ///
/// ## Events /// ## Events
/// The `Registered` event is emitted in case of success. /// The `Registered` event is emitted in case of success.
#[pallet::call_index(0)]
#[pallet::weight(<T as Config>::WeightInfo::register())] #[pallet::weight(<T as Config>::WeightInfo::register())]
pub fn register( pub fn register(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -246,6 +247,7 @@ pub mod pallet {
/// ///
/// The deposit taken can be specified for this registration. Any `ParaId` /// The deposit taken can be specified for this registration. Any `ParaId`
/// can be registered, including sub-1000 IDs which are System Parachains. /// can be registered, including sub-1000 IDs which are System Parachains.
#[pallet::call_index(1)]
#[pallet::weight(<T as Config>::WeightInfo::force_register())] #[pallet::weight(<T as Config>::WeightInfo::force_register())]
pub fn force_register( pub fn force_register(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -262,6 +264,7 @@ pub mod pallet {
/// Deregister a Para Id, freeing all data and returning any deposit. /// Deregister a Para Id, freeing all data and returning any deposit.
/// ///
/// The caller must be Root, the `para` owner, or the `para` itself. The para must be a parathread. /// The caller must be Root, the `para` owner, or the `para` itself. The para must be a parathread.
#[pallet::call_index(2)]
#[pallet::weight(<T as Config>::WeightInfo::deregister())] #[pallet::weight(<T as Config>::WeightInfo::deregister())]
pub fn deregister(origin: OriginFor<T>, id: ParaId) -> DispatchResult { pub fn deregister(origin: OriginFor<T>, id: ParaId) -> DispatchResult {
Self::ensure_root_para_or_owner(origin, id)?; Self::ensure_root_para_or_owner(origin, id)?;
@@ -279,6 +282,7 @@ pub mod pallet {
/// `ParaId` to be a long-term identifier of a notional "parachain". However, their /// `ParaId` to be a long-term identifier of a notional "parachain". However, their
/// scheduling info (i.e. whether they're a parathread or parachain), auction information /// scheduling info (i.e. whether they're a parathread or parachain), auction information
/// and the auction deposit are switched. /// and the auction deposit are switched.
#[pallet::call_index(3)]
#[pallet::weight(<T as Config>::WeightInfo::swap())] #[pallet::weight(<T as Config>::WeightInfo::swap())]
pub fn swap(origin: OriginFor<T>, id: ParaId, other: ParaId) -> DispatchResult { pub fn swap(origin: OriginFor<T>, id: ParaId, other: ParaId) -> DispatchResult {
Self::ensure_root_para_or_owner(origin, id)?; Self::ensure_root_para_or_owner(origin, id)?;
@@ -328,6 +332,7 @@ pub mod pallet {
/// previously locked para to deregister or swap a para without using governance. /// previously locked para to deregister or swap a para without using governance.
/// ///
/// Can only be called by the Root origin or the parachain. /// Can only be called by the Root origin or the parachain.
#[pallet::call_index(4)]
#[pallet::weight(T::DbWeight::get().reads_writes(1, 1))] #[pallet::weight(T::DbWeight::get().reads_writes(1, 1))]
pub fn remove_lock(origin: OriginFor<T>, para: ParaId) -> DispatchResult { pub fn remove_lock(origin: OriginFor<T>, para: ParaId) -> DispatchResult {
Self::ensure_root_or_para(origin, para)?; Self::ensure_root_or_para(origin, para)?;
@@ -349,6 +354,7 @@ pub mod pallet {
/// ///
/// ## Events /// ## Events
/// The `Reserved` event is emitted in case of success, which provides the ID reserved for use. /// The `Reserved` event is emitted in case of success, which provides the ID reserved for use.
#[pallet::call_index(5)]
#[pallet::weight(<T as Config>::WeightInfo::reserve())] #[pallet::weight(<T as Config>::WeightInfo::reserve())]
pub fn reserve(origin: OriginFor<T>) -> DispatchResult { pub fn reserve(origin: OriginFor<T>) -> DispatchResult {
let who = ensure_signed(origin)?; let who = ensure_signed(origin)?;
@@ -362,6 +368,7 @@ pub mod pallet {
/// para to deregister or swap a para. /// para to deregister or swap a para.
/// ///
/// Can be called by Root, the parachain, or the parachain manager if the parachain is unlocked. /// Can be called by Root, the parachain, or the parachain manager if the parachain is unlocked.
#[pallet::call_index(6)]
#[pallet::weight(T::DbWeight::get().reads_writes(1, 1))] #[pallet::weight(T::DbWeight::get().reads_writes(1, 1))]
pub fn add_lock(origin: OriginFor<T>, para: ParaId) -> DispatchResult { pub fn add_lock(origin: OriginFor<T>, para: ParaId) -> DispatchResult {
Self::ensure_root_para_or_owner(origin, para)?; Self::ensure_root_para_or_owner(origin, para)?;
@@ -372,6 +379,7 @@ pub mod pallet {
/// Schedule a parachain upgrade. /// Schedule a parachain upgrade.
/// ///
/// Can be called by Root, the parachain, or the parachain manager if the parachain is unlocked. /// Can be called by Root, the parachain, or the parachain manager if the parachain is unlocked.
#[pallet::call_index(7)]
#[pallet::weight(<T as Config>::WeightInfo::schedule_code_upgrade(new_code.0.len() as u32))] #[pallet::weight(<T as Config>::WeightInfo::schedule_code_upgrade(new_code.0.len() as u32))]
pub fn schedule_code_upgrade( pub fn schedule_code_upgrade(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -386,6 +394,7 @@ pub mod pallet {
/// Set the parachain's current head. /// Set the parachain's current head.
/// ///
/// Can be called by Root, the parachain, or the parachain manager if the parachain is unlocked. /// Can be called by Root, the parachain, or the parachain manager if the parachain is unlocked.
#[pallet::call_index(8)]
#[pallet::weight(<T as Config>::WeightInfo::set_current_head(new_head.0.len() as u32))] #[pallet::weight(<T as Config>::WeightInfo::set_current_head(new_head.0.len() as u32))]
pub fn set_current_head( pub fn set_current_head(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -70,6 +70,7 @@ pub mod pallet {
#[pallet::call] #[pallet::call]
impl<T: Config> Pallet<T> { impl<T: Config> Pallet<T> {
/// Schedule a para to be initialized at the start of the next session. /// Schedule a para to be initialized at the start of the next session.
#[pallet::call_index(0)]
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight((1_000, DispatchClass::Operational))]
pub fn sudo_schedule_para_initialize( pub fn sudo_schedule_para_initialize(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -83,6 +84,7 @@ pub mod pallet {
} }
/// Schedule a para to be cleaned up at the start of the next session. /// Schedule a para to be cleaned up at the start of the next session.
#[pallet::call_index(1)]
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight((1_000, DispatchClass::Operational))]
pub fn sudo_schedule_para_cleanup(origin: OriginFor<T>, id: ParaId) -> DispatchResult { pub fn sudo_schedule_para_cleanup(origin: OriginFor<T>, id: ParaId) -> DispatchResult {
ensure_root(origin)?; ensure_root(origin)?;
@@ -92,6 +94,7 @@ pub mod pallet {
} }
/// Upgrade a parathread to a parachain /// Upgrade a parathread to a parachain
#[pallet::call_index(2)]
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight((1_000, DispatchClass::Operational))]
pub fn sudo_schedule_parathread_upgrade( pub fn sudo_schedule_parathread_upgrade(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -109,6 +112,7 @@ pub mod pallet {
} }
/// Downgrade a parachain to a parathread /// Downgrade a parachain to a parathread
#[pallet::call_index(3)]
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight((1_000, DispatchClass::Operational))]
pub fn sudo_schedule_parachain_downgrade( pub fn sudo_schedule_parachain_downgrade(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -129,6 +133,7 @@ pub mod pallet {
/// ///
/// The given parachain should exist and the payload should not exceed the preconfigured size /// The given parachain should exist and the payload should not exceed the preconfigured size
/// `config.max_downward_message_size`. /// `config.max_downward_message_size`.
#[pallet::call_index(4)]
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight((1_000, DispatchClass::Operational))]
pub fn sudo_queue_downward_xcm( pub fn sudo_queue_downward_xcm(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -149,6 +154,7 @@ pub mod pallet {
/// ///
/// This is equivalent to sending an `Hrmp::hrmp_init_open_channel` extrinsic followed by /// This is equivalent to sending an `Hrmp::hrmp_init_open_channel` extrinsic followed by
/// `Hrmp::hrmp_accept_open_channel`. /// `Hrmp::hrmp_accept_open_channel`.
#[pallet::call_index(5)]
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight((1_000, DispatchClass::Operational))]
pub fn sudo_establish_hrmp_channel( pub fn sudo_establish_hrmp_channel(
origin: OriginFor<T>, origin: OriginFor<T>,
+7
View File
@@ -195,6 +195,7 @@ pub mod pallet {
/// We check that the account does not exist at this stage. /// We check that the account does not exist at this stage.
/// ///
/// Origin must match the `ValidityOrigin`. /// Origin must match the `ValidityOrigin`.
#[pallet::call_index(0)]
#[pallet::weight(Weight::from_ref_time(200_000_000) + T::DbWeight::get().reads_writes(4, 1))] #[pallet::weight(Weight::from_ref_time(200_000_000) + T::DbWeight::get().reads_writes(4, 1))]
pub fn create_account( pub fn create_account(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -232,6 +233,7 @@ pub mod pallet {
/// We check that the account exists at this stage, but has not completed the process. /// We check that the account exists at this stage, but has not completed the process.
/// ///
/// Origin must match the `ValidityOrigin`. /// Origin must match the `ValidityOrigin`.
#[pallet::call_index(1)]
#[pallet::weight(T::DbWeight::get().reads_writes(1, 1))] #[pallet::weight(T::DbWeight::get().reads_writes(1, 1))]
pub fn update_validity_status( pub fn update_validity_status(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -260,6 +262,7 @@ pub mod pallet {
/// We check that the account is valid for a balance transfer at this point. /// We check that the account is valid for a balance transfer at this point.
/// ///
/// Origin must match the `ValidityOrigin`. /// Origin must match the `ValidityOrigin`.
#[pallet::call_index(2)]
#[pallet::weight(T::DbWeight::get().reads_writes(2, 1))] #[pallet::weight(T::DbWeight::get().reads_writes(2, 1))]
pub fn update_balance( pub fn update_balance(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -297,6 +300,7 @@ pub mod pallet {
/// ///
/// Origin must match the configured `PaymentAccount` (if it is not configured then this /// Origin must match the configured `PaymentAccount` (if it is not configured then this
/// will always fail with `BadOrigin`). /// will always fail with `BadOrigin`).
#[pallet::call_index(3)]
#[pallet::weight(T::DbWeight::get().reads_writes(4, 2))] #[pallet::weight(T::DbWeight::get().reads_writes(4, 2))]
pub fn payout(origin: OriginFor<T>, who: T::AccountId) -> DispatchResult { pub fn payout(origin: OriginFor<T>, who: T::AccountId) -> DispatchResult {
// Payments must be made directly by the `PaymentAccount`. // Payments must be made directly by the `PaymentAccount`.
@@ -366,6 +370,7 @@ pub mod pallet {
/// Set the account that will be used to payout users in the DOT purchase process. /// Set the account that will be used to payout users in the DOT purchase process.
/// ///
/// Origin must match the `ConfigurationOrigin` /// Origin must match the `ConfigurationOrigin`
#[pallet::call_index(4)]
#[pallet::weight(T::DbWeight::get().writes(1))] #[pallet::weight(T::DbWeight::get().writes(1))]
pub fn set_payment_account(origin: OriginFor<T>, who: T::AccountId) -> DispatchResult { pub fn set_payment_account(origin: OriginFor<T>, who: T::AccountId) -> DispatchResult {
T::ConfigurationOrigin::ensure_origin(origin)?; T::ConfigurationOrigin::ensure_origin(origin)?;
@@ -378,6 +383,7 @@ pub mod pallet {
/// Set the statement that must be signed for a user to participate on the DOT sale. /// Set the statement that must be signed for a user to participate on the DOT sale.
/// ///
/// Origin must match the `ConfigurationOrigin` /// Origin must match the `ConfigurationOrigin`
#[pallet::call_index(5)]
#[pallet::weight(T::DbWeight::get().writes(1))] #[pallet::weight(T::DbWeight::get().writes(1))]
pub fn set_statement(origin: OriginFor<T>, statement: Vec<u8>) -> DispatchResult { pub fn set_statement(origin: OriginFor<T>, statement: Vec<u8>) -> DispatchResult {
T::ConfigurationOrigin::ensure_origin(origin)?; T::ConfigurationOrigin::ensure_origin(origin)?;
@@ -394,6 +400,7 @@ pub mod pallet {
/// Set the block where locked DOTs will become unlocked. /// Set the block where locked DOTs will become unlocked.
/// ///
/// Origin must match the `ConfigurationOrigin` /// Origin must match the `ConfigurationOrigin`
#[pallet::call_index(6)]
#[pallet::weight(T::DbWeight::get().writes(1))] #[pallet::weight(T::DbWeight::get().writes(1))]
pub fn set_unlock_block( pub fn set_unlock_block(
origin: OriginFor<T>, origin: OriginFor<T>,
+3
View File
@@ -165,6 +165,7 @@ pub mod pallet {
/// independently of any other on-chain mechanism to use it. /// independently of any other on-chain mechanism to use it.
/// ///
/// The dispatch origin for this call must match `T::ForceOrigin`. /// The dispatch origin for this call must match `T::ForceOrigin`.
#[pallet::call_index(0)]
#[pallet::weight(T::WeightInfo::force_lease())] #[pallet::weight(T::WeightInfo::force_lease())]
pub fn force_lease( pub fn force_lease(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -183,6 +184,7 @@ pub mod pallet {
/// Clear all leases for a Para Id, refunding any deposits back to the original owners. /// Clear all leases for a Para Id, refunding any deposits back to the original owners.
/// ///
/// The dispatch origin for this call must match `T::ForceOrigin`. /// The dispatch origin for this call must match `T::ForceOrigin`.
#[pallet::call_index(1)]
#[pallet::weight(T::WeightInfo::clear_all_leases())] #[pallet::weight(T::WeightInfo::clear_all_leases())]
pub fn clear_all_leases(origin: OriginFor<T>, para: ParaId) -> DispatchResult { pub fn clear_all_leases(origin: OriginFor<T>, para: ParaId) -> DispatchResult {
T::ForceOrigin::ensure_origin(origin)?; T::ForceOrigin::ensure_origin(origin)?;
@@ -205,6 +207,7 @@ pub mod pallet {
/// let them onboard from here. /// let them onboard from here.
/// ///
/// Origin must be signed, but can be called by anyone. /// Origin must be signed, but can be called by anyone.
#[pallet::call_index(2)]
#[pallet::weight(T::WeightInfo::trigger_onboard())] #[pallet::weight(T::WeightInfo::trigger_onboard())]
pub fn trigger_onboard(origin: OriginFor<T>, para: ParaId) -> DispatchResult { pub fn trigger_onboard(origin: OriginFor<T>, para: ParaId) -> DispatchResult {
let _ = ensure_signed(origin)?; let _ = ensure_signed(origin)?;
@@ -521,6 +521,7 @@ pub mod pallet {
#[pallet::call] #[pallet::call]
impl<T: Config> Pallet<T> { impl<T: Config> Pallet<T> {
/// Set the validation upgrade cooldown. /// Set the validation upgrade cooldown.
#[pallet::call_index(0)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_block_number(), T::WeightInfo::set_config_with_block_number(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -536,6 +537,7 @@ pub mod pallet {
} }
/// Set the validation upgrade delay. /// Set the validation upgrade delay.
#[pallet::call_index(1)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_block_number(), T::WeightInfo::set_config_with_block_number(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -551,6 +553,7 @@ pub mod pallet {
} }
/// Set the acceptance period for an included candidate. /// Set the acceptance period for an included candidate.
#[pallet::call_index(2)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_block_number(), T::WeightInfo::set_config_with_block_number(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -566,6 +569,7 @@ pub mod pallet {
} }
/// Set the max validation code size for incoming upgrades. /// Set the max validation code size for incoming upgrades.
#[pallet::call_index(3)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -578,6 +582,7 @@ pub mod pallet {
} }
/// Set the max POV block size for incoming upgrades. /// Set the max POV block size for incoming upgrades.
#[pallet::call_index(4)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -590,6 +595,7 @@ pub mod pallet {
} }
/// Set the max head data size for paras. /// Set the max head data size for paras.
#[pallet::call_index(5)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -602,6 +608,7 @@ pub mod pallet {
} }
/// Set the number of parathread execution cores. /// Set the number of parathread execution cores.
#[pallet::call_index(6)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -614,6 +621,7 @@ pub mod pallet {
} }
/// Set the number of retries for a particular parathread. /// Set the number of retries for a particular parathread.
#[pallet::call_index(7)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -626,6 +634,7 @@ pub mod pallet {
} }
/// Set the parachain validator-group rotation frequency /// Set the parachain validator-group rotation frequency
#[pallet::call_index(8)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_block_number(), T::WeightInfo::set_config_with_block_number(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -641,6 +650,7 @@ pub mod pallet {
} }
/// Set the availability period for parachains. /// Set the availability period for parachains.
#[pallet::call_index(9)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_block_number(), T::WeightInfo::set_config_with_block_number(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -656,6 +666,7 @@ pub mod pallet {
} }
/// Set the availability period for parathreads. /// Set the availability period for parathreads.
#[pallet::call_index(10)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_block_number(), T::WeightInfo::set_config_with_block_number(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -671,6 +682,7 @@ pub mod pallet {
} }
/// Set the scheduling lookahead, in expected number of blocks at peak throughput. /// Set the scheduling lookahead, in expected number of blocks at peak throughput.
#[pallet::call_index(11)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -683,6 +695,7 @@ pub mod pallet {
} }
/// Set the maximum number of validators to assign to any core. /// Set the maximum number of validators to assign to any core.
#[pallet::call_index(12)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_option_u32(), T::WeightInfo::set_config_with_option_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -698,6 +711,7 @@ pub mod pallet {
} }
/// Set the maximum number of validators to use in parachain consensus. /// Set the maximum number of validators to use in parachain consensus.
#[pallet::call_index(13)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_option_u32(), T::WeightInfo::set_config_with_option_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -710,6 +724,7 @@ pub mod pallet {
} }
/// Set the dispute period, in number of sessions to keep for disputes. /// Set the dispute period, in number of sessions to keep for disputes.
#[pallet::call_index(14)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -722,6 +737,7 @@ pub mod pallet {
} }
/// Set the dispute post conclusion acceptance period. /// Set the dispute post conclusion acceptance period.
#[pallet::call_index(15)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_block_number(), T::WeightInfo::set_config_with_block_number(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -737,6 +753,7 @@ pub mod pallet {
} }
/// Set the maximum number of dispute spam slots. /// Set the maximum number of dispute spam slots.
#[pallet::call_index(16)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -749,6 +766,7 @@ pub mod pallet {
} }
/// Set the dispute conclusion by time out period. /// Set the dispute conclusion by time out period.
#[pallet::call_index(17)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_block_number(), T::WeightInfo::set_config_with_block_number(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -765,6 +783,7 @@ pub mod pallet {
/// Set the no show slots, in number of number of consensus slots. /// Set the no show slots, in number of number of consensus slots.
/// Must be at least 1. /// Must be at least 1.
#[pallet::call_index(18)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -777,6 +796,7 @@ pub mod pallet {
} }
/// Set the total number of delay tranches. /// Set the total number of delay tranches.
#[pallet::call_index(19)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -789,6 +809,7 @@ pub mod pallet {
} }
/// Set the zeroth delay tranche width. /// Set the zeroth delay tranche width.
#[pallet::call_index(20)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -801,6 +822,7 @@ pub mod pallet {
} }
/// Set the number of validators needed to approve a block. /// Set the number of validators needed to approve a block.
#[pallet::call_index(21)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -813,6 +835,7 @@ pub mod pallet {
} }
/// Set the number of samples to do of the `RelayVRFModulo` approval assignment criterion. /// Set the number of samples to do of the `RelayVRFModulo` approval assignment criterion.
#[pallet::call_index(22)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -825,6 +848,7 @@ pub mod pallet {
} }
/// Sets the maximum items that can present in a upward dispatch queue at once. /// Sets the maximum items that can present in a upward dispatch queue at once.
#[pallet::call_index(23)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -837,6 +861,7 @@ pub mod pallet {
} }
/// Sets the maximum total size of items that can present in a upward dispatch queue at once. /// Sets the maximum total size of items that can present in a upward dispatch queue at once.
#[pallet::call_index(24)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -849,6 +874,7 @@ pub mod pallet {
} }
/// Set the critical downward message size. /// Set the critical downward message size.
#[pallet::call_index(25)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -861,6 +887,7 @@ pub mod pallet {
} }
/// Sets the soft limit for the phase of dispatching dispatchable upward messages. /// Sets the soft limit for the phase of dispatching dispatchable upward messages.
#[pallet::call_index(26)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_weight(), T::WeightInfo::set_config_with_weight(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -873,6 +900,7 @@ pub mod pallet {
} }
/// Sets the maximum size of an upward message that can be sent by a candidate. /// Sets the maximum size of an upward message that can be sent by a candidate.
#[pallet::call_index(27)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -885,6 +913,7 @@ pub mod pallet {
} }
/// Sets the maximum number of messages that a candidate can contain. /// Sets the maximum number of messages that a candidate can contain.
#[pallet::call_index(28)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -900,6 +929,7 @@ pub mod pallet {
} }
/// Sets the number of sessions after which an HRMP open channel request expires. /// Sets the number of sessions after which an HRMP open channel request expires.
#[pallet::call_index(29)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_hrmp_open_request_ttl(), T::WeightInfo::set_hrmp_open_request_ttl(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -911,6 +941,7 @@ pub mod pallet {
} }
/// Sets the amount of funds that the sender should provide for opening an HRMP channel. /// Sets the amount of funds that the sender should provide for opening an HRMP channel.
#[pallet::call_index(30)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_balance(), T::WeightInfo::set_config_with_balance(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -924,6 +955,7 @@ pub mod pallet {
/// Sets the amount of funds that the recipient should provide for accepting opening an HRMP /// Sets the amount of funds that the recipient should provide for accepting opening an HRMP
/// channel. /// channel.
#[pallet::call_index(31)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_balance(), T::WeightInfo::set_config_with_balance(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -936,6 +968,7 @@ pub mod pallet {
} }
/// Sets the maximum number of messages allowed in an HRMP channel at once. /// Sets the maximum number of messages allowed in an HRMP channel at once.
#[pallet::call_index(32)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -948,6 +981,7 @@ pub mod pallet {
} }
/// Sets the maximum total size of messages in bytes allowed in an HRMP channel at once. /// Sets the maximum total size of messages in bytes allowed in an HRMP channel at once.
#[pallet::call_index(33)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -960,6 +994,7 @@ pub mod pallet {
} }
/// Sets the maximum number of inbound HRMP channels a parachain is allowed to accept. /// Sets the maximum number of inbound HRMP channels a parachain is allowed to accept.
#[pallet::call_index(34)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -975,6 +1010,7 @@ pub mod pallet {
} }
/// Sets the maximum number of inbound HRMP channels a parathread is allowed to accept. /// Sets the maximum number of inbound HRMP channels a parathread is allowed to accept.
#[pallet::call_index(35)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -990,6 +1026,7 @@ pub mod pallet {
} }
/// Sets the maximum size of a message that could ever be put into an HRMP channel. /// Sets the maximum size of a message that could ever be put into an HRMP channel.
#[pallet::call_index(36)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -1002,6 +1039,7 @@ pub mod pallet {
} }
/// Sets the maximum number of outbound HRMP channels a parachain is allowed to open. /// Sets the maximum number of outbound HRMP channels a parachain is allowed to open.
#[pallet::call_index(37)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -1017,6 +1055,7 @@ pub mod pallet {
} }
/// Sets the maximum number of outbound HRMP channels a parathread is allowed to open. /// Sets the maximum number of outbound HRMP channels a parathread is allowed to open.
#[pallet::call_index(38)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -1032,6 +1071,7 @@ pub mod pallet {
} }
/// Sets the maximum number of outbound HRMP messages can be sent by a candidate. /// Sets the maximum number of outbound HRMP messages can be sent by a candidate.
#[pallet::call_index(39)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -1047,6 +1087,7 @@ pub mod pallet {
} }
/// Sets the maximum amount of weight any individual upward message may consume. /// Sets the maximum amount of weight any individual upward message may consume.
#[pallet::call_index(40)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_weight(), T::WeightInfo::set_config_with_weight(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -1059,6 +1100,7 @@ pub mod pallet {
} }
/// Enable or disable PVF pre-checking. Consult the field documentation prior executing. /// Enable or disable PVF pre-checking. Consult the field documentation prior executing.
#[pallet::call_index(41)]
#[pallet::weight(( #[pallet::weight((
// Using u32 here is a little bit of cheating, but that should be fine. // Using u32 here is a little bit of cheating, but that should be fine.
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
@@ -1072,6 +1114,7 @@ pub mod pallet {
} }
/// Set the number of session changes after which a PVF pre-checking voting is rejected. /// Set the number of session changes after which a PVF pre-checking voting is rejected.
#[pallet::call_index(42)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_u32(), T::WeightInfo::set_config_with_u32(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -1087,6 +1130,7 @@ pub mod pallet {
/// upgrade taking place. /// upgrade taking place.
/// ///
/// See the field documentation for information and constraints for the new value. /// See the field documentation for information and constraints for the new value.
#[pallet::call_index(43)]
#[pallet::weight(( #[pallet::weight((
T::WeightInfo::set_config_with_block_number(), T::WeightInfo::set_config_with_block_number(),
DispatchClass::Operational, DispatchClass::Operational,
@@ -1103,6 +1147,7 @@ pub mod pallet {
/// Setting this to true will disable consistency checks for the configuration setters. /// Setting this to true will disable consistency checks for the configuration setters.
/// Use with caution. /// Use with caution.
#[pallet::call_index(44)]
#[pallet::weight(( #[pallet::weight((
T::DbWeight::get().writes(1), T::DbWeight::get().writes(1),
DispatchClass::Operational, DispatchClass::Operational,
@@ -525,6 +525,7 @@ pub mod pallet {
#[pallet::call] #[pallet::call]
impl<T: Config> Pallet<T> { impl<T: Config> Pallet<T> {
#[pallet::call_index(0)]
#[pallet::weight(<T as Config>::WeightInfo::force_unfreeze())] #[pallet::weight(<T as Config>::WeightInfo::force_unfreeze())]
pub fn force_unfreeze(origin: OriginFor<T>) -> DispatchResult { pub fn force_unfreeze(origin: OriginFor<T>) -> DispatchResult {
ensure_root(origin)?; ensure_root(origin)?;
@@ -475,6 +475,7 @@ pub mod pallet {
#[pallet::call] #[pallet::call]
impl<T: Config> Pallet<T> { impl<T: Config> Pallet<T> {
#[pallet::call_index(0)]
#[pallet::weight(<T as Config>::WeightInfo::report_dispute_lost( #[pallet::weight(<T as Config>::WeightInfo::report_dispute_lost(
key_owner_proof.validator_count() key_owner_proof.validator_count()
))] ))]
+8
View File
@@ -465,6 +465,7 @@ pub mod pallet {
/// ///
/// The channel can be opened only after the recipient confirms it and only on a session /// The channel can be opened only after the recipient confirms it and only on a session
/// change. /// change.
#[pallet::call_index(0)]
#[pallet::weight(<T as Config>::WeightInfo::hrmp_init_open_channel())] #[pallet::weight(<T as Config>::WeightInfo::hrmp_init_open_channel())]
pub fn hrmp_init_open_channel( pub fn hrmp_init_open_channel(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -491,6 +492,7 @@ pub mod pallet {
/// Accept a pending open channel request from the given sender. /// Accept a pending open channel request from the given sender.
/// ///
/// The channel will be opened only on the next session boundary. /// The channel will be opened only on the next session boundary.
#[pallet::call_index(1)]
#[pallet::weight(<T as Config>::WeightInfo::hrmp_accept_open_channel())] #[pallet::weight(<T as Config>::WeightInfo::hrmp_accept_open_channel())]
pub fn hrmp_accept_open_channel(origin: OriginFor<T>, sender: ParaId) -> DispatchResult { pub fn hrmp_accept_open_channel(origin: OriginFor<T>, sender: ParaId) -> DispatchResult {
let origin = ensure_parachain(<T as Config>::RuntimeOrigin::from(origin))?; let origin = ensure_parachain(<T as Config>::RuntimeOrigin::from(origin))?;
@@ -503,6 +505,7 @@ pub mod pallet {
/// recipient in the channel being closed. /// recipient in the channel being closed.
/// ///
/// The closure can only happen on a session change. /// The closure can only happen on a session change.
#[pallet::call_index(2)]
#[pallet::weight(<T as Config>::WeightInfo::hrmp_close_channel())] #[pallet::weight(<T as Config>::WeightInfo::hrmp_close_channel())]
pub fn hrmp_close_channel( pub fn hrmp_close_channel(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -521,6 +524,7 @@ pub mod pallet {
/// Origin must be Root. /// Origin must be Root.
/// ///
/// Number of inbound and outbound channels for `para` must be provided as witness data of weighing. /// Number of inbound and outbound channels for `para` must be provided as witness data of weighing.
#[pallet::call_index(3)]
#[pallet::weight(<T as Config>::WeightInfo::force_clean_hrmp(*_inbound, *_outbound))] #[pallet::weight(<T as Config>::WeightInfo::force_clean_hrmp(*_inbound, *_outbound))]
pub fn force_clean_hrmp( pub fn force_clean_hrmp(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -539,6 +543,7 @@ pub mod pallet {
/// function process all of those requests immediately. /// function process all of those requests immediately.
/// ///
/// Total number of opening channels must be provided as witness data of weighing. /// Total number of opening channels must be provided as witness data of weighing.
#[pallet::call_index(4)]
#[pallet::weight(<T as Config>::WeightInfo::force_process_hrmp_open(*_channels))] #[pallet::weight(<T as Config>::WeightInfo::force_process_hrmp_open(*_channels))]
pub fn force_process_hrmp_open(origin: OriginFor<T>, _channels: u32) -> DispatchResult { pub fn force_process_hrmp_open(origin: OriginFor<T>, _channels: u32) -> DispatchResult {
ensure_root(origin)?; ensure_root(origin)?;
@@ -553,6 +558,7 @@ pub mod pallet {
/// function process all of those requests immediately. /// function process all of those requests immediately.
/// ///
/// Total number of closing channels must be provided as witness data of weighing. /// Total number of closing channels must be provided as witness data of weighing.
#[pallet::call_index(5)]
#[pallet::weight(<T as Config>::WeightInfo::force_process_hrmp_close(*_channels))] #[pallet::weight(<T as Config>::WeightInfo::force_process_hrmp_close(*_channels))]
pub fn force_process_hrmp_close(origin: OriginFor<T>, _channels: u32) -> DispatchResult { pub fn force_process_hrmp_close(origin: OriginFor<T>, _channels: u32) -> DispatchResult {
ensure_root(origin)?; ensure_root(origin)?;
@@ -568,6 +574,7 @@ pub mod pallet {
/// ///
/// Total number of open requests (i.e. `HrmpOpenChannelRequestsList`) must be provided as /// Total number of open requests (i.e. `HrmpOpenChannelRequestsList`) must be provided as
/// witness data. /// witness data.
#[pallet::call_index(6)]
#[pallet::weight(<T as Config>::WeightInfo::hrmp_cancel_open_request(*open_requests))] #[pallet::weight(<T as Config>::WeightInfo::hrmp_cancel_open_request(*open_requests))]
pub fn hrmp_cancel_open_request( pub fn hrmp_cancel_open_request(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -591,6 +598,7 @@ pub mod pallet {
/// ///
/// Expected use is when one of the `ParaId`s involved in the channel is governed by the /// Expected use is when one of the `ParaId`s involved in the channel is governed by the
/// Relay Chain, e.g. a common good parachain. /// Relay Chain, e.g. a common good parachain.
#[pallet::call_index(7)]
#[pallet::weight(<T as Config>::WeightInfo::force_open_hrmp_channel())] #[pallet::weight(<T as Config>::WeightInfo::force_open_hrmp_channel())]
pub fn force_open_hrmp_channel( pub fn force_open_hrmp_channel(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -210,6 +210,7 @@ pub mod pallet {
/// Issue a signal to the consensus engine to forcibly act as though all parachain /// Issue a signal to the consensus engine to forcibly act as though all parachain
/// blocks in all relay chain blocks up to and including the given number in the current /// blocks in all relay chain blocks up to and including the given number in the current
/// chain are valid and should be finalized. /// chain are valid and should be finalized.
#[pallet::call_index(0)]
#[pallet::weight(( #[pallet::weight((
<T as Config>::WeightInfo::force_approve( <T as Config>::WeightInfo::force_approve(
frame_system::Pallet::<T>::digest().logs.len() as u32, frame_system::Pallet::<T>::digest().logs.len() as u32,
@@ -788,6 +788,7 @@ pub mod pallet {
#[pallet::call] #[pallet::call]
impl<T: Config> Pallet<T> { impl<T: Config> Pallet<T> {
/// Set the storage for the parachain validation code immediately. /// Set the storage for the parachain validation code immediately.
#[pallet::call_index(0)]
#[pallet::weight(<T as Config>::WeightInfo::force_set_current_code(new_code.0.len() as u32))] #[pallet::weight(<T as Config>::WeightInfo::force_set_current_code(new_code.0.len() as u32))]
pub fn force_set_current_code( pub fn force_set_current_code(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -815,6 +816,7 @@ pub mod pallet {
} }
/// Set the storage for the current parachain head data immediately. /// Set the storage for the current parachain head data immediately.
#[pallet::call_index(1)]
#[pallet::weight(<T as Config>::WeightInfo::force_set_current_head(new_head.0.len() as u32))] #[pallet::weight(<T as Config>::WeightInfo::force_set_current_head(new_head.0.len() as u32))]
pub fn force_set_current_head( pub fn force_set_current_head(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -827,6 +829,7 @@ pub mod pallet {
} }
/// Schedule an upgrade as if it was scheduled in the given relay parent block. /// Schedule an upgrade as if it was scheduled in the given relay parent block.
#[pallet::call_index(2)]
#[pallet::weight(<T as Config>::WeightInfo::force_schedule_code_upgrade(new_code.0.len() as u32))] #[pallet::weight(<T as Config>::WeightInfo::force_schedule_code_upgrade(new_code.0.len() as u32))]
pub fn force_schedule_code_upgrade( pub fn force_schedule_code_upgrade(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -842,6 +845,7 @@ pub mod pallet {
} }
/// Note a new block head for para within the context of the current block. /// Note a new block head for para within the context of the current block.
#[pallet::call_index(3)]
#[pallet::weight(<T as Config>::WeightInfo::force_note_new_head(new_head.0.len() as u32))] #[pallet::weight(<T as Config>::WeightInfo::force_note_new_head(new_head.0.len() as u32))]
pub fn force_note_new_head( pub fn force_note_new_head(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -858,6 +862,7 @@ pub mod pallet {
/// Put a parachain directly into the next session's action queue. /// Put a parachain directly into the next session's action queue.
/// We can't queue it any sooner than this without going into the /// We can't queue it any sooner than this without going into the
/// initializer... /// initializer...
#[pallet::call_index(4)]
#[pallet::weight(<T as Config>::WeightInfo::force_queue_action())] #[pallet::weight(<T as Config>::WeightInfo::force_queue_action())]
pub fn force_queue_action(origin: OriginFor<T>, para: ParaId) -> DispatchResult { pub fn force_queue_action(origin: OriginFor<T>, para: ParaId) -> DispatchResult {
ensure_root(origin)?; ensure_root(origin)?;
@@ -884,6 +889,7 @@ pub mod pallet {
/// ///
/// This function is mainly meant to be used for upgrading parachains that do not follow /// This function is mainly meant to be used for upgrading parachains that do not follow
/// the go-ahead signal while the PVF pre-checking feature is enabled. /// the go-ahead signal while the PVF pre-checking feature is enabled.
#[pallet::call_index(5)]
#[pallet::weight(<T as Config>::WeightInfo::add_trusted_validation_code(validation_code.0.len() as u32))] #[pallet::weight(<T as Config>::WeightInfo::add_trusted_validation_code(validation_code.0.len() as u32))]
pub fn add_trusted_validation_code( pub fn add_trusted_validation_code(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -932,6 +938,7 @@ pub mod pallet {
/// This is better than removing the storage directly, because it will not remove the code /// This is better than removing the storage directly, because it will not remove the code
/// that was suddenly got used by some parachain while this dispatchable was pending /// that was suddenly got used by some parachain while this dispatchable was pending
/// dispatching. /// dispatching.
#[pallet::call_index(6)]
#[pallet::weight(<T as Config>::WeightInfo::poke_unused_validation_code())] #[pallet::weight(<T as Config>::WeightInfo::poke_unused_validation_code())]
pub fn poke_unused_validation_code( pub fn poke_unused_validation_code(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -946,6 +953,7 @@ pub mod pallet {
/// Includes a statement for a PVF pre-checking vote. Potentially, finalizes the vote and /// Includes a statement for a PVF pre-checking vote. Potentially, finalizes the vote and
/// enacts the results if that was the last vote before achieving the supermajority. /// enacts the results if that was the last vote before achieving the supermajority.
#[pallet::call_index(7)]
#[pallet::weight( #[pallet::weight(
<T as Config>::WeightInfo::include_pvf_check_statement_finalize_upgrade_accept() <T as Config>::WeightInfo::include_pvf_check_statement_finalize_upgrade_accept()
.max(<T as Config>::WeightInfo::include_pvf_check_statement_finalize_upgrade_reject()) .max(<T as Config>::WeightInfo::include_pvf_check_statement_finalize_upgrade_reject())
@@ -277,6 +277,7 @@ pub mod pallet {
#[pallet::call] #[pallet::call]
impl<T: Config> Pallet<T> { impl<T: Config> Pallet<T> {
/// Enter the paras inherent. This will process bitfields and backed candidates. /// Enter the paras inherent. This will process bitfields and backed candidates.
#[pallet::call_index(0)]
#[pallet::weight(( #[pallet::weight((
paras_inherent_total_weight::<T>( paras_inherent_total_weight::<T>(
data.backed_candidates.as_slice(), data.backed_candidates.as_slice(),
+1
View File
@@ -349,6 +349,7 @@ pub mod pallet {
/// ///
/// Events: /// Events:
/// - `OverweightServiced`: On success. /// - `OverweightServiced`: On success.
#[pallet::call_index(0)]
#[pallet::weight(weight_limit.saturating_add(<T as Config>::WeightInfo::service_overweight()))] #[pallet::weight(weight_limit.saturating_add(<T as Config>::WeightInfo::service_overweight()))]
pub fn service_overweight( pub fn service_overweight(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -66,6 +66,7 @@ pub mod pallet {
/// Add new validators to the set. /// Add new validators to the set.
/// ///
/// The new validators will be active from current session + 2. /// The new validators will be active from current session + 2.
#[pallet::call_index(0)]
#[pallet::weight(100_000)] #[pallet::weight(100_000)]
pub fn register_validators( pub fn register_validators(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -82,6 +83,7 @@ pub mod pallet {
/// Remove validators from the set. /// Remove validators from the set.
/// ///
/// The removed validators will be deactivated from current session + 2. /// The removed validators will be deactivated from current session + 2.
#[pallet::call_index(1)]
#[pallet::weight(100_000)] #[pallet::weight(100_000)]
pub fn deregister_validators( pub fn deregister_validators(
origin: OriginFor<T>, origin: OriginFor<T>,
+3
View File
@@ -621,6 +621,7 @@ pub mod pallet_test_notifier {
#[pallet::call] #[pallet::call]
impl<T: Config> Pallet<T> { impl<T: Config> Pallet<T> {
#[pallet::call_index(0)]
#[pallet::weight(1_000_000)] #[pallet::weight(1_000_000)]
pub fn prepare_new_query(origin: OriginFor<T>) -> DispatchResult { pub fn prepare_new_query(origin: OriginFor<T>) -> DispatchResult {
let who = ensure_signed(origin)?; let who = ensure_signed(origin)?;
@@ -635,6 +636,7 @@ pub mod pallet_test_notifier {
Ok(()) Ok(())
} }
#[pallet::call_index(1)]
#[pallet::weight(1_000_000)] #[pallet::weight(1_000_000)]
pub fn prepare_new_notify_query(origin: OriginFor<T>) -> DispatchResult { pub fn prepare_new_notify_query(origin: OriginFor<T>) -> DispatchResult {
let who = ensure_signed(origin)?; let who = ensure_signed(origin)?;
@@ -652,6 +654,7 @@ pub mod pallet_test_notifier {
Ok(()) Ok(())
} }
#[pallet::call_index(2)]
#[pallet::weight(1_000_000)] #[pallet::weight(1_000_000)]
pub fn notification_received( pub fn notification_received(
origin: OriginFor<T>, origin: OriginFor<T>,
+10
View File
@@ -458,6 +458,7 @@ pub mod pallet {
#[pallet::call] #[pallet::call]
impl<T: Config> Pallet<T> { impl<T: Config> Pallet<T> {
#[pallet::call_index(0)]
#[pallet::weight(100_000_000)] #[pallet::weight(100_000_000)]
pub fn send( pub fn send(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -493,6 +494,7 @@ pub mod pallet {
/// `dest` side. May not be empty. /// `dest` side. May not be empty.
/// - `fee_asset_item`: The index into `assets` of the item which should be used to pay /// - `fee_asset_item`: The index into `assets` of the item which should be used to pay
/// fees. /// fees.
#[pallet::call_index(1)]
#[pallet::weight({ #[pallet::weight({
let maybe_assets: Result<MultiAssets, ()> = (*assets.clone()).try_into(); let maybe_assets: Result<MultiAssets, ()> = (*assets.clone()).try_into();
let maybe_dest: Result<MultiLocation, ()> = (*dest.clone()).try_into(); let maybe_dest: Result<MultiLocation, ()> = (*dest.clone()).try_into();
@@ -534,6 +536,7 @@ pub mod pallet {
/// `dest` side. /// `dest` side.
/// - `fee_asset_item`: The index into `assets` of the item which should be used to pay /// - `fee_asset_item`: The index into `assets` of the item which should be used to pay
/// fees. /// fees.
#[pallet::call_index(2)]
#[pallet::weight({ #[pallet::weight({
match ((*assets.clone()).try_into(), (*dest.clone()).try_into()) { match ((*assets.clone()).try_into(), (*dest.clone()).try_into()) {
(Ok(assets), Ok(dest)) => { (Ok(assets), Ok(dest)) => {
@@ -574,6 +577,7 @@ pub mod pallet {
/// ///
/// NOTE: A successful return to this does *not* imply that the `msg` was executed successfully /// NOTE: A successful return to this does *not* imply that the `msg` was executed successfully
/// to completion; only that *some* of it was executed. /// to completion; only that *some* of it was executed.
#[pallet::call_index(3)]
#[pallet::weight(Weight::from_ref_time(max_weight.saturating_add(100_000_000u64)))] #[pallet::weight(Weight::from_ref_time(max_weight.saturating_add(100_000_000u64)))]
pub fn execute( pub fn execute(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -602,6 +606,7 @@ pub mod pallet {
/// - `origin`: Must be Root. /// - `origin`: Must be Root.
/// - `location`: The destination that is being described. /// - `location`: The destination that is being described.
/// - `xcm_version`: The latest version of XCM that `location` supports. /// - `xcm_version`: The latest version of XCM that `location` supports.
#[pallet::call_index(4)]
#[pallet::weight(100_000_000u64)] #[pallet::weight(100_000_000u64)]
pub fn force_xcm_version( pub fn force_xcm_version(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -624,6 +629,7 @@ pub mod pallet {
/// ///
/// - `origin`: Must be Root. /// - `origin`: Must be Root.
/// - `maybe_xcm_version`: The default XCM encoding version, or `None` to disable. /// - `maybe_xcm_version`: The default XCM encoding version, or `None` to disable.
#[pallet::call_index(5)]
#[pallet::weight(100_000_000u64)] #[pallet::weight(100_000_000u64)]
pub fn force_default_xcm_version( pub fn force_default_xcm_version(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -638,6 +644,7 @@ pub mod pallet {
/// ///
/// - `origin`: Must be Root. /// - `origin`: Must be Root.
/// - `location`: The location to which we should subscribe for XCM version notifications. /// - `location`: The location to which we should subscribe for XCM version notifications.
#[pallet::call_index(6)]
#[pallet::weight(100_000_000u64)] #[pallet::weight(100_000_000u64)]
pub fn force_subscribe_version_notify( pub fn force_subscribe_version_notify(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -661,6 +668,7 @@ pub mod pallet {
/// - `origin`: Must be Root. /// - `origin`: Must be Root.
/// - `location`: The location to which we are currently subscribed for XCM version /// - `location`: The location to which we are currently subscribed for XCM version
/// notifications which we no longer desire. /// notifications which we no longer desire.
#[pallet::call_index(7)]
#[pallet::weight(100_000_000u64)] #[pallet::weight(100_000_000u64)]
pub fn force_unsubscribe_version_notify( pub fn force_unsubscribe_version_notify(
origin: OriginFor<T>, origin: OriginFor<T>,
@@ -696,6 +704,7 @@ pub mod pallet {
/// - `fee_asset_item`: The index into `assets` of the item which should be used to pay /// - `fee_asset_item`: The index into `assets` of the item which should be used to pay
/// fees. /// fees.
/// - `weight_limit`: The remote-side weight limit, if any, for the XCM fee purchase. /// - `weight_limit`: The remote-side weight limit, if any, for the XCM fee purchase.
#[pallet::call_index(8)]
#[pallet::weight({ #[pallet::weight({
match ((*assets.clone()).try_into(), (*dest.clone()).try_into()) { match ((*assets.clone()).try_into(), (*dest.clone()).try_into()) {
(Ok(assets), Ok(dest)) => { (Ok(assets), Ok(dest)) => {
@@ -743,6 +752,7 @@ pub mod pallet {
/// - `fee_asset_item`: The index into `assets` of the item which should be used to pay /// - `fee_asset_item`: The index into `assets` of the item which should be used to pay
/// fees. /// fees.
/// - `weight_limit`: The remote-side weight limit, if any, for the XCM fee purchase. /// - `weight_limit`: The remote-side weight limit, if any, for the XCM fee purchase.
#[pallet::call_index(9)]
#[pallet::weight({ #[pallet::weight({
let maybe_assets: Result<MultiAssets, ()> = (*assets.clone()).try_into(); let maybe_assets: Result<MultiAssets, ()> = (*assets.clone()).try_into();
let maybe_dest: Result<MultiLocation, ()> = (*dest.clone()).try_into(); let maybe_dest: Result<MultiLocation, ()> = (*dest.clone()).try_into();
+3
View File
@@ -73,6 +73,7 @@ pub mod pallet_test_notifier {
#[pallet::call] #[pallet::call]
impl<T: Config> Pallet<T> { impl<T: Config> Pallet<T> {
#[pallet::call_index(0)]
#[pallet::weight(1_000_000)] #[pallet::weight(1_000_000)]
pub fn prepare_new_query(origin: OriginFor<T>) -> DispatchResult { pub fn prepare_new_query(origin: OriginFor<T>) -> DispatchResult {
let who = ensure_signed(origin)?; let who = ensure_signed(origin)?;
@@ -87,6 +88,7 @@ pub mod pallet_test_notifier {
Ok(()) Ok(())
} }
#[pallet::call_index(1)]
#[pallet::weight(1_000_000)] #[pallet::weight(1_000_000)]
pub fn prepare_new_notify_query(origin: OriginFor<T>) -> DispatchResult { pub fn prepare_new_notify_query(origin: OriginFor<T>) -> DispatchResult {
let who = ensure_signed(origin)?; let who = ensure_signed(origin)?;
@@ -104,6 +106,7 @@ pub mod pallet_test_notifier {
Ok(()) Ok(())
} }
#[pallet::call_index(2)]
#[pallet::weight(1_000_000)] #[pallet::weight(1_000_000)]
pub fn notification_received( pub fn notification_received(
origin: OriginFor<T>, origin: OriginFor<T>,