Migrate away from SimpleDispatchInfo (#5686)

* Migrate away from SimpleDispatchInfo

* Fix imports

* Better doc

* Update lib.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Kian Paimani
2020-04-22 09:20:28 +02:00
committed by GitHub
parent 25c3ab2c1e
commit 50a7e12b3f
40 changed files with 458 additions and 405 deletions
+5 -3
View File
@@ -23,7 +23,7 @@ use sp_runtime::traits::{One, Zero, SaturatedConversion};
use sp_std::{prelude::*, result, cmp, vec};
use frame_support::{decl_module, decl_storage, decl_error, ensure};
use frame_support::traits::Get;
use frame_support::weights::{SimpleDispatchInfo, MINIMUM_WEIGHT};
use frame_support::weights::{MINIMUM_WEIGHT, DispatchClass};
use frame_system::{ensure_none, Trait as SystemTrait};
use sp_finality_tracker::{INHERENT_IDENTIFIER, FinalizedInherentData};
@@ -77,7 +77,7 @@ decl_module! {
/// Hint that the author of this block thinks the best finalized
/// block is the given number.
#[weight = SimpleDispatchInfo::FixedMandatory(MINIMUM_WEIGHT)]
#[weight = (MINIMUM_WEIGHT, DispatchClass::Mandatory)]
fn final_hint(origin, #[compact] hint: T::BlockNumber) {
ensure_none(origin)?;
ensure!(!<Self as Store>::Update::exists(), Error::<T>::AlreadyUpdated);
@@ -212,7 +212,9 @@ mod tests {
traits::{BlakeTwo256, IdentityLookup, Header as HeaderT},
};
use frame_support::{
assert_ok, impl_outer_origin, parameter_types, weights::Weight, traits::OnFinalize
assert_ok, impl_outer_origin, parameter_types,
weights::Weight,
traits::OnFinalize,
};
use frame_system as system;
use std::cell::RefCell;