Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 331d4b4

Browse files
committed
1 parent fe3d657 commit 331d4b4

File tree

26 files changed

+26
-168
lines changed

26 files changed

+26
-168
lines changed

bin/node-template/pallets/template/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,11 @@ pub mod pallet {
6464
// Dispatchable functions allows users to interact with the pallet and invoke state changes.
6565
// These functions materialize as "extrinsics", which are often compared to transactions.
6666
// Dispatchable functions must be annotated with a weight and must return a DispatchResult.
67-
#[pallet::call]
67+
#[pallet::call(weight = <T as crate::Config>::WeightInfo)]
6868
impl<T: Config> Pallet<T> {
6969
/// An example dispatchable that takes a singles value as a parameter, writes the value to
7070
/// storage and emits an event. This function must be dispatched by a signed extrinsic.
7171
#[pallet::call_index(0)]
72-
#[pallet::weight(T::WeightInfo::do_something())]
7372
pub fn do_something(origin: OriginFor<T>, something: u32) -> DispatchResult {
7473
// Check that the extrinsic was signed and get the signer.
7574
// This function will return an error if the extrinsic is not signed.
@@ -87,7 +86,6 @@ pub mod pallet {
8786

8887
/// An example dispatchable that may throw a custom error.
8988
#[pallet::call_index(1)]
90-
#[pallet::weight(T::WeightInfo::cause_error())]
9189
pub fn cause_error(origin: OriginFor<T>) -> DispatchResult {
9290
let _who = ensure_signed(origin)?;
9391

frame/bags-list/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ pub mod pallet {
211211
}
212212
}
213213

214-
#[pallet::call]
214+
#[pallet::call(weight = <T as crate::Config<I>>::WeightInfo)]
215215
impl<T: Config<I>, I: 'static> Pallet<T, I> {
216216
/// Declare that some `dislocated` account has, through rewards or penalties, sufficiently
217217
/// changed its score that it should properly fall into a different bag than its current
@@ -243,7 +243,6 @@ pub mod pallet {
243243
/// - both nodes are within the same bag,
244244
/// - and `origin` has a greater `Score` than `lighter`.
245245
#[pallet::call_index(1)]
246-
#[pallet::weight(T::WeightInfo::put_in_front_of())]
247246
pub fn put_in_front_of(
248247
origin: OriginFor<T>,
249248
lighter: AccountIdLookupOf<T>,

frame/contracts/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ pub mod pallet {
374374
}
375375
}
376376

377-
#[pallet::call]
377+
#[pallet::call(weight = <T as crate::Config>::WeightInfo)]
378378
impl<T: Config> Pallet<T>
379379
where
380380
<BalanceOf<T> as HasCompact>::Type: Clone + Eq + PartialEq + Debug + TypeInfo + Encode,
@@ -497,7 +497,6 @@ pub mod pallet {
497497
/// A code can only be removed by its original uploader (its owner) and only if it is
498498
/// not used by any contract.
499499
#[pallet::call_index(4)]
500-
#[pallet::weight(T::WeightInfo::remove_code())]
501500
pub fn remove_code(
502501
origin: OriginFor<T>,
503502
code_hash: CodeHash<T>,
@@ -519,7 +518,6 @@ pub mod pallet {
519518
/// that the contract address is no longer derived from its code hash after calling
520519
/// this dispatchable.
521520
#[pallet::call_index(5)]
522-
#[pallet::weight(T::WeightInfo::set_code())]
523521
pub fn set_code(
524522
origin: OriginFor<T>,
525523
dest: AccountIdLookupOf<T>,

frame/conviction-voting/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ pub mod pallet {
196196
BadClass,
197197
}
198198

199-
#[pallet::call]
199+
#[pallet::call(weight = <T as crate::Config<I>>::WeightInfo)]
200200
impl<T: Config<I>, I: 'static> Pallet<T, I> {
201201
/// Vote in a poll. If `vote.is_aye()`, the vote is to enact the proposal;
202202
/// otherwise it is a vote to keep the status quo.
@@ -296,7 +296,6 @@ pub mod pallet {
296296
///
297297
/// Weight: `O(R)` with R number of vote of target.
298298
#[pallet::call_index(3)]
299-
#[pallet::weight(T::WeightInfo::unlock())]
300299
pub fn unlock(
301300
origin: OriginFor<T>,
302301
class: ClassOf<T, I>,
@@ -338,7 +337,6 @@ pub mod pallet {
338337
/// Weight: `O(R + log R)` where R is the number of polls that `target` has voted on.
339338
/// Weight is calculated for the maximum number of vote.
340339
#[pallet::call_index(4)]
341-
#[pallet::weight(T::WeightInfo::remove_vote())]
342340
pub fn remove_vote(
343341
origin: OriginFor<T>,
344342
class: Option<ClassOf<T, I>>,
@@ -365,7 +363,6 @@ pub mod pallet {
365363
/// Weight: `O(R + log R)` where R is the number of polls that `target` has voted on.
366364
/// Weight is calculated for the maximum number of vote.
367365
#[pallet::call_index(5)]
368-
#[pallet::weight(T::WeightInfo::remove_other_vote())]
369366
pub fn remove_other_vote(
370367
origin: OriginFor<T>,
371368
target: AccountIdLookupOf<T>,

frame/democracy/src/lib.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ pub mod pallet {
576576
}
577577
}
578578

579-
#[pallet::call]
579+
#[pallet::call(weight = <T as crate::Config>::WeightInfo)]
580580
impl<T: Config> Pallet<T> {
581581
/// Propose a sensitive action to be taken.
582582
///
@@ -588,7 +588,6 @@ pub mod pallet {
588588
///
589589
/// Emits `Proposed`.
590590
#[pallet::call_index(0)]
591-
#[pallet::weight(T::WeightInfo::propose())]
592591
pub fn propose(
593592
origin: OriginFor<T>,
594593
proposal: BoundedCallOf<T>,
@@ -631,7 +630,6 @@ pub mod pallet {
631630
///
632631
/// - `proposal`: The index of the proposal to second.
633632
#[pallet::call_index(1)]
634-
#[pallet::weight(T::WeightInfo::second())]
635633
pub fn second(
636634
origin: OriginFor<T>,
637635
#[pallet::compact] proposal: PropIndex,
@@ -699,7 +697,6 @@ pub mod pallet {
699697
///
700698
/// - `proposal_hash`: The preimage hash of the proposal.
701699
#[pallet::call_index(4)]
702-
#[pallet::weight(T::WeightInfo::external_propose())]
703700
pub fn external_propose(
704701
origin: OriginFor<T>,
705702
proposal: BoundedCallOf<T>,
@@ -728,7 +725,6 @@ pub mod pallet {
728725
///
729726
/// Weight: `O(1)`
730727
#[pallet::call_index(5)]
731-
#[pallet::weight(T::WeightInfo::external_propose_majority())]
732728
pub fn external_propose_majority(
733729
origin: OriginFor<T>,
734730
proposal: BoundedCallOf<T>,
@@ -750,7 +746,6 @@ pub mod pallet {
750746
///
751747
/// Weight: `O(1)`
752748
#[pallet::call_index(6)]
753-
#[pallet::weight(T::WeightInfo::external_propose_default())]
754749
pub fn external_propose_default(
755750
origin: OriginFor<T>,
756751
proposal: BoundedCallOf<T>,
@@ -777,7 +772,6 @@ pub mod pallet {
777772
///
778773
/// Weight: `O(1)`
779774
#[pallet::call_index(7)]
780-
#[pallet::weight(T::WeightInfo::fast_track())]
781775
pub fn fast_track(
782776
origin: OriginFor<T>,
783777
proposal_hash: H256,
@@ -831,7 +825,6 @@ pub mod pallet {
831825
///
832826
/// Weight: `O(V + log(V))` where V is number of `existing vetoers`
833827
#[pallet::call_index(8)]
834-
#[pallet::weight(T::WeightInfo::veto_external())]
835828
pub fn veto_external(origin: OriginFor<T>, proposal_hash: H256) -> DispatchResult {
836829
let who = T::VetoOrigin::ensure_origin(origin)?;
837830

@@ -867,7 +860,6 @@ pub mod pallet {
867860
///
868861
/// # Weight: `O(1)`.
869862
#[pallet::call_index(9)]
870-
#[pallet::weight(T::WeightInfo::cancel_referendum())]
871863
pub fn cancel_referendum(
872864
origin: OriginFor<T>,
873865
#[pallet::compact] ref_index: ReferendumIndex,
@@ -942,7 +934,6 @@ pub mod pallet {
942934
///
943935
/// Weight: `O(1)`.
944936
#[pallet::call_index(12)]
945-
#[pallet::weight(T::WeightInfo::clear_public_proposals())]
946937
pub fn clear_public_proposals(origin: OriginFor<T>) -> DispatchResult {
947938
ensure_root(origin)?;
948939
<PublicProps<T>>::kill();
@@ -1096,7 +1087,6 @@ pub mod pallet {
10961087
///
10971088
/// Weight: `O(p)` where `p = PublicProps::<T>::decode_len()`
10981089
#[pallet::call_index(17)]
1099-
#[pallet::weight(T::WeightInfo::cancel_proposal())]
11001090
pub fn cancel_proposal(
11011091
origin: OriginFor<T>,
11021092
#[pallet::compact] prop_index: PropIndex,

frame/election-provider-multi-phase/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ pub mod pallet {
883883
}
884884
}
885885

886-
#[pallet::call]
886+
#[pallet::call(weight = <T as crate::Config>::WeightInfo)]
887887
impl<T: Config> Pallet<T> {
888888
/// Submit a solution for the unsigned phase.
889889
///
@@ -1009,7 +1009,6 @@ pub mod pallet {
10091009
/// A deposit is reserved and recorded for the solution. Based on the outcome, the solution
10101010
/// might be rewarded, slashed, or get all or a part of the deposit back.
10111011
#[pallet::call_index(3)]
1012-
#[pallet::weight(T::WeightInfo::submit())]
10131012
pub fn submit(
10141013
origin: OriginFor<T>,
10151014
raw_solution: Box<RawSolution<SolutionOf<T::MinerConfig>>>,

frame/elections-phragmen/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ pub mod pallet {
327327
}
328328
}
329329

330-
#[pallet::call]
330+
#[pallet::call(weight = <T as crate::Config>::WeightInfo)]
331331
impl<T: Config> Pallet<T> {
332332
/// Vote for a set of candidates for the upcoming round of election. This can be called to
333333
/// set the initial votes, or update already existing votes.
@@ -414,7 +414,6 @@ pub mod pallet {
414414
///
415415
/// The dispatch origin of this call must be signed and be a voter.
416416
#[pallet::call_index(1)]
417-
#[pallet::weight(T::WeightInfo::remove_voter())]
418417
pub fn remove_voter(origin: OriginFor<T>) -> DispatchResult {
419418
let who = ensure_signed(origin)?;
420419
ensure!(Self::is_voter(&who), Error::<T>::MustBeVoter);

frame/glutton/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ pub mod pallet {
139139
}
140140
}
141141

142-
#[pallet::call]
142+
#[pallet::call(weight = <T as crate::Config>::WeightInfo)]
143143
impl<T: Config> Pallet<T> {
144144
/// Initializes the pallet by writing into `TrashData`.
145145
///
@@ -178,7 +178,6 @@ pub mod pallet {
178178
///
179179
/// Only callable by Root.
180180
#[pallet::call_index(1)]
181-
#[pallet::weight(T::WeightInfo::set_compute())]
182181
pub fn set_compute(origin: OriginFor<T>, compute: Perbill) -> DispatchResult {
183182
ensure_root(origin)?;
184183
Compute::<T>::set(compute);
@@ -192,7 +191,6 @@ pub mod pallet {
192191
///
193192
/// Only callable by Root.
194193
#[pallet::call_index(2)]
195-
#[pallet::weight(T::WeightInfo::set_storage())]
196194
pub fn set_storage(origin: OriginFor<T>, storage: Perbill) -> DispatchResult {
197195
ensure_root(origin)?;
198196
Storage::<T>::set(storage);

frame/grandpa/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ pub mod pallet {
181181
}
182182
}
183183

184-
#[pallet::call]
184+
#[pallet::call(weight = <T as crate::Config>::WeightInfo)]
185185
impl<T: Config> Pallet<T> {
186186
/// Report voter equivocation/misbehavior. This method will verify the
187187
/// equivocation proof and validate the given key ownership proof
@@ -242,7 +242,6 @@ pub mod pallet {
242242
///
243243
/// Only callable by root.
244244
#[pallet::call_index(2)]
245-
#[pallet::weight(T::WeightInfo::note_stalled())]
246245
pub fn note_stalled(
247246
origin: OriginFor<T>,
248247
delay: T::BlockNumber,

frame/indices/src/lib.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub mod pallet {
7777
#[pallet::pallet]
7878
pub struct Pallet<T>(PhantomData<T>);
7979

80-
#[pallet::call]
80+
#[pallet::call(weight = <T as crate::Config>::WeightInfo)]
8181
impl<T: Config> Pallet<T> {
8282
/// Assign an previously unassigned index.
8383
///
@@ -92,7 +92,6 @@ pub mod pallet {
9292
/// ## Complexity
9393
/// - `O(1)`.
9494
#[pallet::call_index(0)]
95-
#[pallet::weight(T::WeightInfo::claim())]
9695
pub fn claim(origin: OriginFor<T>, index: T::AccountIndex) -> DispatchResult {
9796
let who = ensure_signed(origin)?;
9897

@@ -118,7 +117,6 @@ pub mod pallet {
118117
/// ## Complexity
119118
/// - `O(1)`.
120119
#[pallet::call_index(1)]
121-
#[pallet::weight(T::WeightInfo::transfer())]
122120
pub fn transfer(
123121
origin: OriginFor<T>,
124122
new: AccountIdLookupOf<T>,
@@ -153,7 +151,6 @@ pub mod pallet {
153151
/// ## Complexity
154152
/// - `O(1)`.
155153
#[pallet::call_index(2)]
156-
#[pallet::weight(T::WeightInfo::free())]
157154
pub fn free(origin: OriginFor<T>, index: T::AccountIndex) -> DispatchResult {
158155
let who = ensure_signed(origin)?;
159156

@@ -182,7 +179,6 @@ pub mod pallet {
182179
/// ## Complexity
183180
/// - `O(1)`.
184181
#[pallet::call_index(3)]
185-
#[pallet::weight(T::WeightInfo::force_transfer())]
186182
pub fn force_transfer(
187183
origin: OriginFor<T>,
188184
new: AccountIdLookupOf<T>,
@@ -215,7 +211,6 @@ pub mod pallet {
215211
/// ## Complexity
216212
/// - `O(1)`.
217213
#[pallet::call_index(4)]
218-
#[pallet::weight(T::WeightInfo::freeze())]
219214
pub fn freeze(origin: OriginFor<T>, index: T::AccountIndex) -> DispatchResult {
220215
let who = ensure_signed(origin)?;
221216

0 commit comments

Comments
 (0)