--- a/pallets/nft/src/benchmarking.rs +++ b/pallets/nft/src/benchmarking.rs @@ -7,35 +7,10 @@ use nft_data_structs::*; use core::convert::TryInto; use sp_runtime::DispatchError; +use pallet_common::benchmarking::{create_data, create_u16_data}; const SEED: u32 = 1; - -fn create_data(size: usize) -> Vec { - (0..size).map(|v| (v & 0xff) as u8).collect() -} -fn create_u16_data(size: usize) -> Vec { - (0..size).map(|v| (v & 0xffff) as u16).collect() -} - -fn default_nft_data() -> CreateItemData { - CreateItemData::NFT(CreateNftData { - const_data: create_data(CUSTOM_DATA_LIMIT as usize).try_into().unwrap(), - variable_data: create_data(CUSTOM_DATA_LIMIT as usize).try_into().unwrap(), - }) -} -fn default_fungible_data() -> CreateItemData { - CreateItemData::Fungible(CreateFungibleData { value: 1000 }) -} - -fn default_re_fungible_data() -> CreateItemData { - CreateItemData::ReFungible(CreateReFungibleData { - const_data: create_data(CUSTOM_DATA_LIMIT as usize).try_into().unwrap(), - variable_data: create_data(CUSTOM_DATA_LIMIT as usize).try_into().unwrap(), - pieces: 1000, - }) -} - fn create_collection_helper( owner: T::AccountId, mode: CollectionMode, @@ -55,20 +30,10 @@ token_prefix, mode, )?; - Ok(CreatedCollectionCount::get()) + Ok(>::get()) } fn create_nft_collection(owner: T::AccountId) -> Result { create_collection_helper::(owner, CollectionMode::NFT) -} -fn create_fungible_collection( - owner: T::AccountId, -) -> Result { - create_collection_helper::(owner, CollectionMode::Fungible(0)) -} -fn create_refungible_collection( - owner: T::AccountId, -) -> Result { - create_collection_helper::(owner, CollectionMode::ReFungible) } benchmarks! { @@ -82,7 +47,7 @@ T::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get()); }: _(RawOrigin::Signed(caller.clone()), col_name.clone(), col_desc.clone(), token_prefix.clone(), mode) verify { - assert_eq!(>::collection_id(2).unwrap().owner, caller); + assert_eq!(>::get(CollectionId(1)).unwrap().owner, caller); } destroy_collection { @@ -129,7 +94,7 @@ let caller: T::AccountId = account("caller", 0, SEED); let collection = create_nft_collection::(caller.clone())?; let new_admin: T::AccountId = account("admin", 0, SEED); - >::add_collection_admin(RawOrigin::Signed(caller.clone()).into(), 2, T::CrossAccountId::from_sub(new_admin.clone()))?; + >::add_collection_admin(RawOrigin::Signed(caller.clone()).into(), collection, T::CrossAccountId::from_sub(new_admin.clone()))?; }: _(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(new_admin)) set_collection_sponsor { @@ -140,152 +105,21 @@ confirm_sponsorship { let caller: T::AccountId = account("caller", 0, SEED); let collection = create_nft_collection::(caller.clone())?; - >::set_collection_sponsor(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone())?; + >::set_collection_sponsor(RawOrigin::Signed(caller.clone()).into(), collection, caller.clone())?; }: _(RawOrigin::Signed(caller.clone()), collection) remove_collection_sponsor { let caller: T::AccountId = account("caller", 0, SEED); let collection = create_nft_collection::(caller.clone())?; - >::set_collection_sponsor(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone())?; - >::confirm_sponsorship(RawOrigin::Signed(caller.clone()).into(), 2)?; + >::set_collection_sponsor(RawOrigin::Signed(caller.clone()).into(), collection, caller.clone())?; + >::confirm_sponsorship(RawOrigin::Signed(caller.clone()).into(), collection)?; }: _(RawOrigin::Signed(caller.clone()), collection) - - // nft item - create_item_nft { - let b in 0..(CUSTOM_DATA_LIMIT * 2); - - let caller: T::AccountId = account("caller", 0, SEED); - let collection = create_nft_collection::(caller.clone())?; - let data = CreateItemData::NFT(CreateNftData { - const_data: create_data(b.min(CUSTOM_DATA_LIMIT) as usize).try_into().unwrap(), - variable_data: create_data(b.saturating_sub(CUSTOM_DATA_LIMIT) as usize).try_into().unwrap(), - }); - }: create_item(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data) - - create_multiple_items_nft { - // TODO: Take item data size into account. As create_item_nft bench shows, this parameter has no effect on execution time, - // but it may if we increase CUSTOM_DATA_LIMIT - let b in 1..1000; - - let caller: T::AccountId = account("caller", 0, SEED); - let collection = create_nft_collection::(caller.clone())?; - let data = (0..b).map(|_| default_nft_data()).collect(); - }: create_multiple_items(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data) - // fungible item - create_item_fungible { - let caller: T::AccountId = account("caller", 0, SEED); - let collection = create_fungible_collection::(caller.clone())?; - let data = CreateItemData::Fungible(CreateFungibleData { - value: 1000, - }); - }: create_item(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data) - - create_multiple_items_fungible { - let b in 1..1000; - - let caller: T::AccountId = account("caller", 0, SEED); - let collection = create_fungible_collection::(caller.clone())?; - let data = (0..b).map(|_| default_fungible_data()).collect(); - }: create_multiple_items(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data) - - // refungible item - create_item_refungible { - let b in 0..(CUSTOM_DATA_LIMIT * 2); - - let caller: T::AccountId = account("caller", 0, SEED); - let collection = create_refungible_collection::(caller.clone())?; - let data = CreateItemData::ReFungible(CreateReFungibleData { - const_data: create_data(b.min(CUSTOM_DATA_LIMIT) as usize).try_into().unwrap(), - variable_data: create_data(b.saturating_sub(CUSTOM_DATA_LIMIT) as usize).try_into().unwrap(), - pieces: 1000, - }); - }: create_item(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data) - - create_multiple_items_refungible { - // TODO: Take item data size into account. As create_item_nft bench shows, this parameter has no effect on execution time, - // but it may if we increase CUSTOM_DATA_LIMIT - let b in 1..1000; - - let caller: T::AccountId = account("caller", 0, SEED); - let collection = create_refungible_collection::(caller.clone())?; - let data = (0..b).map(|_| default_re_fungible_data()).collect(); - }: create_multiple_items(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data) - - burn_item_nft { - let caller: T::AccountId = account("caller", 0, SEED); - let collection = create_nft_collection::(caller.clone())?; - let data = default_nft_data(); - >::create_item(RawOrigin::Signed(caller.clone()).into(), collection, T::CrossAccountId::from_sub(caller.clone()), data)?; - }: burn_item(RawOrigin::Signed(caller.clone()), collection, 1, 1) - - transfer_nft { - let caller: T::AccountId = account("caller", 0, SEED); - let collection = create_nft_collection::(caller.clone())?; - let recipient: T::AccountId = account("recipient", 0, SEED); - let data = default_nft_data(); - >::create_item(RawOrigin::Signed(caller.clone()).into(), collection, T::CrossAccountId::from_sub(caller.clone()), data)?; - }: transfer(RawOrigin::Signed(caller.clone()), T::CrossAccountId::from_sub(recipient.clone()), collection, 1, 1) - - transfer_fungible { - let caller: T::AccountId = account("caller", 0, SEED); - let collection = create_fungible_collection::(caller.clone())?; - let recipient: T::AccountId = account("recipient", 0, SEED); - let data = default_fungible_data(); - >::create_item(RawOrigin::Signed(caller.clone()).into(), collection, T::CrossAccountId::from_sub(caller.clone()), data)?; - }: transfer(RawOrigin::Signed(caller.clone()), T::CrossAccountId::from_sub(recipient.clone()), collection, 1, 1) - - transfer_refungible { - let caller: T::AccountId = account("caller", 0, SEED); - let collection = create_refungible_collection::(caller.clone())?; - let recipient: T::AccountId = account("recipient", 0, SEED); - let data = default_re_fungible_data(); - >::create_item(RawOrigin::Signed(caller.clone()).into(), collection, T::CrossAccountId::from_sub(caller.clone()), data)?; - }: transfer(RawOrigin::Signed(caller.clone()), T::CrossAccountId::from_sub(recipient.clone()), collection, 1, 1) - set_transfers_enabled_flag { let caller: T::AccountId = account("caller", 0, SEED); let collection = create_nft_collection::(caller.clone())?; }: _(RawOrigin::Signed(caller.clone()), collection, false) - - approve_nft { - let caller: T::AccountId = account("caller", 0, SEED); - let collection = create_nft_collection::(caller.clone())?; - let recipient: T::AccountId = account("recipient", 0, SEED); - let data = default_nft_data(); - >::create_item(RawOrigin::Signed(caller.clone()).into(), 2, T::CrossAccountId::from_sub(caller.clone()), data)?; - }: approve(RawOrigin::Signed(caller.clone()), T::CrossAccountId::from_sub(recipient.clone()), collection, 1, 1) - // Nft - transfer_from_nft { - let caller: T::AccountId = account("caller", 0, SEED); - let collection = create_nft_collection::(caller.clone())?; - let recipient: T::AccountId = account("recipient", 0, SEED); - let data = default_nft_data(); - >::create_item(RawOrigin::Signed(caller.clone()).into(), 2, T::CrossAccountId::from_sub(caller.clone()), data)?; - >::approve(RawOrigin::Signed(caller.clone()).into(), T::CrossAccountId::from_sub(recipient.clone()), 2, 1, 1)?; - }: transfer_from(RawOrigin::Signed(caller.clone()), T::CrossAccountId::from_sub(caller.clone()), T::CrossAccountId::from_sub(recipient.clone()), 2, 1, 1) - - // Fungible - transfer_from_fungible { - let caller: T::AccountId = account("caller", 0, SEED); - let collection = create_fungible_collection::(caller.clone())?; - let recipient: T::AccountId = account("recipient", 0, SEED); - let data = default_fungible_data(); - >::create_item(RawOrigin::Signed(caller.clone()).into(), 2, T::CrossAccountId::from_sub(caller.clone()), data)?; - >::approve(RawOrigin::Signed(caller.clone()).into(), T::CrossAccountId::from_sub(recipient.clone()), 2, 1, 1)?; - }: transfer_from(RawOrigin::Signed(caller.clone()), T::CrossAccountId::from_sub(caller.clone()), T::CrossAccountId::from_sub(recipient.clone()), 2, 1, 1) - - // ReFungible - transfer_from_refungible { - let caller: T::AccountId = account("caller", 0, SEED); - let collection = create_refungible_collection::(caller.clone())?; - let recipient: T::AccountId = account("recipient", 0, SEED); - let data = default_re_fungible_data(); - >::create_item(RawOrigin::Signed(caller.clone()).into(), 2, T::CrossAccountId::from_sub(caller.clone()), data)?; - >::approve(RawOrigin::Signed(caller.clone()).into(), T::CrossAccountId::from_sub(recipient.clone()), 2, 1, 1)?; - }: transfer_from(RawOrigin::Signed(caller.clone()), T::CrossAccountId::from_sub(caller.clone()), T::CrossAccountId::from_sub(recipient.clone()), 2, 1, 1) - set_offchain_schema { let b in 0..OFFCHAIN_SCHEMA_LIMIT; @@ -308,29 +142,19 @@ let caller: T::AccountId = account("caller", 0, SEED); let collection = create_nft_collection::(caller.clone())?; let data = create_data(b as usize); - }: set_variable_on_chain_schema(RawOrigin::Signed(caller.clone()), 2, data) - - set_variable_meta_data_nft { - let b in 0..CUSTOM_DATA_LIMIT; - - let caller: T::AccountId = account("caller", 0, SEED); - let collection = create_nft_collection::(caller.clone())?; - let data = default_nft_data(); - >::create_item(RawOrigin::Signed(caller.clone()).into(), 2, T::CrossAccountId::from_sub(caller.clone()), data)?; - let data = create_data(b as usize); - }: set_variable_meta_data(RawOrigin::Signed(caller.clone()), collection, 1, data) + }: set_variable_on_chain_schema(RawOrigin::Signed(caller.clone()), collection, data) set_schema_version { let caller: T::AccountId = account("caller", 0, SEED); let collection = create_nft_collection::(caller.clone())?; - }: set_schema_version(RawOrigin::Signed(caller.clone()), 2, SchemaVersion::Unique) + }: set_schema_version(RawOrigin::Signed(caller.clone()), collection, SchemaVersion::Unique) set_collection_limits{ let caller: T::AccountId = account("caller", 0, SEED); let collection = create_nft_collection::(caller.clone())?; let cl = CollectionLimits { - account_token_ownership_limit: 0, + account_token_ownership_limit: Some(0), sponsored_data_size: 0, token_limit: 1, sponsor_transfer_timeout: 0, @@ -338,5 +162,10 @@ owner_can_transfer: true, sponsored_data_rate_limit: None, }; - }: set_collection_limits(RawOrigin::Signed(caller.clone()), 2, cl) + }: set_collection_limits(RawOrigin::Signed(caller.clone()), collection, cl) + + set_meta_update_permission_flag { + let caller: T::AccountId = account("caller", 0, SEED); + let collection = create_nft_collection::(caller.clone())?; + }: _(RawOrigin::Signed(caller.clone()), collection, MetaUpdatePermission::Admin) } --- a/pallets/nft/src/lib.rs +++ b/pallets/nft/src/lib.rs @@ -100,38 +100,6 @@ type SelfWeightOf = ::WeightInfo; -trait WeightInfoHelpers: WeightInfo { - fn transfer() -> Weight { - Self::transfer_nft() - .max(Self::transfer_fungible()) - .max(Self::transfer_refungible()) - } - fn transfer_from() -> Weight { - Self::transfer_from_nft() - .max(Self::transfer_from_fungible()) - .max(Self::transfer_from_refungible()) - } - fn approve() -> Weight { - // TODO: refungible, fungible - Self::approve_nft() - } - fn set_variable_meta_data(data: u32) -> Weight { - // TODO: refungible - Self::set_variable_meta_data_nft(data) - } - fn create_item(data: u32) -> Weight { - Self::create_item_nft(data) - .max(Self::create_item_fungible()) - .max(Self::create_item_refungible(data)) - } - fn create_multiple_items(amount: u32) -> Weight { - Self::create_multiple_items_nft(amount) - .max(Self::create_multiple_items_fungible(amount)) - .max(Self::create_multiple_items_refungible(amount)) - } -} -impl WeightInfoHelpers for T {} - // # Used definitions // // ## User control levels @@ -754,7 +722,7 @@ /// * collection_id: ID of the collection. /// /// * value: New flag value. - #[weight = >::set_variable_meta_data(0)] + #[weight = >::set_meta_update_permission_flag()] #[transactional] pub fn set_meta_update_permission_flag(origin, collection_id: CollectionId, value: MetaUpdatePermission) -> DispatchResult { let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?); --- a/pallets/nft/src/weights.rs +++ b/pallets/nft/src/weights.rs @@ -2,8 +2,8 @@ //! Autogenerated weights for pallet_nft //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-08-31, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-10-21, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 128 // Executed Command: @@ -43,202 +43,141 @@ fn set_collection_sponsor() -> Weight; fn confirm_sponsorship() -> Weight; fn remove_collection_sponsor() -> Weight; - fn create_item_nft(b: u32, ) -> Weight; - fn create_multiple_items_nft(b: u32, ) -> Weight; - fn create_item_fungible() -> Weight; - fn create_multiple_items_fungible(b: u32, ) -> Weight; - fn create_item_refungible(b: u32, ) -> Weight; - fn create_multiple_items_refungible(b: u32, ) -> Weight; - fn burn_item_nft() -> Weight; - fn transfer_nft() -> Weight; - fn transfer_fungible() -> Weight; - fn transfer_refungible() -> Weight; fn set_transfers_enabled_flag() -> Weight; - fn approve_nft() -> Weight; - fn transfer_from_nft() -> Weight; - fn transfer_from_fungible() -> Weight; - fn transfer_from_refungible() -> Weight; fn set_offchain_schema(b: u32, ) -> Weight; fn set_const_on_chain_schema(b: u32, ) -> Weight; fn set_variable_on_chain_schema(b: u32, ) -> Weight; - fn set_variable_meta_data_nft(b: u32, ) -> Weight; fn set_schema_version() -> Weight; fn set_collection_limits() -> Weight; + fn set_meta_update_permission_flag() -> Weight; } /// Weights for pallet_nft using the Substrate node and recommended hardware. pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { + // Storage: Common CreatedCollectionCount (r:1 w:1) + // Storage: Common DestroyedCollectionCount (r:1 w:0) + // Storage: System Account (r:2 w:2) + // Storage: Common CollectionById (r:0 w:1) fn create_collection() -> Weight { - (25_851_000 as Weight) - .saturating_add(T::DbWeight::get().reads(8 as Weight)) - .saturating_add(T::DbWeight::get().writes(6 as Weight)) + (23_803_000 as Weight) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) } + // Storage: Common CollectionById (r:1 w:1) + // Storage: Common DestroyedCollectionCount (r:1 w:1) + // Storage: Nonfungible TokensMinted (r:0 w:1) + // Storage: Nonfungible TokensBurnt (r:0 w:1) fn destroy_collection() -> Weight { - (28_737_000 as Weight) + (27_831_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } + // Storage: Common CollectionById (r:1 w:0) + // Storage: Common Allowlist (r:0 w:1) fn add_to_white_list() -> Weight { - (6_237_000 as Weight) + (6_629_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } + // Storage: Common CollectionById (r:1 w:0) + // Storage: Common Allowlist (r:0 w:1) fn remove_from_white_list() -> Weight { - (6_252_000 as Weight) + (6_596_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } + // Storage: Common CollectionById (r:1 w:1) fn set_public_access_mode() -> Weight { - (6_691_000 as Weight) + (6_338_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } + // Storage: Common CollectionById (r:1 w:1) fn set_mint_permission() -> Weight { - (6_630_000 as Weight) + (6_383_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } + // Storage: Common CollectionById (r:1 w:1) fn change_collection_owner() -> Weight { - (6_521_000 as Weight) + (6_493_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } + // Storage: Common CollectionById (r:1 w:0) + // Storage: Common IsAdmin (r:0 w:1) fn add_collection_admin() -> Weight { - (8_057_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) + (6_850_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } + // Storage: Common CollectionById (r:1 w:0) + // Storage: Common IsAdmin (r:0 w:1) fn remove_collection_admin() -> Weight { - (8_307_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) + (6_615_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } + // Storage: Common CollectionById (r:1 w:1) fn set_collection_sponsor() -> Weight { - (6_484_000 as Weight) + (6_430_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } + // Storage: Common CollectionById (r:1 w:1) fn confirm_sponsorship() -> Weight { - (6_530_000 as Weight) + (6_125_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } + // Storage: Common CollectionById (r:1 w:1) fn remove_collection_sponsor() -> Weight { - (6_733_000 as Weight) + (6_236_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } - fn create_item_nft(_b: u32, ) -> Weight { - (167_909_000 as Weight) - .saturating_add(T::DbWeight::get().reads(11 as Weight)) - .saturating_add(T::DbWeight::get().writes(8 as Weight)) - } - fn create_multiple_items_nft(b: u32, ) -> Weight { - (336_830_000 as Weight) - // Standard Error: 42_000 - .saturating_add((11_627_000 as Weight).saturating_mul(b as Weight)) - .saturating_add(T::DbWeight::get().reads(11 as Weight)) - .saturating_add(T::DbWeight::get().writes(7 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(b as Weight))) - } - fn create_item_fungible() -> Weight { - (24_123_000 as Weight) - .saturating_add(T::DbWeight::get().reads(9 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) - } - fn create_multiple_items_fungible(b: u32, ) -> Weight { - (48_227_000 as Weight) - // Standard Error: 13_000 - .saturating_add((2_918_000 as Weight).saturating_mul(b as Weight)) - .saturating_add(T::DbWeight::get().reads(9 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) - } - fn create_item_refungible(_b: u32, ) -> Weight { - (26_293_000 as Weight) - .saturating_add(T::DbWeight::get().reads(9 as Weight)) - .saturating_add(T::DbWeight::get().writes(7 as Weight)) - } - fn create_multiple_items_refungible(b: u32, ) -> Weight { - (0 as Weight) - // Standard Error: 16_000 - .saturating_add((8_374_000 as Weight).saturating_mul(b as Weight)) - .saturating_add(T::DbWeight::get().reads(9 as Weight)) - .saturating_add(T::DbWeight::get().writes(6 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(b as Weight))) - } - fn burn_item_nft() -> Weight { - (32_237_000 as Weight) - .saturating_add(T::DbWeight::get().reads(9 as Weight)) - .saturating_add(T::DbWeight::get().writes(7 as Weight)) - } - fn transfer_nft() -> Weight { - (192_578_000 as Weight) - .saturating_add(T::DbWeight::get().reads(14 as Weight)) - .saturating_add(T::DbWeight::get().writes(10 as Weight)) - } - fn transfer_fungible() -> Weight { - (170_749_000 as Weight) - .saturating_add(T::DbWeight::get().reads(11 as Weight)) - .saturating_add(T::DbWeight::get().writes(7 as Weight)) - } - fn transfer_refungible() -> Weight { - (35_949_000 as Weight) - .saturating_add(T::DbWeight::get().reads(10 as Weight)) - .saturating_add(T::DbWeight::get().writes(7 as Weight)) - } + // Storage: Common CollectionById (r:1 w:1) fn set_transfers_enabled_flag() -> Weight { - (6_376_000 as Weight) + (6_500_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } - fn approve_nft() -> Weight { - (169_825_000 as Weight) - .saturating_add(T::DbWeight::get().reads(9 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) - } - fn transfer_from_nft() -> Weight { - (197_912_000 as Weight) - .saturating_add(T::DbWeight::get().reads(15 as Weight)) - .saturating_add(T::DbWeight::get().writes(11 as Weight)) - } - fn transfer_from_fungible() -> Weight { - (183_789_000 as Weight) - .saturating_add(T::DbWeight::get().reads(12 as Weight)) - .saturating_add(T::DbWeight::get().writes(8 as Weight)) - } - fn transfer_from_refungible() -> Weight { - (37_149_000 as Weight) - .saturating_add(T::DbWeight::get().reads(11 as Weight)) - .saturating_add(T::DbWeight::get().writes(8 as Weight)) - } + // Storage: Common CollectionById (r:1 w:1) fn set_offchain_schema(_b: u32, ) -> Weight { - (6_435_000 as Weight) + (6_538_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } + // Storage: Common CollectionById (r:1 w:1) fn set_const_on_chain_schema(_b: u32, ) -> Weight { - (6_646_000 as Weight) + (6_542_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } - fn set_variable_on_chain_schema(_b: u32, ) -> Weight { - (6_542_000 as Weight) + // Storage: Common CollectionById (r:1 w:1) + fn set_variable_on_chain_schema(b: u32, ) -> Weight { + (6_092_000 as Weight) + // Standard Error: 0 + .saturating_add((2_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)) } - fn set_variable_meta_data_nft(_b: u32, ) -> Weight { - (14_697_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) + // Storage: Common CollectionById (r:1 w:1) + fn set_schema_version() -> Weight { + (6_470_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } - fn set_schema_version() -> Weight { - (6_566_000 as Weight) + // Storage: Common CollectionById (r:1 w:1) + fn set_collection_limits() -> Weight { + (6_841_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } - fn set_collection_limits() -> Weight { - (6_349_000 as Weight) + // Storage: Common CollectionById (r:1 w:1) + fn set_meta_update_permission_flag() -> Weight { + (6_278_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -246,178 +185,129 @@ // For backwards compatibility and tests impl WeightInfo for () { + // Storage: Common CreatedCollectionCount (r:1 w:1) + // Storage: Common DestroyedCollectionCount (r:1 w:0) + // Storage: System Account (r:2 w:2) + // Storage: Common CollectionById (r:0 w:1) fn create_collection() -> Weight { - (25_851_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(8 as Weight)) - .saturating_add(RocksDbWeight::get().writes(6 as Weight)) + (23_803_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().writes(4 as Weight)) } + // Storage: Common CollectionById (r:1 w:1) + // Storage: Common DestroyedCollectionCount (r:1 w:1) + // Storage: Nonfungible TokensMinted (r:0 w:1) + // Storage: Nonfungible TokensBurnt (r:0 w:1) fn destroy_collection() -> Weight { - (28_737_000 as Weight) + (27_831_000 as Weight) .saturating_add(RocksDbWeight::get().reads(2 as Weight)) .saturating_add(RocksDbWeight::get().writes(4 as Weight)) } + // Storage: Common CollectionById (r:1 w:0) + // Storage: Common Allowlist (r:0 w:1) fn add_to_white_list() -> Weight { - (6_237_000 as Weight) + (6_629_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } + // Storage: Common CollectionById (r:1 w:0) + // Storage: Common Allowlist (r:0 w:1) fn remove_from_white_list() -> Weight { - (6_252_000 as Weight) + (6_596_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } + // Storage: Common CollectionById (r:1 w:1) fn set_public_access_mode() -> Weight { - (6_691_000 as Weight) + (6_338_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } + // Storage: Common CollectionById (r:1 w:1) fn set_mint_permission() -> Weight { - (6_630_000 as Weight) + (6_383_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } + // Storage: Common CollectionById (r:1 w:1) fn change_collection_owner() -> Weight { - (6_521_000 as Weight) + (6_493_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } + // Storage: Common CollectionById (r:1 w:0) + // Storage: Common IsAdmin (r:0 w:1) fn add_collection_admin() -> Weight { - (8_057_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + (6_850_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } + // Storage: Common CollectionById (r:1 w:0) + // Storage: Common IsAdmin (r:0 w:1) fn remove_collection_admin() -> Weight { - (8_307_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + (6_615_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } + // Storage: Common CollectionById (r:1 w:1) fn set_collection_sponsor() -> Weight { - (6_484_000 as Weight) + (6_430_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } + // Storage: Common CollectionById (r:1 w:1) fn confirm_sponsorship() -> Weight { - (6_530_000 as Weight) + (6_125_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } + // Storage: Common CollectionById (r:1 w:1) fn remove_collection_sponsor() -> Weight { - (6_733_000 as Weight) + (6_236_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } - fn create_item_nft(b: u32, ) -> Weight { - (167_180_000 as Weight) - // Standard Error: 1_000 - .saturating_add((10_000 as Weight).saturating_mul(b as Weight)) - .saturating_add(RocksDbWeight::get().reads(11 as Weight)) - .saturating_add(RocksDbWeight::get().writes(8 as Weight)) - } - fn create_multiple_items_nft(b: u32, ) -> Weight { - (336_830_000 as Weight) - // Standard Error: 42_000 - .saturating_add((11_627_000 as Weight).saturating_mul(b as Weight)) - .saturating_add(RocksDbWeight::get().reads(11 as Weight)) - .saturating_add(RocksDbWeight::get().writes(7 as Weight)) - .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(b as Weight))) - } - fn create_item_fungible() -> Weight { - (24_123_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(9 as Weight)) - .saturating_add(RocksDbWeight::get().writes(4 as Weight)) - } - fn create_multiple_items_fungible(b: u32, ) -> Weight { - (13_217_000 as Weight) - // Standard Error: 4_000 - .saturating_add((2_971_000 as Weight).saturating_mul(b as Weight)) - .saturating_add(RocksDbWeight::get().reads(9 as Weight)) - .saturating_add(RocksDbWeight::get().writes(4 as Weight)) - } - fn create_item_refungible(_b: u32, ) -> Weight { - (26_293_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(9 as Weight)) - .saturating_add(RocksDbWeight::get().writes(7 as Weight)) - } - fn create_multiple_items_refungible(b: u32, ) -> Weight { - (0 as Weight) - // Standard Error: 16_000 - .saturating_add((8_374_000 as Weight).saturating_mul(b as Weight)) - .saturating_add(RocksDbWeight::get().reads(9 as Weight)) - .saturating_add(RocksDbWeight::get().writes(6 as Weight)) - .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(b as Weight))) - } - fn burn_item_nft() -> Weight { - (32_237_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(9 as Weight)) - .saturating_add(RocksDbWeight::get().writes(7 as Weight)) - } - fn transfer_nft() -> Weight { - (192_578_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(14 as Weight)) - .saturating_add(RocksDbWeight::get().writes(10 as Weight)) - } - fn transfer_fungible() -> Weight { - (170_749_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(11 as Weight)) - .saturating_add(RocksDbWeight::get().writes(7 as Weight)) - } - fn transfer_refungible() -> Weight { - (35_949_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(10 as Weight)) - .saturating_add(RocksDbWeight::get().writes(7 as Weight)) - } + // Storage: Common CollectionById (r:1 w:1) fn set_transfers_enabled_flag() -> Weight { - (6_376_000 as Weight) + (6_500_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } - fn approve_nft() -> Weight { - (169_825_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(9 as Weight)) - .saturating_add(RocksDbWeight::get().writes(4 as Weight)) - } - fn transfer_from_nft() -> Weight { - (197_912_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(15 as Weight)) - .saturating_add(RocksDbWeight::get().writes(11 as Weight)) - } - fn transfer_from_fungible() -> Weight { - (183_789_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(12 as Weight)) - .saturating_add(RocksDbWeight::get().writes(8 as Weight)) - } - fn transfer_from_refungible() -> Weight { - (37_149_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(11 as Weight)) - .saturating_add(RocksDbWeight::get().writes(8 as Weight)) - } + // Storage: Common CollectionById (r:1 w:1) fn set_offchain_schema(_b: u32, ) -> Weight { - (6_435_000 as Weight) + (6_538_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } + // Storage: Common CollectionById (r:1 w:1) fn set_const_on_chain_schema(_b: u32, ) -> Weight { - (6_646_000 as Weight) + (6_542_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } - fn set_variable_on_chain_schema(_b: u32, ) -> Weight { - (6_542_000 as Weight) + // Storage: Common CollectionById (r:1 w:1) + fn set_variable_on_chain_schema(b: u32, ) -> Weight { + (6_092_000 as Weight) + // Standard Error: 0 + .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } - fn set_variable_meta_data_nft(_b: u32, ) -> Weight { - (14_697_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + // Storage: Common CollectionById (r:1 w:1) + fn set_schema_version() -> Weight { + (6_470_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } - fn set_schema_version() -> Weight { - (6_566_000 as Weight) + // Storage: Common CollectionById (r:1 w:1) + fn set_collection_limits() -> Weight { + (6_841_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } - fn set_collection_limits() -> Weight { - (6_349_000 as Weight) + // Storage: Common CollectionById (r:1 w:1) + fn set_meta_update_permission_flag() -> Weight { + (6_278_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) }