git.delta.rocks / unique-network / refs/commits / 59e224731e80

difftreelog

feat benchmark property calls

Yaroslav Bolyukin2022-05-23parent: #fd1b071.patch.diff
in: master

30 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5913,6 +5913,7 @@
 dependencies = [
  "evm-coder",
  "fp-evm-mapping",
+ "frame-benchmarking",
  "frame-support",
  "frame-system",
  "pallet-evm",
@@ -6649,6 +6650,7 @@
  "frame-support",
  "frame-system",
  "pallet-common",
+ "pallet-evm",
  "parity-scale-codec 3.1.2",
  "scale-info",
  "sp-std",
modifiedMakefilediffbeforeafterboth
--- a/Makefile
+++ b/Makefile
@@ -41,6 +41,10 @@
 bench-evm-migration:
 	make _bench PALLET=evm-migration
 
+.PHONY: bench-common
+bench-common:
+	make _bench PALLET=common
+
 .PHONY: bench-unique
 bench-unique:
 	make _bench PALLET=unique
modifiedpallets/common/Cargo.tomldiffbeforeafterboth
--- a/pallets/common/Cargo.toml
+++ b/pallets/common/Cargo.toml
@@ -25,6 +25,7 @@
 scale-info = { version = "2.0.1", default-features = false, features = [
     "derive",
 ] }
+frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.21" }
 
 [features]
 default = ["std"]
@@ -37,4 +38,6 @@
     "up-data-structs/std",
     "pallet-evm/std",
 ]
-runtime-benchmarks = []
+runtime-benchmarks = [
+    "frame-benchmarking"
+]
modifiedpallets/common/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/common/src/benchmarking.rs
+++ b/pallets/common/src/benchmarking.rs
@@ -15,11 +15,13 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 use sp_std::vec::Vec;
-use crate::{Config, CollectionHandle};
+use crate::{Config, CollectionHandle, Pallet};
+use pallet_evm::account::CrossAccountId;
+use frame_benchmarking::{benchmarks, account};
 use up_data_structs::{
-	CollectionMode, CreateCollectionData, CollectionId, MAX_COLLECTION_NAME_LENGTH,
-	MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH, OFFCHAIN_SCHEMA_LIMIT,
-	CONST_ON_CHAIN_SCHEMA_LIMIT,
+	CollectionMode, CreateCollectionData, CollectionId, Property, PropertyKey, PropertyValue,
+	MAX_COLLECTION_NAME_LENGTH, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH,
+	OFFCHAIN_SCHEMA_LIMIT, CONST_ON_CHAIN_SCHEMA_LIMIT, MAX_PROPERTIES_PER_ITEM,
 };
 use frame_support::{
 	traits::{Currency, Get},
@@ -29,6 +31,8 @@
 use core::convert::TryInto;
 use sp_runtime::DispatchError;
 
+const SEED: u32 = 1;
+
 pub fn create_data<const S: u32>() -> BoundedVec<u8, ConstU32<S>> {
 	create_var_data::<S>(S)
 }
@@ -52,6 +56,22 @@
 		.try_into()
 		.unwrap()
 }
+pub fn property_key(id: usize) -> PropertyKey {
+	#[cfg(not(feature = "std"))]
+	use alloc::string::ToString;
+	let mut data = create_data();
+	// No DerefMut available for .fill
+	for i in 0..data.len() {
+		data[i] = b'0';
+	}
+	let bytes = id.to_string();
+	let len = data.len();
+	data[len - bytes.len()..].copy_from_slice(&bytes.as_bytes());
+	data
+}
+pub fn property_value() -> PropertyValue {
+	create_data()
+}
 
 pub fn create_collection_raw<T: Config, R>(
 	owner: T::AccountId,
@@ -83,6 +103,14 @@
 	.and_then(CollectionHandle::try_get)
 	.map(cast)
 }
+fn create_collection<T: Config>(owner: T::AccountId) -> Result<CollectionHandle<T>, DispatchError> {
+	create_collection_raw(
+		owner,
+		CollectionMode::NFT,
+		|owner, data| <Pallet<T>>::init_collection(owner, data),
+		|h| h,
+	)
+}
 
 /// Helper macros, which handles all benchmarking preparation in semi-declarative way
 ///
@@ -125,3 +153,31 @@
 	};
 	() => {}
 }
+
+benchmarks! {
+	set_collection_properties {
+		let b in 0..MAX_PROPERTIES_PER_ITEM;
+		bench_init!{
+			owner: sub; collection: collection(owner);
+			owner: cross_from_sub;
+		};
+		let props = (0..b).map(|p| Property {
+			key: property_key(p as usize),
+			value: property_value(),
+		}).collect::<Vec<_>>();
+	}: {<Pallet<T>>::set_collection_properties(&collection, &owner, props)?}
+
+	delete_collection_properties {
+		let b in 0..MAX_PROPERTIES_PER_ITEM;
+		bench_init!{
+			owner: sub; collection: collection(owner);
+			owner: cross_from_sub;
+		};
+		let props = (0..b).map(|p| Property {
+			key: property_key(p as usize),
+			value: property_value(),
+		}).collect::<Vec<_>>();
+		<Pallet<T>>::set_collection_properties(&collection, &owner, props)?;
+		let to_delete = (0..b).map(|p| property_key(p as usize)).collect::<Vec<_>>();
+	}: {<Pallet<T>>::delete_collection_properties(&collection, &owner, to_delete)?}
+}
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -16,6 +16,8 @@
 
 #![cfg_attr(not(feature = "std"), no_std)]
 
+extern crate alloc;
+
 use core::ops::{Deref, DerefMut};
 use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
 use sp_std::vec::Vec;
@@ -85,6 +87,9 @@
 pub mod dispatch;
 pub mod erc;
 pub mod eth;
+pub mod weights;
+
+pub type SelfWeightOf<T> = <T as Config>::WeightInfo;
 
 #[must_use = "Should call submit_logs or save, otherwise some data will be lost for evm side"]
 pub struct CollectionHandle<T: Config> {
@@ -186,11 +191,13 @@
 	use frame_support::traits::Currency;
 	use up_data_structs::{TokenId, mapping::TokenAddressMapping};
 	use scale_info::TypeInfo;
+	use weights::WeightInfo;
 
 	#[pallet::config]
 	pub trait Config:
 		frame_system::Config + pallet_evm_coder_substrate::Config + TypeInfo + account::Config
 	{
+		type WeightInfo: WeightInfo;
 		type Event: IsType<<Self as frame_system::Config>::Event> + From<Event<Self>>;
 
 		type Currency: Currency<Self::AccountId>;
@@ -804,7 +811,7 @@
 	pub fn set_scoped_collection_properties(
 		collection: &CollectionHandle<T>,
 		scope: PropertyScope,
-		properties: impl Iterator<Item=Property>,
+		properties: impl Iterator<Item = Property>,
 	) -> DispatchResult {
 		CollectionProperties::<T>::try_mutate(collection.id, |stored_properties| {
 			stored_properties.try_scoped_set_from_iter(scope, properties)
@@ -903,10 +910,11 @@
 		Ok(())
 	}
 
-	pub fn get_collection_property(collection_id: CollectionId, key: &PropertyKey) -> Option<PropertyValue> {
-		Self::collection_properties(collection_id)
-			.get(key)
-			.cloned()
+	pub fn get_collection_property(
+		collection_id: CollectionId,
+		key: &PropertyKey,
+	) -> Option<PropertyValue> {
+		Self::collection_properties(collection_id).get(key).cloned()
 	}
 
 	pub fn bytes_keys_to_property_keys(
@@ -1131,7 +1139,7 @@
 /// Worst cases
 pub trait CommonWeightInfo<CrossAccountId> {
 	fn create_item() -> Weight;
-	fn create_multiple_items(amount: u32) -> Weight;
+	fn create_multiple_items(amount: &[CreateItemData]) -> Weight;
 	fn create_multiple_items_ex(cost: &CreateItemExData<CrossAccountId>) -> Weight;
 	fn burn_item() -> Weight;
 	fn set_collection_properties(amount: u32) -> Weight;
addedpallets/common/src/weights.rsdiffbeforeafterboth
--- /dev/null
+++ b/pallets/common/src/weights.rs
@@ -0,0 +1,79 @@
+// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs
+
+//! Autogenerated weights for pallet_common
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
+//! DATE: 2022-05-23, STEPS: `50`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
+
+// Executed Command:
+// target/release/unique-collator
+// benchmark
+// pallet
+// --pallet
+// pallet-common
+// --wasm-execution
+// compiled
+// --extrinsic
+// *
+// --template
+// .maintain/frame-weight-template.hbs
+// --steps=50
+// --repeat=1
+// --heap-pages=4096
+// --output=./pallets/common/src/weights.rs
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+#![allow(unused_parens)]
+#![allow(unused_imports)]
+#![allow(clippy::unnecessary_cast)]
+
+use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
+use sp_std::marker::PhantomData;
+
+/// Weight functions needed for pallet_common.
+pub trait WeightInfo {
+	fn set_collection_properties(b: u32, ) -> Weight;
+	fn delete_collection_properties(b: u32, ) -> Weight;
+}
+
+/// Weights for pallet_common using the Substrate node and recommended hardware.
+pub struct SubstrateWeight<T>(PhantomData<T>);
+impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
+	// Storage: Common CollectionProperties (r:1 w:1)
+	fn set_collection_properties(b: u32, ) -> Weight {
+		(0 as Weight)
+			// Standard Error: 142_818_000
+			.saturating_add((2_786_252_000 as Weight).saturating_mul(b as Weight))
+			.saturating_add(T::DbWeight::get().reads(1 as Weight))
+			.saturating_add(T::DbWeight::get().writes(1 as Weight))
+	}
+	// Storage: Common CollectionProperties (r:1 w:1)
+	fn delete_collection_properties(b: u32, ) -> Weight {
+		(0 as Weight)
+			// Standard Error: 101_087_000
+			.saturating_add((2_739_521_000 as Weight).saturating_mul(b as Weight))
+			.saturating_add(T::DbWeight::get().reads(1 as Weight))
+			.saturating_add(T::DbWeight::get().writes(1 as Weight))
+	}
+}
+
+// For backwards compatibility and tests
+impl WeightInfo for () {
+	// Storage: Common CollectionProperties (r:1 w:1)
+	fn set_collection_properties(b: u32, ) -> Weight {
+		(0 as Weight)
+			// Standard Error: 142_818_000
+			.saturating_add((2_786_252_000 as Weight).saturating_mul(b as Weight))
+			.saturating_add(RocksDbWeight::get().reads(1 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
+	}
+	// Storage: Common CollectionProperties (r:1 w:1)
+	fn delete_collection_properties(b: u32, ) -> Weight {
+		(0 as Weight)
+			// Standard Error: 101_087_000
+			.saturating_add((2_739_521_000 as Weight).saturating_mul(b as Weight))
+			.saturating_add(RocksDbWeight::get().reads(1 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
+	}
+}
modifiedpallets/fungible/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/fungible/src/benchmarking.rs
+++ b/pallets/fungible/src/benchmarking.rs
@@ -40,7 +40,7 @@
 			owner: sub; collection: collection(owner);
 			sender: cross_from_sub(owner); to: cross_sub;
 		};
-	}: {<Pallet<T>>::create_item(&collection, &sender, (to, 200))?}
+	}: {<Pallet<T>>::create_item(&collection, &sender, (to, 200), &Unlimited)?}
 
 	create_multiple_items_ex {
 		let b in 0..MAX_ITEMS_PER_BATCH;
@@ -52,14 +52,14 @@
 			bench_init!(to: cross_sub(i););
 			(to, 200)
 		}).collect::<BTreeMap<_, _>>().try_into().unwrap();
-	}: {<Pallet<T>>::create_multiple_items(&collection, &sender, data)?}
+	}: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}
 
 	burn_item {
 		bench_init!{
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; burner: cross_sub;
 		};
-		<Pallet<T>>::create_item(&collection, &owner, (burner.clone(), 200))?;
+		<Pallet<T>>::create_item(&collection, &owner, (burner.clone(), 200), &Unlimited)?;
 	}: {<Pallet<T>>::burn(&collection, &burner, 100)?}
 
 	transfer {
@@ -67,15 +67,15 @@
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; to: cross_sub;
 		};
-		<Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200))?;
-	}: {<Pallet<T>>::transfer(&collection, &sender, &to, 200)?}
+		<Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;
+	}: {<Pallet<T>>::transfer(&collection, &sender, &to, 200, &Unlimited)?}
 
 	approve {
 		bench_init!{
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; spender: cross_sub;
 		};
-		<Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200))?;
+		<Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;
 	}: {<Pallet<T>>::set_allowance(&collection, &sender, &spender, 100)?}
 
 	transfer_from {
@@ -83,7 +83,7 @@
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; spender: cross_sub; receiver: cross_sub;
 		};
-		<Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200))?;
+		<Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;
 		<Pallet<T>>::set_allowance(&collection, &sender, &spender, 200)?;
 	}: {<Pallet<T>>::transfer_from(&collection, &spender, &sender, &receiver, 100, &Unlimited)?}
 
@@ -92,7 +92,7 @@
 			owner: sub; collection: collection(owner);
 			owner: cross_from_sub; sender: cross_sub; burner: cross_sub;
 		};
-		<Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200))?;
+		<Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;
 		<Pallet<T>>::set_allowance(&collection, &sender, &burner, 200)?;
 	}: {<Pallet<T>>::burn_from(&collection, &burner, &sender, 100, &Unlimited)?}
 }
modifiedpallets/fungible/src/common.rsdiffbeforeafterboth
--- a/pallets/fungible/src/common.rs
+++ b/pallets/fungible/src/common.rs
@@ -17,7 +17,7 @@
 use core::marker::PhantomData;
 
 use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight};
-use up_data_structs::{TokenId, CollectionId, CreateItemExData, budget::Budget};
+use up_data_structs::{TokenId, CollectionId, CreateItemExData, budget::Budget, CreateItemData};
 use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};
 use sp_runtime::ArithmeticError;
 use sp_std::{vec::Vec, vec};
@@ -33,7 +33,8 @@
 		<SelfWeightOf<T>>::create_item()
 	}
 
-	fn create_multiple_items(_amount: u32) -> Weight {
+	fn create_multiple_items(_data: &[CreateItemData]) -> Weight {
+		// All items minted for the same user, so it works same as create_item
 		Self::create_item()
 	}
 
@@ -51,23 +52,28 @@
 	}
 
 	fn set_collection_properties(amount: u32) -> Weight {
-		<SelfWeightOf<T>>::set_collection_properties(amount)
+		// Error
+		0
 	}
 
 	fn delete_collection_properties(amount: u32) -> Weight {
-		<SelfWeightOf<T>>::delete_collection_properties(amount)
+		// Error
+		0
 	}
 
 	fn set_token_properties(amount: u32) -> Weight {
-		<SelfWeightOf<T>>::set_token_properties(amount)
+		// Error
+		0
 	}
 
 	fn delete_token_properties(amount: u32) -> Weight {
-		<SelfWeightOf<T>>::delete_token_properties(amount)
+		// Error
+		0
 	}
 
 	fn set_property_permissions(amount: u32) -> Weight {
-		<SelfWeightOf<T>>::set_property_permissions(amount)
+		// Error
+		0
 	}
 
 	fn transfer() -> Weight {
modifiedpallets/fungible/src/weights.rsdiffbeforeafterboth
--- a/pallets/fungible/src/weights.rs
+++ b/pallets/fungible/src/weights.rs
@@ -35,11 +35,6 @@
 	fn create_item() -> Weight;
 	fn create_multiple_items_ex(b: u32, ) -> Weight;
 	fn burn_item() -> Weight;
-	fn set_collection_properties(amount: u32) -> Weight;
-	fn delete_collection_properties(amount: u32) -> Weight;
-	fn set_token_properties(amount: u32) -> Weight;
-	fn delete_token_properties(amount: u32) -> Weight;
-	fn set_property_permissions(amount: u32) -> Weight;
 	fn transfer() -> Weight;
 	fn approve() -> Weight;
 	fn transfer_from() -> Weight;
@@ -73,33 +68,8 @@
 		(15_565_000 as Weight)
 			.saturating_add(T::DbWeight::get().reads(2 as Weight))
 			.saturating_add(T::DbWeight::get().writes(2 as Weight))
-	}
-
-	fn set_collection_properties(_amount: u32) -> Weight {
-		// Error
-		0
-	}
-
-	fn delete_collection_properties(_amount: u32) -> Weight {
-		// Error
-		0
-	}
-
-	fn set_token_properties(_amount: u32) -> Weight {
-		// Error
-		0
-	}
-
-	fn delete_token_properties(_amount: u32) -> Weight {
-		// Error
-		0
 	}
 
-	fn set_property_permissions(_amount: u32) -> Weight {
-		// Error
-		0
-	}
-
 	// Storage: Fungible Balance (r:2 w:2)
 	fn transfer() -> Weight {
 		(17_713_000 as Weight)
@@ -156,31 +126,6 @@
 		(15_565_000 as Weight)
 			.saturating_add(RocksDbWeight::get().reads(2 as Weight))
 			.saturating_add(RocksDbWeight::get().writes(2 as Weight))
-	}
-
-	fn set_collection_properties(_amount: u32) -> Weight {
-		// Error
-		0
-	}
-
-	fn delete_collection_properties(_amount: u32) -> Weight {
-		// Error
-		0
-	}
-
-	fn set_token_properties(_amount: u32) -> Weight {
-		// Error
-		0
-	}
-
-	fn delete_token_properties(_amount: u32) -> Weight {
-		// Error
-		0
-	}
-
-	fn set_property_permissions(_amount: u32) -> Weight {
-		// Error
-		0
 	}
 
 	// Storage: Fungible Balance (r:2 w:2)
modifiedpallets/nonfungible/Cargo.tomldiffbeforeafterboth
--- a/pallets/nonfungible/Cargo.toml
+++ b/pallets/nonfungible/Cargo.toml
@@ -49,4 +49,5 @@
     'frame-benchmarking',
     'frame-support/runtime-benchmarks',
     'frame-system/runtime-benchmarks',
+    'up-data-structs/runtime-benchmarks',
 ]
modifiedpallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/benchmarking.rs
+++ b/pallets/nonfungible/src/benchmarking.rs
@@ -18,24 +18,35 @@
 use crate::{Pallet, Config, NonfungibleHandle};
 
 use sp_std::prelude::*;
-use pallet_common::benchmarking::{create_collection_raw, create_data, create_var_data};
+use pallet_common::benchmarking::{create_collection_raw, create_data, property_key, property_value};
 use frame_benchmarking::{benchmarks, account};
-use up_data_structs::{CollectionMode, MAX_ITEMS_PER_BATCH, CUSTOM_DATA_LIMIT, budget::Unlimited};
+use up_data_structs::{
+	CollectionMode, MAX_ITEMS_PER_BATCH, MAX_PROPERTIES_PER_ITEM, CUSTOM_DATA_LIMIT,
+	budget::Unlimited,
+};
 use pallet_common::bench_init;
-use core::convert::TryInto;
 
 const SEED: u32 = 1;
 
 fn create_max_item_data<T: Config>(owner: T::CrossAccountId) -> CreateItemData<T> {
 	let const_data = create_data::<CUSTOM_DATA_LIMIT>();
-	CreateItemData::<T> { const_data, owner }
+	CreateItemData::<T> {
+		const_data,
+		owner,
+		properties: Default::default(),
+	}
 }
 fn create_max_item<T: Config>(
 	collection: &NonfungibleHandle<T>,
 	sender: &T::CrossAccountId,
 	owner: T::CrossAccountId,
 ) -> Result<TokenId, DispatchError> {
-	<Pallet<T>>::create_item(&collection, sender, create_max_item_data::<T>(owner))?;
+	<Pallet<T>>::create_item(
+		&collection,
+		sender,
+		create_max_item_data::<T>(owner),
+		&Unlimited,
+	)?;
 	Ok(TokenId(<TokensMinted<T>>::get(&collection.id)))
 }
 
@@ -65,7 +76,7 @@
 			sender: cross_from_sub(owner); to: cross_sub;
 		};
 		let data = (0..b).map(|_| create_max_item_data::<T>(to.clone())).collect();
-	}: {<Pallet<T>>::create_multiple_items(&collection, &sender, data)?}
+	}: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}
 
 	create_multiple_items_ex {
 		let b in 0..MAX_ITEMS_PER_BATCH;
@@ -77,7 +88,7 @@
 			bench_init!(to: cross_sub(i););
 			create_max_item_data::<T>(to)
 		}).collect();
-	}: {<Pallet<T>>::create_multiple_items(&collection, &sender, data)?}
+	}: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}
 
 	burn_item {
 		bench_init!{
@@ -93,7 +104,7 @@
 			owner: cross_from_sub; sender: cross_sub; receiver: cross_sub;
 		};
 		let item = create_max_item(&collection, &owner, sender.clone())?;
-	}: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item)?}
+	}: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, &Unlimited)?}
 
 	approve {
 		bench_init!{
@@ -120,4 +131,66 @@
 		let item = create_max_item(&collection, &owner, sender.clone())?;
 		<Pallet<T>>::set_allowance(&collection, &sender, item, Some(&burner))?;
 	}: {<Pallet<T>>::burn_from(&collection, &burner, &sender, item, &Unlimited)?}
+
+	set_property_permissions {
+		let b in 0..MAX_PROPERTIES_PER_ITEM;
+		bench_init!{
+			owner: sub; collection: collection(owner);
+			owner: cross_from_sub;
+		};
+		let perms = (0..b).map(|k| PropertyKeyPermission {
+			key: property_key(k as usize),
+			permission: PropertyPermission {
+				mutable: false,
+				collection_admin: false,
+				token_owner: false,
+			},
+		}).collect::<Vec<_>>();
+	}: {<Pallet<T>>::set_property_permissions(&collection, &owner, perms)?}
+
+	set_token_properties {
+		let b in 0..MAX_PROPERTIES_PER_ITEM;
+		bench_init!{
+			owner: sub; collection: collection(owner);
+			owner: cross_from_sub;
+		};
+		let perms = (0..b).map(|k| PropertyKeyPermission {
+			key: property_key(k as usize),
+			permission: PropertyPermission {
+				mutable: false,
+				collection_admin: true,
+				token_owner: true,
+			},
+		}).collect::<Vec<_>>();
+		<Pallet<T>>::set_property_permissions(&collection, &owner, perms)?;
+		let props = (0..b).map(|k| Property {
+			key: property_key(k as usize),
+			value: property_value(),
+		}).collect::<Vec<_>>();
+		let item = create_max_item(&collection, &owner, owner.clone())?;
+	}: {<Pallet<T>>::set_token_properties(&collection, &owner, item, props)?}
+
+	delete_token_properties {
+		let b in 0..MAX_PROPERTIES_PER_ITEM;
+		bench_init!{
+			owner: sub; collection: collection(owner);
+			owner: cross_from_sub;
+		};
+		let perms = (0..b).map(|k| PropertyKeyPermission {
+			key: property_key(k as usize),
+			permission: PropertyPermission {
+				mutable: true,
+				collection_admin: true,
+				token_owner: true,
+			},
+		}).collect::<Vec<_>>();
+		<Pallet<T>>::set_property_permissions(&collection, &owner, perms)?;
+		let props = (0..b).map(|k| Property {
+			key: property_key(k as usize),
+			value: property_value(),
+		}).collect::<Vec<_>>();
+		let item = create_max_item(&collection, &owner, owner.clone())?;
+		<Pallet<T>>::set_token_properties(&collection, &owner, item, props)?;
+		let to_delete = (0..b).map(|k| property_key(k as usize)).collect::<Vec<_>>();
+	}: {<Pallet<T>>::delete_token_properties(&collection, &owner, item, to_delete)?}
 }
modifiedpallets/nonfungible/src/common.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -21,7 +21,9 @@
 	TokenId, CreateItemExData, CollectionId, budget::Budget, Property, PropertyKey,
 	PropertyKeyPermission, PropertyValue,
 };
-use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};
+use pallet_common::{
+	CommonCollectionOperations, CommonWeightInfo, with_weight, weights::WeightInfo as _,
+};
 use sp_runtime::DispatchError;
 use sp_std::vec::Vec;
 
@@ -38,13 +40,33 @@
 
 	fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {
 		match data {
-			CreateItemExData::NFT(t) => <SelfWeightOf<T>>::create_multiple_items_ex(t.len() as u32),
+			CreateItemExData::NFT(t) => {
+				<SelfWeightOf<T>>::create_multiple_items_ex(t.len() as u32)
+					+ t.iter()
+						.map(|t| {
+							if t.properties.len() > 0 {
+								Self::set_token_properties(t.properties.len() as u32)
+							} else {
+								0
+							}
+						})
+						.sum::<u64>()
+			}
 			_ => 0,
 		}
 	}
 
-	fn create_multiple_items(amount: u32) -> Weight {
-		<SelfWeightOf<T>>::create_multiple_items(amount)
+	fn create_multiple_items(data: &[up_data_structs::CreateItemData]) -> Weight {
+		<SelfWeightOf<T>>::create_multiple_items(data.len() as u32)
+			+ data
+				.iter()
+				.filter_map(|t| match t {
+					up_data_structs::CreateItemData::NFT(n) if n.properties.len() > 0 => {
+						Some(Self::set_token_properties(n.properties.len() as u32))
+					}
+					_ => None,
+				})
+				.sum::<u64>()
 	}
 
 	fn burn_item() -> Weight {
@@ -52,11 +74,11 @@
 	}
 
 	fn set_collection_properties(amount: u32) -> Weight {
-		<SelfWeightOf<T>>::set_collection_properties(amount)
+		<pallet_common::SelfWeightOf<T>>::set_collection_properties(amount)
 	}
 
 	fn delete_collection_properties(amount: u32) -> Weight {
-		<SelfWeightOf<T>>::delete_collection_properties(amount)
+		<pallet_common::SelfWeightOf<T>>::delete_collection_properties(amount)
 	}
 
 	fn set_token_properties(amount: u32) -> Weight {
@@ -128,15 +150,15 @@
 		data: Vec<up_data_structs::CreateItemData>,
 		nesting_budget: &dyn Budget,
 	) -> DispatchResultWithPostInfo {
+		let weight = <CommonWeights<T>>::create_multiple_items(&data);
 		let data = data
 			.into_iter()
 			.map(|d| map_create_data::<T>(d, &to))
 			.collect::<Result<Vec<_>, DispatchError>>()?;
 
-		let amount = data.len();
 		with_weight(
 			<Pallet<T>>::create_multiple_items(self, &sender, data, nesting_budget),
-			<CommonWeights<T>>::create_multiple_items(amount as u32),
+			weight,
 		)
 	}
 
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -18,7 +18,7 @@
 
 use erc::ERC721Events;
 use evm_coder::ToLog;
-use frame_support::{BoundedVec, ensure, fail, transactional};
+use frame_support::{BoundedVec, ensure, fail, transactional, storage::with_transaction};
 use up_data_structs::{
 	AccessMode, CollectionId, CustomDataLimit, TokenId, CreateCollectionData, CreateNftExData,
 	mapping::TokenAddressMapping, NestingRule, budget::Budget, Property, PropertyPermission,
@@ -32,7 +32,7 @@
 use pallet_structure::Pallet as PalletStructure;
 use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
 use sp_core::H160;
-use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};
+use sp_runtime::{ArithmeticError, DispatchError, DispatchResult, TransactionOutcome};
 use sp_std::{vec::Vec, vec};
 use core::ops::Deref;
 use sp_std::collections::btree_map::BTreeMap;
@@ -600,28 +600,37 @@
 
 		// =========
 
+		with_transaction(|| {
+			for (i, data) in data.iter().enumerate() {
+				let token = first_token + i as u32 + 1;
+
+				<TokenData<T>>::insert(
+					(collection.id, token),
+					ItemData {
+						const_data: data.const_data.clone(),
+						owner: data.owner.clone(),
+					},
+				);
+
+				if let Err(e) = Self::set_token_properties(
+					collection,
+					sender,
+					TokenId(token),
+					data.properties.clone().into_inner(),
+				) {
+					return TransactionOutcome::Rollback(Err(e));
+				}
+			}
+			TransactionOutcome::Commit(Ok(()))
+		})?;
+
 		<TokensMinted<T>>::insert(collection.id, tokens_minted);
 		for (account, balance) in balances {
 			<AccountBalance<T>>::insert((collection.id, account), balance);
 		}
 		for (i, data) in data.into_iter().enumerate() {
 			let token = first_token + i as u32 + 1;
-
-			<TokenData<T>>::insert(
-				(collection.id, token),
-				ItemData {
-					const_data: data.const_data,
-					owner: data.owner.clone(),
-				},
-			);
 			<Owned<T>>::insert((collection.id, &data.owner, token), true);
-
-			Self::set_token_properties(
-				collection,
-				sender,
-				TokenId(token),
-				data.properties.into_inner(),
-			)?;
 
 			<PalletEvm<T>>::deposit_log(
 				ERC721Events::Transfer {
modifiedpallets/nonfungible/src/weights.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/weights.rs
+++ b/pallets/nonfungible/src/weights.rs
@@ -151,10 +151,35 @@
 	// Storage: Nonfungible AccountBalance (r:1 w:1)
 	// Storage: Nonfungible Owned (r:0 w:1)
 	fn burn_from() -> Weight {
-		(27_580_000 as Weight)
-			.saturating_add(T::DbWeight::get().reads(4 as Weight))
-			.saturating_add(T::DbWeight::get().writes(5 as Weight))
 	}
+	// Storage: Common CollectionPropertyPermissions (r:1 w:1)
+	fn set_property_permissions(b: u32, ) -> Weight {
+		(0 as Weight)
+			// Standard Error: 3_432_000
+			.saturating_add((126_888_000 as Weight).saturating_mul(b as Weight))
+			.saturating_add(T::DbWeight::get().reads(1 as Weight))
+			.saturating_add(T::DbWeight::get().writes(1 as Weight))
+	}
+	// Storage: Common CollectionPropertyPermissions (r:1 w:0)
+	// Storage: Nonfungible TokenData (r:1 w:0)
+	// Storage: Nonfungible TokenProperties (r:1 w:1)
+	fn set_token_properties(b: u32, ) -> Weight {
+		(0 as Weight)
+			// Standard Error: 158_583_000
+			.saturating_add((4_707_700_000 as Weight).saturating_mul(b as Weight))
+			.saturating_add(T::DbWeight::get().reads(3 as Weight))
+			.saturating_add(T::DbWeight::get().writes(1 as Weight))
+	}
+	// Storage: Common CollectionPropertyPermissions (r:1 w:0)
+	// Storage: Nonfungible TokenData (r:1 w:0)
+	// Storage: Nonfungible TokenProperties (r:1 w:1)
+	fn delete_token_properties(b: u32, ) -> Weight {
+		(0 as Weight)
+			// Standard Error: 169_018_000
+			.saturating_add((4_783_967_000 as Weight).saturating_mul(b as Weight))
+			.saturating_add(T::DbWeight::get().reads(3 as Weight))
+			.saturating_add(T::DbWeight::get().writes(1 as Weight))
+	}
 }
 
 // For backwards compatibility and tests
@@ -260,8 +285,33 @@
 	// Storage: Nonfungible AccountBalance (r:1 w:1)
 	// Storage: Nonfungible Owned (r:0 w:1)
 	fn burn_from() -> Weight {
-		(27_580_000 as Weight)
-			.saturating_add(RocksDbWeight::get().reads(4 as Weight))
-			.saturating_add(RocksDbWeight::get().writes(5 as Weight))
 	}
+	// Storage: Common CollectionPropertyPermissions (r:1 w:1)
+	fn set_property_permissions(b: u32, ) -> Weight {
+		(0 as Weight)
+			// Standard Error: 3_432_000
+			.saturating_add((126_888_000 as Weight).saturating_mul(b as Weight))
+			.saturating_add(RocksDbWeight::get().reads(1 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
+	}
+	// Storage: Common CollectionPropertyPermissions (r:1 w:0)
+	// Storage: Nonfungible TokenData (r:1 w:0)
+	// Storage: Nonfungible TokenProperties (r:1 w:1)
+	fn set_token_properties(b: u32, ) -> Weight {
+		(0 as Weight)
+			// Standard Error: 158_583_000
+			.saturating_add((4_707_700_000 as Weight).saturating_mul(b as Weight))
+			.saturating_add(RocksDbWeight::get().reads(3 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
+	}
+	// Storage: Common CollectionPropertyPermissions (r:1 w:0)
+	// Storage: Nonfungible TokenData (r:1 w:0)
+	// Storage: Nonfungible TokenProperties (r:1 w:1)
+	fn delete_token_properties(b: u32, ) -> Weight {
+		(0 as Weight)
+			// Standard Error: 169_018_000
+			.saturating_add((4_783_967_000 as Weight).saturating_mul(b as Weight))
+			.saturating_add(RocksDbWeight::get().reads(3 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
+	}
 }
modifiedpallets/refungible/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/refungible/src/benchmarking.rs
+++ b/pallets/refungible/src/benchmarking.rs
@@ -18,7 +18,7 @@
 use crate::{Pallet, Config, RefungibleHandle};
 
 use sp_std::prelude::*;
-use pallet_common::benchmarking::{create_collection_raw, create_data, create_var_data};
+use pallet_common::benchmarking::{create_collection_raw, create_data};
 use frame_benchmarking::{benchmarks, account};
 use up_data_structs::{CollectionMode, MAX_ITEMS_PER_BATCH, CUSTOM_DATA_LIMIT, budget::Unlimited};
 use pallet_common::bench_init;
@@ -46,7 +46,7 @@
 	users: impl IntoIterator<Item = (T::CrossAccountId, u128)>,
 ) -> Result<TokenId, DispatchError> {
 	let data: CreateRefungibleExData<T::CrossAccountId> = create_max_item_data(users);
-	<Pallet<T>>::create_item(&collection, sender, data)?;
+	<Pallet<T>>::create_item(&collection, sender, data, &Unlimited)?;
 	Ok(TokenId(<TokensMinted<T>>::get(&collection.id)))
 }
 
@@ -73,7 +73,7 @@
 			sender: cross_from_sub(owner); to: cross_sub;
 		};
 		let data = (0..b).map(|_| create_max_item_data([(to.clone(), 200)])).collect();
-	}: {<Pallet<T>>::create_multiple_items(&collection, &sender, data)?}
+	}: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}
 
 	create_multiple_items_ex_multiple_items {
 		let b in 0..MAX_ITEMS_PER_BATCH;
@@ -85,7 +85,7 @@
 			bench_init!(to: cross_sub(t););
 			create_max_item_data([(to, 200)])
 		}).collect();
-	}: {<Pallet<T>>::create_multiple_items(&collection, &sender, data)?}
+	}: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}
 
 	create_multiple_items_ex_multiple_owners {
 		let b in 0..MAX_ITEMS_PER_BATCH;
@@ -97,7 +97,7 @@
 			bench_init!(to: cross_sub(u););
 			(to, 200)
 		}))].try_into().unwrap();
-	}: {<Pallet<T>>::create_multiple_items(&collection, &sender, data)?}
+	}: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}
 
 	// Other user left, token data is kept
 	burn_item_partial {
@@ -122,7 +122,7 @@
 			sender: cross_from_sub(owner); receiver: cross_sub;
 		};
 		let item = create_max_item(&collection, &sender, [(sender.clone(), 200), (receiver.clone(), 200)])?;
-	}: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 100)?}
+	}: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 100, &Unlimited)?}
 	// Target account is created
 	transfer_creating {
 		bench_init!{
@@ -130,7 +130,7 @@
 			sender: cross_from_sub(owner); receiver: cross_sub;
 		};
 		let item = create_max_item(&collection, &sender, [(sender.clone(), 200)])?;
-	}: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 100)?}
+	}: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 100, &Unlimited)?}
 	// Source account is destroyed
 	transfer_removing {
 		bench_init!{
@@ -138,7 +138,7 @@
 			sender: cross_from_sub(owner); receiver: cross_sub;
 		};
 		let item = create_max_item(&collection, &sender, [(sender.clone(), 200), (receiver.clone(), 200)])?;
-	}: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 200)?}
+	}: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 200, &Unlimited)?}
 	// Source account destroyed, target created
 	transfer_creating_removing {
 		bench_init!{
@@ -146,7 +146,7 @@
 			sender: cross_from_sub(owner); receiver: cross_sub;
 		};
 		let item = create_max_item(&collection, &sender, [(sender.clone(), 200)])?;
-	}: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 200)?}
+	}: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, 200, &Unlimited)?}
 
 	approve {
 		bench_init!{
modifiedpallets/refungible/src/common.rsdiffbeforeafterboth
--- a/pallets/refungible/src/common.rs
+++ b/pallets/refungible/src/common.rs
@@ -20,7 +20,7 @@
 use frame_support::{dispatch::DispatchResultWithPostInfo, fail, weights::Weight};
 use up_data_structs::{
 	CollectionId, TokenId, CreateItemExData, CreateRefungibleExData, budget::Budget, Property,
-	PropertyKey, PropertyValue, PropertyKeyPermission,
+	PropertyKey, PropertyValue, PropertyKeyPermission, CreateItemData,
 };
 use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};
 use sp_runtime::DispatchError;
@@ -46,8 +46,8 @@
 		<SelfWeightOf<T>>::create_item()
 	}
 
-	fn create_multiple_items(amount: u32) -> Weight {
-		<SelfWeightOf<T>>::create_multiple_items(amount)
+	fn create_multiple_items(data: &[CreateItemData]) -> Weight {
+		<SelfWeightOf<T>>::create_multiple_items(data.len() as u32)
 	}
 
 	fn create_multiple_items_ex(call: &CreateItemExData<T::CrossAccountId>) -> Weight {
@@ -66,12 +66,14 @@
 		max_weight_of!(burn_item_partial(), burn_item_fully())
 	}
 
-	fn set_collection_properties(amount: u32) -> Weight {
-		<SelfWeightOf<T>>::set_collection_properties(amount)
+	fn set_collection_properties(_amount: u32) -> Weight {
+		// Error
+		0
 	}
 
-	fn delete_collection_properties(amount: u32) -> Weight {
-		<SelfWeightOf<T>>::delete_collection_properties(amount)
+	fn delete_collection_properties(_amount: u32) -> Weight {
+		// Error
+		0
 	}
 
 	fn set_token_properties(amount: u32) -> Weight {
@@ -156,15 +158,15 @@
 		data: Vec<up_data_structs::CreateItemData>,
 		nesting_budget: &dyn Budget,
 	) -> DispatchResultWithPostInfo {
+		let weight = <CommonWeights<T>>::create_multiple_items(&data);
 		let data = data
 			.into_iter()
 			.map(|d| map_create_data::<T>(d, &to))
 			.collect::<Result<Vec<_>, DispatchError>>()?;
 
-		let amount = data.len();
 		with_weight(
 			<Pallet<T>>::create_multiple_items(self, &sender, data, nesting_budget),
-			<CommonWeights<T>>::create_multiple_items(amount as u32),
+			weight,
 		)
 	}
 
modifiedpallets/refungible/src/weights.rsdiffbeforeafterboth
--- a/pallets/refungible/src/weights.rs
+++ b/pallets/refungible/src/weights.rs
@@ -38,8 +38,6 @@
 	fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight;
 	fn burn_item_partial() -> Weight;
 	fn burn_item_fully() -> Weight;
-	fn set_collection_properties(amount: u32) -> Weight;
-	fn delete_collection_properties(amount: u32) -> Weight;
 	fn set_token_properties(amount: u32) -> Weight;
 	fn delete_token_properties(amount: u32) -> Weight;
 	fn set_property_permissions(amount: u32) -> Weight;
@@ -132,16 +130,6 @@
 		(32_489_000 as Weight)
 			.saturating_add(T::DbWeight::get().reads(4 as Weight))
 			.saturating_add(T::DbWeight::get().writes(6 as Weight))
-	}
-
-	fn set_collection_properties(_amount: u32) -> Weight {
-		// Error
-		0
-	}
-
-	fn delete_collection_properties(_amount: u32) -> Weight {
-		// Error
-		0
 	}
 
 	fn set_token_properties(_amount: u32) -> Weight {
@@ -320,16 +308,6 @@
 		(32_489_000 as Weight)
 			.saturating_add(RocksDbWeight::get().reads(4 as Weight))
 			.saturating_add(RocksDbWeight::get().writes(6 as Weight))
-	}
-
-	fn set_collection_properties(_amount: u32) -> Weight {
-		// Error
-		0
-	}
-
-	fn delete_collection_properties(_amount: u32) -> Weight {
-		// Error
-		0
 	}
 
 	fn set_token_properties(_amount: u32) -> Weight {
modifiedpallets/structure/Cargo.tomldiffbeforeafterboth
--- a/pallets/structure/Cargo.toml
+++ b/pallets/structure/Cargo.toml
@@ -16,6 +16,7 @@
 	"derive",
 ] }
 up-data-structs = { path = "../../primitives/data-structs", default-features = false }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }
 
 [features]
 default = ["std"]
@@ -28,5 +29,6 @@
 	"scale-info/std",
 	"parity-scale-codec/std",
 	"up-data-structs/std",
+	"pallet-evm/std",
 ]
 runtime-benchmarks = ['frame-benchmarking', 'pallet-common/runtime-benchmarks']
modifiedpallets/structure/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/structure/src/benchmarking.rs
+++ b/pallets/structure/src/benchmarking.rs
@@ -2,8 +2,10 @@
 
 use frame_benchmarking::{benchmarks, account};
 use frame_support::traits::{Currency, Get};
-use up_data_structs::{CreateCollectionData, CollectionMode, CreateItemData, CreateNftData};
-use pallet_common::CrossAccountId;
+use up_data_structs::{
+	CreateCollectionData, CollectionMode, CreateItemData, CreateNftData, budget::Unlimited,
+};
+use pallet_evm::account::CrossAccountId;
 
 const SEED: u32 = 1;
 
@@ -20,9 +22,9 @@
 		let dispatch = T::CollectionDispatch::dispatch(CollectionHandle::try_get(CollectionId(1))?);
 		let dispatch = dispatch.as_dyn();
 
-		dispatch.create_item(caller_cross.clone(), caller_cross.clone(), CreateItemData::NFT(CreateNftData::default()))?;
+		dispatch.create_item(caller_cross.clone(), caller_cross.clone(), CreateItemData::NFT(CreateNftData::default()), &Unlimited)?;
 	}: {
 		let parent = <Pallet<T>>::find_parent(CollectionId(1), TokenId(1))?;
-		assert!(matches!(parent, Parent::Normal(_)))
+		assert!(matches!(parent, Parent::User(_)))
 	}
 }
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -687,7 +687,7 @@
 		/// * itemsData: Array items properties. Each property is an array of bytes itself, see [create_item].
 		///
 		/// * owner: Address, initial owner of the NFT.
-		#[weight = T::CommonWeightInfo::create_multiple_items(items_data.len() as u32)]
+		#[weight = T::CommonWeightInfo::create_multiple_items(&items_data)]
 		#[transactional]
 		pub fn create_multiple_items(origin, collection_id: CollectionId, owner: T::CrossAccountId, items_data: Vec<CreateItemData>) -> DispatchResultWithPostInfo {
 			ensure!(!items_data.is_empty(), Error::<T>::EmptyArgument);
modifiedprimitives/data-structs/Cargo.tomldiffbeforeafterboth
--- a/primitives/data-structs/Cargo.toml
+++ b/primitives/data-structs/Cargo.toml
@@ -42,3 +42,4 @@
 ]
 serde1 = ["serde"]
 limit-testing = []
+runtime-benchmarks = []
\ No newline at end of file
modifiedprimitives/data-structs/src/lib.rsdiffbeforeafterboth
--- a/primitives/data-structs/src/lib.rs
+++ b/primitives/data-structs/src/lib.rs
@@ -861,7 +861,9 @@
 	) -> Result<(), PropertiesError> {
 		let value_len = value.len();
 
-		if self.consumed_space as usize + value_len > self.space_limit as usize {
+		if self.consumed_space as usize + value_len > self.space_limit as usize
+			&& !cfg!(feature = "runtime-benchmarks")
+		{
 			return Err(PropertiesError::NoSpaceForProperty);
 		}
 
modifiedruntime/common/src/eth_sponsoring.rsdiffbeforeafterboth
--- a/runtime/common/src/eth_sponsoring.rs
+++ b/runtime/common/src/eth_sponsoring.rs
@@ -50,16 +50,20 @@
 			CollectionMode::NFT => {
 				let call = <UniqueNFTCall<T>>::parse(method_id, &mut reader).ok()??;
 				match call {
-					UniqueNFTCall::TokenProperties(
-						TokenPropertiesCall::SetProperty { token_id, key, value, .. },
-					) => {
+					UniqueNFTCall::TokenProperties(TokenPropertiesCall::SetProperty {
+						token_id,
+						key,
+						value,
+						..
+					}) => {
 						let token_id: TokenId = token_id.try_into().ok()?;
 						withdraw_set_token_property::<T>(
 							&collection,
 							&who,
 							&token_id,
 							key.len() + value.len(),
-						).map(|()| sponsor)
+						)
+						.map(|()| sponsor)
 					}
 					UniqueNFTCall::ERC721UniqueExtensions(
 						ERC721UniqueExtensionsCall::Transfer { token_id, .. },
modifiedruntime/common/src/runtime_apis.rsdiffbeforeafterboth
before · runtime/common/src/runtime_apis.rs
1#[macro_export]2macro_rules! impl_common_runtime_apis {3    (4        $(5            #![custom_apis]67            $($custom_apis:tt)+8        )?9    ) => {10        impl_runtime_apis! {11            $($($custom_apis)+)?1213            impl up_rpc::UniqueApi<Block, CrossAccountId, AccountId> for Runtime {14                fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Result<Vec<TokenId>, DispatchError> {15                    dispatch_unique_runtime!(collection.account_tokens(account))16                }17                fn collection_tokens(collection: CollectionId) -> Result<Vec<TokenId>, DispatchError> {18                    dispatch_unique_runtime!(collection.collection_tokens())19                }20                fn token_exists(collection: CollectionId, token: TokenId) -> Result<bool, DispatchError> {21                    dispatch_unique_runtime!(collection.token_exists(token))22                }2324                fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {25                    dispatch_unique_runtime!(collection.token_owner(token))26                }27                fn topmost_token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {28                    let budget = up_data_structs::budget::Value::new(5);2930                    Ok(Some(<pallet_structure::Pallet<Runtime>>::find_topmost_owner(collection, token, &budget)?))31                }32                fn const_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {33                    dispatch_unique_runtime!(collection.const_metadata(token))34                }3536                fn collection_properties(37                    collection: CollectionId,38                    keys: Option<Vec<Vec<u8>>>39                ) -> Result<Vec<Property>, DispatchError> {40                    let keys = keys.map(41                        |keys| pallet_common::Pallet::<Runtime>::bytes_keys_to_property_keys(keys)42                    ).transpose()?;4344                    pallet_common::Pallet::<Runtime>::filter_collection_properties(collection, keys)45                }4647                fn token_properties(48                    collection: CollectionId,49                    token_id: TokenId,50                    keys: Option<Vec<Vec<u8>>>51                ) -> Result<Vec<Property>, DispatchError> {52                    let keys = keys.map(53                        |keys| pallet_common::Pallet::<Runtime>::bytes_keys_to_property_keys(keys)54                    ).transpose()?;5556                    dispatch_unique_runtime!(collection.token_properties(token_id, keys))57                }5859                fn property_permissions(60                    collection: CollectionId,61                    keys: Option<Vec<Vec<u8>>>62                ) -> Result<Vec<PropertyKeyPermission>, DispatchError> {63                    let keys = keys.map(64                        |keys| pallet_common::Pallet::<Runtime>::bytes_keys_to_property_keys(keys)65                    ).transpose()?;6667                    pallet_common::Pallet::<Runtime>::filter_property_permissions(collection, keys)68                }6970                fn token_data(71                    collection: CollectionId,72                    token_id: TokenId,73                    keys: Option<Vec<Vec<u8>>>74                ) -> Result<TokenData<CrossAccountId>, DispatchError> {75                    let token_data = TokenData {76                        const_data: Self::const_metadata(collection, token_id)?,77                        properties: Self::token_properties(collection, token_id, keys)?,78                        owner: Self::token_owner(collection, token_id)?79                    };8081                    Ok(token_data)82                }8384                fn total_supply(collection: CollectionId) -> Result<u32, DispatchError> {85                    dispatch_unique_runtime!(collection.total_supply())86                }87                fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32, DispatchError> {88                    dispatch_unique_runtime!(collection.account_balance(account))89                }90                fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<u128, DispatchError> {91                    dispatch_unique_runtime!(collection.balance(account, token))92                }93                fn allowance(94                    collection: CollectionId,95                    sender: CrossAccountId,96                    spender: CrossAccountId,97                    token: TokenId,98                ) -> Result<u128, DispatchError> {99                    dispatch_unique_runtime!(collection.allowance(sender, spender, token))100                }101102                fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {103                    Ok(<pallet_common::Pallet<Runtime>>::adminlist(collection))104                }105                fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {106                    Ok(<pallet_common::Pallet<Runtime>>::allowlist(collection))107                }108                fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool, DispatchError> {109                    Ok(<pallet_common::Pallet<Runtime>>::allowed(collection, user))110                }111                fn last_token_id(collection: CollectionId) -> Result<TokenId, DispatchError> {112                    dispatch_unique_runtime!(collection.last_token_id())113                }114                fn collection_by_id(collection: CollectionId) -> Result<Option<RpcCollection<AccountId>>, DispatchError> {115                    Ok(<pallet_common::Pallet<Runtime>>::rpc_collection(collection))116                }117                fn collection_stats() -> Result<CollectionStats, DispatchError> {118                    Ok(<pallet_common::Pallet<Runtime>>::collection_stats())119                }120                fn next_sponsored(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<Option<u64>, DispatchError> {121                    Ok(<$crate::sponsoring::UniqueSponsorshipPredict<Runtime> as122                            $crate::sponsoring::SponsorshipPredict<Runtime>>::predict(123                        collection,124                        account,125                        token))126                }127128                fn effective_collection_limits(collection: CollectionId) -> Result<Option<CollectionLimits>, DispatchError> {129                    Ok(<pallet_common::Pallet<Runtime>>::effective_collection_limits(collection))130                }131            }132133            impl rmrk_rpc::RmrkApi<134                Block,135                AccountId,136                RmrkCollectionInfo<AccountId>,137                RmrkInstanceInfo<AccountId>,138                RmrkResourceInfo,139                RmrkPropertyInfo,140                RmrkBaseInfo<AccountId>,141                RmrkPartType,142                RmrkTheme143            > for Runtime {144                fn last_collection_idx() -> Result<RmrkCollectionId, DispatchError> {145                    Ok(<pallet_common::CreatedCollectionCount<Runtime>>::get().0) // todo storage from proxy pallet146                }147                fn collection_by_id(collection_id: RmrkCollectionId) -> Result<Option<RmrkCollectionInfo<AccountId>>, DispatchError> {148                    // TODO decide on displacement to palettes -- does RMRK belong there, spread across common and nonfungible?149                    use frame_support::BoundedVec;150                    use scale_info::prelude::string::String;151                    use pallet_proxy_rmrk_core::RmrkProperty;152153                    // todo check if this is a rmrk collection? or simply trust and provide anyway?154                    // client-is-always-right / enforce authority and order ?155156                    let collection_id = CollectionId(collection_id);157                    let collection = <pallet_proxy_rmrk_core::Pallet<Runtime>>::get_nft_collection(collection_id)?;158                    // todo Vec::from(["rmrk:metadata", "rmrk:collection-type"])159                    let metadata = BoundedVec::try_from(160                        <pallet_proxy_rmrk_core::Pallet<Runtime>>::get_collection_property(collection_id, RmrkProperty::Metadata)?.into_inner()161                    ).map_err(|_| <pallet_common::Error<Runtime>>::PropertyKeyIsTooLong)?;//unwrap_or_default();162                    let nfts_count = (dispatch_unique_runtime!(collection_id.total_supply()) as Result<u32, DispatchError>)?; // todo? <Runtime>::total_supply(collection_id)163164                    Ok(Some(RmrkCollectionInfo {165                        issuer: collection.owner.clone(),166                        metadata,167                        max: collection.limits.token_limit,168                        symbol: BoundedVec::try_from(169                            collection.token_prefix.clone().into_inner()170                        ).map_err(|_| <pallet_common::Error<Runtime>>::PropertyKeyIsTooLong)?,171                        nfts_count172                    }))173                }174                fn nft_by_id(collection_id: RmrkCollectionId, nft_by_id: RmrkNftId) -> Result<Option<RmrkInstanceInfo<AccountId>>, DispatchError> {175                    use frame_support::BoundedVec;176                    use up_data_structs::mapping::TokenAddressMapping;177                    use pallet_proxy_rmrk_core::RmrkProperty;178179                    let collection_id = CollectionId(collection_id);180                    let nft_id = TokenId(nft_by_id);181182                    let owner = match (dispatch_unique_runtime!(collection_id.token_owner(nft_id)) as Result<Option<CrossAccountId>, DispatchError>)? {183                        Some(owner) => match <Runtime as pallet_common::Config>::CrossTokenAddressMapping::address_to_token(&owner) {184                            Some((col, tok)) => RmrkAccountIdOrCollectionNftTuple::CollectionAndNftTuple(col.0, tok.0),185                            None => RmrkAccountIdOrCollectionNftTuple::AccountId(owner.as_sub().clone())186                        },187                        None => return Ok(None)188                    };189190                    let keys = [191                        RmrkProperty::Royalty,192                        RmrkProperty::Metadata,193                        RmrkProperty::Equipped,194                        RmrkProperty::Pending,195                        // ?? "rmrk:recipient", "rmrk:nft-type", "rmrk:resource-collection", "rmrk:resource-priorities"196                    ];197198                    let properties = keys.into_iter().map(199                        |key| BoundedVec::try_from(200                            // todo nft property, not collection201                            <pallet_proxy_rmrk_core::Pallet<Runtime>>::get_nft_property(collection_id, nft_id, key).unwrap().into_inner()202                        ).unwrap()203                    )204                    .collect::<Vec<RmrkString>>();205206                    Ok(Some(RmrkInstanceInfo {207                        owner: owner,208                        //recipient: , // prop?209                        royalty: None,//Permill::from_percent(0), // prop, decode210                        metadata: properties[1].clone(),211                        equipped: false, // prop, decode212                        pending: false, // prop, decode213                    }))214                }215                fn account_tokens(account_id: AccountId, collection_id: RmrkCollectionId) -> Result<Vec<RmrkNftId>, DispatchError> {216                    let cross_account_id = CrossAccountId::from_sub(account_id);217                    let collection_id = CollectionId(collection_id);218                    Ok(219                        (dispatch_unique_runtime!(collection_id.account_tokens(cross_account_id)) as Result<Vec<TokenId>, DispatchError>)?220                        //<Runtime as up_rpc::UniqueApi<Block, CrossAccountId, AccountId>>::account_tokens(collection_id, cross_account_id)?221                            .into_iter()222                            .map(|token| token.0)223                            .collect::<Vec<_>>()224                    )225                }226                fn nft_children(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkNftChild>, DispatchError> {227                    use up_data_structs::mapping::TokenAddressMapping;228229                    let collection_id = CollectionId(collection_id);230                    let nft_id = TokenId(nft_id);231                    let cross_account_id = CrossAccountId::from_eth(232                        EvmTokenAddressMapping::token_to_address(collection_id, nft_id)233                    );234235                    Ok(236                        pallet_nonfungible::Owned::<Runtime>::iter_prefix((collection_id, cross_account_id))237                            .map(|(child_id, _)| RmrkNftChild {238                                collection_id: collection_id.0, // todo make sure they're always from this collection239                                nft_id: child_id.0,240                            })241                            .collect()242                    )243                }244                fn collection_properties(collection_id: RmrkCollectionId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {245                    use frame_support::BoundedVec;246247                    let collection_id = CollectionId(collection_id);248                    let properties = pallet_common::Pallet::<Runtime>::collection_properties(collection_id);249250                    return Ok(match filter_keys {251                        Some(keys) => {252                            let keys = pallet_common::Pallet::<Runtime>::bytes_keys_to_property_keys(keys)?;253                            let properties = keys254                                .into_iter()255                                .filter_map(|key| {256                                    properties.get(&key).map(|value| RmrkPropertyInfo {257                                        key: BoundedVec::try_from(key.into_inner()).unwrap(),258                                        value: BoundedVec::try_from(value.clone().into_inner()).unwrap(),259                                    })260                                })261                                .collect();262263                            properties264                        }265                        None => {266                            properties267                                .iter()268                                .filter_map(|(key, value)| Some(RmrkPropertyInfo {269                                    key: BoundedVec::try_from(key.clone().into_inner()).unwrap(),270                                    value: BoundedVec::try_from(value.clone().into_inner()).unwrap(),271                                }))272                                .collect()273                        }274                    });275                }276                fn nft_properties(collection_id: RmrkCollectionId, nft_id: RmrkNftId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {277                    use frame_support::BoundedVec;278279                    let collection_id = CollectionId(collection_id);280                    let token_id = TokenId(nft_id);281282		            let properties = pallet_nonfungible::Pallet::<Runtime>::token_properties((collection_id, token_id)); // todo look into usage of pallet_nonfungible283284                    // todo displace to a function? redundant code piece with collection props285                    return Ok(match filter_keys {286                        Some(keys) => {287                            let keys = pallet_common::Pallet::<Runtime>::bytes_keys_to_property_keys(keys)?;288                            let properties = keys289                                .into_iter()290                                .filter_map(|key| {291                                    properties.get(&key).map(|value| RmrkPropertyInfo {292                                        key: BoundedVec::try_from(key.into_inner()).unwrap(),293                                        value: BoundedVec::try_from(value.clone().into_inner()).unwrap(),294                                    })295                                })296                                .collect();297298                            properties299                        }300                        None => {301                            properties302                                .iter()303                                .filter_map(|(key, value)| Some(RmrkPropertyInfo {304                                    key: BoundedVec::try_from(key.clone().into_inner()).unwrap(),305                                    value: BoundedVec::try_from(value.clone().into_inner()).unwrap(),306                                }))307                                .collect()308                        }309                    });310                }311                fn nft_resources(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkResourceInfo>, DispatchError> {312                    use frame_support::BoundedVec;313                    use pallet_proxy_rmrk_core::RmrkProperty;314315                    let collection_id = CollectionId(collection_id);316                    let nft_id = TokenId(nft_id);317318                    let keys = [319                        RmrkProperty::Royalty,320                        RmrkProperty::Metadata,321                        RmrkProperty::Equipped,322                        RmrkProperty::Pending,323                        // ?? "rmrk:recipient", "rmrk:nft-type", "rmrk:resource-collection", "rmrk:resource-priorities"324                    ];325326                    /*let resources = keys.into_iter().map(327                        |key| BoundedVec::try_from(328                            <pallet_proxy_rmrk_core::Pallet<Runtime>>::get_nft_property(collection_id, nft_id, key).unwrap().into_inner()329                        ).unwrap()330                    )331                    .collect::<Vec<RmrkString>>();*/332333                    Ok(Vec::new(/*[RmrkResourceInfo {334335                    }]*/))336                }337                fn nft_resource_priorities(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkResourceId>, DispatchError> {338                    todo!()339                }340                fn base(base_id: RmrkBaseId) -> Result<Option<RmrkBaseInfo<AccountId>>, DispatchError> {341                    use frame_support::BoundedVec;342                    use scale_info::prelude::string::String;343                    use pallet_proxy_rmrk_core::RmrkProperty;344345                    let collection_id = CollectionId(base_id);346                    let collection = <pallet_proxy_rmrk_core::Pallet<Runtime>>::get_nft_collection(collection_id)?;347348                    // todo export to macro? redundancy349                    let keys = [350                        RmrkProperty::BaseType,351                    ];352353                    let properties = keys.into_iter().map(354                        |key| BoundedVec::try_from(355                            <pallet_proxy_rmrk_core::Pallet<Runtime>>::get_collection_property(collection_id, key).unwrap().into_inner()356                        )357                    )358                    // todo not-a-rmrk-collection error359                    .collect::<Result<Vec<_>, _>>()360                    .map_err(|_| <pallet_proxy_rmrk_core::Error<Runtime>>::CollectionUnknown)?;361362                    Ok(Some(RmrkBaseInfo {363                        issuer: collection.owner.clone(),364                        base_type: properties[0].clone(),365                        symbol: BoundedVec::try_from(366                            collection.token_prefix.clone().into_inner()367                        ).map_err(|_| <pallet_common::Error<Runtime>>::PropertyKeyIsTooLong)?,368                    }))369                }370                fn base_parts(base_id: RmrkBaseId) -> Result<Vec<RmrkPartType>, DispatchError> {371                    use frame_support::BoundedVec;372                    use pallet_proxy_rmrk_core::RmrkProperty;373374                    let collection_id = CollectionId(base_id);375376                    let keys = [377                        //RmrkProperty::NftType)?,378                        //RmrkProperty::PartId)?,379                        RmrkProperty::Src,380                        RmrkProperty::ZIndex,381                        RmrkProperty::EquippableList,382                    ];383384                    let parts = (dispatch_unique_runtime!(collection_id.collection_tokens()) as Result<Vec<TokenId>, DispatchError>)?385                        .iter()386                        .filter_map(|token_id| {387                            /*let properties = keys.into_iter().map(388                                |key| BoundedVec::try_from(389                                    <pallet_proxy_rmrk_core::Pallet<Runtime>>::get_nft_property(collection_id, *token_id, key).unwrap().into_inner()390                                ).unwrap()391                            ).collect::<Vec<RmrkString>>();*/392393                            // todo ping properties for "rmrk:nft-type"394                            // if none, skip, None395                            let nft_type = "fixed-part";396397                            match nft_type {398                                "fixed-part" => Some(RmrkPartType::FixedPart(RmrkFixedPart {399                                    id: token_id.0,400                                    src: BoundedVec::default(), // "rmrk:src"401                                    z: 0, // "rmrk:z-index"402                                })),403                                "slot-part" => Some(RmrkPartType::SlotPart(RmrkSlotPart {404                                    id: token_id.0,405                                    equippable: RmrkEquippableList::Empty, // "rmrk:equippable-list" ?406                                    src: BoundedVec::default(), // "rmrk:src"407                                    z: 0, // "rmrk:z-index"408                                })),409                                _ => None410                            }411412                        })413                        .collect();414415                    Ok(parts)416                }417                fn theme_names(base_id: RmrkBaseId) -> Result<Vec<RmrkThemeName>, DispatchError> {418                    use frame_support::BoundedVec;419420                    let collection_id = CollectionId(base_id);421422                    let theme_names = (dispatch_unique_runtime!(collection_id.collection_tokens()) as Result<Vec<TokenId>, DispatchError>)?423                        .iter()424                        .filter_map(|token_id| {425                            let properties = pallet_nonfungible::Pallet::<Runtime>::token_properties((collection_id, token_id));426427                            // todo ping property for "rmrk:nft-type"428                            // if none or not "theme", skip, None429                            let nft_type = "theme";430                            // can't call dispatch_unique_runtime! from here??431                            <pallet_nonfungible::TokenData<Runtime>>::get((collection_id, token_id))432                                .map(|t| t.const_data.into_inner())433                                //.unwrap_or_default()434                            // todo rework to reduce independence435                        })436                        .collect();437438                    Ok(theme_names)439                }440                fn theme(base_id: RmrkBaseId, theme_name: RmrkThemeName, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Option<RmrkTheme>, DispatchError> {441                    use frame_support::BoundedVec;442443                    let collection_id = CollectionId(base_id);444445                    // todo one theme. filter collection tokens according to theme name, should result in one446                    // (is it possible to search with iter_prefix for part of a struct that satisfies?..)447                    // filter properties according to filter_keys and load them into resulting theme.properties448                    let themes = (dispatch_unique_runtime!(collection_id.collection_tokens()) as Result<Vec<TokenId>, DispatchError>)?449                        .iter()450                        .filter_map(|token_id| {451                            let properties = pallet_nonfungible::Pallet::<Runtime>::token_properties((collection_id, token_id));452453                            // todo ping properties for "rmrk:nft-type"454                            // if none, skip, None455                            // ugh gonna go through ALL properties, searching for matches for "rmrk:theme-property-<key>"456                            let nft_type = "theme";457                            match nft_type {458                                "theme" => Some(RmrkTheme {459                                    name: BoundedVec::try_from(460                                        <pallet_nonfungible::TokenData<Runtime>>::get((collection_id, token_id))461                                            .map(|t| t.const_data)462                                            .unwrap_or_default()463                                            .into_inner()464                                    ).unwrap(),465                                    // todo? (dispatch_unique_runtime!(collection_id.const_metadata(token_id)) as Result<Vec<u8>, DispatchError>)?,466                                    properties: Vec::new(), // pain in the ass467                                    inherit: false, // "rmrk:theme-inherit"468                                }),469                                _ => None470                            }471                        })472                        .collect::<Vec<_>>();473474                    // todo475                    Ok(Some(themes[0].clone()))476                }477            }478479            impl sp_api::Core<Block> for Runtime {480                fn version() -> RuntimeVersion {481                    VERSION482                }483484                fn execute_block(block: Block) {485                    Executive::execute_block(block)486                }487488                fn initialize_block(header: &<Block as BlockT>::Header) {489                    Executive::initialize_block(header)490                }491            }492493            impl sp_api::Metadata<Block> for Runtime {494                fn metadata() -> OpaqueMetadata {495                    OpaqueMetadata::new(Runtime::metadata().into())496                }497            }498499            impl sp_block_builder::BlockBuilder<Block> for Runtime {500                fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {501                    Executive::apply_extrinsic(extrinsic)502                }503504                fn finalize_block() -> <Block as BlockT>::Header {505                    Executive::finalize_block()506                }507508                fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {509                    data.create_extrinsics()510                }511512                fn check_inherents(513                    block: Block,514                    data: sp_inherents::InherentData,515                ) -> sp_inherents::CheckInherentsResult {516                    data.check_extrinsics(&block)517                }518519                // fn random_seed() -> <Block as BlockT>::Hash {520                //     RandomnessCollectiveFlip::random_seed().0521                // }522            }523524            impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {525                fn validate_transaction(526                    source: TransactionSource,527                    tx: <Block as BlockT>::Extrinsic,528                    hash: <Block as BlockT>::Hash,529                ) -> TransactionValidity {530                    Executive::validate_transaction(source, tx, hash)531                }532            }533534            impl sp_offchain::OffchainWorkerApi<Block> for Runtime {535                fn offchain_worker(header: &<Block as BlockT>::Header) {536                    Executive::offchain_worker(header)537                }538            }539540            impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {541                fn chain_id() -> u64 {542                    <Runtime as pallet_evm::Config>::ChainId::get()543                }544545                fn account_basic(address: H160) -> EVMAccount {546                    EVM::account_basic(&address)547                }548549                fn gas_price() -> U256 {550                    <Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price()551                }552553                fn account_code_at(address: H160) -> Vec<u8> {554                    EVM::account_codes(address)555                }556557                fn author() -> H160 {558                    <pallet_evm::Pallet<Runtime>>::find_author()559                }560561                fn storage_at(address: H160, index: U256) -> H256 {562                    let mut tmp = [0u8; 32];563                    index.to_big_endian(&mut tmp);564                    EVM::account_storages(address, H256::from_slice(&tmp[..]))565                }566567                #[allow(clippy::redundant_closure)]568                fn call(569                    from: H160,570                    to: H160,571                    data: Vec<u8>,572                    value: U256,573                    gas_limit: U256,574                    max_fee_per_gas: Option<U256>,575                    max_priority_fee_per_gas: Option<U256>,576                    nonce: Option<U256>,577                    estimate: bool,578                    access_list: Option<Vec<(H160, Vec<H256>)>>,579                ) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {580                    let config = if estimate {581                        let mut config = <Runtime as pallet_evm::Config>::config().clone();582                        config.estimate = true;583                        Some(config)584                    } else {585                        None586                    };587588                    let is_transactional = false;589                    <Runtime as pallet_evm::Config>::Runner::call(590                        CrossAccountId::from_eth(from),591                        to,592                        data,593                        value,594                        gas_limit.low_u64(),595                        max_fee_per_gas,596                        max_priority_fee_per_gas,597                        nonce,598                        access_list.unwrap_or_default(),599                        is_transactional,600                        config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),601                    ).map_err(|err| err.into())602                }603604                #[allow(clippy::redundant_closure)]605                fn create(606                    from: H160,607                    data: Vec<u8>,608                    value: U256,609                    gas_limit: U256,610                    max_fee_per_gas: Option<U256>,611                    max_priority_fee_per_gas: Option<U256>,612                    nonce: Option<U256>,613                    estimate: bool,614                    access_list: Option<Vec<(H160, Vec<H256>)>>,615                ) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {616                    let config = if estimate {617                        let mut config = <Runtime as pallet_evm::Config>::config().clone();618                        config.estimate = true;619                        Some(config)620                    } else {621                        None622                    };623624                    let is_transactional = false;625                    <Runtime as pallet_evm::Config>::Runner::create(626                        CrossAccountId::from_eth(from),627                        data,628                        value,629                        gas_limit.low_u64(),630                        max_fee_per_gas,631                        max_priority_fee_per_gas,632                        nonce,633                        access_list.unwrap_or_default(),634                        is_transactional,635                        config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),636                    ).map_err(|err| err.into())637                }638639                fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {640                    Ethereum::current_transaction_statuses()641                }642643                fn current_block() -> Option<pallet_ethereum::Block> {644                    Ethereum::current_block()645                }646647                fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {648                    Ethereum::current_receipts()649                }650651                fn current_all() -> (652                    Option<pallet_ethereum::Block>,653                    Option<Vec<pallet_ethereum::Receipt>>,654                    Option<Vec<TransactionStatus>>655                ) {656                    (657                        Ethereum::current_block(),658                        Ethereum::current_receipts(),659                        Ethereum::current_transaction_statuses()660                    )661                }662663                fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {664                    xts.into_iter().filter_map(|xt| match xt.0.function {665                        Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),666                        _ => None667                    }).collect()668                }669670                fn elasticity() -> Option<Permill> {671                    None672                }673            }674675            impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {676                fn convert_transaction(transaction: pallet_ethereum::Transaction) -> <Block as BlockT>::Extrinsic  {677                    UncheckedExtrinsic::new_unsigned(678                        pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),679                    )680                }681            }682683            impl sp_session::SessionKeys<Block> for Runtime {684                fn decode_session_keys(685                    encoded: Vec<u8>,686                ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {687                    SessionKeys::decode_into_raw_public_keys(&encoded)688                }689690                fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {691                    SessionKeys::generate(seed)692                }693            }694695            impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {696                fn slot_duration() -> sp_consensus_aura::SlotDuration {697                    sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())698                }699700                fn authorities() -> Vec<AuraId> {701                    Aura::authorities().to_vec()702                }703            }704705            impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {706                fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {707                    ParachainSystem::collect_collation_info(header)708                }709            }710711            impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {712                fn account_nonce(account: AccountId) -> Index {713                    System::account_nonce(account)714                }715            }716717            impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {718                fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {719                    TransactionPayment::query_info(uxt, len)720                }721                fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {722                    TransactionPayment::query_fee_details(uxt, len)723                }724            }725726            /*727            impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>728                for Runtime729            {730                fn call(731                    origin: AccountId,732                    dest: AccountId,733                    value: Balance,734                    gas_limit: u64,735                    input_data: Vec<u8>,736                ) -> pallet_contracts_primitives::ContractExecResult {737                    Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)738                }739740                fn instantiate(741                    origin: AccountId,742                    endowment: Balance,743                    gas_limit: u64,744                    code: pallet_contracts_primitives::Code<Hash>,745                    data: Vec<u8>,746                    salt: Vec<u8>,747                ) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>748                {749                    Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)750                }751752                fn get_storage(753                    address: AccountId,754                    key: [u8; 32],755                ) -> pallet_contracts_primitives::GetStorageResult {756                    Contracts::get_storage(address, key)757                }758759                fn rent_projection(760                    address: AccountId,761                ) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {762                    Contracts::rent_projection(address)763                }764            }765            */766767            #[cfg(feature = "runtime-benchmarks")]768            impl frame_benchmarking::Benchmark<Block> for Runtime {769                fn benchmark_metadata(extra: bool) -> (770                    Vec<frame_benchmarking::BenchmarkList>,771                    Vec<frame_support::traits::StorageInfo>,772                ) {773                    use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};774                    use frame_support::traits::StorageInfoTrait;775776                    let mut list = Vec::<BenchmarkList>::new();777778                    list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);779                    list_benchmark!(list, extra, pallet_unique, Unique);780                    list_benchmark!(list, extra, pallet_structure, Structure);781                    list_benchmark!(list, extra, pallet_inflation, Inflation);782                    list_benchmark!(list, extra, pallet_fungible, Fungible);783                    list_benchmark!(list, extra, pallet_refungible, Refungible);784                    list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);785                    // list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);786787                    let storage_info = AllPalletsReversedWithSystemFirst::storage_info();788789                    return (list, storage_info)790                }791792                fn dispatch_benchmark(793                    config: frame_benchmarking::BenchmarkConfig794                ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {795                    use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};796797                    let allowlist: Vec<TrackedStorageKey> = vec![798                        // Block Number799                        hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),800                        // Total Issuance801                        hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),802                        // Execution Phase803                        hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),804                        // Event Count805                        hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),806                        // System Events807                        hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),808809                        // Transactional depth810                        hex_literal::hex!("3a7472616e73616374696f6e5f6c6576656c3a").to_vec().into(),811                    ];812813                    let mut batches = Vec::<BenchmarkBatch>::new();814                    let params = (&config, &allowlist);815816                    add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);817                    add_benchmark!(params, batches, pallet_unique, Unique);818                    add_benchmark!(params, batches, pallet_structure, Structure);819                    add_benchmark!(params, batches, pallet_inflation, Inflation);820                    add_benchmark!(params, batches, pallet_fungible, Fungible);821                    add_benchmark!(params, batches, pallet_refungible, Refungible);822                    add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);823                    // add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);824825                    if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }826                    Ok(batches)827                }828            }829830            #[cfg(feature = "try-runtime")]831            impl frame_try_runtime::TryRuntime<Block> for Runtime {832                fn on_runtime_upgrade() -> (Weight, Weight) {833                    log::info!("try-runtime::on_runtime_upgrade unique-chain.");834                    let weight = Executive::try_runtime_upgrade().unwrap();835                    (weight, RuntimeBlockWeights::get().max_block)836                }837838                fn execute_block_no_check(block: Block) -> Weight {839                    Executive::execute_block_no_check(block)840                }841            }842        }843    }844}
after · runtime/common/src/runtime_apis.rs
1#[macro_export]2macro_rules! impl_common_runtime_apis {3    (4        $(5            #![custom_apis]67            $($custom_apis:tt)+8        )?9    ) => {10        impl_runtime_apis! {11            $($($custom_apis)+)?1213            impl up_rpc::UniqueApi<Block, CrossAccountId, AccountId> for Runtime {14                fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Result<Vec<TokenId>, DispatchError> {15                    dispatch_unique_runtime!(collection.account_tokens(account))16                }17                fn collection_tokens(collection: CollectionId) -> Result<Vec<TokenId>, DispatchError> {18                    dispatch_unique_runtime!(collection.collection_tokens())19                }20                fn token_exists(collection: CollectionId, token: TokenId) -> Result<bool, DispatchError> {21                    dispatch_unique_runtime!(collection.token_exists(token))22                }2324                fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {25                    dispatch_unique_runtime!(collection.token_owner(token))26                }27                fn topmost_token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {28                    let budget = up_data_structs::budget::Value::new(5);2930                    Ok(Some(<pallet_structure::Pallet<Runtime>>::find_topmost_owner(collection, token, &budget)?))31                }32                fn const_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {33                    dispatch_unique_runtime!(collection.const_metadata(token))34                }3536                fn collection_properties(37                    collection: CollectionId,38                    keys: Option<Vec<Vec<u8>>>39                ) -> Result<Vec<Property>, DispatchError> {40                    let keys = keys.map(41                        |keys| pallet_common::Pallet::<Runtime>::bytes_keys_to_property_keys(keys)42                    ).transpose()?;4344                    pallet_common::Pallet::<Runtime>::filter_collection_properties(collection, keys)45                }4647                fn token_properties(48                    collection: CollectionId,49                    token_id: TokenId,50                    keys: Option<Vec<Vec<u8>>>51                ) -> Result<Vec<Property>, DispatchError> {52                    let keys = keys.map(53                        |keys| pallet_common::Pallet::<Runtime>::bytes_keys_to_property_keys(keys)54                    ).transpose()?;5556                    dispatch_unique_runtime!(collection.token_properties(token_id, keys))57                }5859                fn property_permissions(60                    collection: CollectionId,61                    keys: Option<Vec<Vec<u8>>>62                ) -> Result<Vec<PropertyKeyPermission>, DispatchError> {63                    let keys = keys.map(64                        |keys| pallet_common::Pallet::<Runtime>::bytes_keys_to_property_keys(keys)65                    ).transpose()?;6667                    pallet_common::Pallet::<Runtime>::filter_property_permissions(collection, keys)68                }6970                fn token_data(71                    collection: CollectionId,72                    token_id: TokenId,73                    keys: Option<Vec<Vec<u8>>>74                ) -> Result<TokenData<CrossAccountId>, DispatchError> {75                    let token_data = TokenData {76                        const_data: Self::const_metadata(collection, token_id)?,77                        properties: Self::token_properties(collection, token_id, keys)?,78                        owner: Self::token_owner(collection, token_id)?79                    };8081                    Ok(token_data)82                }8384                fn total_supply(collection: CollectionId) -> Result<u32, DispatchError> {85                    dispatch_unique_runtime!(collection.total_supply())86                }87                fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32, DispatchError> {88                    dispatch_unique_runtime!(collection.account_balance(account))89                }90                fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<u128, DispatchError> {91                    dispatch_unique_runtime!(collection.balance(account, token))92                }93                fn allowance(94                    collection: CollectionId,95                    sender: CrossAccountId,96                    spender: CrossAccountId,97                    token: TokenId,98                ) -> Result<u128, DispatchError> {99                    dispatch_unique_runtime!(collection.allowance(sender, spender, token))100                }101102                fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {103                    Ok(<pallet_common::Pallet<Runtime>>::adminlist(collection))104                }105                fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {106                    Ok(<pallet_common::Pallet<Runtime>>::allowlist(collection))107                }108                fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool, DispatchError> {109                    Ok(<pallet_common::Pallet<Runtime>>::allowed(collection, user))110                }111                fn last_token_id(collection: CollectionId) -> Result<TokenId, DispatchError> {112                    dispatch_unique_runtime!(collection.last_token_id())113                }114                fn collection_by_id(collection: CollectionId) -> Result<Option<RpcCollection<AccountId>>, DispatchError> {115                    Ok(<pallet_common::Pallet<Runtime>>::rpc_collection(collection))116                }117                fn collection_stats() -> Result<CollectionStats, DispatchError> {118                    Ok(<pallet_common::Pallet<Runtime>>::collection_stats())119                }120                fn next_sponsored(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<Option<u64>, DispatchError> {121                    Ok(<$crate::sponsoring::UniqueSponsorshipPredict<Runtime> as122                            $crate::sponsoring::SponsorshipPredict<Runtime>>::predict(123                        collection,124                        account,125                        token))126                }127128                fn effective_collection_limits(collection: CollectionId) -> Result<Option<CollectionLimits>, DispatchError> {129                    Ok(<pallet_common::Pallet<Runtime>>::effective_collection_limits(collection))130                }131            }132133            impl rmrk_rpc::RmrkApi<134                Block,135                AccountId,136                RmrkCollectionInfo<AccountId>,137                RmrkInstanceInfo<AccountId>,138                RmrkResourceInfo,139                RmrkPropertyInfo,140                RmrkBaseInfo<AccountId>,141                RmrkPartType,142                RmrkTheme143            > for Runtime {144                fn last_collection_idx() -> Result<RmrkCollectionId, DispatchError> {145                    Ok(<pallet_common::CreatedCollectionCount<Runtime>>::get().0) // todo storage from proxy pallet146                }147                fn collection_by_id(collection_id: RmrkCollectionId) -> Result<Option<RmrkCollectionInfo<AccountId>>, DispatchError> {148                    // TODO decide on displacement to palettes -- does RMRK belong there, spread across common and nonfungible?149                    use frame_support::BoundedVec;150                    use scale_info::prelude::string::String;151                    use pallet_proxy_rmrk_core::RmrkProperty;152153                    // todo check if this is a rmrk collection? or simply trust and provide anyway?154                    // client-is-always-right / enforce authority and order ?155156                    let collection_id = CollectionId(collection_id);157                    let collection = <pallet_proxy_rmrk_core::Pallet<Runtime>>::get_nft_collection(collection_id)?;158                    // todo Vec::from(["rmrk:metadata", "rmrk:collection-type"])159                    let metadata = BoundedVec::try_from(160                        <pallet_proxy_rmrk_core::Pallet<Runtime>>::get_collection_property(collection_id, RmrkProperty::Metadata)?.into_inner()161                    ).map_err(|_| <pallet_common::Error<Runtime>>::PropertyKeyIsTooLong)?;//unwrap_or_default();162                    let nfts_count = (dispatch_unique_runtime!(collection_id.total_supply()) as Result<u32, DispatchError>)?; // todo? <Runtime>::total_supply(collection_id)163164                    Ok(Some(RmrkCollectionInfo {165                        issuer: collection.owner.clone(),166                        metadata,167                        max: collection.limits.token_limit,168                        symbol: BoundedVec::try_from(169                            collection.token_prefix.clone().into_inner()170                        ).map_err(|_| <pallet_common::Error<Runtime>>::PropertyKeyIsTooLong)?,171                        nfts_count172                    }))173                }174                fn nft_by_id(collection_id: RmrkCollectionId, nft_by_id: RmrkNftId) -> Result<Option<RmrkInstanceInfo<AccountId>>, DispatchError> {175                    use frame_support::BoundedVec;176                    use up_data_structs::mapping::TokenAddressMapping;177                    use pallet_proxy_rmrk_core::RmrkProperty;178179                    let collection_id = CollectionId(collection_id);180                    let nft_id = TokenId(nft_by_id);181182                    let owner = match (dispatch_unique_runtime!(collection_id.token_owner(nft_id)) as Result<Option<CrossAccountId>, DispatchError>)? {183                        Some(owner) => match <Runtime as pallet_common::Config>::CrossTokenAddressMapping::address_to_token(&owner) {184                            Some((col, tok)) => RmrkAccountIdOrCollectionNftTuple::CollectionAndNftTuple(col.0, tok.0),185                            None => RmrkAccountIdOrCollectionNftTuple::AccountId(owner.as_sub().clone())186                        },187                        None => return Ok(None)188                    };189190                    let keys = [191                        RmrkProperty::Royalty,192                        RmrkProperty::Metadata,193                        RmrkProperty::Equipped,194                        RmrkProperty::Pending,195                        // ?? "rmrk:recipient", "rmrk:nft-type", "rmrk:resource-collection", "rmrk:resource-priorities"196                    ];197198                    let properties = keys.into_iter().map(199                        |key| BoundedVec::try_from(200                            // todo nft property, not collection201                            <pallet_proxy_rmrk_core::Pallet<Runtime>>::get_nft_property(collection_id, nft_id, key).unwrap().into_inner()202                        ).unwrap()203                    )204                    .collect::<Vec<RmrkString>>();205206                    Ok(Some(RmrkInstanceInfo {207                        owner: owner,208                        //recipient: , // prop?209                        royalty: None,//Permill::from_percent(0), // prop, decode210                        metadata: properties[1].clone(),211                        equipped: false, // prop, decode212                        pending: false, // prop, decode213                    }))214                }215                fn account_tokens(account_id: AccountId, collection_id: RmrkCollectionId) -> Result<Vec<RmrkNftId>, DispatchError> {216                    let cross_account_id = CrossAccountId::from_sub(account_id);217                    let collection_id = CollectionId(collection_id);218                    Ok(219                        (dispatch_unique_runtime!(collection_id.account_tokens(cross_account_id)) as Result<Vec<TokenId>, DispatchError>)?220                        //<Runtime as up_rpc::UniqueApi<Block, CrossAccountId, AccountId>>::account_tokens(collection_id, cross_account_id)?221                            .into_iter()222                            .map(|token| token.0)223                            .collect::<Vec<_>>()224                    )225                }226                fn nft_children(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkNftChild>, DispatchError> {227                    use up_data_structs::mapping::TokenAddressMapping;228229                    let collection_id = CollectionId(collection_id);230                    let nft_id = TokenId(nft_id);231                    let cross_account_id = CrossAccountId::from_eth(232                        EvmTokenAddressMapping::token_to_address(collection_id, nft_id)233                    );234235                    Ok(236                        pallet_nonfungible::Owned::<Runtime>::iter_prefix((collection_id, cross_account_id))237                            .map(|(child_id, _)| RmrkNftChild {238                                collection_id: collection_id.0, // todo make sure they're always from this collection239                                nft_id: child_id.0,240                            })241                            .collect()242                    )243                }244                fn collection_properties(collection_id: RmrkCollectionId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {245                    use frame_support::BoundedVec;246247                    let collection_id = CollectionId(collection_id);248                    let properties = pallet_common::Pallet::<Runtime>::collection_properties(collection_id);249250                    return Ok(match filter_keys {251                        Some(keys) => {252                            let keys = pallet_common::Pallet::<Runtime>::bytes_keys_to_property_keys(keys)?;253                            let properties = keys254                                .into_iter()255                                .filter_map(|key| {256                                    properties.get(&key).map(|value| RmrkPropertyInfo {257                                        key: BoundedVec::try_from(key.into_inner()).unwrap(),258                                        value: BoundedVec::try_from(value.clone().into_inner()).unwrap(),259                                    })260                                })261                                .collect();262263                            properties264                        }265                        None => {266                            properties267                                .iter()268                                .filter_map(|(key, value)| Some(RmrkPropertyInfo {269                                    key: BoundedVec::try_from(key.clone().into_inner()).unwrap(),270                                    value: BoundedVec::try_from(value.clone().into_inner()).unwrap(),271                                }))272                                .collect()273                        }274                    });275                }276                fn nft_properties(collection_id: RmrkCollectionId, nft_id: RmrkNftId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {277                    use frame_support::BoundedVec;278279                    let collection_id = CollectionId(collection_id);280                    let token_id = TokenId(nft_id);281282		            let properties = pallet_nonfungible::Pallet::<Runtime>::token_properties((collection_id, token_id)); // todo look into usage of pallet_nonfungible283284                    // todo displace to a function? redundant code piece with collection props285                    return Ok(match filter_keys {286                        Some(keys) => {287                            let keys = pallet_common::Pallet::<Runtime>::bytes_keys_to_property_keys(keys)?;288                            let properties = keys289                                .into_iter()290                                .filter_map(|key| {291                                    properties.get(&key).map(|value| RmrkPropertyInfo {292                                        key: BoundedVec::try_from(key.into_inner()).unwrap(),293                                        value: BoundedVec::try_from(value.clone().into_inner()).unwrap(),294                                    })295                                })296                                .collect();297298                            properties299                        }300                        None => {301                            properties302                                .iter()303                                .filter_map(|(key, value)| Some(RmrkPropertyInfo {304                                    key: BoundedVec::try_from(key.clone().into_inner()).unwrap(),305                                    value: BoundedVec::try_from(value.clone().into_inner()).unwrap(),306                                }))307                                .collect()308                        }309                    });310                }311                fn nft_resources(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkResourceInfo>, DispatchError> {312                    use frame_support::BoundedVec;313                    use pallet_proxy_rmrk_core::RmrkProperty;314315                    let collection_id = CollectionId(collection_id);316                    let nft_id = TokenId(nft_id);317318                    let keys = [319                        RmrkProperty::Royalty,320                        RmrkProperty::Metadata,321                        RmrkProperty::Equipped,322                        RmrkProperty::Pending,323                        // ?? "rmrk:recipient", "rmrk:nft-type", "rmrk:resource-collection", "rmrk:resource-priorities"324                    ];325326                    /*let resources = keys.into_iter().map(327                        |key| BoundedVec::try_from(328                            <pallet_proxy_rmrk_core::Pallet<Runtime>>::get_nft_property(collection_id, nft_id, key).unwrap().into_inner()329                        ).unwrap()330                    )331                    .collect::<Vec<RmrkString>>();*/332333                    Ok(Vec::new(/*[RmrkResourceInfo {334335                    }]*/))336                }337                fn nft_resource_priorities(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkResourceId>, DispatchError> {338                    todo!()339                }340                fn base(base_id: RmrkBaseId) -> Result<Option<RmrkBaseInfo<AccountId>>, DispatchError> {341                    use frame_support::BoundedVec;342                    use scale_info::prelude::string::String;343                    use pallet_proxy_rmrk_core::RmrkProperty;344345                    let collection_id = CollectionId(base_id);346                    let collection = <pallet_proxy_rmrk_core::Pallet<Runtime>>::get_nft_collection(collection_id)?;347348                    // todo export to macro? redundancy349                    let keys = [350                        RmrkProperty::BaseType,351                    ];352353                    let properties = keys.into_iter().map(354                        |key| BoundedVec::try_from(355                            <pallet_proxy_rmrk_core::Pallet<Runtime>>::get_collection_property(collection_id, key).unwrap().into_inner()356                        )357                    )358                    // todo not-a-rmrk-collection error359                    .collect::<Result<Vec<_>, _>>()360                    .map_err(|_| <pallet_proxy_rmrk_core::Error<Runtime>>::CollectionUnknown)?;361362                    Ok(Some(RmrkBaseInfo {363                        issuer: collection.owner.clone(),364                        base_type: properties[0].clone(),365                        symbol: BoundedVec::try_from(366                            collection.token_prefix.clone().into_inner()367                        ).map_err(|_| <pallet_common::Error<Runtime>>::PropertyKeyIsTooLong)?,368                    }))369                }370                fn base_parts(base_id: RmrkBaseId) -> Result<Vec<RmrkPartType>, DispatchError> {371                    use frame_support::BoundedVec;372                    use pallet_proxy_rmrk_core::RmrkProperty;373374                    let collection_id = CollectionId(base_id);375376                    let keys = [377                        //RmrkProperty::NftType)?,378                        //RmrkProperty::PartId)?,379                        RmrkProperty::Src,380                        RmrkProperty::ZIndex,381                        RmrkProperty::EquippableList,382                    ];383384                    let parts = (dispatch_unique_runtime!(collection_id.collection_tokens()) as Result<Vec<TokenId>, DispatchError>)?385                        .iter()386                        .filter_map(|token_id| {387                            /*let properties = keys.into_iter().map(388                                |key| BoundedVec::try_from(389                                    <pallet_proxy_rmrk_core::Pallet<Runtime>>::get_nft_property(collection_id, *token_id, key).unwrap().into_inner()390                                ).unwrap()391                            ).collect::<Vec<RmrkString>>();*/392393                            // todo ping properties for "rmrk:nft-type"394                            // if none, skip, None395                            let nft_type = "fixed-part";396397                            match nft_type {398                                "fixed-part" => Some(RmrkPartType::FixedPart(RmrkFixedPart {399                                    id: token_id.0,400                                    src: BoundedVec::default(), // "rmrk:src"401                                    z: 0, // "rmrk:z-index"402                                })),403                                "slot-part" => Some(RmrkPartType::SlotPart(RmrkSlotPart {404                                    id: token_id.0,405                                    equippable: RmrkEquippableList::Empty, // "rmrk:equippable-list" ?406                                    src: BoundedVec::default(), // "rmrk:src"407                                    z: 0, // "rmrk:z-index"408                                })),409                                _ => None410                            }411412                        })413                        .collect();414415                    Ok(parts)416                }417                fn theme_names(base_id: RmrkBaseId) -> Result<Vec<RmrkThemeName>, DispatchError> {418                    use frame_support::BoundedVec;419420                    let collection_id = CollectionId(base_id);421422                    let theme_names = (dispatch_unique_runtime!(collection_id.collection_tokens()) as Result<Vec<TokenId>, DispatchError>)?423                        .iter()424                        .filter_map(|token_id| {425                            let properties = pallet_nonfungible::Pallet::<Runtime>::token_properties((collection_id, token_id));426427                            // todo ping property for "rmrk:nft-type"428                            // if none or not "theme", skip, None429                            let nft_type = "theme";430                            // can't call dispatch_unique_runtime! from here??431                            <pallet_nonfungible::TokenData<Runtime>>::get((collection_id, token_id))432                                .map(|t| t.const_data.into_inner())433                                //.unwrap_or_default()434                            // todo rework to reduce independence435                        })436                        .collect();437438                    Ok(theme_names)439                }440                fn theme(base_id: RmrkBaseId, theme_name: RmrkThemeName, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Option<RmrkTheme>, DispatchError> {441                    use frame_support::BoundedVec;442443                    let collection_id = CollectionId(base_id);444445                    // todo one theme. filter collection tokens according to theme name, should result in one446                    // (is it possible to search with iter_prefix for part of a struct that satisfies?..)447                    // filter properties according to filter_keys and load them into resulting theme.properties448                    let themes = (dispatch_unique_runtime!(collection_id.collection_tokens()) as Result<Vec<TokenId>, DispatchError>)?449                        .iter()450                        .filter_map(|token_id| {451                            let properties = pallet_nonfungible::Pallet::<Runtime>::token_properties((collection_id, token_id));452453                            // todo ping properties for "rmrk:nft-type"454                            // if none, skip, None455                            // ugh gonna go through ALL properties, searching for matches for "rmrk:theme-property-<key>"456                            let nft_type = "theme";457                            match nft_type {458                                "theme" => Some(RmrkTheme {459                                    name: BoundedVec::try_from(460                                        <pallet_nonfungible::TokenData<Runtime>>::get((collection_id, token_id))461                                            .map(|t| t.const_data)462                                            .unwrap_or_default()463                                            .into_inner()464                                    ).unwrap(),465                                    // todo? (dispatch_unique_runtime!(collection_id.const_metadata(token_id)) as Result<Vec<u8>, DispatchError>)?,466                                    properties: Vec::new(), // pain in the ass467                                    inherit: false, // "rmrk:theme-inherit"468                                }),469                                _ => None470                            }471                        })472                        .collect::<Vec<_>>();473474                    // todo475                    Ok(Some(themes[0].clone()))476                }477            }478479            impl sp_api::Core<Block> for Runtime {480                fn version() -> RuntimeVersion {481                    VERSION482                }483484                fn execute_block(block: Block) {485                    Executive::execute_block(block)486                }487488                fn initialize_block(header: &<Block as BlockT>::Header) {489                    Executive::initialize_block(header)490                }491            }492493            impl sp_api::Metadata<Block> for Runtime {494                fn metadata() -> OpaqueMetadata {495                    OpaqueMetadata::new(Runtime::metadata().into())496                }497            }498499            impl sp_block_builder::BlockBuilder<Block> for Runtime {500                fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {501                    Executive::apply_extrinsic(extrinsic)502                }503504                fn finalize_block() -> <Block as BlockT>::Header {505                    Executive::finalize_block()506                }507508                fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {509                    data.create_extrinsics()510                }511512                fn check_inherents(513                    block: Block,514                    data: sp_inherents::InherentData,515                ) -> sp_inherents::CheckInherentsResult {516                    data.check_extrinsics(&block)517                }518519                // fn random_seed() -> <Block as BlockT>::Hash {520                //     RandomnessCollectiveFlip::random_seed().0521                // }522            }523524            impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {525                fn validate_transaction(526                    source: TransactionSource,527                    tx: <Block as BlockT>::Extrinsic,528                    hash: <Block as BlockT>::Hash,529                ) -> TransactionValidity {530                    Executive::validate_transaction(source, tx, hash)531                }532            }533534            impl sp_offchain::OffchainWorkerApi<Block> for Runtime {535                fn offchain_worker(header: &<Block as BlockT>::Header) {536                    Executive::offchain_worker(header)537                }538            }539540            impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {541                fn chain_id() -> u64 {542                    <Runtime as pallet_evm::Config>::ChainId::get()543                }544545                fn account_basic(address: H160) -> EVMAccount {546                    EVM::account_basic(&address)547                }548549                fn gas_price() -> U256 {550                    <Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price()551                }552553                fn account_code_at(address: H160) -> Vec<u8> {554                    EVM::account_codes(address)555                }556557                fn author() -> H160 {558                    <pallet_evm::Pallet<Runtime>>::find_author()559                }560561                fn storage_at(address: H160, index: U256) -> H256 {562                    let mut tmp = [0u8; 32];563                    index.to_big_endian(&mut tmp);564                    EVM::account_storages(address, H256::from_slice(&tmp[..]))565                }566567                #[allow(clippy::redundant_closure)]568                fn call(569                    from: H160,570                    to: H160,571                    data: Vec<u8>,572                    value: U256,573                    gas_limit: U256,574                    max_fee_per_gas: Option<U256>,575                    max_priority_fee_per_gas: Option<U256>,576                    nonce: Option<U256>,577                    estimate: bool,578                    access_list: Option<Vec<(H160, Vec<H256>)>>,579                ) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {580                    let config = if estimate {581                        let mut config = <Runtime as pallet_evm::Config>::config().clone();582                        config.estimate = true;583                        Some(config)584                    } else {585                        None586                    };587588                    let is_transactional = false;589                    <Runtime as pallet_evm::Config>::Runner::call(590                        CrossAccountId::from_eth(from),591                        to,592                        data,593                        value,594                        gas_limit.low_u64(),595                        max_fee_per_gas,596                        max_priority_fee_per_gas,597                        nonce,598                        access_list.unwrap_or_default(),599                        is_transactional,600                        config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),601                    ).map_err(|err| err.into())602                }603604                #[allow(clippy::redundant_closure)]605                fn create(606                    from: H160,607                    data: Vec<u8>,608                    value: U256,609                    gas_limit: U256,610                    max_fee_per_gas: Option<U256>,611                    max_priority_fee_per_gas: Option<U256>,612                    nonce: Option<U256>,613                    estimate: bool,614                    access_list: Option<Vec<(H160, Vec<H256>)>>,615                ) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {616                    let config = if estimate {617                        let mut config = <Runtime as pallet_evm::Config>::config().clone();618                        config.estimate = true;619                        Some(config)620                    } else {621                        None622                    };623624                    let is_transactional = false;625                    <Runtime as pallet_evm::Config>::Runner::create(626                        CrossAccountId::from_eth(from),627                        data,628                        value,629                        gas_limit.low_u64(),630                        max_fee_per_gas,631                        max_priority_fee_per_gas,632                        nonce,633                        access_list.unwrap_or_default(),634                        is_transactional,635                        config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),636                    ).map_err(|err| err.into())637                }638639                fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {640                    Ethereum::current_transaction_statuses()641                }642643                fn current_block() -> Option<pallet_ethereum::Block> {644                    Ethereum::current_block()645                }646647                fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {648                    Ethereum::current_receipts()649                }650651                fn current_all() -> (652                    Option<pallet_ethereum::Block>,653                    Option<Vec<pallet_ethereum::Receipt>>,654                    Option<Vec<TransactionStatus>>655                ) {656                    (657                        Ethereum::current_block(),658                        Ethereum::current_receipts(),659                        Ethereum::current_transaction_statuses()660                    )661                }662663                fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {664                    xts.into_iter().filter_map(|xt| match xt.0.function {665                        Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),666                        _ => None667                    }).collect()668                }669670                fn elasticity() -> Option<Permill> {671                    None672                }673            }674675            impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {676                fn convert_transaction(transaction: pallet_ethereum::Transaction) -> <Block as BlockT>::Extrinsic  {677                    UncheckedExtrinsic::new_unsigned(678                        pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),679                    )680                }681            }682683            impl sp_session::SessionKeys<Block> for Runtime {684                fn decode_session_keys(685                    encoded: Vec<u8>,686                ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {687                    SessionKeys::decode_into_raw_public_keys(&encoded)688                }689690                fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {691                    SessionKeys::generate(seed)692                }693            }694695            impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {696                fn slot_duration() -> sp_consensus_aura::SlotDuration {697                    sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())698                }699700                fn authorities() -> Vec<AuraId> {701                    Aura::authorities().to_vec()702                }703            }704705            impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {706                fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {707                    ParachainSystem::collect_collation_info(header)708                }709            }710711            impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {712                fn account_nonce(account: AccountId) -> Index {713                    System::account_nonce(account)714                }715            }716717            impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {718                fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {719                    TransactionPayment::query_info(uxt, len)720                }721                fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {722                    TransactionPayment::query_fee_details(uxt, len)723                }724            }725726            /*727            impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>728                for Runtime729            {730                fn call(731                    origin: AccountId,732                    dest: AccountId,733                    value: Balance,734                    gas_limit: u64,735                    input_data: Vec<u8>,736                ) -> pallet_contracts_primitives::ContractExecResult {737                    Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)738                }739740                fn instantiate(741                    origin: AccountId,742                    endowment: Balance,743                    gas_limit: u64,744                    code: pallet_contracts_primitives::Code<Hash>,745                    data: Vec<u8>,746                    salt: Vec<u8>,747                ) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>748                {749                    Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)750                }751752                fn get_storage(753                    address: AccountId,754                    key: [u8; 32],755                ) -> pallet_contracts_primitives::GetStorageResult {756                    Contracts::get_storage(address, key)757                }758759                fn rent_projection(760                    address: AccountId,761                ) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {762                    Contracts::rent_projection(address)763                }764            }765            */766767            #[cfg(feature = "runtime-benchmarks")]768            impl frame_benchmarking::Benchmark<Block> for Runtime {769                fn benchmark_metadata(extra: bool) -> (770                    Vec<frame_benchmarking::BenchmarkList>,771                    Vec<frame_support::traits::StorageInfo>,772                ) {773                    use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};774                    use frame_support::traits::StorageInfoTrait;775776                    let mut list = Vec::<BenchmarkList>::new();777778                    list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);779                    list_benchmark!(list, extra, pallet_common, Common);780                    list_benchmark!(list, extra, pallet_unique, Unique);781                    list_benchmark!(list, extra, pallet_structure, Structure);782                    list_benchmark!(list, extra, pallet_inflation, Inflation);783                    list_benchmark!(list, extra, pallet_fungible, Fungible);784                    list_benchmark!(list, extra, pallet_refungible, Refungible);785                    list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);786                    // list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);787788                    let storage_info = AllPalletsReversedWithSystemFirst::storage_info();789790                    return (list, storage_info)791                }792793                fn dispatch_benchmark(794                    config: frame_benchmarking::BenchmarkConfig795                ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {796                    use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};797798                    let allowlist: Vec<TrackedStorageKey> = vec![799                        // Block Number800                        hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),801                        // Total Issuance802                        hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),803                        // Execution Phase804                        hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),805                        // Event Count806                        hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),807                        // System Events808                        hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),809810                        // Transactional depth811                        hex_literal::hex!("3a7472616e73616374696f6e5f6c6576656c3a").to_vec().into(),812                    ];813814                    let mut batches = Vec::<BenchmarkBatch>::new();815                    let params = (&config, &allowlist);816817                    add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);818                    add_benchmark!(params, batches, pallet_common, Common);819                    add_benchmark!(params, batches, pallet_unique, Unique);820                    add_benchmark!(params, batches, pallet_structure, Structure);821                    add_benchmark!(params, batches, pallet_inflation, Inflation);822                    add_benchmark!(params, batches, pallet_fungible, Fungible);823                    add_benchmark!(params, batches, pallet_refungible, Refungible);824                    add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);825                    // add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);826827                    if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }828                    Ok(batches)829                }830            }831832            #[cfg(feature = "try-runtime")]833            impl frame_try_runtime::TryRuntime<Block> for Runtime {834                fn on_runtime_upgrade() -> (Weight, Weight) {835                    log::info!("try-runtime::on_runtime_upgrade unique-chain.");836                    let weight = Executive::try_runtime_upgrade().unwrap();837                    (weight, RuntimeBlockWeights::get().max_block)838                }839840                fn execute_block_no_check(block: Block) -> Weight {841                    Executive::execute_block_no_check(block)842                }843            }844        }845    }846}
modifiedruntime/common/src/sponsoring.rsdiffbeforeafterboth
--- a/runtime/common/src/sponsoring.rs
+++ b/runtime/common/src/sponsoring.rs
@@ -29,8 +29,8 @@
 use pallet_evm::account::CrossAccountId;
 use pallet_unique::{
 	Call as UniqueCall, Config as UniqueConfig, FungibleApproveBasket, RefungibleApproveBasket,
-	NftApproveBasket, CreateItemBasket, ReFungibleTransferBasket,
-	FungibleTransferBasket, NftTransferBasket, TokenPropertyBasket,
+	NftApproveBasket, CreateItemBasket, ReFungibleTransferBasket, FungibleTransferBasket,
+	NftTransferBasket, TokenPropertyBasket,
 };
 use pallet_fungible::Config as FungibleConfig;
 use pallet_nonfungible::Config as NonfungibleConfig;
@@ -247,7 +247,7 @@
 					&T::CrossAccountId::from_sub(who.clone()),
 					&token_id,
 					// No overflow may happen, as data larger than usize can't reach here
-					properties.iter().map(|p| p.key.len() + p.value.len()).sum()
+					properties.iter().map(|p| p.key.len() + p.value.len()).sum(),
 				)
 				.map(|()| sponsor)
 			}
modifiedruntime/common/src/weights.rsdiffbeforeafterboth
--- a/runtime/common/src/weights.rs
+++ b/runtime/common/src/weights.rs
@@ -21,7 +21,7 @@
 use pallet_fungible::{Config as FungibleConfig, common::CommonWeights as FungibleWeights};
 use pallet_nonfungible::{Config as NonfungibleConfig, common::CommonWeights as NonfungibleWeights};
 use pallet_refungible::{Config as RefungibleConfig, common::CommonWeights as RefungibleWeights};
-use up_data_structs::CreateItemExData;
+use up_data_structs::{CreateItemExData, CreateItemData};
 
 macro_rules! max_weight_of {
 	($method:ident ( $($args:tt)* )) => {
@@ -42,8 +42,8 @@
 		dispatch_weight::<T>() + max_weight_of!(create_item())
 	}
 
-	fn create_multiple_items(amount: u32) -> Weight {
-		dispatch_weight::<T>() + max_weight_of!(create_multiple_items(amount))
+	fn create_multiple_items(data: &[CreateItemData]) -> Weight {
+		dispatch_weight::<T>() + max_weight_of!(create_multiple_items(data))
 	}
 
 	fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -875,6 +875,7 @@
 }
 
 impl pallet_common::Config for Runtime {
+	type WeightInfo = pallet_common::weights::SubstrateWeight<Self>;
 	type Event = Event;
 	type Currency = Balances;
 	type CollectionCreationPrice = CollectionCreationPrice;
modifiedruntime/tests/src/lib.rsdiffbeforeafterboth
--- a/runtime/tests/src/lib.rs
+++ b/runtime/tests/src/lib.rs
@@ -212,6 +212,7 @@
 }
 
 impl pallet_common::Config for Test {
+	type WeightInfo = ();
 	type Event = ();
 	type Currency = Balances;
 	type CollectionCreationPrice = CollectionCreationPrice;
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -39,6 +39,7 @@
     'pallet-xcm/runtime-benchmarks',
     'sp-runtime/runtime-benchmarks',
     'xcm-builder/runtime-benchmarks',
+    'up-data-structs/runtime-benchmarks',
 ]
 try-runtime = [
     'frame-try-runtime',
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -66,7 +66,12 @@
 		WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, ConstantMultiplier,
 	},
 };
-use unique_runtime_common::dispatch::{CollectionDispatchT, CollectionDispatch};
+use unique_runtime_common::{
+	dispatch::{CollectionDispatchT, CollectionDispatch},
+	weights::CommonWeights,
+	sponsoring::UniqueSponsorshipHandler,
+	eth_sponsoring::UniqueEthSponsorshipHandler,
+};
 use up_data_structs::*;
 // use pallet_contracts::weights::WeightInfo;
 // #[cfg(any(feature = "std", test))]
@@ -846,6 +851,7 @@
 }
 
 impl pallet_common::Config for Runtime {
+	type WeightInfo = pallet_common::weights::SubstrateWeight<Self>;
 	type Event = Event;
 	type Currency = Balances;
 	type CollectionCreationPrice = CollectionCreationPrice;
@@ -881,6 +887,7 @@
 impl pallet_unique::Config for Runtime {
 	type Event = Event;
 	type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;
+	type CommonWeightInfo = CommonWeights<Self>;
 }
 
 parameter_types! {
@@ -902,11 +909,11 @@
 // }
 
 type EvmSponsorshipHandler = (
-	pallet_unique::UniqueEthSponsorshipHandler<Runtime>,
+	UniqueEthSponsorshipHandler<Runtime>,
 	pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,
 );
 type SponsorshipHandler = (
-	pallet_unique::UniqueSponsorshipHandler<Runtime>,
+	UniqueSponsorshipHandler<Runtime>,
 	//pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,
 	pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,
 );