@@ -10,7 +10,6 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
1010
1111use core:: num:: NonZeroU64 ;
1212
13- mod base_call_filter;
1413pub mod check_nonce;
1514mod migrations;
1615pub mod sudo_wrapper;
@@ -76,9 +75,6 @@ use subtensor_runtime_common::{AlphaCurrency, AuthorshipInfo, TaoCurrency, time:
7675use subtensor_swap_interface:: { Order , SwapHandler } ;
7776
7877// A few exports that help ease life for downstream crates.
79- use crate :: base_call_filter:: NoNestingCallFilter ;
80- use crate :: base_call_filter:: SafeModeWhitelistedCalls ;
81- use core:: marker:: PhantomData ;
8278pub use frame_support:: {
8379 StorageValue , construct_runtime, parameter_types,
8480 traits:: {
@@ -98,12 +94,15 @@ pub use pallet_balances::Call as BalancesCall;
9894use pallet_commitments:: GetCommitments ;
9995pub use pallet_timestamp:: Call as TimestampCall ;
10096use pallet_transaction_payment:: { ConstFeeMultiplier , Multiplier } ;
101- use scale_info:: TypeInfo ;
10297#[ cfg( any( feature = "std" , test) ) ]
10398pub use sp_runtime:: BuildStorage ;
10499pub use sp_runtime:: { Perbill , Permill } ;
105100use subtensor_transaction_fee:: { SubtensorTxFeeHandler , TransactionFeeHandler } ;
106101
102+ use core:: marker:: PhantomData ;
103+
104+ use scale_info:: TypeInfo ;
105+
107106// Frontier
108107use fp_rpc:: TransactionStatus ;
109108use pallet_ethereum:: { Call :: transact, PostLogContent , Transaction as EthereumTransaction } ;
@@ -276,6 +275,28 @@ parameter_types! {
276275 pub const SS58Prefix : u8 = 42 ;
277276}
278277
278+ pub struct NoNestingCallFilter ;
279+
280+ impl Contains < RuntimeCall > for NoNestingCallFilter {
281+ fn contains ( call : & RuntimeCall ) -> bool {
282+ match call {
283+ RuntimeCall :: Utility ( inner) => {
284+ let calls = match inner {
285+ pallet_utility:: Call :: force_batch { calls } => calls,
286+ pallet_utility:: Call :: batch { calls } => calls,
287+ pallet_utility:: Call :: batch_all { calls } => calls,
288+ _ => & Vec :: new ( ) ,
289+ } ;
290+
291+ !calls. iter ( ) . any ( |call| {
292+ matches ! ( call, RuntimeCall :: Utility ( inner) if matches!( inner, pallet_utility:: Call :: force_batch { .. } | pallet_utility:: Call :: batch_all { .. } | pallet_utility:: Call :: batch { .. } ) )
293+ } )
294+ }
295+ _ => true ,
296+ }
297+ }
298+ }
299+
279300// Configure FRAME pallets to include in runtime.
280301
281302impl frame_system:: Config for Runtime {
@@ -409,6 +430,25 @@ parameter_types! {
409430 pub const DisallowPermissionlessRelease : Option <BlockNumber > = None ;
410431}
411432
433+ pub struct SafeModeWhitelistedCalls ;
434+ impl Contains < RuntimeCall > for SafeModeWhitelistedCalls {
435+ fn contains ( call : & RuntimeCall ) -> bool {
436+ matches ! (
437+ call,
438+ RuntimeCall :: Sudo ( _)
439+ | RuntimeCall :: Multisig ( _)
440+ | RuntimeCall :: System ( _)
441+ | RuntimeCall :: SafeMode ( _)
442+ | RuntimeCall :: Timestamp ( _)
443+ | RuntimeCall :: SubtensorModule (
444+ pallet_subtensor:: Call :: set_weights { .. }
445+ | pallet_subtensor:: Call :: serve_axon { .. }
446+ )
447+ | RuntimeCall :: Commitments ( pallet_commitments:: Call :: set_commitment { .. } )
448+ )
449+ }
450+ }
451+
412452impl pallet_safe_mode:: Config for Runtime {
413453 type RuntimeEvent = RuntimeEvent ;
414454 type Currency = Balances ;
0 commit comments