Companion to #9514 (Remove Filter and use Contains instead) (#3591)

* Remove Filter and use Contains instead

* Fixes

* Remove patch

* Formatting

* update Substrate

Co-authored-by: parity-processbot <>
This commit is contained in:
Gavin Wood
2021-08-07 22:19:28 +02:00
committed by GitHub
parent a4527cbc49
commit 9800d22b1d
28 changed files with 226 additions and 232 deletions
+6 -6
View File
@@ -37,7 +37,7 @@ use frame_support::{
decl_event, decl_module, decl_storage,
dispatch::{Dispatchable, Parameter},
ensure,
traits::{Filter, Get},
traits::{Contains, Get},
weights::{extract_actual_weight, GetDispatchInfo},
};
use frame_system::RawOrigin;
@@ -73,7 +73,7 @@ pub trait Config<I = DefaultInstance>: frame_system::Config {
///
/// The pallet will filter all incoming calls right before they're dispatched. If this filter
/// rejects the call, special event (`Event::MessageCallRejected`) is emitted.
type CallFilter: Filter<<Self as Config<I>>::Call>;
type CallFilter: Contains<<Self as Config<I>>::Call>;
/// The type that is used to wrap the `Self::Call` when it is moved over bridge.
///
/// The idea behind this is to avoid `Call` conversion/decoding until we'll be sure
@@ -244,7 +244,7 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::AccountId, T::MessageId> for
};
// filter the call
if !T::CallFilter::filter(&call) {
if !T::CallFilter::contains(&call) {
log::trace!(
target: "runtime::bridge-dispatch",
"Message {:?}/{:?}: the call ({:?}) is rejected by filter",
@@ -482,7 +482,7 @@ mod tests {
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type BaseCallFilter = frame_support::traits::AllowAll;
type BaseCallFilter = frame_support::traits::Everything;
type SystemWeightInfo = ();
type BlockWeights = ();
type BlockLength = ();
@@ -514,8 +514,8 @@ mod tests {
pub struct TestCallFilter;
impl Filter<Call> for TestCallFilter {
fn filter(call: &Call) -> bool {
impl Contains<Call> for TestCallFilter {
fn contains(call: &Call) -> bool {
!matches!(*call, Call::System(frame_system::Call::fill_block(_)))
}
}