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
+9 -9
View File
@@ -159,7 +159,7 @@ use codec::{Encode, Decode};
use frame_support::{
decl_module, decl_event, decl_storage, decl_error, ensure,
Parameter, RuntimeDebug, weights::{GetDispatchInfo, SimpleDispatchInfo, FunctionOf},
Parameter, RuntimeDebug, weights::{MINIMUM_WEIGHT, GetDispatchInfo, SimpleDispatchInfo, FunctionOf},
traits::{Currency, ReservableCurrency, Get, BalanceStatus},
dispatch::PostDispatchInfo,
};
@@ -365,7 +365,7 @@ decl_module! {
/// - One storage write O(1)
/// - One event
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(10_000)]
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
fn set_recovered(origin, lost: T::AccountId, rescuer: T::AccountId) {
ensure_root(origin)?;
// Create the recovery storage item.
@@ -400,7 +400,7 @@ decl_module! {
///
/// Total Complexity: O(F + X)
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(100_000)]
#[weight = SimpleDispatchInfo::FixedNormal(100_000_000)]
fn create_recovery(origin,
friends: Vec<T::AccountId>,
threshold: u16,
@@ -460,7 +460,7 @@ decl_module! {
///
/// Total Complexity: O(F + X)
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(100_000)]
#[weight = SimpleDispatchInfo::FixedNormal(100_000_000)]
fn initiate_recovery(origin, account: T::AccountId) {
let who = ensure_signed(origin)?;
// Check that the account is recoverable
@@ -506,7 +506,7 @@ decl_module! {
///
/// Total Complexity: O(F + logF + V + logV)
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(100_000)]
#[weight = SimpleDispatchInfo::FixedNormal(100_000_000)]
fn vouch_recovery(origin, lost: T::AccountId, rescuer: T::AccountId) {
let who = ensure_signed(origin)?;
// Get the recovery configuration for the lost account.
@@ -545,7 +545,7 @@ decl_module! {
///
/// Total Complexity: O(F + V)
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(100_000)]
#[weight = SimpleDispatchInfo::FixedNormal(100_000_000)]
fn claim_recovery(origin, account: T::AccountId) {
let who = ensure_signed(origin)?;
// Get the recovery configuration for the lost account
@@ -590,7 +590,7 @@ decl_module! {
///
/// Total Complexity: O(V + X)
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(30_000)]
#[weight = SimpleDispatchInfo::FixedNormal(30_000_000)]
fn close_recovery(origin, rescuer: T::AccountId) {
let who = ensure_signed(origin)?;
// Take the active recovery process started by the rescuer for this account.
@@ -622,7 +622,7 @@ decl_module! {
///
/// Total Complexity: O(F + X)
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(30_000)]
#[weight = SimpleDispatchInfo::FixedNormal(30_000_000)]
fn remove_recovery(origin) {
let who = ensure_signed(origin)?;
// Check there are no active recoveries
@@ -647,7 +647,7 @@ decl_module! {
/// # <weight>
/// - One storage mutation to check account is recovered by `who`. O(1)
/// # </weight>
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
fn cancel_recovered(origin, account: T::AccountId) {
let who = ensure_signed(origin)?;
// Check `who` is allowed to make a call on behalf of `account`
+1
View File
@@ -75,6 +75,7 @@ impl frame_system::Trait for Test {
type Event = TestEvent;
type BlockHashCount = BlockHashCount;
type MaximumBlockWeight = MaximumBlockWeight;
type DbWeight = ();
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();