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
+6
View File
@@ -61,6 +61,7 @@
//!
//! decl_module! {
//! pub struct Module<T: Trait> for enum Call where origin: T::Origin {
//! #[weight = frame_support::weights::SimpleDispatchInfo::default()]
//! pub fn candidate(origin) -> dispatch::DispatchResult {
//! let who = ensure_signed(origin)?;
//!
@@ -265,6 +266,7 @@ decl_module! {
///
/// The `index` parameter of this function must be set to
/// the index of the transactor in the `Pool`.
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
pub fn submit_candidacy(origin) {
let who = ensure_signed(origin)?;
ensure!(!<CandidateExists<T, I>>::contains_key(&who), Error::<T, I>::AlreadyInPool);
@@ -294,6 +296,7 @@ decl_module! {
///
/// The `index` parameter of this function must be set to
/// the index of the transactor in the `Pool`.
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
pub fn withdraw_candidacy(
origin,
index: u32
@@ -313,6 +316,7 @@ decl_module! {
///
/// The `index` parameter of this function must be set to
/// the index of `dest` in the `Pool`.
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
pub fn kick(
origin,
dest: <T::Lookup as StaticLookup>::Source,
@@ -337,6 +341,7 @@ decl_module! {
///
/// The `index` parameter of this function must be set to
/// the index of the `dest` in the `Pool`.
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
pub fn score(
origin,
dest: <T::Lookup as StaticLookup>::Source,
@@ -377,6 +382,7 @@ decl_module! {
/// (this happens each `Period`).
///
/// May only be called from root.
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
pub fn change_member_count(origin, count: u32) {
ensure_root(origin)?;
<MemberCount<I>>::put(&count);