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
+5 -3
View File
@@ -62,6 +62,7 @@
//!
//! ```
//! use frame_support::{decl_module, dispatch};
//! use frame_support::weights::{SimpleDispatchInfo, MINIMUM_WEIGHT};
//! # use pallet_timestamp as timestamp;
//! use frame_system::{self as system, ensure_signed};
//!
@@ -69,7 +70,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 get_time(origin) -> dispatch::DispatchResult {
//! let _sender = ensure_signed(origin)?;
//! let _now = <timestamp::Module<T>>::get();
@@ -100,7 +101,7 @@ use frame_support::debug;
use frame_support::{
Parameter, decl_storage, decl_module,
traits::{Time, UnixTime, Get},
weights::SimpleDispatchInfo,
weights::{SimpleDispatchInfo, MINIMUM_WEIGHT},
};
use sp_runtime::{
RuntimeString,
@@ -147,7 +148,7 @@ decl_module! {
/// `MinimumPeriod`.
///
/// The dispatch origin for this call must be `Inherent`.
#[weight = SimpleDispatchInfo::FixedMandatory(10_000)]
#[weight = SimpleDispatchInfo::FixedMandatory(MINIMUM_WEIGHT)]
fn set(origin, #[compact] now: T::Moment) {
ensure_none(origin)?;
assert!(!<Self as Store>::DidUpdate::exists(), "Timestamp must be updated only once in the block");
@@ -301,6 +302,7 @@ mod tests {
type Event = ();
type BlockHashCount = BlockHashCount;
type MaximumBlockWeight = MaximumBlockWeight;
type DbWeight = ();
type AvailableBlockRatio = AvailableBlockRatio;
type MaximumBlockLength = MaximumBlockLength;
type Version = ();