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
@@ -18,6 +18,7 @@
use sp_runtime::{generic, traits::{BlakeTwo256, Block as _, Verify}, DispatchError};
use sp_core::{H256, sr25519};
use frame_support::weights::{SimpleDispatchInfo, MINIMUM_WEIGHT};
mod system;
@@ -32,7 +33,7 @@ mod module1 {
pub struct Module<T: Trait<I>, I: Instance = DefaultInstance> for enum Call
where origin: <T as system::Trait>::Origin
{
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
pub fn fail(_origin) -> frame_support::dispatch::DispatchResult {
Err(Error::<T, I>::Something.into())
}
@@ -59,7 +60,7 @@ mod module2 {
pub struct Module<T: Trait> for enum Call
where origin: <T as system::Trait>::Origin
{
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
pub fn fail(_origin) -> frame_support::dispatch::DispatchResult {
Err(Error::<T>::Something.into())
}
@@ -23,6 +23,7 @@ use frame_support::{
DecodeDifferent, StorageMetadata, StorageEntryModifier, StorageEntryType, DefaultByteGetter,
StorageEntryMetadata, StorageHasher,
},
weights::{SimpleDispatchInfo, MINIMUM_WEIGHT},
StorageValue, StorageMap, StorageDoubleMap,
};
use sp_inherents::{ProvideInherent, InherentData, InherentIdentifier, MakeFatalError};
@@ -55,7 +56,7 @@ mod module1 {
fn deposit_event() = default;
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
fn one(origin) {
system::ensure_root(origin)?;
Self::deposit_event(RawEvent::AnotherVariant(3));
@@ -2,7 +2,7 @@ macro_rules! reserved {
($($reserved:ident)*) => {
$(
mod $reserved {
pub use frame_support::dispatch;
pub use frame_support::{dispatch, weights::{SimpleDispatchInfo, MINIMUM_WEIGHT}};
pub trait Trait {
type Origin;
@@ -19,7 +19,7 @@ macro_rules! reserved {
frame_support::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)]
fn $reserved(_origin) -> dispatch::DispatchResult { unreachable!() }
}
}