Skip to content

Commit 6685abd

Browse files
rphmeierpepyakin
authored andcommitted
kusama: disallow balance transfers
1 parent 199cd21 commit 6685abd

File tree

1 file changed

+17
-5
lines changed
  • sugondat-chain/runtimes/sugondat-kusama/src

1 file changed

+17
-5
lines changed

sugondat-chain/runtimes/sugondat-kusama/src/lib.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ use frame_support::{
3434
dispatch::DispatchClass,
3535
genesis_builder_helper::{build_config, create_default_config},
3636
parameter_types,
37-
traits::{
38-
ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, Everything, TransformOrigin,
39-
},
37+
traits::{ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, TransformOrigin},
4038
weights::{ConstantMultiplier, Weight},
4139
PalletId,
4240
};
@@ -166,6 +164,20 @@ parameter_types! {
166164
pub const SS58Prefix: u16 = 2; // Kusama
167165
}
168166

167+
/// Call filter that allows all kinds of transactions except for balance transfers.
168+
pub struct NoBalanceTransfers;
169+
170+
impl frame_support::traits::Contains<RuntimeCall> for NoBalanceTransfers {
171+
fn contains(x: &RuntimeCall) -> bool {
172+
match *x {
173+
RuntimeCall::Balances(pallet_balances::Call::transfer_allow_death { .. })
174+
| RuntimeCall::Balances(pallet_balances::Call::transfer_keep_alive { .. })
175+
| RuntimeCall::Balances(pallet_balances::Call::transfer_all { .. }) => false,
176+
_ => true,
177+
}
178+
}
179+
}
180+
169181
// Configure FRAME pallets to include in runtime.
170182

171183
impl frame_system::Config for Runtime {
@@ -202,7 +214,7 @@ impl frame_system::Config for Runtime {
202214
/// The weight of database operations that the runtime can invoke.
203215
type DbWeight = RocksDbWeight;
204216
/// The basic call filter to use in dispatchable.
205-
type BaseCallFilter = Everything;
217+
type BaseCallFilter = NoBalanceTransfers;
206218
/// Weight information for the extrinsics of this pallet.
207219
type SystemWeightInfo = ();
208220
/// Block & extrinsics weights: base values and limits.
@@ -386,7 +398,7 @@ impl pallet_collator_selection::Config for Runtime {
386398
type Currency = Balances;
387399
type UpdateOrigin = CollatorSelectionUpdateOrigin;
388400
type PotId = PotId;
389-
type MaxCandidates = ConstU32<100>;
401+
type MaxCandidates = ConstU32<0>;
390402
type MinEligibleCollators = ConstU32<4>;
391403
type MaxInvulnerables = ConstU32<20>;
392404
// should be a multiple of session or things will get inconsistent

0 commit comments

Comments
 (0)