Restrict remove_proxies (#6383)

This commit is contained in:
Gavin Wood
2020-06-18 09:33:51 +02:00
committed by GitHub
parent 82bdf1a891
commit a0541e864c
2 changed files with 13 additions and 0 deletions
+4
View File
@@ -68,6 +68,8 @@ pub trait Trait: frame_system::Trait {
/// A kind of proxy; specified with the proxy and passed in to the `IsProxyable` fitler.
/// The instance filter determines whether a given call may be proxied under this type.
///
/// IMPORTANT: `Default` must be provided and MUST BE the the *most permissive* value.
type ProxyType: Parameter + Member + Ord + PartialOrd + InstanceFilter<<Self as Trait>::Call>
+ Default;
@@ -174,6 +176,8 @@ decl_module! {
match c.is_sub_type() {
Some(Call::add_proxy(_, ref pt)) | Some(Call::remove_proxy(_, ref pt))
if !proxy_type.is_superset(&pt) => false,
Some(Call::remove_proxies(..)) | Some(Call::kill_anonymous(..))
if proxy_type != T::ProxyType::default() => false,
_ => proxy_type.filter(c)
}
});