Skip to content

Commit

Permalink
call_runtime filter to Shibuya
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreOssun committed Jul 13, 2023
1 parent 04ce329 commit e55f340
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
3 changes: 1 addition & 2 deletions runtime/local/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ use frame_support::{
construct_runtime, parameter_types,
traits::{
AsEnsureOriginWithArg, ConstU128, ConstU32, ConstU64, Currency, EitherOfDiverse,
EqualPrivilegeOnly, FindAuthor, Get, InstanceFilter, KeyOwnerProofSystem, Nothing,
WithdrawReasons,
EqualPrivilegeOnly, FindAuthor, Get, InstanceFilter, WithdrawReasons,
},
weights::{
constants::{RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND},
Expand Down
15 changes: 13 additions & 2 deletions runtime/shibuya/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use frame_support::{
parameter_types,
traits::{
AsEnsureOriginWithArg, ConstU32, Contains, Currency, EitherOfDiverse, EqualPrivilegeOnly,
FindAuthor, Get, Imbalance, InstanceFilter, Nothing, OnUnbalanced, WithdrawReasons,
FindAuthor, Get, Imbalance, InstanceFilter, OnUnbalanced, WithdrawReasons,
},
weights::{
constants::{
Expand Down Expand Up @@ -647,6 +647,17 @@ impl pallet_vesting::Config for Runtime {
const MAX_VESTING_SCHEDULES: u32 = 28;
}

pub struct CallRuntimeFilter;
impl Contains<RuntimeCall> for CallRuntimeFilter {
fn contains(c: &RuntimeCall) -> bool {
match *c {
RuntimeCall::Assets(pallet_assets::Call::transfer { .. }) => true,
RuntimeCall::Assets(pallet_assets::Call::transfer_approved { .. }) => true,
_ => false,
}
}
}

// TODO: changing depost per item and per byte to `deposit` function will require storage migration it seems
parameter_types! {
pub const DepositPerItem: Balance = MILLISBY / 1_000_000;
Expand All @@ -669,7 +680,7 @@ impl pallet_contracts::Config for Runtime {
/// and make sure they are stable. Dispatchables exposed to contracts are not allowed to
/// change because that would break already deployed contracts. The `Call` structure itself
/// is not allowed to change the indices of existing pallets, too.
type CallFilter = Nothing;
type CallFilter = CallRuntimeFilter;
type DepositPerItem = DepositPerItem;
type DepositPerByte = DepositPerByte;
type CallStack = [pallet_contracts::Frame<Self>; 5];
Expand Down

0 comments on commit e55f340

Please sign in to comment.