Skip to content

Commit

Permalink
Merge pull request #44 from galacticcouncil/feat/call_filter
Browse files Browse the repository at this point in the history
feat: add extrinsics filter
  • Loading branch information
mrq1911 committed May 30, 2021
2 parents 4152c16 + da2d373 commit 351eeea
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions runtime/src/lib.rs
Expand Up @@ -26,7 +26,7 @@ use sp_version::RuntimeVersion;
// A few exports that help ease life for downstream crates.
pub use frame_support::{
construct_runtime, parameter_types,
traits::{Get, KeyOwnerProofSystem, LockIdentifier, Randomness},
traits::{Filter, Get, KeyOwnerProofSystem, LockIdentifier, Randomness},
weights::{
constants::{BlockExecutionWeight, RocksDbWeight, WEIGHT_PER_SECOND},
DispatchClass, IdentityFee, Pays, Weight,
Expand Down Expand Up @@ -145,6 +145,28 @@ pub fn native_version() -> NativeVersion {
}
}

pub struct BaseFilter;
impl Filter<Call> for BaseFilter {
fn filter(call: &Call) -> bool {
match call {
Call::System(_)
| Call::Timestamp(_)
| Call::RandomnessCollectiveFlip(_)
| Call::ParachainSystem(_)
| Call::Sudo(_) => true,

Call::XYK(_)
| Call::Balances(_)
| Call::AssetRegistry(_)
| Call::Currencies(_)
| Call::Exchange(_)
| Call::Faucet(_)
| Call::MultiTransactionPayment(_)
| Call::Tokens(_) => false,
}
}
}

parameter_types! {
pub const BlockHashCount: BlockNumber = 250;
pub const Version: RuntimeVersion = VERSION;
Expand Down Expand Up @@ -179,7 +201,7 @@ parameter_types! {

impl frame_system::Config for Runtime {
/// The basic call filter to use in dispatchable.
type BaseCallFilter = ();
type BaseCallFilter = BaseFilter;
type BlockWeights = BlockWeights;
type BlockLength = BlockLength;
/// The ubiquitous origin type.
Expand Down

0 comments on commit 351eeea

Please sign in to comment.