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
@@ -157,7 +157,7 @@ parameter_types! {
impl frame_system::Config for Runtime {
/// The basic call filter to use in dispatchable.
type BaseCallFilter = frame_support::traits::AllowAll;
type BaseCallFilter = frame_support::traits::Everything;
/// The identifier used to distinguish between accounts.
type AccountId = AccountId;
/// The aggregated dispatch type that is available for extrinsics.
@@ -214,7 +214,7 @@ impl pallet_bridge_dispatch::Config for Runtime {
type Event = Event;
type MessageId = (bp_messages::LaneId, bp_messages::MessageNonce);
type Call = Call;
type CallFilter = frame_support::traits::AllowAll;
type CallFilter = frame_support::traits::Everything;
type EncodedCall = crate::rialto_messages::FromRialtoEncodedCall;
type SourceChainAccountId = bp_rialto::AccountId;
type TargetChainAccountPublic = MultiSigner;
@@ -165,7 +165,7 @@ parameter_types! {
impl frame_system::Config for Runtime {
/// The basic call filter to use in dispatchable.
type BaseCallFilter = frame_support::traits::AllowAll;
type BaseCallFilter = frame_support::traits::Everything;
/// The identifier used to distinguish between accounts.
type AccountId = AccountId;
/// The aggregated dispatch type that is available for extrinsics.
@@ -265,7 +265,7 @@ impl pallet_bridge_dispatch::Config for Runtime {
type Event = Event;
type MessageId = (bp_messages::LaneId, bp_messages::MessageNonce);
type Call = Call;
type CallFilter = frame_support::traits::AllowAll;
type CallFilter = frame_support::traits::Everything;
type EncodedCall = crate::millau_messages::FromMillauEncodedCall;
type SourceChainAccountId = bp_millau::AccountId;
type TargetChainAccountPublic = MultiSigner;
@@ -355,7 +355,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 = ();
+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(_)))
}
}
@@ -73,7 +73,7 @@ impl frame_system::Config for TestRuntime {
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type BaseCallFilter = frame_support::traits::AllowAll;
type BaseCallFilter = frame_support::traits::Everything;
type SystemWeightInfo = ();
type BlockWeights = ();
type BlockLength = ();
+1 -1
View File
@@ -70,7 +70,7 @@ impl frame_system::Config for TestRuntime {
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type BaseCallFilter = frame_support::traits::AllowAll;
type BaseCallFilter = frame_support::traits::Everything;
type SystemWeightInfo = ();
type DbWeight = ();
type BlockWeights = ();
@@ -106,7 +106,7 @@ impl frame_system::Config for TestRuntime {
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
type BaseCallFilter = frame_support::traits::AllowAll;
type BaseCallFilter = frame_support::traits::Everything;
type SystemWeightInfo = ();
type BlockWeights = ();
type BlockLength = ();
@@ -139,7 +139,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 = ();