From 331d4b42d72de1dacaed714d69166fa1bc9c92dd Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Tue, 18 Apr 2023 14:09:45 +0200 Subject: [PATCH] Migrate remaining pallets Using script from https://github.com/ggwpez/substrate-scripts/blob/e1b5ea5b5b4018867f3e869fce6f448b4ba9d71f/frame-code-migration/src/call_weight.rs Signed-off-by: Oliver Tale-Yazdi --- bin/node-template/pallets/template/src/lib.rs | 4 +-- frame/bags-list/src/lib.rs | 3 +- frame/contracts/src/lib.rs | 4 +-- frame/conviction-voting/src/lib.rs | 5 +-- frame/democracy/src/lib.rs | 12 +------ .../election-provider-multi-phase/src/lib.rs | 3 +- frame/elections-phragmen/src/lib.rs | 3 +- frame/glutton/src/lib.rs | 4 +-- frame/grandpa/src/lib.rs | 3 +- frame/indices/src/lib.rs | 7 +--- frame/lottery/src/lib.rs | 4 +-- frame/message-queue/src/lib.rs | 3 +- frame/nfts/src/lib.rs | 35 +------------------ frame/nis/src/lib.rs | 7 +--- frame/node-authorization/src/lib.rs | 7 +--- frame/nomination-pools/src/lib.rs | 14 +------- frame/preimage/src/lib.rs | 5 +-- frame/ranked-collective/src/lib.rs | 4 +-- frame/recovery/src/lib.rs | 5 +-- frame/referenda/src/lib.rs | 7 +--- frame/session/src/lib.rs | 4 +-- frame/staking/src/pallet/mod.rs | 15 +------- frame/transaction-storage/src/lib.rs | 3 +- frame/treasury/src/lib.rs | 4 +-- frame/uniques/src/lib.rs | 25 +------------ frame/whitelist/src/lib.rs | 4 +-- 26 files changed, 26 insertions(+), 168 deletions(-) diff --git a/bin/node-template/pallets/template/src/lib.rs b/bin/node-template/pallets/template/src/lib.rs index 9550d3d546cca..1c40356f6f539 100644 --- a/bin/node-template/pallets/template/src/lib.rs +++ b/bin/node-template/pallets/template/src/lib.rs @@ -64,12 +64,11 @@ pub mod pallet { // Dispatchable functions allows users to interact with the pallet and invoke state changes. // These functions materialize as "extrinsics", which are often compared to transactions. // Dispatchable functions must be annotated with a weight and must return a DispatchResult. - #[pallet::call] + #[pallet::call(weight = ::WeightInfo)] 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(T::WeightInfo::do_something())] pub fn do_something(origin: OriginFor, something: u32) -> DispatchResult { // Check that the extrinsic was signed and get the signer. // This function will return an error if the extrinsic is not signed. @@ -87,7 +86,6 @@ pub mod pallet { /// An example dispatchable that may throw a custom error. #[pallet::call_index(1)] - #[pallet::weight(T::WeightInfo::cause_error())] pub fn cause_error(origin: OriginFor) -> DispatchResult { let _who = ensure_signed(origin)?; diff --git a/frame/bags-list/src/lib.rs b/frame/bags-list/src/lib.rs index 87eb2d1b341aa..dd6aa5d39c0c7 100644 --- a/frame/bags-list/src/lib.rs +++ b/frame/bags-list/src/lib.rs @@ -211,7 +211,7 @@ pub mod pallet { } } - #[pallet::call] + #[pallet::call(weight = >::WeightInfo)] impl, I: 'static> Pallet { /// Declare that some `dislocated` account has, through rewards or penalties, sufficiently /// changed its score that it should properly fall into a different bag than its current @@ -243,7 +243,6 @@ pub mod pallet { /// - both nodes are within the same bag, /// - and `origin` has a greater `Score` than `lighter`. #[pallet::call_index(1)] - #[pallet::weight(T::WeightInfo::put_in_front_of())] pub fn put_in_front_of( origin: OriginFor, lighter: AccountIdLookupOf, diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index 26b16b3291a2f..640bf3d63b477 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -374,7 +374,7 @@ pub mod pallet { } } - #[pallet::call] + #[pallet::call(weight = ::WeightInfo)] impl Pallet where as HasCompact>::Type: Clone + Eq + PartialEq + Debug + TypeInfo + Encode, @@ -497,7 +497,6 @@ pub mod pallet { /// A code can only be removed by its original uploader (its owner) and only if it is /// not used by any contract. #[pallet::call_index(4)] - #[pallet::weight(T::WeightInfo::remove_code())] pub fn remove_code( origin: OriginFor, code_hash: CodeHash, @@ -519,7 +518,6 @@ pub mod pallet { /// that the contract address is no longer derived from its code hash after calling /// this dispatchable. #[pallet::call_index(5)] - #[pallet::weight(T::WeightInfo::set_code())] pub fn set_code( origin: OriginFor, dest: AccountIdLookupOf, diff --git a/frame/conviction-voting/src/lib.rs b/frame/conviction-voting/src/lib.rs index 072e57035484d..2e902dd4caa89 100644 --- a/frame/conviction-voting/src/lib.rs +++ b/frame/conviction-voting/src/lib.rs @@ -196,7 +196,7 @@ pub mod pallet { BadClass, } - #[pallet::call] + #[pallet::call(weight = >::WeightInfo)] impl, I: 'static> Pallet { /// Vote in a poll. If `vote.is_aye()`, the vote is to enact the proposal; /// otherwise it is a vote to keep the status quo. @@ -296,7 +296,6 @@ pub mod pallet { /// /// Weight: `O(R)` with R number of vote of target. #[pallet::call_index(3)] - #[pallet::weight(T::WeightInfo::unlock())] pub fn unlock( origin: OriginFor, class: ClassOf, @@ -338,7 +337,6 @@ pub mod pallet { /// Weight: `O(R + log R)` where R is the number of polls that `target` has voted on. /// Weight is calculated for the maximum number of vote. #[pallet::call_index(4)] - #[pallet::weight(T::WeightInfo::remove_vote())] pub fn remove_vote( origin: OriginFor, class: Option>, @@ -365,7 +363,6 @@ pub mod pallet { /// Weight: `O(R + log R)` where R is the number of polls that `target` has voted on. /// Weight is calculated for the maximum number of vote. #[pallet::call_index(5)] - #[pallet::weight(T::WeightInfo::remove_other_vote())] pub fn remove_other_vote( origin: OriginFor, target: AccountIdLookupOf, diff --git a/frame/democracy/src/lib.rs b/frame/democracy/src/lib.rs index a3d7f103a98f3..954bb14033100 100644 --- a/frame/democracy/src/lib.rs +++ b/frame/democracy/src/lib.rs @@ -576,7 +576,7 @@ pub mod pallet { } } - #[pallet::call] + #[pallet::call(weight = ::WeightInfo)] impl Pallet { /// Propose a sensitive action to be taken. /// @@ -588,7 +588,6 @@ pub mod pallet { /// /// Emits `Proposed`. #[pallet::call_index(0)] - #[pallet::weight(T::WeightInfo::propose())] pub fn propose( origin: OriginFor, proposal: BoundedCallOf, @@ -631,7 +630,6 @@ pub mod pallet { /// /// - `proposal`: The index of the proposal to second. #[pallet::call_index(1)] - #[pallet::weight(T::WeightInfo::second())] pub fn second( origin: OriginFor, #[pallet::compact] proposal: PropIndex, @@ -699,7 +697,6 @@ pub mod pallet { /// /// - `proposal_hash`: The preimage hash of the proposal. #[pallet::call_index(4)] - #[pallet::weight(T::WeightInfo::external_propose())] pub fn external_propose( origin: OriginFor, proposal: BoundedCallOf, @@ -728,7 +725,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(5)] - #[pallet::weight(T::WeightInfo::external_propose_majority())] pub fn external_propose_majority( origin: OriginFor, proposal: BoundedCallOf, @@ -750,7 +746,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(6)] - #[pallet::weight(T::WeightInfo::external_propose_default())] pub fn external_propose_default( origin: OriginFor, proposal: BoundedCallOf, @@ -777,7 +772,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(7)] - #[pallet::weight(T::WeightInfo::fast_track())] pub fn fast_track( origin: OriginFor, proposal_hash: H256, @@ -831,7 +825,6 @@ pub mod pallet { /// /// Weight: `O(V + log(V))` where V is number of `existing vetoers` #[pallet::call_index(8)] - #[pallet::weight(T::WeightInfo::veto_external())] pub fn veto_external(origin: OriginFor, proposal_hash: H256) -> DispatchResult { let who = T::VetoOrigin::ensure_origin(origin)?; @@ -867,7 +860,6 @@ pub mod pallet { /// /// # Weight: `O(1)`. #[pallet::call_index(9)] - #[pallet::weight(T::WeightInfo::cancel_referendum())] pub fn cancel_referendum( origin: OriginFor, #[pallet::compact] ref_index: ReferendumIndex, @@ -942,7 +934,6 @@ pub mod pallet { /// /// Weight: `O(1)`. #[pallet::call_index(12)] - #[pallet::weight(T::WeightInfo::clear_public_proposals())] pub fn clear_public_proposals(origin: OriginFor) -> DispatchResult { ensure_root(origin)?; >::kill(); @@ -1096,7 +1087,6 @@ pub mod pallet { /// /// Weight: `O(p)` where `p = PublicProps::::decode_len()` #[pallet::call_index(17)] - #[pallet::weight(T::WeightInfo::cancel_proposal())] pub fn cancel_proposal( origin: OriginFor, #[pallet::compact] prop_index: PropIndex, diff --git a/frame/election-provider-multi-phase/src/lib.rs b/frame/election-provider-multi-phase/src/lib.rs index 3599037104d18..7444d5637d670 100644 --- a/frame/election-provider-multi-phase/src/lib.rs +++ b/frame/election-provider-multi-phase/src/lib.rs @@ -883,7 +883,7 @@ pub mod pallet { } } - #[pallet::call] + #[pallet::call(weight = ::WeightInfo)] impl Pallet { /// Submit a solution for the unsigned phase. /// @@ -1009,7 +1009,6 @@ pub mod pallet { /// A deposit is reserved and recorded for the solution. Based on the outcome, the solution /// might be rewarded, slashed, or get all or a part of the deposit back. #[pallet::call_index(3)] - #[pallet::weight(T::WeightInfo::submit())] pub fn submit( origin: OriginFor, raw_solution: Box>>, diff --git a/frame/elections-phragmen/src/lib.rs b/frame/elections-phragmen/src/lib.rs index d83c94db139a4..956074653390b 100644 --- a/frame/elections-phragmen/src/lib.rs +++ b/frame/elections-phragmen/src/lib.rs @@ -327,7 +327,7 @@ pub mod pallet { } } - #[pallet::call] + #[pallet::call(weight = ::WeightInfo)] impl Pallet { /// Vote for a set of candidates for the upcoming round of election. This can be called to /// set the initial votes, or update already existing votes. @@ -414,7 +414,6 @@ pub mod pallet { /// /// 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) -> DispatchResult { let who = ensure_signed(origin)?; ensure!(Self::is_voter(&who), Error::::MustBeVoter); diff --git a/frame/glutton/src/lib.rs b/frame/glutton/src/lib.rs index e9a46374a5ade..8882d4fc83c9a 100644 --- a/frame/glutton/src/lib.rs +++ b/frame/glutton/src/lib.rs @@ -139,7 +139,7 @@ pub mod pallet { } } - #[pallet::call] + #[pallet::call(weight = ::WeightInfo)] impl Pallet { /// Initializes the pallet by writing into `TrashData`. /// @@ -178,7 +178,6 @@ pub mod pallet { /// /// Only callable by Root. #[pallet::call_index(1)] - #[pallet::weight(T::WeightInfo::set_compute())] pub fn set_compute(origin: OriginFor, compute: Perbill) -> DispatchResult { ensure_root(origin)?; Compute::::set(compute); @@ -192,7 +191,6 @@ pub mod pallet { /// /// Only callable by Root. #[pallet::call_index(2)] - #[pallet::weight(T::WeightInfo::set_storage())] pub fn set_storage(origin: OriginFor, storage: Perbill) -> DispatchResult { ensure_root(origin)?; Storage::::set(storage); diff --git a/frame/grandpa/src/lib.rs b/frame/grandpa/src/lib.rs index f01c25e49edd4..d5c51f08d7819 100644 --- a/frame/grandpa/src/lib.rs +++ b/frame/grandpa/src/lib.rs @@ -181,7 +181,7 @@ pub mod pallet { } } - #[pallet::call] + #[pallet::call(weight = ::WeightInfo)] impl Pallet { /// Report voter equivocation/misbehavior. This method will verify the /// equivocation proof and validate the given key ownership proof @@ -242,7 +242,6 @@ pub mod pallet { /// /// Only callable by root. #[pallet::call_index(2)] - #[pallet::weight(T::WeightInfo::note_stalled())] pub fn note_stalled( origin: OriginFor, delay: T::BlockNumber, diff --git a/frame/indices/src/lib.rs b/frame/indices/src/lib.rs index 74f86abb51914..d041a8808c312 100644 --- a/frame/indices/src/lib.rs +++ b/frame/indices/src/lib.rs @@ -77,7 +77,7 @@ pub mod pallet { #[pallet::pallet] pub struct Pallet(PhantomData); - #[pallet::call] + #[pallet::call(weight = ::WeightInfo)] impl Pallet { /// Assign an previously unassigned index. /// @@ -92,7 +92,6 @@ pub mod pallet { /// ## Complexity /// - `O(1)`. #[pallet::call_index(0)] - #[pallet::weight(T::WeightInfo::claim())] pub fn claim(origin: OriginFor, index: T::AccountIndex) -> DispatchResult { let who = ensure_signed(origin)?; @@ -118,7 +117,6 @@ pub mod pallet { /// ## Complexity /// - `O(1)`. #[pallet::call_index(1)] - #[pallet::weight(T::WeightInfo::transfer())] pub fn transfer( origin: OriginFor, new: AccountIdLookupOf, @@ -153,7 +151,6 @@ pub mod pallet { /// ## Complexity /// - `O(1)`. #[pallet::call_index(2)] - #[pallet::weight(T::WeightInfo::free())] pub fn free(origin: OriginFor, index: T::AccountIndex) -> DispatchResult { let who = ensure_signed(origin)?; @@ -182,7 +179,6 @@ pub mod pallet { /// ## Complexity /// - `O(1)`. #[pallet::call_index(3)] - #[pallet::weight(T::WeightInfo::force_transfer())] pub fn force_transfer( origin: OriginFor, new: AccountIdLookupOf, @@ -215,7 +211,6 @@ pub mod pallet { /// ## Complexity /// - `O(1)`. #[pallet::call_index(4)] - #[pallet::weight(T::WeightInfo::freeze())] pub fn freeze(origin: OriginFor, index: T::AccountIndex) -> DispatchResult { let who = ensure_signed(origin)?; diff --git a/frame/lottery/src/lib.rs b/frame/lottery/src/lib.rs index 178f221a8946f..b17d40861e825 100644 --- a/frame/lottery/src/lib.rs +++ b/frame/lottery/src/lib.rs @@ -282,7 +282,7 @@ pub mod pallet { } } - #[pallet::call] + #[pallet::call(weight = ::WeightInfo)] impl Pallet { /// Buy a ticket to enter the lottery. /// @@ -346,7 +346,6 @@ pub mod pallet { /// * `delay`: How long after the lottery end we should wait before picking a winner. /// * `repeat`: If the lottery should repeat when completed. #[pallet::call_index(2)] - #[pallet::weight(T::WeightInfo::start_lottery())] pub fn start_lottery( origin: OriginFor, price: BalanceOf, @@ -379,7 +378,6 @@ pub mod pallet { /// /// This extrinsic must be called by the `ManagerOrigin`. #[pallet::call_index(3)] - #[pallet::weight(T::WeightInfo::stop_repeat())] pub fn stop_repeat(origin: OriginFor) -> DispatchResult { T::ManagerOrigin::ensure_origin(origin)?; Lottery::::mutate(|mut lottery| { diff --git a/frame/message-queue/src/lib.rs b/frame/message-queue/src/lib.rs index c8e1976103ebf..c08e7be90e2eb 100644 --- a/frame/message-queue/src/lib.rs +++ b/frame/message-queue/src/lib.rs @@ -576,11 +576,10 @@ pub mod pallet { } } - #[pallet::call] + #[pallet::call(weight = ::WeightInfo)] impl Pallet { /// Remove a page which has no more messages remaining to be processed or is stale. #[pallet::call_index(0)] - #[pallet::weight(T::WeightInfo::reap_page())] pub fn reap_page( origin: OriginFor, message_origin: MessageOriginOf, diff --git a/frame/nfts/src/lib.rs b/frame/nfts/src/lib.rs index f4d0e41593476..7d7f556ddf330 100644 --- a/frame/nfts/src/lib.rs +++ b/frame/nfts/src/lib.rs @@ -639,7 +639,7 @@ pub mod pallet { CollectionNotEmpty, } - #[pallet::call] + #[pallet::call(weight = >::WeightInfo)] impl, I: 'static> Pallet { /// Issue a new collection of non-fungible items from a public origin. /// @@ -657,7 +657,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(0)] - #[pallet::weight(T::WeightInfo::create())] pub fn create( origin: OriginFor, admin: AccountIdLookupOf, @@ -701,7 +700,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(1)] - #[pallet::weight(T::WeightInfo::force_create())] pub fn force_create( origin: OriginFor, owner: AccountIdLookupOf, @@ -780,7 +778,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(3)] - #[pallet::weight(T::WeightInfo::mint())] pub fn mint( origin: OriginFor, collection: T::CollectionId, @@ -886,7 +883,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(4)] - #[pallet::weight(T::WeightInfo::force_mint())] pub fn force_mint( origin: OriginFor, collection: T::CollectionId, @@ -920,7 +916,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(5)] - #[pallet::weight(T::WeightInfo::burn())] pub fn burn( origin: OriginFor, collection: T::CollectionId, @@ -953,7 +948,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(6)] - #[pallet::weight(T::WeightInfo::transfer())] pub fn transfer( origin: OriginFor, collection: T::CollectionId, @@ -1054,7 +1048,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(8)] - #[pallet::weight(T::WeightInfo::lock_item_transfer())] pub fn lock_item_transfer( origin: OriginFor, collection: T::CollectionId, @@ -1075,7 +1068,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(9)] - #[pallet::weight(T::WeightInfo::unlock_item_transfer())] pub fn unlock_item_transfer( origin: OriginFor, collection: T::CollectionId, @@ -1098,7 +1090,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(10)] - #[pallet::weight(T::WeightInfo::lock_collection())] pub fn lock_collection( origin: OriginFor, collection: T::CollectionId, @@ -1120,7 +1111,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(11)] - #[pallet::weight(T::WeightInfo::transfer_ownership())] pub fn transfer_ownership( origin: OriginFor, collection: T::CollectionId, @@ -1148,7 +1138,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(12)] - #[pallet::weight(T::WeightInfo::set_team())] pub fn set_team( origin: OriginFor, collection: T::CollectionId, @@ -1176,7 +1165,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(13)] - #[pallet::weight(T::WeightInfo::force_collection_owner())] pub fn force_collection_owner( origin: OriginFor, collection: T::CollectionId, @@ -1198,7 +1186,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(14)] - #[pallet::weight(T::WeightInfo::force_collection_config())] pub fn force_collection_config( origin: OriginFor, collection: T::CollectionId, @@ -1223,7 +1210,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(15)] - #[pallet::weight(T::WeightInfo::approve_transfer())] pub fn approve_transfer( origin: OriginFor, collection: T::CollectionId, @@ -1259,7 +1245,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(16)] - #[pallet::weight(T::WeightInfo::cancel_approval())] pub fn cancel_approval( origin: OriginFor, collection: T::CollectionId, @@ -1287,7 +1272,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(17)] - #[pallet::weight(T::WeightInfo::clear_all_transfer_approvals())] pub fn clear_all_transfer_approvals( origin: OriginFor, collection: T::CollectionId, @@ -1317,7 +1301,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(18)] - #[pallet::weight(T::WeightInfo::lock_item_properties())] pub fn lock_item_properties( origin: OriginFor, collection: T::CollectionId, @@ -1360,7 +1343,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(19)] - #[pallet::weight(T::WeightInfo::set_attribute())] pub fn set_attribute( origin: OriginFor, collection: T::CollectionId, @@ -1396,7 +1378,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(20)] - #[pallet::weight(T::WeightInfo::force_set_attribute())] pub fn force_set_attribute( origin: OriginFor, set_as: Option, @@ -1426,7 +1407,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(21)] - #[pallet::weight(T::WeightInfo::clear_attribute())] pub fn clear_attribute( origin: OriginFor, collection: T::CollectionId, @@ -1450,7 +1430,6 @@ pub mod pallet { /// /// Emits `ItemAttributesApprovalAdded` on success. #[pallet::call_index(22)] - #[pallet::weight(T::WeightInfo::approve_item_attributes())] pub fn approve_item_attributes( origin: OriginFor, collection: T::CollectionId, @@ -1505,7 +1484,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(24)] - #[pallet::weight(T::WeightInfo::set_metadata())] pub fn set_metadata( origin: OriginFor, collection: T::CollectionId, @@ -1532,7 +1510,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(25)] - #[pallet::weight(T::WeightInfo::clear_metadata())] pub fn clear_metadata( origin: OriginFor, collection: T::CollectionId, @@ -1560,7 +1537,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(26)] - #[pallet::weight(T::WeightInfo::set_collection_metadata())] pub fn set_collection_metadata( origin: OriginFor, collection: T::CollectionId, @@ -1585,7 +1561,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(27)] - #[pallet::weight(T::WeightInfo::clear_collection_metadata())] pub fn clear_collection_metadata( origin: OriginFor, collection: T::CollectionId, @@ -1607,7 +1582,6 @@ pub mod pallet { /// /// Emits `OwnershipAcceptanceChanged`. #[pallet::call_index(28)] - #[pallet::weight(T::WeightInfo::set_accept_ownership())] pub fn set_accept_ownership( origin: OriginFor, maybe_collection: Option, @@ -1626,7 +1600,6 @@ pub mod pallet { /// /// Emits `CollectionMaxSupplySet` event when successful. #[pallet::call_index(29)] - #[pallet::weight(T::WeightInfo::set_collection_max_supply())] pub fn set_collection_max_supply( origin: OriginFor, collection: T::CollectionId, @@ -1648,7 +1621,6 @@ pub mod pallet { /// /// Emits `CollectionMintSettingsUpdated` event when successful. #[pallet::call_index(30)] - #[pallet::weight(T::WeightInfo::update_mint_settings())] pub fn update_mint_settings( origin: OriginFor, collection: T::CollectionId, @@ -1676,7 +1648,6 @@ pub mod pallet { /// Emits `ItemPriceSet` on success if the price is not `None`. /// Emits `ItemPriceRemoved` on success if the price is `None`. #[pallet::call_index(31)] - #[pallet::weight(T::WeightInfo::set_price())] pub fn set_price( origin: OriginFor, collection: T::CollectionId, @@ -1699,7 +1670,6 @@ pub mod pallet { /// /// Emits `ItemBought` on success. #[pallet::call_index(32)] - #[pallet::weight(T::WeightInfo::buy_item())] pub fn buy_item( origin: OriginFor, collection: T::CollectionId, @@ -1744,7 +1714,6 @@ pub mod pallet { /// /// Emits `SwapCreated` on success. #[pallet::call_index(34)] - #[pallet::weight(T::WeightInfo::create_swap())] pub fn create_swap( origin: OriginFor, offered_collection: T::CollectionId, @@ -1776,7 +1745,6 @@ pub mod pallet { /// /// Emits `SwapCancelled` on success. #[pallet::call_index(35)] - #[pallet::weight(T::WeightInfo::cancel_swap())] pub fn cancel_swap( origin: OriginFor, offered_collection: T::CollectionId, @@ -1799,7 +1767,6 @@ pub mod pallet { /// /// Emits `SwapClaimed` on success. #[pallet::call_index(36)] - #[pallet::weight(T::WeightInfo::claim_swap())] pub fn claim_swap( origin: OriginFor, send_collection: T::CollectionId, diff --git a/frame/nis/src/lib.rs b/frame/nis/src/lib.rs index c4d0d0d420290..c420d275ea7d0 100644 --- a/frame/nis/src/lib.rs +++ b/frame/nis/src/lib.rs @@ -537,7 +537,7 @@ pub mod pallet { } } - #[pallet::call] + #[pallet::call(weight = ::WeightInfo)] impl Pallet { /// Place a bid. /// @@ -655,7 +655,6 @@ pub mod pallet { /// /// - `origin`: Must be accepted by `FundOrigin`. #[pallet::call_index(2)] - #[pallet::weight(T::WeightInfo::fund_deficit())] pub fn fund_deficit(origin: OriginFor) -> DispatchResult { T::FundOrigin::ensure_origin(origin)?; let summary: SummaryRecordOf = Summary::::get(); @@ -677,7 +676,6 @@ pub mod pallet { /// - `portion`: If `Some`, then only the given portion of the receipt should be thawed. If /// `None`, then all of it should be. #[pallet::call_index(3)] - #[pallet::weight(T::WeightInfo::thaw_private())] pub fn thaw_private( origin: OriginFor, #[pallet::compact] index: ReceiptIndex, @@ -783,7 +781,6 @@ pub mod pallet { /// for receipt `index`. /// - `index`: The index of the receipt. #[pallet::call_index(4)] - #[pallet::weight(T::WeightInfo::thaw_communal())] pub fn thaw_communal( origin: OriginFor, #[pallet::compact] index: ReceiptIndex, @@ -834,7 +831,6 @@ pub mod pallet { /// Make a private receipt communal and create fungible counterparts for its owner. #[pallet::call_index(5)] - #[pallet::weight(T::WeightInfo::communify())] pub fn communify( origin: OriginFor, #[pallet::compact] index: ReceiptIndex, @@ -872,7 +868,6 @@ pub mod pallet { /// Make a communal receipt private and burn fungible counterparts from its owner. #[pallet::call_index(6)] - #[pallet::weight(T::WeightInfo::privatize())] pub fn privatize( origin: OriginFor, #[pallet::compact] index: ReceiptIndex, diff --git a/frame/node-authorization/src/lib.rs b/frame/node-authorization/src/lib.rs index eaeda3cade9e9..27cca7e9433ac 100644 --- a/frame/node-authorization/src/lib.rs +++ b/frame/node-authorization/src/lib.rs @@ -201,7 +201,7 @@ pub mod pallet { } } - #[pallet::call] + #[pallet::call(weight = ::WeightInfo)] impl Pallet { /// Add a node to the set of well known nodes. If the node is already claimed, the owner /// will be updated and keep the existing additional connection unchanged. @@ -322,7 +322,6 @@ pub mod pallet { /// /// - `node`: identifier of the node. #[pallet::call_index(4)] - #[pallet::weight(T::WeightInfo::claim_node())] pub fn claim_node(origin: OriginFor, node: PeerId) -> DispatchResult { let sender = ensure_signed(origin)?; @@ -340,7 +339,6 @@ pub mod pallet { /// /// - `node`: identifier of the node. #[pallet::call_index(5)] - #[pallet::weight(T::WeightInfo::remove_claim())] pub fn remove_claim(origin: OriginFor, node: PeerId) -> DispatchResult { let sender = ensure_signed(origin)?; @@ -361,7 +359,6 @@ pub mod pallet { /// - `node`: identifier of the node. /// - `owner`: new owner of the node. #[pallet::call_index(6)] - #[pallet::weight(T::WeightInfo::transfer_node())] pub fn transfer_node( origin: OriginFor, node: PeerId, @@ -385,7 +382,6 @@ pub mod pallet { /// - `node`: identifier of the node. /// - `connections`: additonal nodes from which the connections are allowed. #[pallet::call_index(7)] - #[pallet::weight(T::WeightInfo::add_connections())] pub fn add_connections( origin: OriginFor, node: PeerId, @@ -420,7 +416,6 @@ pub mod pallet { /// - `node`: identifier of the node. /// - `connections`: additonal nodes from which the connections are not allowed anymore. #[pallet::call_index(8)] - #[pallet::weight(T::WeightInfo::remove_connections())] pub fn remove_connections( origin: OriginFor, node: PeerId, diff --git a/frame/nomination-pools/src/lib.rs b/frame/nomination-pools/src/lib.rs index 78f0c730ce5dd..d10ecf21e75ee 100644 --- a/frame/nomination-pools/src/lib.rs +++ b/frame/nomination-pools/src/lib.rs @@ -1859,7 +1859,7 @@ pub mod pallet { } } - #[pallet::call] + #[pallet::call(weight = ::WeightInfo)] impl Pallet { /// Stake funds with a pool. The amount to bond is transferred from the member to the /// pools account and immediately increases the pools bond. @@ -1872,7 +1872,6 @@ pub mod pallet { /// `existential deposit + amount` in their account. /// * Only a pool with [`PoolState::Open`] can be joined #[pallet::call_index(0)] - #[pallet::weight(T::WeightInfo::join())] pub fn join( origin: OriginFor, #[pallet::compact] amount: BalanceOf, @@ -1953,7 +1952,6 @@ pub mod pallet { /// /// See `claim_payout_other` to caim rewards on bahalf of some `other` pool member. #[pallet::call_index(2)] - #[pallet::weight(T::WeightInfo::claim_payout())] pub fn claim_payout(origin: OriginFor) -> DispatchResult { let signer = ensure_signed(origin)?; Self::do_claim_payout(signer.clone(), signer) @@ -1991,7 +1989,6 @@ pub mod pallet { /// in which case, the result of this call will likely be the `NoMoreChunks` error from the /// staking system. #[pallet::call_index(3)] - #[pallet::weight(T::WeightInfo::unbond())] pub fn unbond( origin: OriginFor, member_account: AccountIdLookupOf, @@ -2230,7 +2227,6 @@ pub mod pallet { /// In addition to `amount`, the caller will transfer the existential deposit; so the caller /// needs at have at least `amount + existential_deposit` transferrable. #[pallet::call_index(6)] - #[pallet::weight(T::WeightInfo::create())] pub fn create( origin: OriginFor, #[pallet::compact] amount: BalanceOf, @@ -2303,7 +2299,6 @@ pub mod pallet { /// 2. if the pool conditions to be open are NOT met (as described by `ok_to_be_open`), and /// then the state of the pool can be permissionlessly changed to `Destroying`. #[pallet::call_index(9)] - #[pallet::weight(T::WeightInfo::set_state())] pub fn set_state( origin: OriginFor, pool_id: PoolId, @@ -2365,7 +2360,6 @@ pub mod pallet { /// * `max_members_per_pool` - Set [`MaxPoolMembersPerPool`]. /// * `global_max_commission` - Set [`GlobalMaxCommission`]. #[pallet::call_index(11)] - #[pallet::weight(T::WeightInfo::set_configs())] pub fn set_configs( origin: OriginFor, min_join_bond: ConfigOp>, @@ -2404,7 +2398,6 @@ pub mod pallet { /// It emits an event, notifying UIs of the role change. This event is quite relevant to /// most pool members and they should be informed of changes to pool roles. #[pallet::call_index(12)] - #[pallet::weight(T::WeightInfo::update_roles())] pub fn update_roles( origin: OriginFor, pool_id: PoolId, @@ -2457,7 +2450,6 @@ pub mod pallet { /// This directly forward the call to the staking pallet, on behalf of the pool bonded /// account. #[pallet::call_index(13)] - #[pallet::weight(T::WeightInfo::chill())] pub fn chill(origin: OriginFor, pool_id: PoolId) -> DispatchResult { let who = ensure_signed(origin)?; let bonded_pool = BondedPool::::get(pool_id).ok_or(Error::::PoolNotFound)?; @@ -2533,7 +2525,6 @@ pub mod pallet { /// /// - If a `None` is supplied to `new_commission`, existing commission will be removed. #[pallet::call_index(17)] - #[pallet::weight(T::WeightInfo::set_commission())] pub fn set_commission( origin: OriginFor, pool_id: PoolId, @@ -2569,7 +2560,6 @@ pub mod pallet { /// - Current commission will be lowered in the event it is higher than a new max /// commission. #[pallet::call_index(18)] - #[pallet::weight(T::WeightInfo::set_commission_max())] pub fn set_commission_max( origin: OriginFor, pool_id: PoolId, @@ -2591,7 +2581,6 @@ pub mod pallet { /// Initial change rate is not bounded, whereas subsequent updates can only be more /// restrictive than the current. #[pallet::call_index(19)] - #[pallet::weight(T::WeightInfo::set_commission_change_rate())] pub fn set_commission_change_rate( origin: OriginFor, pool_id: PoolId, @@ -2617,7 +2606,6 @@ pub mod pallet { /// commission is paid out and added to total claimed commission`. Total pending commission /// is reset to zero. the current. #[pallet::call_index(20)] - #[pallet::weight(T::WeightInfo::claim_commission())] pub fn claim_commission(origin: OriginFor, pool_id: PoolId) -> DispatchResult { let who = ensure_signed(origin)?; Self::do_claim_commission(who, pool_id) diff --git a/frame/preimage/src/lib.rs b/frame/preimage/src/lib.rs index 60208424db953..354a4c66fb7c8 100644 --- a/frame/preimage/src/lib.rs +++ b/frame/preimage/src/lib.rs @@ -146,7 +146,7 @@ pub mod pallet { pub(super) type PreimageFor = StorageMap<_, Identity, (T::Hash, u32), BoundedVec>>; - #[pallet::call] + #[pallet::call(weight = ::WeightInfo)] impl Pallet { /// Register a preimage on-chain. /// @@ -173,7 +173,6 @@ pub mod pallet { /// - `hash`: The hash of the preimage to be removed from the store. /// - `len`: The length of the preimage of `hash`. #[pallet::call_index(1)] - #[pallet::weight(T::WeightInfo::unnote_preimage())] pub fn unnote_preimage(origin: OriginFor, hash: T::Hash) -> DispatchResult { let maybe_sender = Self::ensure_signed_or_manager(origin)?; Self::do_unnote_preimage(&hash, maybe_sender) @@ -184,7 +183,6 @@ pub mod pallet { /// If the preimage requests has already been provided on-chain, we unreserve any deposit /// a user may have paid, and take the control of the preimage out of their hands. #[pallet::call_index(2)] - #[pallet::weight(T::WeightInfo::request_preimage())] pub fn request_preimage(origin: OriginFor, hash: T::Hash) -> DispatchResult { T::ManagerOrigin::ensure_origin(origin)?; Self::do_request_preimage(&hash); @@ -195,7 +193,6 @@ pub mod pallet { /// /// NOTE: THIS MUST NOT BE CALLED ON `hash` MORE TIMES THAN `request_preimage`. #[pallet::call_index(3)] - #[pallet::weight(T::WeightInfo::unrequest_preimage())] pub fn unrequest_preimage(origin: OriginFor, hash: T::Hash) -> DispatchResult { T::ManagerOrigin::ensure_origin(origin)?; Self::do_unrequest_preimage(&hash) diff --git a/frame/ranked-collective/src/lib.rs b/frame/ranked-collective/src/lib.rs index 288fd78d6e718..f4ca9fe886482 100644 --- a/frame/ranked-collective/src/lib.rs +++ b/frame/ranked-collective/src/lib.rs @@ -428,7 +428,7 @@ pub mod pallet { NoPermission, } - #[pallet::call] + #[pallet::call(weight = >::WeightInfo)] impl, I: 'static> Pallet { /// Introduce a new member. /// @@ -438,7 +438,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(0)] - #[pallet::weight(T::WeightInfo::add_member())] pub fn add_member(origin: OriginFor, who: AccountIdLookupOf) -> DispatchResult { let _ = T::PromoteOrigin::ensure_origin(origin)?; let who = T::Lookup::lookup(who)?; @@ -517,7 +516,6 @@ pub mod pallet { /// /// 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, poll: PollIndexOf, diff --git a/frame/recovery/src/lib.rs b/frame/recovery/src/lib.rs index d66b5725fd4f7..9d671ef4c5bd2 100644 --- a/frame/recovery/src/lib.rs +++ b/frame/recovery/src/lib.rs @@ -363,7 +363,7 @@ pub mod pallet { #[pallet::getter(fn proxy)] pub type Proxy = StorageMap<_, Blake2_128Concat, T::AccountId, T::AccountId>; - #[pallet::call] + #[pallet::call(weight = ::WeightInfo)] impl Pallet { /// Send a call through a recovered account. /// @@ -404,7 +404,6 @@ pub mod pallet { /// - `lost`: The "lost account" to be recovered. /// - `rescuer`: The "rescuer account" which can call as the lost account. #[pallet::call_index(1)] - #[pallet::weight(T::WeightInfo::set_recovered())] pub fn set_recovered( origin: OriginFor, lost: AccountIdLookupOf, @@ -491,7 +490,6 @@ pub mod pallet { /// - `account`: The lost account that you want to recover. This account needs to be /// recoverable (i.e. have a recovery configuration). #[pallet::call_index(3)] - #[pallet::weight(T::WeightInfo::initiate_recovery())] pub fn initiate_recovery( origin: OriginFor, account: AccountIdLookupOf, @@ -689,7 +687,6 @@ pub mod pallet { /// Parameters: /// - `account`: The recovered account you are able to call on-behalf-of. #[pallet::call_index(8)] - #[pallet::weight(T::WeightInfo::cancel_recovered())] pub fn cancel_recovered( origin: OriginFor, account: AccountIdLookupOf, diff --git a/frame/referenda/src/lib.rs b/frame/referenda/src/lib.rs index 68837376c5b33..c34b90c98c756 100644 --- a/frame/referenda/src/lib.rs +++ b/frame/referenda/src/lib.rs @@ -411,7 +411,7 @@ pub mod pallet { PreimageNotExist, } - #[pallet::call] + #[pallet::call(weight = >::WeightInfo)] impl, I: 'static> Pallet { /// Propose a referendum on a privileged action. /// @@ -423,7 +423,6 @@ pub mod pallet { /// /// Emits `Submitted`. #[pallet::call_index(0)] - #[pallet::weight(T::WeightInfo::submit())] pub fn submit( origin: OriginFor, proposal_origin: Box>, @@ -499,7 +498,6 @@ pub mod pallet { /// /// Emits `DecisionDepositRefunded`. #[pallet::call_index(2)] - #[pallet::weight(T::WeightInfo::refund_decision_deposit())] pub fn refund_decision_deposit( origin: OriginFor, index: ReferendumIndex, @@ -529,7 +527,6 @@ pub mod pallet { /// /// Emits `Cancelled`. #[pallet::call_index(3)] - #[pallet::weight(T::WeightInfo::cancel())] pub fn cancel(origin: OriginFor, index: ReferendumIndex) -> DispatchResult { T::CancelOrigin::ensure_origin(origin)?; let status = Self::ensure_ongoing(index)?; @@ -554,7 +551,6 @@ pub mod pallet { /// /// Emits `Killed` and `DepositSlashed`. #[pallet::call_index(4)] - #[pallet::weight(T::WeightInfo::kill())] pub fn kill(origin: OriginFor, index: ReferendumIndex) -> DispatchResult { T::KillOrigin::ensure_origin(origin)?; let status = Self::ensure_ongoing(index)?; @@ -637,7 +633,6 @@ pub mod pallet { /// /// Emits `SubmissionDepositRefunded`. #[pallet::call_index(7)] - #[pallet::weight(T::WeightInfo::refund_submission_deposit())] pub fn refund_submission_deposit( origin: OriginFor, index: ReferendumIndex, diff --git a/frame/session/src/lib.rs b/frame/session/src/lib.rs index a9f89412a71c4..174da2ed6af8b 100644 --- a/frame/session/src/lib.rs +++ b/frame/session/src/lib.rs @@ -578,7 +578,7 @@ pub mod pallet { } } - #[pallet::call] + #[pallet::call(weight = ::WeightInfo)] impl Pallet { /// Sets the session key(s) of the function caller to `keys`. /// Allows an account to set its session key prior to becoming a validator. @@ -590,7 +590,6 @@ pub mod pallet { /// - `O(1)`. Actual cost depends on the number of length of `T::Keys::key_ids()` which is /// fixed. #[pallet::call_index(0)] - #[pallet::weight(T::WeightInfo::set_keys())] pub fn set_keys(origin: OriginFor, keys: T::Keys, proof: Vec) -> DispatchResult { let who = ensure_signed(origin)?; ensure!(keys.ownership_proof_is_valid(&proof), Error::::InvalidProof); @@ -612,7 +611,6 @@ pub mod pallet { /// - `O(1)` in number of key types. Actual cost depends on the number of length of /// `T::Keys::key_ids()` which is fixed. #[pallet::call_index(1)] - #[pallet::weight(T::WeightInfo::purge_keys())] pub fn purge_keys(origin: OriginFor) -> DispatchResult { let who = ensure_signed(origin)?; Self::do_purge_keys(&who)?; diff --git a/frame/staking/src/pallet/mod.rs b/frame/staking/src/pallet/mod.rs index d8f1855da4bc0..a37783182b5d5 100644 --- a/frame/staking/src/pallet/mod.rs +++ b/frame/staking/src/pallet/mod.rs @@ -829,7 +829,7 @@ pub mod pallet { } } - #[pallet::call] + #[pallet::call(weight = ::WeightInfo)] impl Pallet { /// Take the origin account as a stash and lock up `value` of its balance. `controller` will /// be the account that controls it. @@ -847,7 +847,6 @@ pub mod pallet { /// NOTE: Two of the storage writes (`Self::bonded`, `Self::payee`) are _never_ cleaned /// unless the `origin` falls below _existential deposit_ and gets removed as dust. #[pallet::call_index(0)] - #[pallet::weight(T::WeightInfo::bond())] pub fn bond( origin: OriginFor, controller: AccountIdLookupOf, @@ -916,7 +915,6 @@ pub mod pallet { /// - Independent of the arguments. Insignificant complexity. /// - O(1). #[pallet::call_index(1)] - #[pallet::weight(T::WeightInfo::bond_extra())] pub fn bond_extra( origin: OriginFor, #[pallet::compact] max_additional: BalanceOf, @@ -1093,7 +1091,6 @@ pub mod pallet { /// /// The dispatch origin for this call must be _Signed_ by the controller, not the stash. #[pallet::call_index(4)] - #[pallet::weight(T::WeightInfo::validate())] pub fn validate(origin: OriginFor, prefs: ValidatorPrefs) -> DispatchResult { let controller = ensure_signed(origin)?; @@ -1204,7 +1201,6 @@ pub mod pallet { /// - Contains one read. /// - Writes are limited to the `origin` account key. #[pallet::call_index(6)] - #[pallet::weight(T::WeightInfo::chill())] pub fn chill(origin: OriginFor) -> DispatchResult { let controller = ensure_signed(origin)?; let ledger = Self::ledger(&controller).ok_or(Error::::NotController)?; @@ -1225,7 +1221,6 @@ pub mod pallet { /// - Writes are limited to the `origin` account key. /// --------- #[pallet::call_index(7)] - #[pallet::weight(T::WeightInfo::set_payee())] pub fn set_payee( origin: OriginFor, payee: RewardDestination, @@ -1249,7 +1244,6 @@ pub mod pallet { /// - Contains a limited number of reads. /// - Writes are limited to the `origin` account key. #[pallet::call_index(8)] - #[pallet::weight(T::WeightInfo::set_controller())] pub fn set_controller( origin: OriginFor, controller: AccountIdLookupOf, @@ -1276,7 +1270,6 @@ pub mod pallet { /// ## Complexity /// O(1) #[pallet::call_index(9)] - #[pallet::weight(T::WeightInfo::set_validator_count())] pub fn set_validator_count( origin: OriginFor, #[pallet::compact] new: u32, @@ -1354,7 +1347,6 @@ pub mod pallet { /// - No arguments. /// - Weight: O(1) #[pallet::call_index(12)] - #[pallet::weight(T::WeightInfo::force_no_eras())] pub fn force_no_eras(origin: OriginFor) -> DispatchResult { ensure_root(origin)?; Self::set_force_era(Forcing::ForceNone); @@ -1376,7 +1368,6 @@ pub mod pallet { /// - No arguments. /// - Weight: O(1) #[pallet::call_index(13)] - #[pallet::weight(T::WeightInfo::force_new_era())] pub fn force_new_era(origin: OriginFor) -> DispatchResult { ensure_root(origin)?; Self::set_force_era(Forcing::ForceNew); @@ -1427,7 +1418,6 @@ pub mod pallet { /// If this is called just before a new era is triggered, the election process may not /// have enough blocks to get a result. #[pallet::call_index(16)] - #[pallet::weight(T::WeightInfo::force_new_era_always())] pub fn force_new_era_always(origin: OriginFor) -> DispatchResult { ensure_root(origin)?; Self::set_force_era(Forcing::ForceAlways); @@ -1682,7 +1672,6 @@ pub mod pallet { /// This can be helpful if bond requirements are updated, and we need to remove old users /// who do not satisfy these requirements. #[pallet::call_index(23)] - #[pallet::weight(T::WeightInfo::chill_other())] pub fn chill_other(origin: OriginFor, controller: T::AccountId) -> DispatchResult { // Anyone can call this function. let caller = ensure_signed(origin)?; @@ -1745,7 +1734,6 @@ pub mod pallet { /// validator who already has a commission greater than or equal to the minimum. Any account /// can call this. #[pallet::call_index(24)] - #[pallet::weight(T::WeightInfo::force_apply_min_commission())] pub fn force_apply_min_commission( origin: OriginFor, validator_stash: T::AccountId, @@ -1769,7 +1757,6 @@ pub mod pallet { /// This call has lower privilege requirements than `set_staking_config` and can be called /// by the `T::AdminOrigin`. Root can always call this. #[pallet::call_index(25)] - #[pallet::weight(T::WeightInfo::set_min_commission())] pub fn set_min_commission(origin: OriginFor, new: Perbill) -> DispatchResult { T::AdminOrigin::ensure_origin(origin)?; MinCommission::::put(new); diff --git a/frame/transaction-storage/src/lib.rs b/frame/transaction-storage/src/lib.rs index 59662ee860541..a519a63a318a0 100644 --- a/frame/transaction-storage/src/lib.rs +++ b/frame/transaction-storage/src/lib.rs @@ -179,7 +179,7 @@ pub mod pallet { } } - #[pallet::call] + #[pallet::call(weight = ::WeightInfo)] impl Pallet { /// Index and store data off chain. Minimum data size is 1 bytes, maximum is /// `MaxTransactionSize`. Data will be removed after `STORAGE_PERIOD` blocks, unless `renew` @@ -235,7 +235,6 @@ pub mod pallet { /// ## Complexity /// - O(1). #[pallet::call_index(1)] - #[pallet::weight(T::WeightInfo::renew())] pub fn renew( origin: OriginFor, block: T::BlockNumber, diff --git a/frame/treasury/src/lib.rs b/frame/treasury/src/lib.rs index 450aee51f2ce8..25eab73f486f1 100644 --- a/frame/treasury/src/lib.rs +++ b/frame/treasury/src/lib.rs @@ -343,7 +343,7 @@ pub mod pallet { spend_in_context: BTreeMap, } - #[pallet::call] + #[pallet::call(weight = >::WeightInfo)] impl, I: 'static> Pallet { /// Put forward a suggestion for spending. A deposit proportional to the value /// is reserved and slashed if the proposal is rejected. It is returned once the @@ -352,7 +352,6 @@ pub mod pallet { /// ## Complexity /// - O(1) #[pallet::call_index(0)] - #[pallet::weight(T::WeightInfo::propose_spend())] pub fn propose_spend( origin: OriginFor, #[pallet::compact] value: BalanceOf, @@ -430,7 +429,6 @@ pub mod pallet { /// NOTE: For record-keeping purposes, the proposer is deemed to be equivalent to the /// beneficiary. #[pallet::call_index(3)] - #[pallet::weight(T::WeightInfo::spend())] pub fn spend( origin: OriginFor, #[pallet::compact] amount: BalanceOf, diff --git a/frame/uniques/src/lib.rs b/frame/uniques/src/lib.rs index fd94bd3a9a7e4..0aeb8090047c5 100644 --- a/frame/uniques/src/lib.rs +++ b/frame/uniques/src/lib.rs @@ -432,7 +432,7 @@ pub mod pallet { } } - #[pallet::call] + #[pallet::call(weight = >::WeightInfo)] impl, I: 'static> Pallet { /// Issue a new collection of non-fungible items from a public origin. /// @@ -451,7 +451,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(0)] - #[pallet::weight(T::WeightInfo::create())] pub fn create( origin: OriginFor, collection: T::CollectionId, @@ -488,7 +487,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(1)] - #[pallet::weight(T::WeightInfo::force_create())] pub fn force_create( origin: OriginFor, collection: T::CollectionId, @@ -560,7 +558,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(3)] - #[pallet::weight(T::WeightInfo::mint())] pub fn mint( origin: OriginFor, collection: T::CollectionId, @@ -592,7 +589,6 @@ pub mod pallet { /// Weight: `O(1)` /// Modes: `check_owner.is_some()`. #[pallet::call_index(4)] - #[pallet::weight(T::WeightInfo::burn())] pub fn burn( origin: OriginFor, collection: T::CollectionId, @@ -631,7 +627,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(5)] - #[pallet::weight(T::WeightInfo::transfer())] pub fn transfer( origin: OriginFor, collection: T::CollectionId, @@ -729,7 +724,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(7)] - #[pallet::weight(T::WeightInfo::freeze())] pub fn freeze( origin: OriginFor, collection: T::CollectionId, @@ -761,7 +755,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(8)] - #[pallet::weight(T::WeightInfo::thaw())] pub fn thaw( origin: OriginFor, collection: T::CollectionId, @@ -792,7 +785,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(9)] - #[pallet::weight(T::WeightInfo::freeze_collection())] pub fn freeze_collection( origin: OriginFor, collection: T::CollectionId, @@ -820,7 +812,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(10)] - #[pallet::weight(T::WeightInfo::thaw_collection())] pub fn thaw_collection( origin: OriginFor, collection: T::CollectionId, @@ -850,7 +841,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(11)] - #[pallet::weight(T::WeightInfo::transfer_ownership())] pub fn transfer_ownership( origin: OriginFor, collection: T::CollectionId, @@ -899,7 +889,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(12)] - #[pallet::weight(T::WeightInfo::set_team())] pub fn set_team( origin: OriginFor, collection: T::CollectionId, @@ -940,7 +929,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(13)] - #[pallet::weight(T::WeightInfo::approve_transfer())] pub fn approve_transfer( origin: OriginFor, collection: T::CollectionId, @@ -994,7 +982,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(14)] - #[pallet::weight(T::WeightInfo::cancel_approval())] pub fn cancel_approval( origin: OriginFor, collection: T::CollectionId, @@ -1047,7 +1034,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(15)] - #[pallet::weight(T::WeightInfo::force_item_status())] pub fn force_item_status( origin: OriginFor, collection: T::CollectionId, @@ -1097,7 +1083,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(16)] - #[pallet::weight(T::WeightInfo::set_attribute())] pub fn set_attribute( origin: OriginFor, collection: T::CollectionId, @@ -1160,7 +1145,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(17)] - #[pallet::weight(T::WeightInfo::clear_attribute())] pub fn clear_attribute( origin: OriginFor, collection: T::CollectionId, @@ -1210,7 +1194,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(18)] - #[pallet::weight(T::WeightInfo::set_metadata())] pub fn set_metadata( origin: OriginFor, collection: T::CollectionId, @@ -1273,7 +1256,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(19)] - #[pallet::weight(T::WeightInfo::clear_metadata())] pub fn clear_metadata( origin: OriginFor, collection: T::CollectionId, @@ -1323,7 +1305,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(20)] - #[pallet::weight(T::WeightInfo::set_collection_metadata())] pub fn set_collection_metadata( origin: OriginFor, collection: T::CollectionId, @@ -1381,7 +1362,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(21)] - #[pallet::weight(T::WeightInfo::clear_collection_metadata())] pub fn clear_collection_metadata( origin: OriginFor, collection: T::CollectionId, @@ -1418,7 +1398,6 @@ pub mod pallet { /// /// Emits `OwnershipAcceptanceChanged`. #[pallet::call_index(22)] - #[pallet::weight(T::WeightInfo::set_accept_ownership())] pub fn set_accept_ownership( origin: OriginFor, maybe_collection: Option, @@ -1455,7 +1434,6 @@ pub mod pallet { /// /// Emits `CollectionMaxSupplySet` event when successful. #[pallet::call_index(23)] - #[pallet::weight(T::WeightInfo::set_collection_max_supply())] pub fn set_collection_max_supply( origin: OriginFor, collection: T::CollectionId, @@ -1495,7 +1473,6 @@ pub mod pallet { /// Emits `ItemPriceSet` on success if the price is not `None`. /// Emits `ItemPriceRemoved` on success if the price is `None`. #[pallet::call_index(24)] - #[pallet::weight(T::WeightInfo::set_price())] pub fn set_price( origin: OriginFor, collection: T::CollectionId, diff --git a/frame/whitelist/src/lib.rs b/frame/whitelist/src/lib.rs index decf010b06757..08828293e7551 100644 --- a/frame/whitelist/src/lib.rs +++ b/frame/whitelist/src/lib.rs @@ -116,10 +116,9 @@ pub mod pallet { pub type WhitelistedCall = StorageMap<_, Twox64Concat, PreimageHash, (), OptionQuery>; - #[pallet::call] + #[pallet::call(weight = ::WeightInfo)] impl Pallet { #[pallet::call_index(0)] - #[pallet::weight(T::WeightInfo::whitelist_call())] pub fn whitelist_call(origin: OriginFor, call_hash: PreimageHash) -> DispatchResult { T::WhitelistOrigin::ensure_origin(origin)?; @@ -137,7 +136,6 @@ pub mod pallet { } #[pallet::call_index(1)] - #[pallet::weight(T::WeightInfo::remove_whitelisted_call())] pub fn remove_whitelisted_call( origin: OriginFor, call_hash: PreimageHash,