Remove Filter and use Contains instead (#9514)

* Remove Filter and use Contains instead

* Fixes

* Formatting

* Update docs/Upgrading-2.0-to-3.0.md

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

* Typo

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
Gavin Wood
2021-08-07 21:26:40 +02:00
committed by GitHub
parent e251d1cedb
commit bdda3ed612
79 changed files with 199 additions and 199 deletions
+4 -4
View File
@@ -26,7 +26,7 @@ use frame_support::{
assert_err_ignore_postinfo, assert_noop, assert_ok, decl_module,
dispatch::{DispatchError, DispatchErrorWithPostInfo, Dispatchable},
parameter_types, storage,
traits::Filter,
traits::Contains,
weights::{Pays, Weight},
};
use sp_core::H256;
@@ -142,8 +142,8 @@ parameter_types! {
impl example::Config for Test {}
pub struct TestBaseCallFilter;
impl Filter<Call> for TestBaseCallFilter {
fn filter(c: &Call) -> bool {
impl Contains<Call> for TestBaseCallFilter {
fn contains(c: &Call) -> bool {
match *c {
// Transfer works. Use `transfer_keep_alive` for a call that doesn't pass the filter.
Call::Balances(pallet_balances::Call::transfer(..)) => true,
@@ -282,7 +282,7 @@ fn batch_with_root_works() {
new_test_ext().execute_with(|| {
let k = b"a".to_vec();
let call = Call::System(frame_system::Call::set_storage(vec![(k.clone(), k.clone())]));
assert!(!TestBaseCallFilter::filter(&call));
assert!(!TestBaseCallFilter::contains(&call));
assert_eq!(Balances::free_balance(1), 10);
assert_eq!(Balances::free_balance(2), 10);
assert_ok!(Utility::batch(