git.delta.rocks / unique-network / refs/commits / 47c39a449fef

difftreelog

refactor hide permissive unless benchmarking

Farhad Hakimov2022-06-21parent: #011ebf2.patch.diff
in: master

5 files changed

modifiedpallets/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),
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
1212 limit_default_clone!(old_limit, new_limit,1212 limit_default_clone!(old_limit, new_limit,
1213 access => {},1213 access => {},
1214 mint_mode => {},1214 mint_mode => {},
1215 nesting => {1215 nesting => { /* todo check for permissive, if only it gets out of benchmarks */ },
1216 #[cfg(not(feature = "runtime-benchmarks"))]
1217 ensure!(
1218 // Permissive is only allowed for tests and internal usage of chain for now
1219 old_limit.permissive || !new_limit.permissive,
1220 <Error<T>>::NoPermission,
1221 )
1222 },
1223 );1216 );
1224 Ok(new_limit)1217 Ok(new_limit)
modifiedpallets/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(
modifiedpallets/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()
modifiedprimitives/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,
 }