Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Migrate remaining pallets
  • Loading branch information
ggwpez committed Apr 18, 2023
commit 331d4b42d72de1dacaed714d69166fa1bc9c92dd
4 changes: 1 addition & 3 deletions bin/node-template/pallets/template/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <T as crate::Config>::WeightInfo)]
impl<T: Config> Pallet<T> {
/// 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<T>, 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.
Expand All @@ -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<T>) -> DispatchResult {
let _who = ensure_signed(origin)?;

Expand Down
3 changes: 1 addition & 2 deletions frame/bags-list/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ pub mod pallet {
}
}

#[pallet::call]
#[pallet::call(weight = <T as crate::Config<I>>::WeightInfo)]
impl<T: Config<I>, I: 'static> Pallet<T, I> {
/// 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
Expand Down Expand Up @@ -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<T>,
lighter: AccountIdLookupOf<T>,
Expand Down
4 changes: 1 addition & 3 deletions frame/contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ pub mod pallet {
}
}

#[pallet::call]
#[pallet::call(weight = <T as crate::Config>::WeightInfo)]
impl<T: Config> Pallet<T>
where
<BalanceOf<T> as HasCompact>::Type: Clone + Eq + PartialEq + Debug + TypeInfo + Encode,
Expand Down Expand Up @@ -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<T>,
code_hash: CodeHash<T>,
Expand All @@ -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<T>,
dest: AccountIdLookupOf<T>,
Expand Down
5 changes: 1 addition & 4 deletions frame/conviction-voting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ pub mod pallet {
BadClass,
}

#[pallet::call]
#[pallet::call(weight = <T as crate::Config<I>>::WeightInfo)]
impl<T: Config<I>, I: 'static> Pallet<T, I> {
/// 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.
Expand Down Expand Up @@ -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<T>,
class: ClassOf<T, I>,
Expand Down Expand Up @@ -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<T>,
class: Option<ClassOf<T, I>>,
Expand All @@ -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<T>,
target: AccountIdLookupOf<T>,
Expand Down
12 changes: 1 addition & 11 deletions frame/democracy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ pub mod pallet {
}
}

#[pallet::call]
#[pallet::call(weight = <T as crate::Config>::WeightInfo)]
impl<T: Config> Pallet<T> {
/// Propose a sensitive action to be taken.
///
Expand All @@ -588,7 +588,6 @@ pub mod pallet {
///
/// Emits `Proposed`.
#[pallet::call_index(0)]
#[pallet::weight(T::WeightInfo::propose())]
pub fn propose(
origin: OriginFor<T>,
proposal: BoundedCallOf<T>,
Expand Down Expand Up @@ -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<T>,
#[pallet::compact] proposal: PropIndex,
Expand Down Expand Up @@ -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<T>,
proposal: BoundedCallOf<T>,
Expand Down Expand Up @@ -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<T>,
proposal: BoundedCallOf<T>,
Expand All @@ -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<T>,
proposal: BoundedCallOf<T>,
Expand All @@ -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<T>,
proposal_hash: H256,
Expand Down Expand Up @@ -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<T>, proposal_hash: H256) -> DispatchResult {
let who = T::VetoOrigin::ensure_origin(origin)?;

Expand Down Expand Up @@ -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<T>,
#[pallet::compact] ref_index: ReferendumIndex,
Expand Down Expand Up @@ -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<T>) -> DispatchResult {
ensure_root(origin)?;
<PublicProps<T>>::kill();
Expand Down Expand Up @@ -1096,7 +1087,6 @@ pub mod pallet {
///
/// Weight: `O(p)` where `p = PublicProps::<T>::decode_len()`
#[pallet::call_index(17)]
#[pallet::weight(T::WeightInfo::cancel_proposal())]
pub fn cancel_proposal(
origin: OriginFor<T>,
#[pallet::compact] prop_index: PropIndex,
Expand Down
3 changes: 1 addition & 2 deletions frame/election-provider-multi-phase/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ pub mod pallet {
}
}

#[pallet::call]
#[pallet::call(weight = <T as crate::Config>::WeightInfo)]
impl<T: Config> Pallet<T> {
/// Submit a solution for the unsigned phase.
///
Expand Down Expand Up @@ -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<T>,
raw_solution: Box<RawSolution<SolutionOf<T::MinerConfig>>>,
Expand Down
3 changes: 1 addition & 2 deletions frame/elections-phragmen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ pub mod pallet {
}
}

#[pallet::call]
#[pallet::call(weight = <T as crate::Config>::WeightInfo)]
impl<T: Config> Pallet<T> {
/// 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.
Expand Down Expand Up @@ -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<T>) -> DispatchResult {
let who = ensure_signed(origin)?;
ensure!(Self::is_voter(&who), Error::<T>::MustBeVoter);
Expand Down
4 changes: 1 addition & 3 deletions frame/glutton/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ pub mod pallet {
}
}

#[pallet::call]
#[pallet::call(weight = <T as crate::Config>::WeightInfo)]
impl<T: Config> Pallet<T> {
/// Initializes the pallet by writing into `TrashData`.
///
Expand Down Expand Up @@ -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<T>, compute: Perbill) -> DispatchResult {
ensure_root(origin)?;
Compute::<T>::set(compute);
Expand All @@ -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<T>, storage: Perbill) -> DispatchResult {
ensure_root(origin)?;
Storage::<T>::set(storage);
Expand Down
3 changes: 1 addition & 2 deletions frame/grandpa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ pub mod pallet {
}
}

#[pallet::call]
#[pallet::call(weight = <T as crate::Config>::WeightInfo)]
impl<T: Config> Pallet<T> {
/// Report voter equivocation/misbehavior. This method will verify the
/// equivocation proof and validate the given key ownership proof
Expand Down Expand Up @@ -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<T>,
delay: T::BlockNumber,
Expand Down
7 changes: 1 addition & 6 deletions frame/indices/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub mod pallet {
#[pallet::pallet]
pub struct Pallet<T>(PhantomData<T>);

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

Expand All @@ -118,7 +117,6 @@ pub mod pallet {
/// ## Complexity
/// - `O(1)`.
#[pallet::call_index(1)]
#[pallet::weight(T::WeightInfo::transfer())]
pub fn transfer(
origin: OriginFor<T>,
new: AccountIdLookupOf<T>,
Expand Down Expand Up @@ -153,7 +151,6 @@ pub mod pallet {
/// ## Complexity
/// - `O(1)`.
#[pallet::call_index(2)]
#[pallet::weight(T::WeightInfo::free())]
pub fn free(origin: OriginFor<T>, index: T::AccountIndex) -> DispatchResult {
let who = ensure_signed(origin)?;

Expand Down Expand Up @@ -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<T>,
new: AccountIdLookupOf<T>,
Expand Down Expand Up @@ -215,7 +211,6 @@ pub mod pallet {
/// ## Complexity
/// - `O(1)`.
#[pallet::call_index(4)]
#[pallet::weight(T::WeightInfo::freeze())]
pub fn freeze(origin: OriginFor<T>, index: T::AccountIndex) -> DispatchResult {
let who = ensure_signed(origin)?;

Expand Down
4 changes: 1 addition & 3 deletions frame/lottery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ pub mod pallet {
}
}

#[pallet::call]
#[pallet::call(weight = <T as crate::Config>::WeightInfo)]
impl<T: Config> Pallet<T> {
/// Buy a ticket to enter the lottery.
///
Expand Down Expand Up @@ -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<T>,
price: BalanceOf<T>,
Expand Down Expand Up @@ -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<T>) -> DispatchResult {
T::ManagerOrigin::ensure_origin(origin)?;
Lottery::<T>::mutate(|mut lottery| {
Expand Down
3 changes: 1 addition & 2 deletions frame/message-queue/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -576,11 +576,10 @@ pub mod pallet {
}
}

#[pallet::call]
#[pallet::call(weight = <T as crate::Config>::WeightInfo)]
impl<T: Config> Pallet<T> {
/// 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<T>,
message_origin: MessageOriginOf<T>,
Expand Down
Loading