Skip to content

Commit

Permalink
Filter call
Browse files Browse the repository at this point in the history
Signed-off-by: Xavier Lau <x@acg.box>
  • Loading branch information
AurevoirXavier committed Oct 9, 2024
1 parent c2cc1d9 commit ace8f37
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion runtime/crab/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade {

fn migrate() -> frame_support::weights::Weight {
if let Ok(k) = array_bytes::hex2bytes("0x1da53b775b270400e7e61ed5cbc5a146ab1160471b1418779239ba8e2b847e42d53de13b56da115d3342f0588bc3614108837de0ae21c270383d9f2de4db03c7b1314632314d8c74970d627c9b4f4c42e06688a9f7a2866905a810c4b1a49b8cb0dca3f1bc953905609869b6e9d4fb794cd36c5f") {
System::kill_storage(RuntimeOrigin::root(), vec![k]);
let _ = System::kill_storage(RuntimeOrigin::root(), vec![k]);
}

<Runtime as frame_system::Config>::DbWeight::get().reads_writes(0, 1)
Expand Down
2 changes: 1 addition & 1 deletion runtime/darwinia/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ fn migrate() -> frame_support::weights::Weight {
}

if let Ok(k) = array_bytes::hex2bytes("0x1da53b775b270400e7e61ed5cbc5a146ab1160471b1418779239ba8e2b847e42d53de13b56da115d3342f0588bc3614108837de0ae21c270383d9f2de4db03c7b1314632314d8c74970d627c9b4f4c42e06688a9f7a2866905a810c4b1a49b8cb0dca3f1bc953905609869b6e9d4fb794cd36c5f") {
System::kill_storage(RuntimeOrigin::root(), vec![k]);
let _ = System::kill_storage(RuntimeOrigin::root(), vec![k]);
}

<Runtime as frame_system::Config>::DbWeight::get().reads_writes(7, 10)
Expand Down
13 changes: 12 additions & 1 deletion runtime/darwinia/src/pallets/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,22 @@ frame_support::parameter_types! {
pub const Version: sp_version::RuntimeVersion = VERSION;
}

pub enum LockAndStake {}
impl frame_support::traits::Contains<RuntimeCall> for LockAndStake {
fn contains(c: &RuntimeCall) -> bool {
matches!(
c,
RuntimeCall::DarwiniaStaking(darwinia_staking::Call::stake { .. })
| RuntimeCall::Deposit(darwinia_deposit::Call::lock { .. })
)
}
}

#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Runtime {
type AccountData = pallet_balances::AccountData<Balance>;
type AccountId = AccountId;
type BaseCallFilter = frame_support::traits::Everything;
type BaseCallFilter = frame_support::traits::EverythingBut<LockAndStake>;
type Block = Block;
type BlockLength = pallet_config::RuntimeBlockLength;
type BlockWeights = pallet_config::RuntimeBlockWeights;
Expand Down

0 comments on commit ace8f37

Please sign in to comment.