mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 10:21:05 +00:00
Weights to u64 + Balances Weights (#5446)
Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -54,6 +54,7 @@
|
||||
//!
|
||||
//! ```
|
||||
//! use frame_support::{decl_module, dispatch};
|
||||
//! use frame_support::weights::{SimpleDispatchInfo, MINIMUM_WEIGHT};
|
||||
//! use frame_system::{self as system, ensure_signed};
|
||||
//! use pallet_scored_pool::{self as scored_pool};
|
||||
//!
|
||||
@@ -61,7 +62,7 @@
|
||||
//!
|
||||
//! decl_module! {
|
||||
//! pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
||||
//! #[weight = frame_support::weights::SimpleDispatchInfo::default()]
|
||||
//! #[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
//! pub fn candidate(origin) -> dispatch::DispatchResult {
|
||||
//! let who = ensure_signed(origin)?;
|
||||
//!
|
||||
@@ -97,7 +98,7 @@ use sp_std::{
|
||||
use frame_support::{
|
||||
decl_module, decl_storage, decl_event, ensure, decl_error,
|
||||
traits::{EnsureOrigin, ChangeMembers, InitializeMembers, Currency, Get, ReservableCurrency},
|
||||
weights::{Weight, SimpleDispatchInfo, WeighData},
|
||||
weights::{Weight, MINIMUM_WEIGHT, SimpleDispatchInfo},
|
||||
};
|
||||
use frame_system::{self as system, ensure_root, ensure_signed};
|
||||
use sp_runtime::{
|
||||
@@ -252,7 +253,7 @@ decl_module! {
|
||||
let pool = <Pool<T, I>>::get();
|
||||
<Module<T, I>>::refresh_members(pool, ChangeReceiver::MembershipChanged);
|
||||
}
|
||||
SimpleDispatchInfo::default().weigh_data(())
|
||||
MINIMUM_WEIGHT
|
||||
}
|
||||
|
||||
/// Add `origin` to the pool of candidates.
|
||||
@@ -266,7 +267,7 @@ decl_module! {
|
||||
///
|
||||
/// The `index` parameter of this function must be set to
|
||||
/// the index of the transactor in the `Pool`.
|
||||
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
pub fn submit_candidacy(origin) {
|
||||
let who = ensure_signed(origin)?;
|
||||
ensure!(!<CandidateExists<T, I>>::contains_key(&who), Error::<T, I>::AlreadyInPool);
|
||||
@@ -296,7 +297,7 @@ decl_module! {
|
||||
///
|
||||
/// The `index` parameter of this function must be set to
|
||||
/// the index of the transactor in the `Pool`.
|
||||
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
pub fn withdraw_candidacy(
|
||||
origin,
|
||||
index: u32
|
||||
@@ -316,7 +317,7 @@ decl_module! {
|
||||
///
|
||||
/// The `index` parameter of this function must be set to
|
||||
/// the index of `dest` in the `Pool`.
|
||||
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
pub fn kick(
|
||||
origin,
|
||||
dest: <T::Lookup as StaticLookup>::Source,
|
||||
@@ -341,7 +342,7 @@ decl_module! {
|
||||
///
|
||||
/// The `index` parameter of this function must be set to
|
||||
/// the index of the `dest` in the `Pool`.
|
||||
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
pub fn score(
|
||||
origin,
|
||||
dest: <T::Lookup as StaticLookup>::Source,
|
||||
@@ -382,7 +383,7 @@ decl_module! {
|
||||
/// (this happens each `Period`).
|
||||
///
|
||||
/// May only be called from root.
|
||||
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
pub fn change_member_count(origin, count: u32) {
|
||||
ensure_root(origin)?;
|
||||
<MemberCount<I>>::put(&count);
|
||||
|
||||
@@ -66,6 +66,7 @@ impl frame_system::Trait for Test {
|
||||
type Event = ();
|
||||
type BlockHashCount = BlockHashCount;
|
||||
type MaximumBlockWeight = MaximumBlockWeight;
|
||||
type DbWeight = ();
|
||||
type MaximumBlockLength = MaximumBlockLength;
|
||||
type AvailableBlockRatio = AvailableBlockRatio;
|
||||
type Version = ();
|
||||
|
||||
Reference in New Issue
Block a user