mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 04:01:10 +00:00
Weights to u64 + Balances Weights (#5446)
Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -30,7 +30,7 @@ use sp_runtime::{
|
||||
};
|
||||
use frame_support::{
|
||||
decl_storage, decl_event, ensure, decl_module, decl_error,
|
||||
weights::{Weight, SimpleDispatchInfo, WeighData},
|
||||
weights::{Weight, MINIMUM_WEIGHT, SimpleDispatchInfo},
|
||||
traits::{
|
||||
Currency, ExistenceRequirement, Get, LockableCurrency, LockIdentifier, BalanceStatus,
|
||||
OnUnbalanced, ReservableCurrency, WithdrawReason, WithdrawReasons, ChangeMembers
|
||||
@@ -405,7 +405,7 @@ decl_module! {
|
||||
/// - Two extra DB entries, one DB change.
|
||||
/// - Argument `votes` is limited in length to number of candidates.
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(2_500_000)]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(2_500_000_000)]
|
||||
fn set_approvals(
|
||||
origin,
|
||||
votes: Vec<bool>,
|
||||
@@ -423,7 +423,7 @@ decl_module! {
|
||||
/// # <weight>
|
||||
/// - Same as `set_approvals` with one additional storage read.
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(2_500_000)]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(2_500_000_000)]
|
||||
fn proxy_set_approvals(origin,
|
||||
votes: Vec<bool>,
|
||||
#[compact] index: VoteIndex,
|
||||
@@ -446,7 +446,7 @@ decl_module! {
|
||||
/// - O(1).
|
||||
/// - Two fewer DB entries, one DB change.
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(2_500_000)]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(2_500_000_000)]
|
||||
fn reap_inactive_voter(
|
||||
origin,
|
||||
#[compact] reporter_index: u32,
|
||||
@@ -520,7 +520,7 @@ decl_module! {
|
||||
/// - O(1).
|
||||
/// - Two fewer DB entries, one DB change.
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(1_250_000)]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(1_250_000_000)]
|
||||
fn retract_voter(origin, #[compact] index: u32) {
|
||||
let who = ensure_signed(origin)?;
|
||||
|
||||
@@ -548,7 +548,7 @@ decl_module! {
|
||||
/// - Independent of input.
|
||||
/// - Three DB changes.
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(2_500_000)]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(2_500_000_000)]
|
||||
fn submit_candidacy(origin, #[compact] slot: u32) {
|
||||
let who = ensure_signed(origin)?;
|
||||
|
||||
@@ -585,7 +585,7 @@ decl_module! {
|
||||
/// - O(voters) compute.
|
||||
/// - One DB change.
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(10_000_000)]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(10_000_000_000)]
|
||||
fn present_winner(
|
||||
origin,
|
||||
candidate: <T::Lookup as StaticLookup>::Source,
|
||||
@@ -659,7 +659,7 @@ decl_module! {
|
||||
/// Set the desired member count; if lower than the current count, then seats will not be up
|
||||
/// election when they expire. If more, then a new vote will be started if one is not
|
||||
/// already in progress.
|
||||
#[weight = SimpleDispatchInfo::FixedOperational(10_000)]
|
||||
#[weight = SimpleDispatchInfo::FixedOperational(MINIMUM_WEIGHT)]
|
||||
fn set_desired_seats(origin, #[compact] count: u32) {
|
||||
ensure_root(origin)?;
|
||||
DesiredSeats::put(count);
|
||||
@@ -669,7 +669,7 @@ decl_module! {
|
||||
///
|
||||
/// Note: A tally should happen instantly (if not already in a presentation
|
||||
/// period) to fill the seat if removal means that the desired members are not met.
|
||||
#[weight = SimpleDispatchInfo::FixedOperational(10_000)]
|
||||
#[weight = SimpleDispatchInfo::FixedOperational(MINIMUM_WEIGHT)]
|
||||
fn remove_member(origin, who: <T::Lookup as StaticLookup>::Source) {
|
||||
ensure_root(origin)?;
|
||||
let who = T::Lookup::lookup(who)?;
|
||||
@@ -684,7 +684,7 @@ decl_module! {
|
||||
|
||||
/// Set the presentation duration. If there is currently a vote being presented for, will
|
||||
/// invoke `finalize_vote`.
|
||||
#[weight = SimpleDispatchInfo::FixedOperational(10_000)]
|
||||
#[weight = SimpleDispatchInfo::FixedOperational(MINIMUM_WEIGHT)]
|
||||
fn set_presentation_duration(origin, #[compact] count: T::BlockNumber) {
|
||||
ensure_root(origin)?;
|
||||
<PresentationDuration<T>>::put(count);
|
||||
@@ -692,7 +692,7 @@ decl_module! {
|
||||
|
||||
/// Set the presentation duration. If there is current a vote being presented for, will
|
||||
/// invoke `finalize_vote`.
|
||||
#[weight = SimpleDispatchInfo::FixedOperational(10_000)]
|
||||
#[weight = SimpleDispatchInfo::FixedOperational(MINIMUM_WEIGHT)]
|
||||
fn set_term_duration(origin, #[compact] count: T::BlockNumber) {
|
||||
ensure_root(origin)?;
|
||||
<TermDuration<T>>::put(count);
|
||||
@@ -703,7 +703,7 @@ decl_module! {
|
||||
print("Guru meditation");
|
||||
print(e);
|
||||
}
|
||||
SimpleDispatchInfo::default().weigh_data(())
|
||||
MINIMUM_WEIGHT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ impl frame_system::Trait for Test {
|
||||
type Event = Event;
|
||||
type BlockHashCount = BlockHashCount;
|
||||
type MaximumBlockWeight = MaximumBlockWeight;
|
||||
type DbWeight = ();
|
||||
type MaximumBlockLength = MaximumBlockLength;
|
||||
type AvailableBlockRatio = AvailableBlockRatio;
|
||||
type Version = ();
|
||||
|
||||
Reference in New Issue
Block a user