From be301f4284786bac631368058ecd54e67fdf807a Mon Sep 17 00:00:00 2001 From: kianenigma Date: Tue, 6 Sep 2022 08:43:27 +0100 Subject: [PATCH 1/5] Remove stale polkadot call filter --- runtime/common/src/lib.rs | 8 +++++ runtime/kusama/src/lib.rs | 10 +------ runtime/polkadot/src/lib.rs | 58 +------------------------------------ runtime/westend/src/lib.rs | 10 +------ 4 files changed, 11 insertions(+), 75 deletions(-) diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 84c9745d7a23..12b87822437e 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -261,3 +261,11 @@ macro_rules! prod_or_fast { } }; } + +/// Allow for all calls to be dispatched. +pub struct AllowAllCalls; +impl Contains for AllowAllCalls { + fn contains(_c: &Call) -> bool { + true + } +} diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index a957e943cd30..15674047185e 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -144,14 +144,6 @@ pub fn native_version() -> NativeVersion { NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } } -/// We currently allow all calls. -pub struct BaseFilter; -impl Contains for BaseFilter { - fn contains(_c: &Call) -> bool { - true - } -} - type MoreThanHalfCouncil = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionMoreThan, @@ -163,7 +155,7 @@ parameter_types! { } impl frame_system::Config for Runtime { - type BaseCallFilter = BaseFilter; + type BaseCallFilter = runtime_common::AllowAllCalls; type BlockWeights = BlockWeights; type BlockLength = BlockLength; type Origin = Origin; diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index 49988a50a902..69abaa3ff1d3 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -135,62 +135,6 @@ pub fn native_version() -> NativeVersion { NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } } -pub struct BaseFilter; -impl Contains for BaseFilter { - fn contains(call: &Call) -> bool { - match call { - // These modules are all allowed to be called by transactions: - Call::Democracy(_) | - Call::Council(_) | - Call::TechnicalCommittee(_) | - Call::TechnicalMembership(_) | - Call::Treasury(_) | - Call::PhragmenElection(_) | - Call::System(_) | - Call::Scheduler(_) | - Call::Preimage(_) | - Call::Indices(_) | - Call::Babe(_) | - Call::Timestamp(_) | - Call::Balances(_) | - Call::Authorship(_) | - Call::Staking(_) | - Call::Session(_) | - Call::Grandpa(_) | - Call::ImOnline(_) | - Call::Utility(_) | - Call::Claims(_) | - Call::Vesting(_) | - Call::Identity(_) | - Call::Proxy(_) | - Call::Multisig(_) | - Call::Bounties(_) | - Call::ChildBounties(_) | - Call::Tips(_) | - Call::ElectionProviderMultiPhase(_) | - Call::Configuration(_) | - Call::ParasShared(_) | - Call::ParaInclusion(_) | - Call::Paras(_) | - Call::Initializer(_) | - Call::ParaInherent(_) | - Call::ParasDisputes(_) | - Call::Dmp(_) | - Call::Ump(_) | - Call::Hrmp(_) | - Call::Slots(_) | - Call::Registrar(_) | - Call::Auctions(_) | - Call::Crowdloan(_) | - Call::VoterList(_) | - Call::XcmPallet(_) | - Call::NominationPools(_) => true, - // All pallets are allowed, but exhaustive match is defensive - // in the case of adding new pallets. - } - } -} - type MoreThanHalfCouncil = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionMoreThan, @@ -202,7 +146,7 @@ parameter_types! { } impl frame_system::Config for Runtime { - type BaseCallFilter = BaseFilter; + type BaseCallFilter = runtime_common::AllowAllCalls; type BlockWeights = BlockWeights; type BlockLength = BlockLength; type Origin = Origin; diff --git a/runtime/westend/src/lib.rs b/runtime/westend/src/lib.rs index f1761efcc5bc..713dec4131dc 100644 --- a/runtime/westend/src/lib.rs +++ b/runtime/westend/src/lib.rs @@ -129,21 +129,13 @@ pub fn native_version() -> NativeVersion { NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } } -/// Allow everything. -pub struct BaseFilter; -impl Contains for BaseFilter { - fn contains(_: &Call) -> bool { - true - } -} - parameter_types! { pub const Version: RuntimeVersion = VERSION; pub const SS58Prefix: u8 = 42; } impl frame_system::Config for Runtime { - type BaseCallFilter = BaseFilter; + type BaseCallFilter = runtime_common::AllowAllCalls; type BlockWeights = BlockWeights; type BlockLength = BlockLength; type Origin = Origin; From db89a2969feec399258503eaf0fbe57c4fd595a5 Mon Sep 17 00:00:00 2001 From: kianenigma Date: Tue, 6 Sep 2022 12:53:19 +0100 Subject: [PATCH 2/5] fix build --- runtime/common/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index eea05ab65a3e..6ffa69762163 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -264,7 +264,7 @@ macro_rules! prod_or_fast { /// Allow for all calls to be dispatched. pub struct AllowAllCalls; -impl Contains for AllowAllCalls { +impl frame_support::traits::Contains for AllowAllCalls { fn contains(_c: &Call) -> bool { true } From 376501ab2eeb5597758893ba561102535fcab5bc Mon Sep 17 00:00:00 2001 From: kianenigma Date: Tue, 6 Sep 2022 12:54:00 +0100 Subject: [PATCH 3/5] really fix it --- runtime/common/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 6ffa69762163..35e93712c0ca 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -264,8 +264,8 @@ macro_rules! prod_or_fast { /// Allow for all calls to be dispatched. pub struct AllowAllCalls; -impl frame_support::traits::Contains for AllowAllCalls { - fn contains(_c: &Call) -> bool { +impl frame_support::traits::Contains for AllowAllCalls { + fn contains(_c: &C) -> bool { true } } From d7d2949afa30547cbac217ec9d252b3679aa8211 Mon Sep 17 00:00:00 2001 From: kianenigma Date: Tue, 6 Sep 2022 13:21:52 +0100 Subject: [PATCH 4/5] unused import --- runtime/kusama/src/lib.rs | 2 +- runtime/polkadot/src/lib.rs | 5 +---- runtime/westend/src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 1859c1fa3326..ea61834e417f 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -53,7 +53,7 @@ use frame_election_provider_support::{ use frame_support::{ construct_runtime, parameter_types, traits::{ - ConstU32, Contains, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, + ConstU32, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, PrivilegeCmp, }, weights::ConstantMultiplier, diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index 9c2a333fcabd..b8507ab9283b 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -40,10 +40,7 @@ use beefy_primitives::crypto::AuthorityId as BeefyId; use frame_election_provider_support::{generate_solution_type, onchain, SequentialPhragmen}; use frame_support::{ construct_runtime, parameter_types, - traits::{ - Contains, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, - PrivilegeCmp, - }, + traits::{EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, PrivilegeCmp}, weights::ConstantMultiplier, PalletId, RuntimeDebug, }; diff --git a/runtime/westend/src/lib.rs b/runtime/westend/src/lib.rs index 037b8977765f..53e49efd219e 100644 --- a/runtime/westend/src/lib.rs +++ b/runtime/westend/src/lib.rs @@ -25,7 +25,7 @@ use beefy_primitives::crypto::AuthorityId as BeefyId; use frame_election_provider_support::{onchain, SequentialPhragmen}; use frame_support::{ construct_runtime, parameter_types, - traits::{ConstU32, Contains, InstanceFilter, KeyOwnerProofSystem}, + traits::{ConstU32, InstanceFilter, KeyOwnerProofSystem}, weights::ConstantMultiplier, PalletId, }; From 5dca2f268c627f61ba19ea5e124bce7fa155a253 Mon Sep 17 00:00:00 2001 From: kianenigma Date: Thu, 8 Sep 2022 10:49:29 +0000 Subject: [PATCH 5/5] Fix --- runtime/common/src/lib.rs | 8 -------- runtime/kusama/src/lib.rs | 2 +- runtime/polkadot/src/lib.rs | 2 +- runtime/westend/src/lib.rs | 2 +- 4 files changed, 3 insertions(+), 11 deletions(-) diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 35e93712c0ca..24ed3b90d99c 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -261,11 +261,3 @@ macro_rules! prod_or_fast { } }; } - -/// Allow for all calls to be dispatched. -pub struct AllowAllCalls; -impl frame_support::traits::Contains for AllowAllCalls { - fn contains(_c: &C) -> bool { - true - } -} diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index ea61834e417f..7c1b9e9337d1 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -155,7 +155,7 @@ parameter_types! { } impl frame_system::Config for Runtime { - type BaseCallFilter = runtime_common::AllowAllCalls; + type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = BlockWeights; type BlockLength = BlockLength; type Origin = Origin; diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index b8507ab9283b..82a83d8bbe00 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -143,7 +143,7 @@ parameter_types! { } impl frame_system::Config for Runtime { - type BaseCallFilter = runtime_common::AllowAllCalls; + type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = BlockWeights; type BlockLength = BlockLength; type Origin = Origin; diff --git a/runtime/westend/src/lib.rs b/runtime/westend/src/lib.rs index 53e49efd219e..5963122ec1f1 100644 --- a/runtime/westend/src/lib.rs +++ b/runtime/westend/src/lib.rs @@ -135,7 +135,7 @@ parameter_types! { } impl frame_system::Config for Runtime { - type BaseCallFilter = runtime_common::AllowAllCalls; + type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = BlockWeights; type BlockLength = BlockLength; type Origin = Origin;