Introduce in-origin filtering (#6318)

* impl filter in origin

* remove IsCallable usage. Breaking: utility::batch(root, calls) no longer bypass BasicCallFilter

* rename BasicCallFilter -> BaseCallFilter

* refactor code

* Apply suggestions from code review

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* remove forgotten temporar comment

* better add suggestion in another PR

* refactor: use Clone instead of mem::replace

* fix tests

* fix tests

* fix tests

* fix benchmarks

* Make root bypass filter in utility::batch

* fix unused imports

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
Guillaume Thiolliere
2020-06-15 17:05:41 +02:00
committed by GitHub
parent 97cac4ce8b
commit c2ad27271b
79 changed files with 536 additions and 302 deletions
@@ -89,12 +89,14 @@ pub type BlockNumber = u64;
pub type Index = u64;
impl system::Trait for Runtime {
type BaseCallFilter = ();
type Hash = H256;
type Origin = Origin;
type BlockNumber = BlockNumber;
type AccountId = AccountId;
type Event = Event;
type ModuleToIndex = ModuleToIndex;
type Call = Call;
}
frame_support::construct_runtime!(
@@ -233,12 +233,14 @@ pub type BlockNumber = u64;
pub type Index = u64;
impl system::Trait for Runtime {
type BaseCallFilter= ();
type Hash = H256;
type Origin = Origin;
type BlockNumber = BlockNumber;
type AccountId = AccountId;
type Event = Event;
type ModuleToIndex = ();
type Call = Call;
}
frame_support::construct_runtime!(
@@ -158,12 +158,14 @@ pub type Block = generic::Block<Header, UncheckedExtrinsic>;
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, Call, Signature, ()>;
impl system::Trait for Runtime {
type BaseCallFilter = ();
type Hash = H256;
type Origin = Origin;
type BlockNumber = BlockNumber;
type AccountId = AccountId;
type Event = Event;
type ModuleToIndex = ();
type Call = Call;
}
impl module::Trait for Runtime {}
@@ -21,9 +21,11 @@ pub trait Trait: 'static + Eq + Clone {
type Origin: Into<Result<RawOrigin<Self::AccountId>, Self::Origin>>
+ From<RawOrigin<Self::AccountId>>;
type BaseCallFilter: frame_support::traits::Filter<Self::Call>;
type BlockNumber: Decode + Encode + EncodeLike + Clone + Default;
type Hash;
type AccountId: Encode + EncodeLike + Decode;
type Call;
type Event: From<Event<Self>>;
type ModuleToIndex: frame_support::traits::ModuleToIndex;
}