git.delta.rocks / unique-network / refs/commits / b8e70f32f7e0

difftreelog

Item size weight added

str-mv2020-10-27parent: #2f8a220.patch.diff
in: master

2 files changed

modifiedpallets/nft/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/nft/src/benchmarking.rs
+++ b/pallets/nft/src/benchmarking.rs
@@ -142,7 +142,22 @@
             let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
             Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
 
-        }: create_item(RawOrigin::Signed(caller.clone()), 2, [1, 2, 3].to_vec(), caller.clone())
+        }: create_item(RawOrigin::Signed(caller.clone()), 2, [1,2,3].to_vec(), caller.clone())
+
+        #[extra]
+        create_item_nft_large {
+            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
+            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
+            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
+            let mode: CollectionMode = CollectionMode::NFT(2000);
+            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
+            let mut item_large: Vec<u8> = Vec::new(); 
+            for i in 0..1998 {
+                item_large.push(10);
+            }
+            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
+
+        }: create_item(RawOrigin::Signed(caller.clone()), 2, item_large, caller.clone())
 
         // fungible item
         create_item_fungible {
modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
785 /// * owner: Address, initial owner of the NFT.785 /// * owner: Address, initial owner of the NFT.
786 #[weight =786 #[weight =
787 (130_000_000 as Weight)787 (130_000_000 as Weight)
788 .saturating_add((2135 as Weight).saturating_mul((properties.len() as u64) as Weight))
788 .saturating_add(RocksDbWeight::get().reads(10 as Weight))789 .saturating_add(RocksDbWeight::get().reads(10 as Weight))
789 .saturating_add(RocksDbWeight::get().writes(8 as Weight))]790 .saturating_add(RocksDbWeight::get().writes(8 as Weight))]
790 pub fn create_item(origin, collection_id: u64, properties: Vec<u8>, owner: T::AccountId) -> DispatchResult {791 pub fn create_item(origin, collection_id: u64, properties: Vec<u8>, owner: T::AccountId) -> DispatchResult {