Weights to u64 + Balances Weights (#5446)

Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
Shawn Tabrizi
2020-04-16 10:43:18 +02:00
committed by GitHub
parent 1c7525fd4b
commit 980b635c8d
82 changed files with 636 additions and 428 deletions
+10 -10
View File
@@ -98,7 +98,7 @@ use frame_support::traits::{
use sp_runtime::{Permill, ModuleId, Percent, RuntimeDebug, traits::{
Zero, StaticLookup, AccountIdConversion, Saturating, Hash, BadOrigin
}};
use frame_support::weights::{Weight, WeighData, SimpleDispatchInfo};
use frame_support::weights::{Weight, MINIMUM_WEIGHT, SimpleDispatchInfo};
use frame_support::traits::{Contains, EnsureOrigin};
use codec::{Encode, Decode};
use frame_system::{self as system, ensure_signed, ensure_root};
@@ -327,7 +327,7 @@ decl_module! {
/// - Limited storage reads.
/// - One DB change, one extra DB entry.
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(500_000)]
#[weight = SimpleDispatchInfo::FixedNormal(500_000_000)]
fn propose_spend(
origin,
#[compact] value: BalanceOf<T>,
@@ -354,7 +354,7 @@ decl_module! {
/// - Limited storage reads.
/// - One DB clear.
/// # </weight>
#[weight = SimpleDispatchInfo::FixedOperational(100_000)]
#[weight = SimpleDispatchInfo::FixedOperational(100_000_000)]
fn reject_proposal(origin, #[compact] proposal_id: ProposalIndex) {
T::RejectOrigin::try_origin(origin)
.map(|_| ())
@@ -376,7 +376,7 @@ decl_module! {
/// - Limited storage reads.
/// - One DB change.
/// # </weight>
#[weight = SimpleDispatchInfo::FixedOperational(100_000)]
#[weight = SimpleDispatchInfo::FixedOperational(100_000_000)]
fn approve_proposal(origin, #[compact] proposal_id: ProposalIndex) {
T::ApproveOrigin::try_origin(origin)
.map(|_| ())
@@ -405,7 +405,7 @@ decl_module! {
/// - One storage mutation (codec `O(R)`).
/// - One event.
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(100_000)]
#[weight = SimpleDispatchInfo::FixedNormal(100_000_000)]
fn report_awesome(origin, reason: Vec<u8>, who: T::AccountId) {
let finder = ensure_signed(origin)?;
@@ -447,7 +447,7 @@ decl_module! {
/// - Two storage removals (one read, codec `O(T)`).
/// - One event.
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(50_000)]
#[weight = SimpleDispatchInfo::FixedNormal(50_000_000)]
fn retract_tip(origin, hash: T::Hash) {
let who = ensure_signed(origin)?;
let tip = Tips::<T>::get(&hash).ok_or(Error::<T>::UnknownTip)?;
@@ -479,7 +479,7 @@ decl_module! {
/// - Two storage insertions (codecs `O(R)`, `O(T)`), one read `O(1)`.
/// - One event.
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(150_000)]
#[weight = SimpleDispatchInfo::FixedNormal(150_000_000)]
fn tip_new(origin, reason: Vec<u8>, who: T::AccountId, tip_value: BalanceOf<T>) {
let tipper = ensure_signed(origin)?;
ensure!(T::Tippers::contains(&tipper), BadOrigin);
@@ -513,7 +513,7 @@ decl_module! {
/// - One storage mutation (codec `O(T)`), one storage read `O(1)`.
/// - Up to one event.
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(50_000)]
#[weight = SimpleDispatchInfo::FixedNormal(50_000_000)]
fn tip(origin, hash: T::Hash, tip_value: BalanceOf<T>) {
let tipper = ensure_signed(origin)?;
ensure!(T::Tippers::contains(&tipper), BadOrigin);
@@ -539,7 +539,7 @@ decl_module! {
/// - One storage retrieval (codec `O(T)`) and two removals.
/// - Up to three balance operations.
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(50_000)]
#[weight = SimpleDispatchInfo::FixedNormal(50_000_000)]
fn close_tip(origin, hash: T::Hash) {
ensure_signed(origin)?;
@@ -558,7 +558,7 @@ decl_module! {
Self::spend_funds();
}
SimpleDispatchInfo::default().weigh_data(())
MINIMUM_WEIGHT
}
}
}
+1
View File
@@ -56,6 +56,7 @@ impl frame_system::Trait for Test {
type Event = ();
type BlockHashCount = BlockHashCount;
type MaximumBlockWeight = MaximumBlockWeight;
type DbWeight = ();
type AvailableBlockRatio = AvailableBlockRatio;
type MaximumBlockLength = MaximumBlockLength;
type Version = ();