difftreelog
refactor hide permissive unless benchmarking
in: master
5 files changed
pallets/common/src/benchmarking.rsdiffbeforeafterboth98 token_owner: false,98 token_owner: false,99 collection_admin: false,99 collection_admin: false,100 restricted: None,100 restricted: None,101 #[cfg(feature = "runtime-benchmarks")]101 permissive: true,102 permissive: true,102 }),103 }),103 mint_mode: Some(true),104 mint_mode: Some(true),pallets/common/src/lib.rsdiffbeforeafterboth--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -1212,14 +1212,7 @@
limit_default_clone!(old_limit, new_limit,
access => {},
mint_mode => {},
- nesting => {
- #[cfg(not(feature = "runtime-benchmarks"))]
- ensure!(
- // Permissive is only allowed for tests and internal usage of chain for now
- old_limit.permissive || !new_limit.permissive,
- <Error<T>>::NoPermission,
- )
- },
+ nesting => { /* todo check for permissive, if only it gets out of benchmarks */ },
);
Ok(new_limit)
}
pallets/nonfungible/src/lib.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -1038,7 +1038,13 @@
nesting_budget: &dyn Budget,
) -> DispatchResult {
let nesting = handle.permissions.nesting();
- if nesting.permissive {
+
+ #[cfg(not(feature = "runtime-benchmarks"))]
+ let permissive = false;
+ #[cfg(feature = "runtime-benchmarks")]
+ let permissive = nesting.permissive;
+
+ if permissive {
// Pass
} else if nesting.token_owner
&& <PalletStructure<T>>::check_indirectly_owned(
pallets/proxy-rmrk-core/src/lib.rsdiffbeforeafterboth--- a/pallets/proxy-rmrk-core/src/lib.rs
+++ b/pallets/proxy-rmrk-core/src/lib.rs
@@ -205,7 +205,7 @@
token_owner: true,
collection_admin: false,
restricted: None,
-
+ #[cfg(feature = "runtime-benchmarks")]
permissive: false,
}),
..Default::default()
primitives/data-structs/src/lib.rsdiffbeforeafterboth--- a/primitives/data-structs/src/lib.rs
+++ b/primitives/data-structs/src/lib.rs
@@ -454,7 +454,7 @@
token_owner: false,
collection_admin: false,
restricted: None,
-
+ #[cfg(feature = "runtime-benchmarks")]
permissive: false,
};
self.nesting.as_ref().unwrap_or(&DEFAULT)
@@ -499,6 +499,7 @@
/// If set - only tokens from specified collections can be nested
pub restricted: Option<OwnerRestrictedSet>,
+ #[cfg(feature = "runtime-benchmarks")]
/// Anyone can nest tokens, mutually exclusive with `token_owner`, `admin`
pub permissive: bool,
}