difftreelog
Item size weight added
in: master
2 files changed
pallets/nft/src/benchmarking.rsdiffbeforeafterboth144144145 }: create_item(RawOrigin::Signed(caller.clone()), 2, [1, 2, 3].to_vec(), caller.clone())145 }: create_item(RawOrigin::Signed(caller.clone()), 2, [1,2,3].to_vec(), caller.clone())146147 #[extra]148 create_item_nft_large {149 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();150 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();151 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();152 let mode: CollectionMode = CollectionMode::NFT(2000);153 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());154 let mut item_large: Vec<u8> = Vec::new(); 155 for i in 0..1998 {156 item_large.push(10);157 }158 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;159160 }: create_item(RawOrigin::Signed(caller.clone()), 2, item_large, caller.clone())146161147 // fungible item162 // fungible item148 create_item_fungible {163 create_item_fungible {pallets/nft/src/lib.rsdiffbeforeafterboth--- a/pallets/nft/src/lib.rs
+++ b/pallets/nft/src/lib.rs
@@ -785,6 +785,7 @@
/// * owner: Address, initial owner of the NFT.
#[weight =
(130_000_000 as Weight)
+ .saturating_add((2135 as Weight).saturating_mul((properties.len() as u64) as Weight))
.saturating_add(RocksDbWeight::get().reads(10 as Weight))
.saturating_add(RocksDbWeight::get().writes(8 as Weight))]
pub fn create_item(origin, collection_id: u64, properties: Vec<u8>, owner: T::AccountId) -> DispatchResult {