diff --git a/runtime/devnet/src/lib.rs b/runtime/devnet/src/lib.rs index dee597b64..ef455a613 100644 --- a/runtime/devnet/src/lib.rs +++ b/runtime/devnet/src/lib.rs @@ -35,8 +35,8 @@ use frame_support::{ parameter_types, traits::{ fungible::HoldConsideration, tokens::nonfungibles_v2::Inspect, ConstBool, ConstU32, - ConstU64, ConstU8, Contains, EitherOfDiverse, EqualPrivilegeOnly, EverythingBut, - LinearStoragePrice, TransformOrigin, VariantCountOf, + ConstU64, ConstU8, EitherOfDiverse, EqualPrivilegeOnly, Everything, LinearStoragePrice, + TransformOrigin, VariantCountOf, }, weights::{ ConstantMultiplier, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, @@ -50,7 +50,6 @@ use frame_system::{ CheckWeight, EnsureRoot, }; use pallet_api::{fungibles, nonfungibles}; -use pallet_balances::Call as BalancesCall; use pallet_ismp::offchain::{Leaf, Proof, ProofKeys}; use pallet_revive::{ evm::{runtime::EthExtra, H160}, @@ -285,23 +284,6 @@ parameter_types! { pub const SS58Prefix: u16 = 42; } -/// A type to identify filtered calls. -pub struct FilteredCalls; -impl Contains for FilteredCalls { - fn contains(c: &RuntimeCall) -> bool { - use BalancesCall::*; - matches!( - c, - RuntimeCall::Balances( - force_adjust_total_issuance { .. } | - force_set_balance { .. } | - force_transfer { .. } | - force_unreserve { .. } - ) - ) - } -} - /// The default types are being injected by [`derive_impl`](`frame_support::derive_impl`) from /// [`ParaChainDefaultConfig`](`struct@frame_system::config_preludes::ParaChainDefaultConfig`), /// but overridden as needed. @@ -312,7 +294,7 @@ impl frame_system::Config for Runtime { /// The identifier used to distinguish between accounts. type AccountId = AccountId; /// The basic call filter to use in dispatchable. Supports everything as the default. - type BaseCallFilter = EverythingBut; + type BaseCallFilter = Everything; /// The block type. type Block = Block; /// Maximum number of block number to block hash mappings to keep (oldest pruned first). diff --git a/runtime/mainnet/src/config/system.rs b/runtime/mainnet/src/config/system.rs index 24aecb5b1..bb3aad80d 100644 --- a/runtime/mainnet/src/config/system.rs +++ b/runtime/mainnet/src/config/system.rs @@ -1,6 +1,5 @@ use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; -use frame_support::traits::{ConstU32, ConstU64, Contains, EnqueueWithOrigin, EverythingBut}; -use pallet_balances::Call as BalancesCall; +use frame_support::traits::{ConstU32, ConstU64, EnqueueWithOrigin, Everything}; use polkadot_runtime_common::BlockHashCount; use pop_runtime_common::{ Nonce, AVERAGE_ON_INITIALIZE_RATIO, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, @@ -52,22 +51,6 @@ parameter_types! { .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO) .build_or_panic(); } -/// A type to identify filtered calls. -pub struct FilteredCalls; -impl Contains for FilteredCalls { - fn contains(c: &RuntimeCall) -> bool { - use BalancesCall::*; - matches!( - c, - RuntimeCall::Balances( - force_adjust_total_issuance { .. } | - force_set_balance { .. } | - force_transfer { .. } | - force_unreserve { .. } - ) - ) - } -} impl frame_system::Config for Runtime { /// The data to be stored in an account. @@ -75,7 +58,7 @@ impl frame_system::Config for Runtime { /// The identifier used to distinguish between accounts. type AccountId = AccountId; /// The basic call filter to use in dispatchable. Supports everything as the default. - type BaseCallFilter = EverythingBut; + type BaseCallFilter = Everything; /// The block type. type Block = Block; /// Maximum number of block number to block hash mappings to keep (oldest pruned first). @@ -188,15 +171,12 @@ mod tests { }; use frame_system::limits::WeightsPerClass; use sp_core::crypto::AccountId32; - use sp_runtime::{generic, MultiAddress}; + use sp_runtime::generic; use super::*; use crate::{Header, Perbill, UncheckedExtrinsic, Weight}; mod system { - use pallet_balances::AdjustmentDirection; - use BalancesCall::*; - use super::*; #[test] @@ -208,30 +188,11 @@ mod tests { } #[test] - fn base_call_filter_allows_everything_but_filtered_calls() { + fn base_call_filter_allows_everything() { assert_eq!( TypeId::of::<::BaseCallFilter>(), - TypeId::of::>(), - ); - let dummy_acc = MultiAddress::from(AccountId32::from([0; 32])); - let filtered_calls = [ - RuntimeCall::Balances(force_adjust_total_issuance { - direction: AdjustmentDirection::Increase, - delta: 0, - }), - RuntimeCall::Balances(force_set_balance { who: dummy_acc.clone(), new_free: 0 }), - RuntimeCall::Balances(force_transfer { - source: dummy_acc.clone(), - dest: dummy_acc.clone(), - value: 1, - }), - RuntimeCall::Balances(force_unreserve { who: dummy_acc, amount: 0 }), - ]; - - for call in filtered_calls { - assert!(FilteredCalls::contains(&call)); - assert!(!<::BaseCallFilter>::contains(&call)); - } + TypeId::of::(), + ); } #[test] diff --git a/runtime/testnet/src/config/system.rs b/runtime/testnet/src/config/system.rs index 360a8e7d6..b5c2cc384 100644 --- a/runtime/testnet/src/config/system.rs +++ b/runtime/testnet/src/config/system.rs @@ -3,7 +3,7 @@ use frame_support::{ derive_impl, pallet_prelude::ConstU32, parameter_types, - traits::{ConstU64, Contains, EverythingBut}, + traits::{ConstU64, Everything}, }; use parachains_common::{Balance, Hash}; use polkadot_runtime_common::BlockHashCount; @@ -15,10 +15,10 @@ use sp_runtime::{ #[cfg(not(feature = "runtime-benchmarks"))] use crate::Revive; use crate::{ - weights::RocksDbWeight, AccountId, AggregateMessageOrigin, Aura, BalancesCall, Block, - BlockExecutionWeight, BlockLength, BlockWeights, DispatchClass, ExtrinsicBaseWeight, - MessageQueue, MultiBlockMigrations, Nonce, PalletInfo, Runtime, RuntimeCall, RuntimeEvent, - RuntimeOrigin, RuntimeTask, RuntimeVersion, Weight, XcmpQueue, AVERAGE_ON_INITIALIZE_RATIO, + weights::RocksDbWeight, AccountId, AggregateMessageOrigin, Aura, Block, BlockExecutionWeight, + BlockLength, BlockWeights, DispatchClass, ExtrinsicBaseWeight, MessageQueue, + MultiBlockMigrations, Nonce, PalletInfo, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, + RuntimeTask, RuntimeVersion, Weight, XcmpQueue, AVERAGE_ON_INITIALIZE_RATIO, BLOCK_PROCESSING_VELOCITY, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, RELAY_CHAIN_SLOT_DURATION_MILLIS, UNINCLUDED_SEGMENT_CAPACITY, VERSION, }; @@ -53,23 +53,6 @@ parameter_types! { pub const SS58Prefix: u16 = 0; } -/// A type to identify filtered calls. -pub struct FilteredCalls; -impl Contains for FilteredCalls { - fn contains(c: &RuntimeCall) -> bool { - use BalancesCall::*; - matches!( - c, - RuntimeCall::Balances( - force_adjust_total_issuance { .. } | - force_set_balance { .. } | - force_transfer { .. } | - force_unreserve { .. } - ) - ) - } -} - #[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig)] impl frame_system::Config for Runtime { /// The data to be stored in an account. @@ -77,7 +60,7 @@ impl frame_system::Config for Runtime { /// The identifier used to distinguish between accounts. type AccountId = AccountId; /// The basic call filter to use in dispatchable. Supports everything as the default. - type BaseCallFilter = EverythingBut; + type BaseCallFilter = Everything; /// The block type. type Block = Block; /// Maximum number of block number to block hash mappings to keep (oldest pruned first).