diff --git a/pallets/collator-selection/src/lib.rs b/pallets/collator-selection/src/lib.rs index 16440344846..34fa5b371ce 100644 --- a/pallets/collator-selection/src/lib.rs +++ b/pallets/collator-selection/src/lib.rs @@ -286,6 +286,7 @@ pub mod pallet { #[pallet::call] impl Pallet { /// Set the list of invulnerable (fixed) collators. + #[pallet::call_index(0)] #[pallet::weight(T::WeightInfo::set_invulnerables(new.len() as u32))] pub fn set_invulnerables( origin: OriginFor, @@ -315,6 +316,7 @@ pub mod pallet { /// Set the ideal number of collators (not including the invulnerables). /// If lowering this number, then the number of running collators could be higher than this figure. /// Aside from that edge case, there should be no other way to have more collators than the desired number. + #[pallet::call_index(1)] #[pallet::weight(T::WeightInfo::set_desired_candidates())] pub fn set_desired_candidates( origin: OriginFor, @@ -331,6 +333,7 @@ pub mod pallet { } /// Set the candidacy bond amount. + #[pallet::call_index(2)] #[pallet::weight(T::WeightInfo::set_candidacy_bond())] pub fn set_candidacy_bond( origin: OriginFor, @@ -346,6 +349,7 @@ pub mod pallet { /// registered session keys and (b) be able to reserve the `CandidacyBond`. /// /// This call is not available to `Invulnerable` collators. + #[pallet::call_index(3)] #[pallet::weight(T::WeightInfo::register_as_candidate(T::MaxCandidates::get()))] pub fn register_as_candidate(origin: OriginFor) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; @@ -391,6 +395,7 @@ pub mod pallet { /// This call will fail if the total number of candidates would drop below `MinCandidates`. /// /// This call is not available to `Invulnerable` collators. + #[pallet::call_index(4)] #[pallet::weight(T::WeightInfo::leave_intent(T::MaxCandidates::get()))] pub fn leave_intent(origin: OriginFor) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; diff --git a/pallets/dmp-queue/src/lib.rs b/pallets/dmp-queue/src/lib.rs index cb464f0cf9e..f2a5b2a305a 100644 --- a/pallets/dmp-queue/src/lib.rs +++ b/pallets/dmp-queue/src/lib.rs @@ -156,6 +156,7 @@ pub mod pallet { /// /// Events: /// - `OverweightServiced`: On success. + #[pallet::call_index(0)] #[pallet::weight(Weight::from_ref_time(weight_limit.saturating_add(1_000_000)))] pub fn service_overweight( origin: OriginFor, diff --git a/pallets/parachain-system/src/lib.rs b/pallets/parachain-system/src/lib.rs index 3b685f5a274..743c0c25372 100644 --- a/pallets/parachain-system/src/lib.rs +++ b/pallets/parachain-system/src/lib.rs @@ -335,6 +335,7 @@ pub mod pallet { /// /// As a side effect, this function upgrades the current validation function /// if the appropriate time has come. + #[pallet::call_index(0)] #[pallet::weight((0, DispatchClass::Mandatory))] // TODO: This weight should be corrected. pub fn set_validation_data( @@ -431,6 +432,7 @@ pub mod pallet { Ok(PostDispatchInfo { actual_weight: Some(total_weight), pays_fee: Pays::No }) } + #[pallet::call_index(1)] #[pallet::weight((1_000, DispatchClass::Operational))] pub fn sudo_send_upward_message( origin: OriginFor, @@ -441,6 +443,7 @@ pub mod pallet { Ok(()) } + #[pallet::call_index(2)] #[pallet::weight((1_000_000, DispatchClass::Operational))] pub fn authorize_upgrade(origin: OriginFor, code_hash: T::Hash) -> DispatchResult { ensure_root(origin)?; @@ -451,6 +454,7 @@ pub mod pallet { Ok(()) } + #[pallet::call_index(3)] #[pallet::weight(1_000_000)] pub fn enact_authorized_upgrade( _: OriginFor, diff --git a/pallets/solo-to-para/src/lib.rs b/pallets/solo-to-para/src/lib.rs index bf4f476712a..efa61c8ebda 100644 --- a/pallets/solo-to-para/src/lib.rs +++ b/pallets/solo-to-para/src/lib.rs @@ -61,6 +61,7 @@ pub mod pallet { #[pallet::call] impl Pallet { + #[pallet::call_index(0)] #[pallet::weight(0)] pub fn schedule_migration( origin: OriginFor, diff --git a/pallets/xcmp-queue/src/lib.rs b/pallets/xcmp-queue/src/lib.rs index 71906da59e2..bb062470c07 100644 --- a/pallets/xcmp-queue/src/lib.rs +++ b/pallets/xcmp-queue/src/lib.rs @@ -134,6 +134,7 @@ pub mod pallet { /// /// Events: /// - `OverweightServiced`: On success. + #[pallet::call_index(0)] #[pallet::weight((Weight::from_ref_time(weight_limit.saturating_add(1_000_000)), DispatchClass::Operational,))] pub fn service_overweight( origin: OriginFor, @@ -160,6 +161,7 @@ pub mod pallet { /// Suspends all XCM executions for the XCMP queue, regardless of the sender's origin. /// /// - `origin`: Must pass `ControllerOrigin`. + #[pallet::call_index(1)] #[pallet::weight((T::DbWeight::get().writes(1), DispatchClass::Operational,))] pub fn suspend_xcm_execution(origin: OriginFor) -> DispatchResult { T::ControllerOrigin::ensure_origin(origin)?; @@ -174,6 +176,7 @@ pub mod pallet { /// Note that this function doesn't change the status of the in/out bound channels. /// /// - `origin`: Must pass `ControllerOrigin`. + #[pallet::call_index(2)] #[pallet::weight((T::DbWeight::get().writes(1), DispatchClass::Operational,))] pub fn resume_xcm_execution(origin: OriginFor) -> DispatchResult { T::ControllerOrigin::ensure_origin(origin)?; @@ -188,6 +191,7 @@ pub mod pallet { /// /// - `origin`: Must pass `Root`. /// - `new`: Desired value for `QueueConfigData.suspend_value` + #[pallet::call_index(3)] #[pallet::weight((T::WeightInfo::set_config_with_u32(), DispatchClass::Operational,))] pub fn update_suspend_threshold(origin: OriginFor, new: u32) -> DispatchResult { ensure_root(origin)?; @@ -201,6 +205,7 @@ pub mod pallet { /// /// - `origin`: Must pass `Root`. /// - `new`: Desired value for `QueueConfigData.drop_threshold` + #[pallet::call_index(4)] #[pallet::weight((T::WeightInfo::set_config_with_u32(),DispatchClass::Operational,))] pub fn update_drop_threshold(origin: OriginFor, new: u32) -> DispatchResult { ensure_root(origin)?; @@ -214,6 +219,7 @@ pub mod pallet { /// /// - `origin`: Must pass `Root`. /// - `new`: Desired value for `QueueConfigData.resume_threshold` + #[pallet::call_index(5)] #[pallet::weight((T::WeightInfo::set_config_with_u32(), DispatchClass::Operational,))] pub fn update_resume_threshold(origin: OriginFor, new: u32) -> DispatchResult { ensure_root(origin)?; @@ -226,6 +232,7 @@ pub mod pallet { /// /// - `origin`: Must pass `Root`. /// - `new`: Desired value for `QueueConfigData.threshold_weight` + #[pallet::call_index(6)] #[pallet::weight((T::WeightInfo::set_config_with_weight(), DispatchClass::Operational,))] pub fn update_threshold_weight(origin: OriginFor, new: XcmWeight) -> DispatchResult { ensure_root(origin)?; @@ -239,6 +246,7 @@ pub mod pallet { /// /// - `origin`: Must pass `Root`. /// - `new`: Desired value for `QueueConfigData.weight_restrict_decay`. + #[pallet::call_index(7)] #[pallet::weight((T::WeightInfo::set_config_with_weight(), DispatchClass::Operational,))] pub fn update_weight_restrict_decay( origin: OriginFor, @@ -257,6 +265,7 @@ pub mod pallet { /// /// - `origin`: Must pass `Root`. /// - `new`: Desired value for `QueueConfigData.xcmp_max_individual_weight`. + #[pallet::call_index(8)] #[pallet::weight((T::WeightInfo::set_config_with_weight(), DispatchClass::Operational,))] pub fn update_xcmp_max_individual_weight( origin: OriginFor, diff --git a/parachain-template/pallets/template/src/lib.rs b/parachain-template/pallets/template/src/lib.rs index 18d94bedb98..fde11a46108 100644 --- a/parachain-template/pallets/template/src/lib.rs +++ b/parachain-template/pallets/template/src/lib.rs @@ -67,6 +67,7 @@ pub mod pallet { impl Pallet { /// An example dispatchable that takes a singles value as a parameter, writes the value to /// storage and emits an event. This function must be dispatched by a signed extrinsic. + #[pallet::call_index(0)] #[pallet::weight(Weight::from_ref_time(10_000) + T::DbWeight::get().writes(1))] pub fn do_something(origin: OriginFor, something: u32) -> DispatchResultWithPostInfo { // Check that the extrinsic was signed and get the signer. @@ -84,6 +85,7 @@ pub mod pallet { } /// An example dispatchable that may throw a custom error. + #[pallet::call_index(1)] #[pallet::weight(Weight::from_ref_time(10_000) + T::DbWeight::get().reads_writes(1,1))] pub fn cause_error(origin: OriginFor) -> DispatchResultWithPostInfo { let _who = ensure_signed(origin)?; diff --git a/parachains/pallets/ping/src/lib.rs b/parachains/pallets/ping/src/lib.rs index 1ef9938e5c7..099f45eeee7 100644 --- a/parachains/pallets/ping/src/lib.rs +++ b/parachains/pallets/ping/src/lib.rs @@ -135,6 +135,7 @@ pub mod pallet { #[pallet::call] impl Pallet { + #[pallet::call_index(0)] #[pallet::weight(0)] pub fn start(origin: OriginFor, para: ParaId, payload: Vec) -> DispatchResult { ensure_root(origin)?; @@ -146,6 +147,7 @@ pub mod pallet { Ok(()) } + #[pallet::call_index(1)] #[pallet::weight(0)] pub fn start_many( origin: OriginFor, @@ -165,6 +167,7 @@ pub mod pallet { Ok(()) } + #[pallet::call_index(2)] #[pallet::weight(0)] pub fn stop(origin: OriginFor, para: ParaId) -> DispatchResult { ensure_root(origin)?; @@ -176,6 +179,7 @@ pub mod pallet { Ok(()) } + #[pallet::call_index(3)] #[pallet::weight(0)] pub fn stop_all(origin: OriginFor, maybe_para: Option) -> DispatchResult { ensure_root(origin)?; @@ -187,6 +191,7 @@ pub mod pallet { Ok(()) } + #[pallet::call_index(4)] #[pallet::weight(0)] pub fn ping(origin: OriginFor, seq: u32, payload: Vec) -> DispatchResult { // Only accept pings from other chains. @@ -212,6 +217,7 @@ pub mod pallet { Ok(()) } + #[pallet::call_index(5)] #[pallet::weight(0)] pub fn pong(origin: OriginFor, seq: u32, payload: Vec) -> DispatchResult { // Only accept pings from other chains. diff --git a/test/runtime/src/test_pallet.rs b/test/runtime/src/test_pallet.rs index facb929dc98..59b82bd256e 100644 --- a/test/runtime/src/test_pallet.rs +++ b/test/runtime/src/test_pallet.rs @@ -17,7 +17,7 @@ /// A special pallet that exposes dispatchables that are only useful for testing. pub use pallet::*; -#[frame_support::pallet] +#[frame_support::pallet(dev_mode)] pub mod pallet { use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::*;