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
+7
View File
@@ -372,6 +372,7 @@ pub mod pallet {
/// - `P` storage mutations (codec `O(M)`) for updating the votes for each proposal
/// - 1 storage write (codec `O(1)`) for deleting the old `prime` and setting the new one
/// # </weight>
#[pallet::call_index(0)]
#[pallet::weight((
T::WeightInfo::set_members(
*old_count, // M
@@ -429,6 +430,7 @@ pub mod pallet {
/// - DB: 1 read (codec `O(M)`) + DB access of `proposal`
/// - 1 event
/// # </weight>
#[pallet::call_index(1)]
#[pallet::weight((
T::WeightInfo::execute(
*length_bound, // B
@@ -492,6 +494,7 @@ pub mod pallet {
/// - 1 storage write `Voting` (codec `O(M)`)
/// - 1 event
/// # </weight>
#[pallet::call_index(2)]
#[pallet::weight((
if *threshold < 2 {
T::WeightInfo::propose_execute(
@@ -557,6 +560,7 @@ pub mod pallet {
/// - 1 storage mutation `Voting` (codec `O(M)`)
/// - 1 event
/// # </weight>
#[pallet::call_index(3)]
#[pallet::weight((T::WeightInfo::vote(T::MaxMembers::get()), DispatchClass::Operational))]
pub fn vote(
origin: OriginFor<T>,
@@ -610,6 +614,7 @@ pub mod pallet {
/// - any mutations done while executing `proposal` (`P1`)
/// - up to 3 events
/// # </weight>
#[pallet::call_index(4)]
#[pallet::weight((
{
let b = *length_bound;
@@ -653,6 +658,7 @@ pub mod pallet {
/// * Reads: Proposals
/// * Writes: Voting, Proposals, ProposalOf
/// # </weight>
#[pallet::call_index(5)]
#[pallet::weight(T::WeightInfo::disapprove_proposal(T::MaxProposals::get()))]
pub fn disapprove_proposal(
origin: OriginFor<T>,
@@ -695,6 +701,7 @@ pub mod pallet {
/// - any mutations done while executing `proposal` (`P1`)
/// - up to 3 events
/// # </weight>
#[pallet::call_index(6)]
#[pallet::weight((
{
let b = *length_bound;
+1
View File
@@ -69,6 +69,7 @@ mod mock_democracy {
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pallet::call_index(0)]
#[pallet::weight(0)]
pub fn external_propose_majority(origin: OriginFor<T>) -> DispatchResult {
T::ExternalMajorityOrigin::ensure_origin(origin)?;