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
+4 -4
View File
@@ -411,22 +411,22 @@ mod tests {
use hex_literal::hex;
mod custom {
use frame_support::weights::{SimpleDispatchInfo, Weight};
use frame_support::weights::{Weight, DispatchClass};
pub trait Trait: frame_system::Trait {}
frame_support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
#[weight = SimpleDispatchInfo::FixedNormal(100)]
#[weight = 100]
fn some_function(origin) {
// NOTE: does not make any different.
let _ = frame_system::ensure_signed(origin);
}
#[weight = SimpleDispatchInfo::FixedOperational(200)]
#[weight = (200, DispatchClass::Operational)]
fn some_root_operation(origin) {
let _ = frame_system::ensure_root(origin);
}
#[weight = SimpleDispatchInfo::InsecureFreeNormal]
#[weight = 0]
fn some_unsigned_message(origin) {
let _ = frame_system::ensure_none(origin);
}