Make priviledged functions explicity use origin (#3045)

* Make priviledged functions explicity use `origin`

* Fix typo in docs

* Fix more tests

* Remove `root` pathway, add semicolons
This commit is contained in:
Shawn Tabrizi
2019-07-08 15:51:54 +02:00
committed by Bastian Köcher
parent 29311e98b4
commit 3d72844710
11 changed files with 71 additions and 114 deletions
+3 -1
View File
@@ -163,7 +163,7 @@ use primitives::traits::{
Zero, SimpleArithmetic, StaticLookup, Member, CheckedAdd, CheckedSub,
MaybeSerializeDebug, Saturating, Bounded
};
use system::{IsDeadAccount, OnNewAccount, ensure_signed};
use system::{IsDeadAccount, OnNewAccount, ensure_signed, ensure_root};
mod mock;
mod tests;
@@ -436,10 +436,12 @@ decl_module! {
/// - Contains a limited number of reads and writes.
/// # </weight>
fn set_balance(
origin,
who: <T::Lookup as StaticLookup>::Source,
#[compact] new_free: T::Balance,
#[compact] new_reserved: T::Balance
) {
ensure_root(origin)?;
let who = T::Lookup::lookup(who)?;
let current_free = <FreeBalance<T, I>>::get(&who);