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 2 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 Contains<Call> for AllowAllCalls {
fn contains(_c: &Call) -> bool {
true
}
}
10 changes: 1 addition & 9 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
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
58 changes: 1 addition & 57 deletions runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,62 +135,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 +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;
Expand Down
10 changes: 1 addition & 9 deletions runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
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