Use explicit call indices (#12891)

* frame-system: explicit call index

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>

* pallet-template: explicit call index

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

* DNM: Temporarily require call_index

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

* Revert "DNM: Temporarily require call_index"

This reverts commit c4934e312e12af72ca05a8029d7da753a9c99346.

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Oliver Tale-Yazdi
2022-12-12 15:32:41 +01:00
committed by GitHub
parent 6e0453a298
commit 31f5119ecd
67 changed files with 403 additions and 0 deletions
@@ -470,6 +470,7 @@ pub mod pallet {
/// - `rank`: The rank to give the new member.
///
/// Weight: `O(1)`
#[pallet::call_index(0)]
#[pallet::weight(T::WeightInfo::add_member())]
pub fn add_member(origin: OriginFor<T>, who: AccountIdLookupOf<T>) -> DispatchResult {
let _ = T::PromoteOrigin::ensure_origin(origin)?;
@@ -483,6 +484,7 @@ pub mod pallet {
/// - `who`: Account of existing member.
///
/// Weight: `O(1)`
#[pallet::call_index(1)]
#[pallet::weight(T::WeightInfo::promote_member(0))]
pub fn promote_member(origin: OriginFor<T>, who: AccountIdLookupOf<T>) -> DispatchResult {
let max_rank = T::PromoteOrigin::ensure_origin(origin)?;
@@ -497,6 +499,7 @@ pub mod pallet {
/// - `who`: Account of existing member of rank greater than zero.
///
/// Weight: `O(1)`, less if the member's index is highest in its rank.
#[pallet::call_index(2)]
#[pallet::weight(T::WeightInfo::demote_member(0))]
pub fn demote_member(origin: OriginFor<T>, who: AccountIdLookupOf<T>) -> DispatchResult {
let max_rank = T::DemoteOrigin::ensure_origin(origin)?;
@@ -528,6 +531,7 @@ pub mod pallet {
/// - `min_rank`: The rank of the member or greater.
///
/// Weight: `O(min_rank)`.
#[pallet::call_index(3)]
#[pallet::weight(T::WeightInfo::remove_member(*min_rank as u32))]
pub fn remove_member(
origin: OriginFor<T>,
@@ -562,6 +566,7 @@ pub mod pallet {
/// fee.
///
/// Weight: `O(1)`, less if there was no previous vote on the poll by the member.
#[pallet::call_index(4)]
#[pallet::weight(T::WeightInfo::vote())]
pub fn vote(
origin: OriginFor<T>,
@@ -618,6 +623,7 @@ pub mod pallet {
/// Transaction fees are waived if the operation is successful.
///
/// Weight `O(max)` (less if there are fewer items to remove than `max`).
#[pallet::call_index(5)]
#[pallet::weight(T::WeightInfo::cleanup_poll(*max))]
pub fn cleanup_poll(
origin: OriginFor<T>,