Mandate weight annotation (#5357)

* Disallow default weight

* Fix build and test

* Fix tests

* Fix another beloved ui test.

* fix beloved trybuild tests

* fix treasury?

* Final test fix

* Fix build

* Fix another one

* Fix

* More doctest fix
This commit is contained in:
Kian Paimani
2020-03-26 11:17:05 +01:00
committed by GitHub
parent 7cbadd73be
commit a0772117ac
27 changed files with 111 additions and 48 deletions
+4 -2
View File
@@ -58,6 +58,7 @@
//!
//! decl_module! {
//! pub struct Module<T: Trait> for enum Call where origin: T::Origin {
//! #[weight = frame_support::weights::SimpleDispatchInfo::default()]
//! pub fn privileged_function(origin) -> dispatch::DispatchResult {
//! ensure_root(origin)?;
//!
@@ -120,7 +121,7 @@ decl_module! {
/// - Weight of derivative `call` execution + 10,000.
/// # </weight>
#[weight = FunctionOf(
|args: (&Box<<T as Trait>::Call>,)| args.0.get_dispatch_info().weight + 10_000,
|args: (&Box<<T as Trait>::Call>,)| args.0.get_dispatch_info().weight + 10_000,
|args: (&Box<<T as Trait>::Call>,)| args.0.get_dispatch_info().class,
true
)]
@@ -150,6 +151,7 @@ decl_module! {
/// - Limited storage reads.
/// - One DB change.
/// # </weight>
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
fn set_key(origin, new: <T::Lookup as StaticLookup>::Source) {
// This is a public call, so we ensure that the origin is some signed account.
let sender = ensure_signed(origin)?;
@@ -174,7 +176,7 @@ decl_module! {
#[weight = FunctionOf(
|args: (&<T::Lookup as StaticLookup>::Source, &Box<<T as Trait>::Call>,)| {
args.1.get_dispatch_info().weight + 10_000
},
},
|args: (&<T::Lookup as StaticLookup>::Source, &Box<<T as Trait>::Call>,)| {
args.1.get_dispatch_info().class
},