Allow Sudo to do anything (#6375)

* All Sudo to do anything.

* Rename old labels.
This commit is contained in:
Gavin Wood
2020-06-17 12:22:57 +02:00
committed by GitHub
parent 194b3dfb17
commit 5f991ae9b8
4 changed files with 25 additions and 17 deletions
+13 -5
View File
@@ -24,10 +24,11 @@ use frame_support::{
};
use sp_core::H256;
// The testing primitives are very useful for avoiding having to work with signatures
// or public keys.
// or public keys.
use sp_runtime::{Perbill, traits::{BlakeTwo256, IdentityLookup}, testing::Header};
use sp_io;
use crate as sudo;
use frame_support::traits::Filter;
// Logger module to track execution.
pub mod logger {
@@ -58,7 +59,7 @@ pub mod logger {
#[weight = *weight]
fn privileged_i32_log(origin, i: i32, weight: Weight){
// Ensure that the `origin` is `Root`.
// Ensure that the `origin` is `Root`.
ensure_root(origin)?;
<I32Log>::append(i);
Self::deposit_event(RawEvent::AppendI32(i, weight));
@@ -66,7 +67,7 @@ pub mod logger {
#[weight = *weight]
fn non_privileged_log(origin, i: i32, weight: Weight){
// Ensure that the `origin` is some signed account.
// Ensure that the `origin` is some signed account.
let sender = ensure_signed(origin)?;
<I32Log>::append(i);
<AccountLog<T>>::append(sender.clone());
@@ -112,8 +113,15 @@ parameter_types! {
pub const AvailableBlockRatio: Perbill = Perbill::one();
}
pub struct BlockEverything;
impl Filter<Call> for BlockEverything {
fn filter(_: &Call) -> bool {
false
}
}
impl frame_system::Trait for Test {
type BaseCallFilter = ();
type BaseCallFilter = BlockEverything;
type Origin = Origin;
type Call = Call;
type Index = u64;
@@ -121,7 +129,7 @@ impl frame_system::Trait for Test {
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = TestEvent;
type BlockHashCount = BlockHashCount;