Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

remove stale polkadot call filter #5969

Merged
merged 7 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,11 @@ macro_rules! prod_or_fast {
}
};
}

/// Allow for all calls to be dispatched.
pub struct AllowAllCalls;
impl<C> frame_support::traits::Contains<C> for AllowAllCalls {
fn contains(_c: &C) -> bool {
true
}
}
12 changes: 2 additions & 10 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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<Call> for BaseFilter {
fn contains(_c: &Call) -> bool {
true
}
}

type MoreThanHalfCouncil = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionMoreThan<AccountId, CouncilCollective, 1, 2>,
Expand All @@ -163,7 +155,7 @@ parameter_types! {
}

impl frame_system::Config for Runtime {
type BaseCallFilter = BaseFilter;
type BaseCallFilter = runtime_common::AllowAllCalls;
kianenigma marked this conversation as resolved.
Show resolved Hide resolved
type BlockWeights = BlockWeights;
type BlockLength = BlockLength;
type Origin = Origin;
Expand Down
63 changes: 2 additions & 61 deletions runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -135,62 +132,6 @@ pub fn native_version() -> NativeVersion {
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
}

pub struct BaseFilter;
impl Contains<Call> 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.
Comment on lines -188 to -189
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont disagree with this PR, but this was stated to be explicit

}
}
}

type MoreThanHalfCouncil = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionMoreThan<AccountId, CouncilCollective, 1, 2>,
Expand All @@ -202,7 +143,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;
Expand Down
12 changes: 2 additions & 10 deletions runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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<Call> 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;
Expand Down