Skip to content

Commit

Permalink
https://github.com/pendulum-chain/pendulum/pull/325#discussion_r13748…
Browse files Browse the repository at this point in the history
…34036,

#325 (comment),
  • Loading branch information
b-yap committed Nov 6, 2023
1 parent 8a36e55 commit 01ac3cf
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 66 deletions.
9 changes: 7 additions & 2 deletions runtime/amplitude/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1230,8 +1230,13 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
}

// Determines whether self matches at least everything that o does.
fn is_superset(&self, _o: &Self) -> bool {
true
fn is_superset(&self, o: &Self) -> bool {
match (self, o) {
(x, y) if x == y => true,
(ProxyType::Any, _) => true,
(_, ProxyType::Any) => false,
_ => false,
}
}
}

Expand Down
11 changes: 0 additions & 11 deletions runtime/common/src/proxy_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@ use sp_runtime::RuntimeDebug;
pub enum ProxyType {
/// Allows all runtime calls for proxy account
Any,
// /// Allows only NonTransfer runtime calls for proxy account
// /// To know exact calls check InstanceFilter inmplementation for ProxyTypes
// NonTransfer,
// /// All Runtime calls from Pallet Balances allowed for proxy account
// Balances,
// /// Only provide_judgement call from pallet identity allowed for proxy account
// IdentityJudgement,
// /// Only reject_announcement call from pallet proxy allowed for proxy account
// CancelProxy,
// /// Only claim_reward call from pallet staking is allowed for proxy account
// StakerRewardClaim,
}

impl Default for ProxyType {
Expand Down
59 changes: 8 additions & 51 deletions runtime/foucoco/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1519,61 +1519,18 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
// Always allowed RuntimeCall::Utility no matter type.
// Only transactions allowed by Proxy.filter can be executed
_ if matches!(c, RuntimeCall::Utility(..)) => true,
ProxyType::Any => true,
// ProxyType::NonTransfer => {
// matches!(
// c,
// RuntimeCall::System(..)
// | RuntimeCall::Identity(..)
// | RuntimeCall::Timestamp(..)
// | RuntimeCall::Multisig(..)
// | RuntimeCall::Proxy(..)
// | RuntimeCall::ParachainSystem(..)
// | RuntimeCall::ParachainInfo(..)
// // Skip entire Balances pallet
// | RuntimeCall::Vesting(pallet_vesting::Call::vest{..})
// | RuntimeCall::Vesting(pallet_vesting::Call::vest_other{..})
// // Specifically omitting Vesting `vested_transfer`, and `force_vested_transfer`
// | RuntimeCall::Session(..)
// | RuntimeCall::XcmpQueue(..)
// | RuntimeCall::PolkadotXcm(..)
// | RuntimeCall::DmpQueue(..)
// )
// }
// ProxyType::Balances => {
// matches!(c, RuntimeCall::Balances(..))
// }
// ProxyType::IdentityJudgement => {
// matches!(
// c,
// RuntimeCall::Identity(pallet_identity::Call::provide_judgement { .. })
// )
// }
// ProxyType::CancelProxy => {
// matches!(
// c,
// RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. })
// )
// }
// ProxyType::StakerRewardClaim => {
// matches!(
// c,
// RuntimeCall::DappsStaking(parachain_staking::Call::claim_rewards { .. })
// )
// }
ProxyType::Any => true
}
}

// Determines whether self matches at least everything that o does.
fn is_superset(&self, _o: &Self) -> bool {
true
// match (self, o) {
// (x, y) if x == y => true,
// (ProxyType::Any, _) => true,
// (_, ProxyType::Any) => false,
// (_, ProxyType::StakerRewardClaim) => true,
// _ => false,
// }
fn is_superset(&self, o: &Self) -> bool {
match (self, o) {
(x, y) if x == y => true,
(ProxyType::Any, _) => true,
(_, ProxyType::Any) => false,
_ => false,
}
}
}

Expand Down
9 changes: 7 additions & 2 deletions runtime/pendulum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -965,8 +965,13 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
}

// Determines whether self matches at least everything that o does.
fn is_superset(&self, _o: &Self) -> bool {
true
fn is_superset(&self, o: &Self) -> bool {
match (self, o) {
(x, y) if x == y => true,
(ProxyType::Any, _) => true,
(_, ProxyType::Any) => false,
_ => false,
}
}
}

Expand Down

0 comments on commit 01ac3cf

Please sign in to comment.