diff --git a/asset-registry/src/lib.rs b/asset-registry/src/lib.rs index 4086f19b6..2bea733e5 100644 --- a/asset-registry/src/lib.rs +++ b/asset-registry/src/lib.rs @@ -140,6 +140,7 @@ pub mod module { #[pallet::call] impl Pallet { + #[pallet::call_index(0)] #[pallet::weight(T::WeightInfo::register_asset())] pub fn register_asset( origin: OriginFor, @@ -151,6 +152,7 @@ pub mod module { Self::do_register_asset(metadata, asset_id) } + #[pallet::call_index(1)] #[pallet::weight(T::WeightInfo::update_asset())] pub fn update_asset( origin: OriginFor, diff --git a/auction/src/lib.rs b/auction/src/lib.rs index 7874a28e8..2c9c3ec4b 100644 --- a/auction/src/lib.rs +++ b/auction/src/lib.rs @@ -127,6 +127,7 @@ pub mod module { /// /// The dispatch origin for this call must be `Signed` by the /// transactor. + #[pallet::call_index(0)] #[pallet::weight(T::WeightInfo::bid_collateral_auction())] pub fn bid(origin: OriginFor, id: T::AuctionId, #[pallet::compact] value: T::Balance) -> DispatchResult { let from = ensure_signed(origin)?; diff --git a/authority/src/lib.rs b/authority/src/lib.rs index c140b6f15..506f96578 100644 --- a/authority/src/lib.rs +++ b/authority/src/lib.rs @@ -307,6 +307,7 @@ pub mod module { #[pallet::call] impl Pallet { /// Dispatch a dispatchable on behalf of other origin + #[pallet::call_index(0)] #[pallet::weight({ let info = call.get_dispatch_info(); (T::WeightInfo::dispatch_as().saturating_add(info.weight), info.class) @@ -324,6 +325,7 @@ pub mod module { /// Schedule a dispatchable to be dispatched at later block. /// This is the only way to dispatch a call with `DelayedOrigin`. + #[pallet::call_index(1)] #[pallet::weight(T::WeightInfo::schedule_dispatch_without_delay())] pub fn schedule_dispatch( origin: OriginFor, @@ -375,6 +377,7 @@ pub mod module { } /// Fast track a scheduled dispatchable. + #[pallet::call_index(2)] #[pallet::weight(T::WeightInfo::fast_track_scheduled_dispatch())] pub fn fast_track_scheduled_dispatch( origin: OriginFor, @@ -405,6 +408,7 @@ pub mod module { } /// Delay a scheduled dispatchable. + #[pallet::call_index(3)] #[pallet::weight(T::WeightInfo::delay_scheduled_dispatch())] pub fn delay_scheduled_dispatch( origin: OriginFor, @@ -432,6 +436,7 @@ pub mod module { } /// Cancel a scheduled dispatchable. + #[pallet::call_index(4)] #[pallet::weight(T::WeightInfo::cancel_scheduled_dispatch())] pub fn cancel_scheduled_dispatch( origin: OriginFor, @@ -448,6 +453,7 @@ pub mod module { Ok(()) } + #[pallet::call_index(5)] #[pallet::weight(T::WeightInfo::authorize_call())] pub fn authorize_call( origin: OriginFor, @@ -461,6 +467,7 @@ pub mod module { Ok(()) } + #[pallet::call_index(6)] #[pallet::weight(T::WeightInfo::remove_authorized_call())] pub fn remove_authorized_call(origin: OriginFor, hash: T::Hash) -> DispatchResult { let root_or_signed = @@ -481,6 +488,7 @@ pub mod module { }) } + #[pallet::call_index(7)] #[pallet::weight(( T::WeightInfo::trigger_call().saturating_add((*call_weight_bound).into()), DispatchClass::Operational, @@ -512,6 +520,7 @@ pub mod module { }) } + #[pallet::call_index(8)] #[pallet::weight(( T::WeightInfo::trigger_call().saturating_add(*call_weight_bound), DispatchClass::Operational, diff --git a/bencher/test/src/lib.rs b/bencher/test/src/lib.rs index ed81c5f44..7881e2ea7 100644 --- a/bencher/test/src/lib.rs +++ b/bencher/test/src/lib.rs @@ -38,6 +38,7 @@ pub mod pallet { #[pallet::call] impl Pallet { + #[pallet::call_index(0)] #[pallet::weight(0)] #[orml_weight_meter::start(ModuleWeights::::set_value())] pub fn set_value(origin: OriginFor, n: u32) -> DispatchResultWithPostInfo { @@ -49,6 +50,7 @@ pub mod pallet { Ok(Some(orml_weight_meter::used_weight()).into()) } + #[pallet::call_index(1)] #[pallet::weight(0)] pub fn dummy(origin: OriginFor, _n: u32) -> DispatchResult { let _sender = frame_system::ensure_none(origin)?; @@ -85,4 +87,4 @@ pub mod pallet { _ = Bar::::clear(10, None); } } -} +} \ No newline at end of file diff --git a/benchmarking/src/tests.rs b/benchmarking/src/tests.rs index 15c827918..89ee0e7ff 100644 --- a/benchmarking/src/tests.rs +++ b/benchmarking/src/tests.rs @@ -34,6 +34,7 @@ pub mod test { #[pallet::call] impl Pallet { + #[pallet::call_index(0)] #[pallet::weight(0)] pub fn set_value(origin: OriginFor, n: u32) -> DispatchResult { let _sender = frame_system::ensure_signed(origin)?; @@ -41,6 +42,7 @@ pub mod test { Ok(()) } + #[pallet::call_index(1)] #[pallet::weight(0)] pub fn dummy(origin: OriginFor, _n: u32) -> DispatchResult { let _sender = frame_system::ensure_none(origin)?; diff --git a/currencies/src/lib.rs b/currencies/src/lib.rs index b60c2573f..a7594f9c4 100644 --- a/currencies/src/lib.rs +++ b/currencies/src/lib.rs @@ -126,6 +126,7 @@ pub mod module { /// /// The dispatch origin for this call must be `Signed` by the /// transactor. + #[pallet::call_index(0)] #[pallet::weight(T::WeightInfo::transfer_non_native_currency())] pub fn transfer( origin: OriginFor, @@ -142,6 +143,7 @@ pub mod module { /// /// The dispatch origin for this call must be `Signed` by the /// transactor. + #[pallet::call_index(1)] #[pallet::weight(T::WeightInfo::transfer_native_currency())] pub fn transfer_native_currency( origin: OriginFor, @@ -156,6 +158,7 @@ pub mod module { /// update amount of account `who` under `currency_id`. /// /// The dispatch origin of this call must be _Root_. + #[pallet::call_index(2)] #[pallet::weight(T::WeightInfo::update_balance_non_native_currency())] pub fn update_balance( origin: OriginFor, diff --git a/gradually-update/src/lib.rs b/gradually-update/src/lib.rs index ff34cea19..0371b0fa2 100644 --- a/gradually-update/src/lib.rs +++ b/gradually-update/src/lib.rs @@ -162,6 +162,7 @@ pub mod module { #[pallet::call] impl Pallet { /// Add gradually_update to adjust numeric parameter. + #[pallet::call_index(0)] #[pallet::weight(T::WeightInfo::gradually_update())] pub fn gradually_update(origin: OriginFor, update: GraduallyUpdateOf) -> DispatchResult { T::DispatchOrigin::try_origin(origin).map(|_| ()).or_else(ensure_root)?; @@ -202,6 +203,7 @@ pub mod module { } /// Cancel gradually_update to adjust numeric parameter. + #[pallet::call_index(1)] #[pallet::weight(T::WeightInfo::cancel_gradually_update())] pub fn cancel_gradually_update(origin: OriginFor, key: StorageKeyBytes) -> DispatchResult { T::DispatchOrigin::try_origin(origin).map(|_| ()).or_else(ensure_root)?; diff --git a/oracle/src/lib.rs b/oracle/src/lib.rs index a44ba200d..1d2513197 100644 --- a/oracle/src/lib.rs +++ b/oracle/src/lib.rs @@ -155,6 +155,7 @@ pub mod module { /// Feed the external value. /// /// Require authorized operator. + #[pallet::call_index(0)] #[pallet::weight(T::WeightInfo::feed_values(values.len() as u32))] pub fn feed_values( origin: OriginFor, diff --git a/payments/src/lib.rs b/payments/src/lib.rs index 810839d30..8a66cbee6 100644 --- a/payments/src/lib.rs +++ b/payments/src/lib.rs @@ -280,6 +280,7 @@ pub mod pallet { /// the option to add a remark, this remark can then be used to run /// custom logic and trigger alternate payment flows. the specified /// amount. + #[pallet::call_index(0)] #[pallet::weight(T::WeightInfo::pay(T::MaxRemarkLength::get()))] pub fn pay( origin: OriginFor, @@ -314,6 +315,7 @@ pub mod pallet { /// Release any created payment, this will transfer the reserved amount /// from the creator of the payment to the assigned recipient + #[pallet::call_index(1)] #[pallet::weight(T::WeightInfo::release())] pub fn release(origin: OriginFor, to: T::AccountId) -> DispatchResultWithPostInfo { let from = ensure_signed(origin)?; @@ -332,6 +334,7 @@ pub mod pallet { /// Cancel a payment in created state, this will release the reserved /// back to creator of the payment. This extrinsic can only be called by /// the recipient of the payment + #[pallet::call_index(2)] #[pallet::weight(T::WeightInfo::cancel())] pub fn cancel(origin: OriginFor, creator: T::AccountId) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; @@ -354,6 +357,7 @@ pub mod pallet { /// recipient of the payment. /// This extrinsic allows the assigned judge to /// cancel/release/partial_release the payment. + #[pallet::call_index(3)] #[pallet::weight(T::WeightInfo::resolve_payment())] pub fn resolve_payment( origin: OriginFor, @@ -389,6 +393,7 @@ pub mod pallet { /// Allow the creator of a payment to initiate a refund that will return /// the funds after a configured amount of time that the reveiver has to /// react and opose the request + #[pallet::call_index(4)] #[pallet::weight(T::WeightInfo::request_refund())] pub fn request_refund(origin: OriginFor, recipient: T::AccountId) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; @@ -436,6 +441,7 @@ pub mod pallet { /// payment creator This does not cancel the request, instead sends the /// payment to a NeedsReview state The assigned resolver account can /// then change the state of the payment after review. + #[pallet::call_index(5)] #[pallet::weight(T::WeightInfo::dispute_refund())] pub fn dispute_refund(origin: OriginFor, creator: T::AccountId) -> DispatchResultWithPostInfo { use PaymentState::*; @@ -482,6 +488,7 @@ pub mod pallet { // using the `accept_and_pay` extrinsic. The payment will be in // PaymentRequested State and can only be modified by the `accept_and_pay` // extrinsic. + #[pallet::call_index(6)] #[pallet::weight(T::WeightInfo::request_payment())] pub fn request_payment( origin: OriginFor, @@ -510,6 +517,7 @@ pub mod pallet { // This extrinsic allows the sender to fulfill a payment request created by a // recipient. The amount will be transferred to the recipient and payment // removed from storage + #[pallet::call_index(7)] #[pallet::weight(T::WeightInfo::accept_and_pay())] pub fn accept_and_pay(origin: OriginFor, to: T::AccountId) -> DispatchResultWithPostInfo { let from = ensure_signed(origin)?; diff --git a/tokens/src/lib.rs b/tokens/src/lib.rs index b1d30c822..f6b531899 100644 --- a/tokens/src/lib.rs +++ b/tokens/src/lib.rs @@ -462,6 +462,7 @@ pub mod module { /// - `dest`: The recipient of the transfer. /// - `currency_id`: currency type. /// - `amount`: free balance amount to tranfer. + #[pallet::call_index(0)] #[pallet::weight(T::WeightInfo::transfer())] pub fn transfer( origin: OriginFor, @@ -493,6 +494,7 @@ pub mod module { /// the sender account to be killed (false), or transfer everything /// except at least the existential deposit, which will guarantee to /// keep the sender account alive (true). + #[pallet::call_index(1)] #[pallet::weight(T::WeightInfo::transfer_all())] pub fn transfer_all( origin: OriginFor, @@ -519,6 +521,7 @@ pub mod module { /// - `dest`: The recipient of the transfer. /// - `currency_id`: currency type. /// - `amount`: free balance amount to tranfer. + #[pallet::call_index(2)] #[pallet::weight(T::WeightInfo::transfer_keep_alive())] pub fn transfer_keep_alive( origin: OriginFor, @@ -541,6 +544,7 @@ pub mod module { /// - `dest`: The recipient of the transfer. /// - `currency_id`: currency type. /// - `amount`: free balance amount to tranfer. + #[pallet::call_index(3)] #[pallet::weight(T::WeightInfo::force_transfer())] pub fn force_transfer( origin: OriginFor, @@ -563,6 +567,7 @@ pub mod module { /// existential deposit, it will reap the `AccountInfo`. /// /// The dispatch origin for this call is `root`. + #[pallet::call_index(4)] #[pallet::weight(T::WeightInfo::set_balance())] pub fn set_balance( origin: OriginFor, diff --git a/vesting/src/lib.rs b/vesting/src/lib.rs index 96dab8fb6..8ca778c34 100644 --- a/vesting/src/lib.rs +++ b/vesting/src/lib.rs @@ -244,6 +244,7 @@ pub mod module { #[pallet::call] impl Pallet { + #[pallet::call_index(0)] #[pallet::weight(T::WeightInfo::claim((::MaxVestingSchedules::get() / 2) as u32))] pub fn claim(origin: OriginFor) -> DispatchResult { let who = ensure_signed(origin)?; @@ -256,6 +257,7 @@ pub mod module { Ok(()) } + #[pallet::call_index(1)] #[pallet::weight(T::WeightInfo::vested_transfer())] pub fn vested_transfer( origin: OriginFor, @@ -282,6 +284,7 @@ pub mod module { Ok(()) } + #[pallet::call_index(2)] #[pallet::weight(T::WeightInfo::update_vesting_schedules(vesting_schedules.len() as u32))] pub fn update_vesting_schedules( origin: OriginFor, @@ -297,6 +300,7 @@ pub mod module { Ok(()) } + #[pallet::call_index(3)] #[pallet::weight(T::WeightInfo::claim((::MaxVestingSchedules::get() / 2) as u32))] pub fn claim_for(origin: OriginFor, dest: ::Source) -> DispatchResult { let _ = ensure_signed(origin)?; diff --git a/weight-meter/src/mock.rs b/weight-meter/src/mock.rs index dee781d26..8126a377f 100644 --- a/weight-meter/src/mock.rs +++ b/weight-meter/src/mock.rs @@ -19,6 +19,7 @@ pub mod test_module { #[pallet::call] impl Pallet { + #[pallet::call_index(0)] #[pallet::weight(50_000)] #[orml_weight_meter::start] pub fn expect_100(origin: OriginFor) -> DispatchResultWithPostInfo { @@ -29,6 +30,7 @@ pub mod test_module { Ok(Some(orml_weight_meter::used_weight()).into()) } + #[pallet::call_index(1)] #[pallet::weight(50_000)] #[orml_weight_meter::start] pub fn expect_500(origin: OriginFor) -> DispatchResultWithPostInfo { @@ -43,6 +45,7 @@ pub mod test_module { Ok(Some(orml_weight_meter::used_weight()).into()) } + #[pallet::call_index(2)] #[pallet::weight(50_000)] #[orml_weight_meter::start] pub fn expect_max_weight(origin: OriginFor) -> DispatchResultWithPostInfo { @@ -54,6 +57,7 @@ pub mod test_module { Ok(Some(orml_weight_meter::used_weight()).into()) } + #[pallet::call_index(3)] #[pallet::weight(50_000)] #[orml_weight_meter::start] pub fn expect_100_or_200(origin: OriginFor, branch: bool) -> DispatchResultWithPostInfo { @@ -68,6 +72,7 @@ pub mod test_module { Ok(Some(orml_weight_meter::used_weight()).into()) } + #[pallet::call_index(4)] #[pallet::weight(50_000)] #[orml_weight_meter::start] pub fn nested_inner_methods(origin: OriginFor) -> DispatchResultWithPostInfo { @@ -78,6 +83,7 @@ pub mod test_module { Ok(Some(orml_weight_meter::used_weight()).into()) } + #[pallet::call_index(5)] #[pallet::weight(50_000)] #[orml_weight_meter::start] pub fn nested_extrinsic(origin: OriginFor) -> DispatchResultWithPostInfo { diff --git a/xcm/src/lib.rs b/xcm/src/lib.rs index 61607a5b4..40057f889 100644 --- a/xcm/src/lib.rs +++ b/xcm/src/lib.rs @@ -50,6 +50,7 @@ pub mod module { #[pallet::call] impl Pallet { /// Send an XCM message as parachain sovereign. + #[pallet::call_index(0)] #[pallet::weight(100_000_000)] pub fn send_as_sovereign( origin: OriginFor, diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 89ad16bff..e75585d31 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -199,6 +199,7 @@ pub mod module { /// received. Receiving depends on if the XCM message could be delivered /// by the network, and if the receiving chain would handle /// messages correctly. + #[pallet::call_index(0)] #[pallet::weight(Pallet::::weight_of_transfer(currency_id.clone(), *amount, dest))] pub fn transfer( origin: OriginFor, @@ -224,6 +225,7 @@ pub mod module { /// received. Receiving depends on if the XCM message could be delivered /// by the network, and if the receiving chain would handle /// messages correctly. + #[pallet::call_index(1)] #[pallet::weight(Pallet::::weight_of_transfer_multiasset(asset, dest))] pub fn transfer_multiasset( origin: OriginFor, @@ -258,6 +260,7 @@ pub mod module { /// received. Receiving depends on if the XCM message could be delivered /// by the network, and if the receiving chain would handle /// messages correctly. + #[pallet::call_index(2)] #[pallet::weight(Pallet::::weight_of_transfer(currency_id.clone(), *amount, dest))] pub fn transfer_with_fee( origin: OriginFor, @@ -294,6 +297,7 @@ pub mod module { /// received. Receiving depends on if the XCM message could be delivered /// by the network, and if the receiving chain would handle /// messages correctly. + #[pallet::call_index(3)] #[pallet::weight(Pallet::::weight_of_transfer_multiasset(asset, dest))] pub fn transfer_multiasset_with_fee( origin: OriginFor, @@ -325,6 +329,7 @@ pub mod module { /// received. Receiving depends on if the XCM message could be delivered /// by the network, and if the receiving chain would handle /// messages correctly. + #[pallet::call_index(4)] #[pallet::weight(Pallet::::weight_of_transfer_multicurrencies(currencies, fee_item, dest))] pub fn transfer_multicurrencies( origin: OriginFor, @@ -354,6 +359,7 @@ pub mod module { /// received. Receiving depends on if the XCM message could be delivered /// by the network, and if the receiving chain would handle /// messages correctly. + #[pallet::call_index(5)] #[pallet::weight(Pallet::::weight_of_transfer_multiassets(assets, fee_item, dest))] pub fn transfer_multiassets( origin: OriginFor,