difftreelog
refactor hide permissive unless benchmarking
in: master
5 files changed
pallets/common/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/common/src/benchmarking.rs
+++ b/pallets/common/src/benchmarking.rs
@@ -98,6 +98,7 @@
token_owner: false,
collection_admin: false,
restricted: None,
+ #[cfg(feature = "runtime-benchmarks")]
permissive: true,
}),
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.rsdiffbeforeafterboth454 token_owner: false,454 token_owner: false,455 collection_admin: false,455 collection_admin: false,456 restricted: None,456 restricted: None,457457 #[cfg(feature = "runtime-benchmarks")]458 permissive: false,458 permissive: false,459 };459 };460 self.nesting.as_ref().unwrap_or(&DEFAULT)460 self.nesting.as_ref().unwrap_or(&DEFAULT)499 /// If set - only tokens from specified collections can be nested499 /// If set - only tokens from specified collections can be nested500 pub restricted: Option<OwnerRestrictedSet>,500 pub restricted: Option<OwnerRestrictedSet>,501501502 #[cfg(feature = "runtime-benchmarks")]502 /// Anyone can nest tokens, mutually exclusive with `token_owner`, `admin`503 /// Anyone can nest tokens, mutually exclusive with `token_owner`, `admin`503 pub permissive: bool,504 pub permissive: bool,504}505}