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
@@ -35,13 +35,13 @@
//! ### Example - Get random seed for the current block
//!
//! ```
//! use frame_support::{decl_module, dispatch, traits::Randomness, weights::SimpleDispatchInfo};
//! use frame_support::{decl_module, dispatch, traits::Randomness, weights::{SimpleDispatchInfo, MINIMUM_WEIGHT}};
//!
//! pub trait Trait: frame_system::Trait {}
//!
//! decl_module! {
//! pub struct Module<T: Trait> for enum Call where origin: T::Origin {
//! #[weight = SimpleDispatchInfo::default()]
//! #[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
//! pub fn random_module_example(origin) -> dispatch::DispatchResult {
//! let _random_seed = <pallet_randomness_collective_flip::Module<T>>::random_seed();
//! Ok(())
@@ -57,7 +57,7 @@ use sp_std::{prelude::*, convert::TryInto};
use sp_runtime::traits::Hash;
use frame_support::{
decl_module, decl_storage, traits::Randomness,
weights::{Weight, SimpleDispatchInfo, WeighData}
weights::{Weight, MINIMUM_WEIGHT}
};
use safe_mix::TripletMix;
use codec::Encode;
@@ -83,7 +83,7 @@ decl_module! {
values[index] = parent_hash;
});
SimpleDispatchInfo::default().weigh_data(())
MINIMUM_WEIGHT
}
}
}
@@ -195,6 +195,7 @@ mod tests {
type Event = ();
type BlockHashCount = BlockHashCount;
type MaximumBlockWeight = MaximumBlockWeight;
type DbWeight = ();
type AvailableBlockRatio = AvailableBlockRatio;
type MaximumBlockLength = MaximumBlockLength;
type Version = ();