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
@@ -309,6 +309,7 @@ pub mod pallet {
/// # <weight>
/// We assume the maximum weight among all 3 cases: vote_equal, vote_more and vote_less.
/// # </weight>
#[pallet::call_index(0)]
#[pallet::weight(
T::WeightInfo::vote_more(votes.len() as u32)
.max(T::WeightInfo::vote_less(votes.len() as u32))
@@ -371,6 +372,7 @@ pub mod pallet {
/// This removes the lock and returns the deposit.
///
/// The dispatch origin of this call must be signed and be a voter.
#[pallet::call_index(1)]
#[pallet::weight(T::WeightInfo::remove_voter())]
pub fn remove_voter(origin: OriginFor<T>) -> DispatchResult {
let who = ensure_signed(origin)?;
@@ -394,6 +396,7 @@ pub mod pallet {
/// # <weight>
/// The number of current candidates must be provided as witness data.
/// # </weight>
#[pallet::call_index(2)]
#[pallet::weight(T::WeightInfo::submit_candidacy(*candidate_count))]
pub fn submit_candidacy(
origin: OriginFor<T>,
@@ -438,6 +441,7 @@ pub mod pallet {
/// # <weight>
/// The type of renouncing must be provided as witness data.
/// # </weight>
#[pallet::call_index(3)]
#[pallet::weight(match *renouncing {
Renouncing::Candidate(count) => T::WeightInfo::renounce_candidacy_candidate(count),
Renouncing::Member => T::WeightInfo::renounce_candidacy_members(),
@@ -500,6 +504,7 @@ pub mod pallet {
/// If we have a replacement, we use a small weight. Else, since this is a root call and
/// will go into phragmen, we assume full block for now.
/// # </weight>
#[pallet::call_index(4)]
#[pallet::weight(if *rerun_election {
T::WeightInfo::remove_member_without_replacement()
} else {
@@ -535,6 +540,7 @@ pub mod pallet {
/// # <weight>
/// The total number of voters and those that are defunct must be provided as witness data.
/// # </weight>
#[pallet::call_index(5)]
#[pallet::weight(T::WeightInfo::clean_defunct_voters(*_num_voters, *_num_defunct))]
pub fn clean_defunct_voters(
origin: OriginFor<T>,