diff --git a/pallets/nfts/src/features/approvals.rs b/pallets/nfts/src/features/approvals.rs index 09903316..ec3646ba 100644 --- a/pallets/nfts/src/features/approvals.rs +++ b/pallets/nfts/src/features/approvals.rs @@ -19,7 +19,7 @@ //! The bitflag [`PalletFeature::Approvals`] needs to be set in [`Config::Features`] for NFTs //! to have the functionality defined in this module. -use frame_support::{pallet_prelude::*, sp_runtime::ArithmeticError}; +use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::BlockNumberFor; use crate::*; @@ -158,18 +158,17 @@ impl, I: 'static> Pallet { collection: T::CollectionId, item: T::ItemId, ) -> DispatchResult { - let collection_details = - Collection::::get(collection).ok_or(Error::::UnknownCollection)?; - - ensure!( - CollectionApprovalCount::::get(collection, Some(collection_details.owner)) == 0, - Error::::DelegateApprovalConflict - ); - let mut details = Item::::get(collection, item).ok_or(Error::::UnknownCollection)?; if let Some(check_origin) = maybe_check_origin { + ensure!( + CollectionApprovals::::iter_prefix((collection, &check_origin)) + .take(1) + .next() + .is_none(), + Error::::DelegateApprovalConflict + ); ensure!(check_origin == details.owner, Error::::NoPermission); } @@ -228,29 +227,7 @@ impl, I: 'static> Pallet { let deposit_required = T::CollectionApprovalDeposit::get(); let mut current_deposit = match maybe_approval.take() { Some((_, deposit)) => deposit, - None => { - // Increment approval counts for the `origin`, ensuring limits are - // respected. - CollectionApprovalCount::::try_mutate( - collection, - Some(&origin), - |approvals| -> DispatchResult { - ensure!( - *approvals < T::ApprovalsLimit::get(), - Error::::ReachedApprovalLimit - ); - approvals.saturating_inc(); - Ok(()) - }, - )?; - // Increment the total approval count for the collection. - CollectionApprovalCount::::mutate( - collection, - Option::::None, - |approvals| approvals.saturating_inc(), - ); - Zero::zero() - }, + None => Zero::zero(), }; if current_deposit < deposit_required { @@ -291,18 +268,6 @@ impl, I: 'static> Pallet { let (_, deposit) = CollectionApprovals::::take((&collection, &origin, &delegate)) .ok_or(Error::::UnknownCollection)?; - // Update the approval count for the `origin` account and the whole collection. - for key in [Some(&origin), Option::<&T::AccountId>::None] { - let count = CollectionApprovalCount::::get(collection, key) - .checked_sub(1) - .ok_or(ArithmeticError::Overflow)?; - if count == 0 { - CollectionApprovalCount::::remove(collection, key); - } else { - CollectionApprovalCount::::insert(collection, key, count); - } - } - T::Currency::unreserve(&origin, deposit); Self::deposit_event(Event::ApprovalCancelled { @@ -330,40 +295,17 @@ impl, I: 'static> Pallet { origin: T::AccountId, collection: T::CollectionId, witness_approvals: u32, - ) -> Result { + ) -> DispatchResult { let mut removed_approvals: u32 = 0; - CollectionApprovalCount::::try_mutate_exists( - collection, - Option::::None, - |maybe_collection| -> DispatchResult { - let total_approvals = - maybe_collection.as_mut().ok_or(Error::::UnknownCollection)?; - - // Remove the total number of collection approvals from the `origin`. - let approvals = CollectionApprovalCount::::take(collection, Some(&origin)); - ensure!(approvals == witness_approvals, Error::::BadWitness); - - // Iterate and remove each collection approval, return the deposited fund back to - // the `origin`. - for (_, (_, deposit)) in - CollectionApprovals::::drain_prefix((collection, &origin)) - { - T::Currency::unreserve(&origin, deposit); - removed_approvals.saturating_inc(); - total_approvals.saturating_dec(); - if removed_approvals >= approvals { - break - } - } - Self::deposit_event(Event::AllApprovalsCancelled { - collection, - item: None, - owner: origin, - }); - Ok(()) - }, - )?; - Ok(removed_approvals) + // Iterate and remove each collection approval, return the deposited fund back to the + // `origin`. + for (_, (_, deposit)) in CollectionApprovals::::drain_prefix((collection, &origin)) { + T::Currency::unreserve(&origin, deposit); + removed_approvals.saturating_inc(); + } + ensure!(removed_approvals == witness_approvals, Error::::BadWitness); + Self::deposit_event(Event::AllApprovalsCancelled { collection, item: None, owner: origin }); + Ok(()) } /// Checks whether the `delegate` has the necessary allowance to transfer items in the diff --git a/pallets/nfts/src/features/create_delete_collection.rs b/pallets/nfts/src/features/create_delete_collection.rs index 4b5e9be5..c749a212 100644 --- a/pallets/nfts/src/features/create_delete_collection.rs +++ b/pallets/nfts/src/features/create_delete_collection.rs @@ -109,13 +109,14 @@ impl, I: 'static> Pallet { Collection::::try_mutate_exists(collection, |maybe_details| { let collection_details = maybe_details.take().ok_or(Error::::UnknownCollection)?; - let collection_approvals = - CollectionApprovalCount::::take(collection, Option::::None); if let Some(check_owner) = maybe_check_owner { ensure!(collection_details.owner == check_owner, Error::::NoPermission); } ensure!(collection_details.items == 0, Error::::CollectionNotEmpty); - ensure!(collection_approvals == 0, Error::::CollectionApprovalsExist); + ensure!( + CollectionApprovals::::iter_prefix((collection,)).take(1).next().is_none(), + Error::::CollectionApprovalsExist + ); ensure!(collection_details.attributes == witness.attributes, Error::::BadWitness); ensure!( collection_details.item_metadatas == witness.item_metadatas, diff --git a/pallets/nfts/src/features/create_delete_item.rs b/pallets/nfts/src/features/create_delete_item.rs index e9ad74b0..2694aa6d 100644 --- a/pallets/nfts/src/features/create_delete_item.rs +++ b/pallets/nfts/src/features/create_delete_item.rs @@ -265,9 +265,9 @@ impl, I: 'static> Pallet { ItemAttributesApprovalsOf::::remove(collection, item); let balance = AccountBalance::::get(collection, &owner) - .checked_sub(1) + .checked_sub(&One::one()) .ok_or(ArithmeticError::Overflow)?; - if balance == 0 { + if balance == Zero::zero() { AccountBalance::::remove(collection, &owner); } else { AccountBalance::::insert(collection, &owner, balance); diff --git a/pallets/nfts/src/features/transfer.rs b/pallets/nfts/src/features/transfer.rs index 346f217a..2671e7c9 100644 --- a/pallets/nfts/src/features/transfer.rs +++ b/pallets/nfts/src/features/transfer.rs @@ -92,9 +92,9 @@ impl, I: 'static> Pallet { }); // Update account balance of the owner. let balance = AccountBalance::::get(collection, &details.owner) - .checked_sub(1) + .checked_sub(&One::one()) .ok_or(ArithmeticError::Overflow)?; - if balance == 0 { + if balance == Zero::zero() { AccountBalance::::remove(collection, &details.owner); } else { AccountBalance::::insert(collection, &details.owner, balance); diff --git a/pallets/nfts/src/lib.rs b/pallets/nfts/src/lib.rs index 71942127..db8b1b53 100644 --- a/pallets/nfts/src/lib.rs +++ b/pallets/nfts/src/lib.rs @@ -63,7 +63,7 @@ use frame_support::traits::{ use frame_system::Config as SystemConfig; pub use pallet::*; use sp_runtime::{ - traits::{IdentifyAccount, Saturating, StaticLookup, Verify, Zero}, + traits::{CheckedSub, IdentifyAccount, One, Saturating, StaticLookup, Verify, Zero}, RuntimeDebug, }; pub use types::*; @@ -151,7 +151,15 @@ pub mod pallet { type CollectionId: Member + Parameter + MaxEncodedLen + Copy + Incrementable; /// The type used to identify a unique item within a collection. - type ItemId: Member + Parameter + MaxEncodedLen + Copy; + type ItemId: Member + + Parameter + + MaxEncodedLen + + Copy + + Default + + One + + Zero + + CheckedSub + + Saturating; /// The currency mechanism, used for paying for reserves. type Currency: ReservableCurrency; @@ -418,7 +426,7 @@ pub mod pallet { T::CollectionId, Blake2_128Concat, T::AccountId, - u32, + T::ItemId, ValueQuery, >; @@ -437,18 +445,6 @@ pub mod pallet { (Option>, DepositBalanceOf), >; - /// Total number approvals of a whole collection or a specified account. - #[pallet::storage] - pub type CollectionApprovalCount, I: 'static = ()> = StorageDoubleMap< - _, - Blake2_128Concat, - T::CollectionId, - Blake2_128Concat, - Option, - u32, - ValueQuery, - >; - /// Config of an item. #[pallet::storage] pub type ItemConfigOf, I: 'static = ()> = StorageDoubleMap< @@ -702,7 +698,7 @@ pub mod pallet { NotForSale, /// The provided bid is too low. BidTooLow, - /// The collection or item has reached its approval limit. + /// The item has reached its approval limit. ReachedApprovalLimit, /// The deadline has already expired. DeadlineExpired, @@ -1460,12 +1456,9 @@ pub mod pallet { }, None => { let origin = ensure_signed(origin)?; - let removed_approvals = Self::do_clear_all_collection_approvals( - origin, - collection, - witness_approvals.unwrap_or_default(), - )?; - T::WeightInfo::clear_all_transfer_approvals(0, removed_approvals) + let witness_approvals = witness_approvals.unwrap_or_default(); + Self::do_clear_all_collection_approvals(origin, collection, witness_approvals)?; + T::WeightInfo::clear_all_transfer_approvals(0, witness_approvals) }, }; Ok(Some(weight).into()) diff --git a/pallets/nfts/src/tests.rs b/pallets/nfts/src/tests.rs index bfe7a2f7..37fbde39 100644 --- a/pallets/nfts/src/tests.rs +++ b/pallets/nfts/src/tests.rs @@ -36,8 +36,6 @@ use crate::{mock::*, Event, SystemConfig, *}; type AccountIdOf = ::AccountId; -const NO_ACCOUNT: Option = Option::::None; - fn account(id: u8) -> AccountIdOf { [id; 32].into() } @@ -355,10 +353,7 @@ fn destroy_should_work() { )); assert_eq!(AccountBalance::::get(0, account(1)), 0); assert_eq!(AccountBalance::::contains_key(0, account(5)), false); - assert_eq!(CollectionApprovalCount::::contains_key(0, NO_ACCOUNT), false); assert_eq!(CollectionApprovals::::iter_prefix((0,)).count(), 0); - assert_eq!(CollectionApprovalCount::::contains_key(0, Some(account(5))), false); - assert_eq!(CollectionApprovalCount::::contains_key(0, NO_ACCOUNT), false); assert!(!ItemConfigOf::::contains_key(0, 42)); assert_eq!(ItemConfigOf::::iter_prefix(0).count() as u32, 0); }); @@ -2097,12 +2092,6 @@ fn cancel_approval_collection_works() { delegate: account(3) })); assert_eq!(CollectionApprovals::::get((0, account(2), account(3))), None); - assert_eq!(CollectionApprovalCount::::get(0, Some(account(2))), 0); - assert_eq!(CollectionApprovalCount::::get(0, NO_ACCOUNT), 0); - assert_eq!( - CollectionApprovalCount::::get(0, Some(account(2))), - CollectionApprovals::::iter_prefix((0, account(2))).count() as u32 - ); assert_noop!( Nfts::transfer(RuntimeOrigin::signed(account(3)), 0, 42, account(4)), @@ -2206,32 +2195,6 @@ fn approvals_limit_works() { }); } -#[test] -fn collection_approvals_limit_works() { - new_test_ext().execute_with(|| { - Balances::make_free_balance_be(&account(1), 100); - assert_ok!(Nfts::force_create( - RuntimeOrigin::root(), - account(1), - default_collection_config() - )); - for i in 3..13 { - assert_ok!(Nfts::approve_transfer( - RuntimeOrigin::signed(account(1)), - 0, - None, - account(i), - None - )); - } - // the limit is 10 - assert_noop!( - Nfts::approve_transfer(RuntimeOrigin::signed(account(1)), 0, None, account(14), None), - Error::::ReachedApprovalLimit - ); - }); -} - #[test] fn approve_transfer_collection_works() { new_test_ext().execute_with(|| { @@ -2279,8 +2242,6 @@ fn approve_transfer_collection_works() { account(3), None )); - assert_eq!(CollectionApprovalCount::::get(0, Some(account(2))), 1); - assert_eq!(CollectionApprovalCount::::get(0, NO_ACCOUNT), 1); assert_eq!(Balances::reserved_balance(&account(2)), 1); // must not update the total collection approvals. @@ -2291,8 +2252,6 @@ fn approve_transfer_collection_works() { account(3), None )); - assert_eq!(CollectionApprovalCount::::get(0, Some(account(2))), 1); - assert_eq!(CollectionApprovalCount::::get(0, NO_ACCOUNT), 1); assert_eq!(Balances::reserved_balance(&account(2)), 1); assert_ok!(Nfts::approve_transfer( @@ -2303,8 +2262,6 @@ fn approve_transfer_collection_works() { None )); assert_eq!(Balances::reserved_balance(&account(2)), 1); - assert_eq!(CollectionApprovalCount::::get(0, Some(account(3))), 1); - assert_eq!(CollectionApprovalCount::::get(0, NO_ACCOUNT), 2); assert!(events().contains(&Event::::TransferApproved { collection: 0, item: None, @@ -2313,10 +2270,6 @@ fn approve_transfer_collection_works() { deadline: None })); assert_eq!(CollectionApprovals::::get((0, account(2), account(3))), Some((None, 1))); - assert_eq!( - CollectionApprovalCount::::get(0, Some(account(2))), - CollectionApprovals::::iter_prefix((0, account(2))).count() as u32 - ); assert_ok!(Nfts::transfer(RuntimeOrigin::signed(account(3)), 0, 42, account(4))); }); } @@ -2546,7 +2499,6 @@ fn clear_all_transfer_approvals_works() { owner: account(2), })); assert_eq!(approvals(0, 42), vec![]); - assert_eq!(CollectionApprovalCount::::contains_key(0, Some(account(2))), false); assert_eq!(CollectionApprovals::::iter_prefix((0, account(2))).count(), 0); assert_noop!( @@ -2611,12 +2563,6 @@ fn clear_all_collection_approvals_works() { })); assert_eq!(Balances::free_balance(&account(1)), 100); assert_eq!(CollectionApprovals::::iter_prefix((0, account(1))).count(), 0); - assert_eq!(CollectionApprovalCount::::contains_key(0, Some(account(1))), false); - assert_eq!(CollectionApprovalCount::::get(0, NO_ACCOUNT), 0); - assert_eq!( - CollectionApprovalCount::::get(0, Some(account(1))), - CollectionApprovals::::iter_prefix((0, account(1))).count() as u32 - ); assert_noop!( Nfts::transfer(RuntimeOrigin::signed(account(3)), 0, 42, account(5)), diff --git a/pallets/nfts/src/weights.rs b/pallets/nfts/src/weights.rs index 518a5b7e..f9d8b331 100644 --- a/pallets/nfts/src/weights.rs +++ b/pallets/nfts/src/weights.rs @@ -2,7 +2,7 @@ //! Autogenerated weights for `pallet_nfts` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 40.0.0 -//! DATE: 2024-11-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-11-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `R0GUE`, CPU: `` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` @@ -92,8 +92,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `105` // Estimated: `3549` - // Minimum execution time: 27_000_000 picoseconds. - Weight::from_parts(28_000_000, 3549) + // Minimum execution time: 29_000_000 picoseconds. + Weight::from_parts(37_000_000, 3549) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -111,15 +111,15 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `3` // Estimated: `3549` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(17_000_000, 3549) + // Minimum execution time: 15_000_000 picoseconds. + Weight::from_parts(15_000_000, 3549) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: `Nfts::Collection` (r:1 w:1) /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) - /// Storage: `Nfts::CollectionApprovalCount` (r:1 w:0) - /// Proof: `Nfts::CollectionApprovalCount` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionApprovals` (r:1 w:0) + /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) /// Storage: `Nfts::ItemMetadataOf` (r:1 w:0) /// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(347), added: 2822, mode: `MaxEncodedLen`) /// Storage: `Nfts::CollectionRoleOf` (r:1 w:1) @@ -139,12 +139,12 @@ impl WeightInfo for SubstrateWeight { /// The range of component `a` is `[0, 1000]`. fn destroy(_m: u32, _c: u32, a: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `32131 + a * (366 ±0)` + // Measured: `32137 + a * (366 ±0)` // Estimated: `2523990 + a * (2954 ±0)` - // Minimum execution time: 1_014_000_000 picoseconds. - Weight::from_parts(1_146_825_407, 2523990) - // Standard Error: 37_482 - .saturating_add(Weight::from_parts(5_348_736, 0).saturating_mul(a.into())) + // Minimum execution time: 1_005_000_000 picoseconds. + Weight::from_parts(2_234_507_890, 2523990) + // Standard Error: 87_675 + .saturating_add(Weight::from_parts(5_794_302, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(1005_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1005_u64)) @@ -169,8 +169,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `382` // Estimated: `4326` - // Minimum execution time: 41_000_000 picoseconds. - Weight::from_parts(50_000_000, 4326) + // Minimum execution time: 40_000_000 picoseconds. + Weight::from_parts(43_000_000, 4326) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -192,8 +192,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `382` // Estimated: `4326` - // Minimum execution time: 39_000_000 picoseconds. - Weight::from_parts(43_000_000, 4326) + // Minimum execution time: 38_000_000 picoseconds. + Weight::from_parts(40_000_000, 4326) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -249,7 +249,7 @@ impl WeightInfo for SubstrateWeight { // Measured: `613` // Estimated: `6084` // Minimum execution time: 39_000_000 picoseconds. - Weight::from_parts(40_000_000, 6084) + Weight::from_parts(45_000_000, 6084) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -266,8 +266,8 @@ impl WeightInfo for SubstrateWeight { // Estimated: `3549 + i * (3336 ±0)` // Minimum execution time: 11_000_000 picoseconds. Weight::from_parts(11_000_000, 3549) - // Standard Error: 35_916 - .saturating_add(Weight::from_parts(16_637_380, 0).saturating_mul(i.into())) + // Standard Error: 33_010 + .saturating_add(Weight::from_parts(17_115_197, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) @@ -281,8 +281,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `395` // Estimated: `3534` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(14_000_000, 3534) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(15_000_000, 3534) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -294,8 +294,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `395` // Estimated: `3534` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(14_000_000, 3534) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(15_000_000, 3534) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -325,7 +325,7 @@ impl WeightInfo for SubstrateWeight { // Measured: `417` // Estimated: `3593` // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(19_000_000, 3593) + Weight::from_parts(21_000_000, 3593) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -364,7 +364,7 @@ impl WeightInfo for SubstrateWeight { // Measured: `203` // Estimated: `3549` // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(9_000_000, 3549) + Weight::from_parts(10_000_000, 3549) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -376,8 +376,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `395` // Estimated: `3534` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(13_000_000, 3534) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(14_000_000, 3534) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -395,8 +395,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `499` // Estimated: `3944` - // Minimum execution time: 39_000_000 picoseconds. - Weight::from_parts(45_000_000, 3944) + // Minimum execution time: 38_000_000 picoseconds. + Weight::from_parts(39_000_000, 3944) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -425,7 +425,7 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `943` // Estimated: `3944` - // Minimum execution time: 34_000_000 picoseconds. + // Minimum execution time: 35_000_000 picoseconds. Weight::from_parts(36_000_000, 3944) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) @@ -456,10 +456,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `686 + n * (398 ±0)` // Estimated: `4466 + n * (2954 ±0)` - // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(19_000_000, 4466) - // Standard Error: 12_409 - .saturating_add(Weight::from_parts(5_237_238, 0).saturating_mul(n.into())) + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(20_000_000, 4466) + // Standard Error: 11_913 + .saturating_add(Weight::from_parts(5_265_987, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) @@ -480,8 +480,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `499` // Estimated: `3812` - // Minimum execution time: 31_000_000 picoseconds. - Weight::from_parts(31_000_000, 3812) + // Minimum execution time: 32_000_000 picoseconds. + Weight::from_parts(38_000_000, 3812) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -497,8 +497,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `809` // Estimated: `3812` - // Minimum execution time: 29_000_000 picoseconds. - Weight::from_parts(30_000_000, 3812) + // Minimum execution time: 30_000_000 picoseconds. + Weight::from_parts(33_000_000, 3812) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -515,7 +515,7 @@ impl WeightInfo for SubstrateWeight { // Measured: `325` // Estimated: `3759` // Minimum execution time: 28_000_000 picoseconds. - Weight::from_parts(29_000_000, 3759) + Weight::from_parts(30_000_000, 3759) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -531,8 +531,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `643` // Estimated: `3759` - // Minimum execution time: 27_000_000 picoseconds. - Weight::from_parts(29_000_000, 3759) + // Minimum execution time: 28_000_000 picoseconds. + Weight::from_parts(30_000_000, 3759) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -542,56 +542,49 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) /// Storage: `Nfts::CollectionApprovals` (r:1 w:1) /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) - /// Storage: `Nfts::CollectionApprovalCount` (r:2 w:2) - /// Proof: `Nfts::CollectionApprovalCount` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) /// The range of component `i` is `[0, 1]`. fn approve_transfer(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `192 + i * (145 ±0)` - // Estimated: `6086 + i * (2163 ±0)` + // Estimated: `3602 + i * (2163 ±0)` // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(28_691_836, 6086) - .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(T::DbWeight::get().writes(3_u64)) + Weight::from_parts(24_983_673, 3602) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 2163).saturating_mul(i.into())) } /// Storage: `Nfts::Item` (r:1 w:1) /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`) /// Storage: `Nfts::CollectionApprovals` (r:1 w:0) /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) - /// Storage: `Nfts::CollectionApprovalCount` (r:2 w:2) - /// Proof: `Nfts::CollectionApprovalCount` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) /// The range of component `i` is `[0, 1]`. fn cancel_approval(i: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `447` - // Estimated: `6086 + i * (2163 ±0)` - // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(32_663_265, 6086) - .saturating_add(T::DbWeight::get().reads(3_u64)) - .saturating_add(T::DbWeight::get().writes(3_u64)) + // Measured: `322 + i * (23 ±0)` + // Estimated: `3602 + i * (2163 ±0)` + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(22_891_836, 3602) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into()))) + .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 2163).saturating_mul(i.into())) } - /// Storage: `Nfts::Collection` (r:1 w:0) - /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) - /// Storage: `Nfts::CollectionApprovalCount` (r:1 w:0) - /// Proof: `Nfts::CollectionApprovalCount` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) /// Storage: `Nfts::Item` (r:1 w:1) /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`) - /// Storage: `Nfts::CollectionApprovals` (r:21 w:20) + /// Storage: `Nfts::CollectionApprovals` (r:1 w:0) /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) /// The range of component `i` is `[0, 1]`. /// The range of component `n` is `[0, 20]`. fn clear_all_transfer_approvals(i: u32, n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1889` + // Measured: `1770` // Estimated: `55842 + i * (4325 ±496_172_781_796_926)` // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(288_990_100, 55842) - // Standard Error: 50_286 - .saturating_add(Weight::from_parts(46_413, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(23_u64)) - .saturating_add(T::DbWeight::get().writes(22_u64)) + Weight::from_parts(289_694_442, 55842) + // Standard Error: 62_848 + .saturating_add(Weight::from_parts(21_298, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(21_u64)) + .saturating_add(T::DbWeight::get().writes(20_u64)) .saturating_add(Weight::from_parts(0, 4325).saturating_mul(i.into())) } /// Storage: `Nfts::OwnershipAcceptance` (r:1 w:1) @@ -613,7 +606,7 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `267` // Estimated: `3549` - // Minimum execution time: 12_000_000 picoseconds. + // Minimum execution time: 13_000_000 picoseconds. Weight::from_parts(13_000_000, 3549) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -627,7 +620,7 @@ impl WeightInfo for SubstrateWeight { // Measured: `250` // Estimated: `3538` // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(12_000_000, 3538) + Weight::from_parts(13_000_000, 3538) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -643,8 +636,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `478` // Estimated: `4326` - // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(17_000_000, 4326) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(18_000_000, 4326) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -670,7 +663,7 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `725` // Estimated: `6084` - // Minimum execution time: 45_000_000 picoseconds. + // Minimum execution time: 46_000_000 picoseconds. Weight::from_parts(48_000_000, 6084) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) @@ -681,9 +674,9 @@ impl WeightInfo for SubstrateWeight { // Measured: `0` // Estimated: `0` // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(2_165_281, 0) - // Standard Error: 6_212 - .saturating_add(Weight::from_parts(1_751_486, 0).saturating_mul(n.into())) + Weight::from_parts(1_971_321, 0) + // Standard Error: 11_267 + .saturating_add(Weight::from_parts(1_831_565, 0).saturating_mul(n.into())) } /// Storage: `Nfts::Item` (r:2 w:0) /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`) @@ -694,7 +687,7 @@ impl WeightInfo for SubstrateWeight { // Measured: `421` // Estimated: `7662` // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(18_000_000, 7662) + Weight::from_parts(15_000_000, 7662) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -706,7 +699,7 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `440` // Estimated: `4326` - // Minimum execution time: 13_000_000 picoseconds. + // Minimum execution time: 14_000_000 picoseconds. Weight::from_parts(14_000_000, 4326) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -733,8 +726,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `916` // Estimated: `7662` - // Minimum execution time: 80_000_000 picoseconds. - Weight::from_parts(85_000_000, 7662) + // Minimum execution time: 81_000_000 picoseconds. + Weight::from_parts(87_000_000, 7662) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(12_u64)) } @@ -764,9 +757,9 @@ impl WeightInfo for SubstrateWeight { // Measured: `485` // Estimated: `6078 + n * (2954 ±0)` // Minimum execution time: 102_000_000 picoseconds. - Weight::from_parts(111_267_023, 6078) - // Standard Error: 152_884 - .saturating_add(Weight::from_parts(29_566_587, 0).saturating_mul(n.into())) + Weight::from_parts(115_875_572, 6078) + // Standard Error: 214_394 + .saturating_add(Weight::from_parts(29_706_731, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(7_u64)) @@ -791,9 +784,9 @@ impl WeightInfo for SubstrateWeight { // Measured: `514` // Estimated: `4466 + n * (2954 ±0)` // Minimum execution time: 51_000_000 picoseconds. - Weight::from_parts(59_990_513, 4466) - // Standard Error: 136_656 - .saturating_add(Weight::from_parts(28_171_567, 0).saturating_mul(n.into())) + Weight::from_parts(66_554_620, 4466) + // Standard Error: 115_497 + .saturating_add(Weight::from_parts(27_385_703, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) @@ -818,8 +811,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `105` // Estimated: `3549` - // Minimum execution time: 27_000_000 picoseconds. - Weight::from_parts(28_000_000, 3549) + // Minimum execution time: 29_000_000 picoseconds. + Weight::from_parts(37_000_000, 3549) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -837,15 +830,15 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `3` // Estimated: `3549` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(17_000_000, 3549) + // Minimum execution time: 15_000_000 picoseconds. + Weight::from_parts(15_000_000, 3549) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } /// Storage: `Nfts::Collection` (r:1 w:1) /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) - /// Storage: `Nfts::CollectionApprovalCount` (r:1 w:0) - /// Proof: `Nfts::CollectionApprovalCount` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Nfts::CollectionApprovals` (r:1 w:0) + /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) /// Storage: `Nfts::ItemMetadataOf` (r:1 w:0) /// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(347), added: 2822, mode: `MaxEncodedLen`) /// Storage: `Nfts::CollectionRoleOf` (r:1 w:1) @@ -865,12 +858,12 @@ impl WeightInfo for () { /// The range of component `a` is `[0, 1000]`. fn destroy(_m: u32, _c: u32, a: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `32131 + a * (366 ±0)` + // Measured: `32137 + a * (366 ±0)` // Estimated: `2523990 + a * (2954 ±0)` - // Minimum execution time: 1_014_000_000 picoseconds. - Weight::from_parts(1_146_825_407, 2523990) - // Standard Error: 37_482 - .saturating_add(Weight::from_parts(5_348_736, 0).saturating_mul(a.into())) + // Minimum execution time: 1_005_000_000 picoseconds. + Weight::from_parts(2_234_507_890, 2523990) + // Standard Error: 87_675 + .saturating_add(Weight::from_parts(5_794_302, 0).saturating_mul(a.into())) .saturating_add(RocksDbWeight::get().reads(1005_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(RocksDbWeight::get().writes(1005_u64)) @@ -895,8 +888,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `382` // Estimated: `4326` - // Minimum execution time: 41_000_000 picoseconds. - Weight::from_parts(50_000_000, 4326) + // Minimum execution time: 40_000_000 picoseconds. + Weight::from_parts(43_000_000, 4326) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -918,8 +911,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `382` // Estimated: `4326` - // Minimum execution time: 39_000_000 picoseconds. - Weight::from_parts(43_000_000, 4326) + // Minimum execution time: 38_000_000 picoseconds. + Weight::from_parts(40_000_000, 4326) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -975,7 +968,7 @@ impl WeightInfo for () { // Measured: `613` // Estimated: `6084` // Minimum execution time: 39_000_000 picoseconds. - Weight::from_parts(40_000_000, 6084) + Weight::from_parts(45_000_000, 6084) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -992,8 +985,8 @@ impl WeightInfo for () { // Estimated: `3549 + i * (3336 ±0)` // Minimum execution time: 11_000_000 picoseconds. Weight::from_parts(11_000_000, 3549) - // Standard Error: 35_916 - .saturating_add(Weight::from_parts(16_637_380, 0).saturating_mul(i.into())) + // Standard Error: 33_010 + .saturating_add(Weight::from_parts(17_115_197, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(i.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) @@ -1007,8 +1000,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `395` // Estimated: `3534` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(14_000_000, 3534) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(15_000_000, 3534) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1020,8 +1013,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `395` // Estimated: `3534` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(14_000_000, 3534) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(15_000_000, 3534) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1051,7 +1044,7 @@ impl WeightInfo for () { // Measured: `417` // Estimated: `3593` // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(19_000_000, 3593) + Weight::from_parts(21_000_000, 3593) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -1090,7 +1083,7 @@ impl WeightInfo for () { // Measured: `203` // Estimated: `3549` // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(9_000_000, 3549) + Weight::from_parts(10_000_000, 3549) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1102,8 +1095,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `395` // Estimated: `3534` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(13_000_000, 3534) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(14_000_000, 3534) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1121,8 +1114,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `499` // Estimated: `3944` - // Minimum execution time: 39_000_000 picoseconds. - Weight::from_parts(45_000_000, 3944) + // Minimum execution time: 38_000_000 picoseconds. + Weight::from_parts(39_000_000, 3944) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1151,7 +1144,7 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `943` // Estimated: `3944` - // Minimum execution time: 34_000_000 picoseconds. + // Minimum execution time: 35_000_000 picoseconds. Weight::from_parts(36_000_000, 3944) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) @@ -1182,10 +1175,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `686 + n * (398 ±0)` // Estimated: `4466 + n * (2954 ±0)` - // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(19_000_000, 4466) - // Standard Error: 12_409 - .saturating_add(Weight::from_parts(5_237_238, 0).saturating_mul(n.into())) + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(20_000_000, 4466) + // Standard Error: 11_913 + .saturating_add(Weight::from_parts(5_265_987, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64)) @@ -1206,8 +1199,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `499` // Estimated: `3812` - // Minimum execution time: 31_000_000 picoseconds. - Weight::from_parts(31_000_000, 3812) + // Minimum execution time: 32_000_000 picoseconds. + Weight::from_parts(38_000_000, 3812) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1223,8 +1216,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `809` // Estimated: `3812` - // Minimum execution time: 29_000_000 picoseconds. - Weight::from_parts(30_000_000, 3812) + // Minimum execution time: 30_000_000 picoseconds. + Weight::from_parts(33_000_000, 3812) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1241,7 +1234,7 @@ impl WeightInfo for () { // Measured: `325` // Estimated: `3759` // Minimum execution time: 28_000_000 picoseconds. - Weight::from_parts(29_000_000, 3759) + Weight::from_parts(30_000_000, 3759) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1257,8 +1250,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `643` // Estimated: `3759` - // Minimum execution time: 27_000_000 picoseconds. - Weight::from_parts(29_000_000, 3759) + // Minimum execution time: 28_000_000 picoseconds. + Weight::from_parts(30_000_000, 3759) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1268,56 +1261,49 @@ impl WeightInfo for () { /// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) /// Storage: `Nfts::CollectionApprovals` (r:1 w:1) /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) - /// Storage: `Nfts::CollectionApprovalCount` (r:2 w:2) - /// Proof: `Nfts::CollectionApprovalCount` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) /// The range of component `i` is `[0, 1]`. fn approve_transfer(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `192 + i * (145 ±0)` - // Estimated: `6086 + i * (2163 ±0)` + // Estimated: `3602 + i * (2163 ±0)` // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(28_691_836, 6086) - .saturating_add(RocksDbWeight::get().reads(4_u64)) - .saturating_add(RocksDbWeight::get().writes(3_u64)) + Weight::from_parts(24_983_673, 3602) + .saturating_add(RocksDbWeight::get().reads(2_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 2163).saturating_mul(i.into())) } /// Storage: `Nfts::Item` (r:1 w:1) /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`) /// Storage: `Nfts::CollectionApprovals` (r:1 w:0) /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) - /// Storage: `Nfts::CollectionApprovalCount` (r:2 w:2) - /// Proof: `Nfts::CollectionApprovalCount` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) /// The range of component `i` is `[0, 1]`. fn cancel_approval(i: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `447` - // Estimated: `6086 + i * (2163 ±0)` - // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(32_663_265, 6086) - .saturating_add(RocksDbWeight::get().reads(3_u64)) - .saturating_add(RocksDbWeight::get().writes(3_u64)) + // Measured: `322 + i * (23 ±0)` + // Estimated: `3602 + i * (2163 ±0)` + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(22_891_836, 3602) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(i.into()))) + .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 2163).saturating_mul(i.into())) } - /// Storage: `Nfts::Collection` (r:1 w:0) - /// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) - /// Storage: `Nfts::CollectionApprovalCount` (r:1 w:0) - /// Proof: `Nfts::CollectionApprovalCount` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) /// Storage: `Nfts::Item` (r:1 w:1) /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`) - /// Storage: `Nfts::CollectionApprovals` (r:21 w:20) + /// Storage: `Nfts::CollectionApprovals` (r:1 w:0) /// Proof: `Nfts::CollectionApprovals` (`max_values`: None, `max_size`: Some(137), added: 2612, mode: `MaxEncodedLen`) /// The range of component `i` is `[0, 1]`. /// The range of component `n` is `[0, 20]`. fn clear_all_transfer_approvals(i: u32, n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1889` + // Measured: `1770` // Estimated: `55842 + i * (4325 ±496_172_781_796_926)` // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(288_990_100, 55842) - // Standard Error: 50_286 - .saturating_add(Weight::from_parts(46_413, 0).saturating_mul(n.into())) - .saturating_add(RocksDbWeight::get().reads(23_u64)) - .saturating_add(RocksDbWeight::get().writes(22_u64)) + Weight::from_parts(289_694_442, 55842) + // Standard Error: 62_848 + .saturating_add(Weight::from_parts(21_298, 0).saturating_mul(n.into())) + .saturating_add(RocksDbWeight::get().reads(21_u64)) + .saturating_add(RocksDbWeight::get().writes(20_u64)) .saturating_add(Weight::from_parts(0, 4325).saturating_mul(i.into())) } /// Storage: `Nfts::OwnershipAcceptance` (r:1 w:1) @@ -1339,7 +1325,7 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `267` // Estimated: `3549` - // Minimum execution time: 12_000_000 picoseconds. + // Minimum execution time: 13_000_000 picoseconds. Weight::from_parts(13_000_000, 3549) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -1353,7 +1339,7 @@ impl WeightInfo for () { // Measured: `250` // Estimated: `3538` // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(12_000_000, 3538) + Weight::from_parts(13_000_000, 3538) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1369,8 +1355,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `478` // Estimated: `4326` - // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(17_000_000, 4326) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(18_000_000, 4326) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1396,7 +1382,7 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `725` // Estimated: `6084` - // Minimum execution time: 45_000_000 picoseconds. + // Minimum execution time: 46_000_000 picoseconds. Weight::from_parts(48_000_000, 6084) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) @@ -1407,9 +1393,9 @@ impl WeightInfo for () { // Measured: `0` // Estimated: `0` // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(2_165_281, 0) - // Standard Error: 6_212 - .saturating_add(Weight::from_parts(1_751_486, 0).saturating_mul(n.into())) + Weight::from_parts(1_971_321, 0) + // Standard Error: 11_267 + .saturating_add(Weight::from_parts(1_831_565, 0).saturating_mul(n.into())) } /// Storage: `Nfts::Item` (r:2 w:0) /// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`) @@ -1420,7 +1406,7 @@ impl WeightInfo for () { // Measured: `421` // Estimated: `7662` // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(18_000_000, 7662) + Weight::from_parts(15_000_000, 7662) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1432,7 +1418,7 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `440` // Estimated: `4326` - // Minimum execution time: 13_000_000 picoseconds. + // Minimum execution time: 14_000_000 picoseconds. Weight::from_parts(14_000_000, 4326) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -1459,8 +1445,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `916` // Estimated: `7662` - // Minimum execution time: 80_000_000 picoseconds. - Weight::from_parts(85_000_000, 7662) + // Minimum execution time: 81_000_000 picoseconds. + Weight::from_parts(87_000_000, 7662) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(12_u64)) } @@ -1490,9 +1476,9 @@ impl WeightInfo for () { // Measured: `485` // Estimated: `6078 + n * (2954 ±0)` // Minimum execution time: 102_000_000 picoseconds. - Weight::from_parts(111_267_023, 6078) - // Standard Error: 152_884 - .saturating_add(Weight::from_parts(29_566_587, 0).saturating_mul(n.into())) + Weight::from_parts(115_875_572, 6078) + // Standard Error: 214_394 + .saturating_add(Weight::from_parts(29_706_731, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(7_u64)) @@ -1517,9 +1503,9 @@ impl WeightInfo for () { // Measured: `514` // Estimated: `4466 + n * (2954 ±0)` // Minimum execution time: 51_000_000 picoseconds. - Weight::from_parts(59_990_513, 4466) - // Standard Error: 136_656 - .saturating_add(Weight::from_parts(28_171_567, 0).saturating_mul(n.into())) + Weight::from_parts(66_554_620, 4466) + // Standard Error: 115_497 + .saturating_add(Weight::from_parts(27_385_703, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64)) diff --git a/runtime/devnet/src/config/assets.rs b/runtime/devnet/src/config/assets.rs index bb08be0d..3e5f11b4 100644 --- a/runtime/devnet/src/config/assets.rs +++ b/runtime/devnet/src/config/assets.rs @@ -30,7 +30,7 @@ parameter_types! { parameter_types! { pub NftsPalletFeatures: PalletFeatures = PalletFeatures::all_enabled(); pub const NftsCollectionDeposit: Balance = 10 * UNIT; - pub const NftsCollectionApprovalDeposit: Balance = UNIT / 100; + pub const NftsCollectionApprovalDeposit: Balance = deposit(1, 0); pub const NftsItemDeposit: Balance = UNIT / 100; pub const NftsMetadataDepositBase: Balance = deposit(1, 129); pub const NftsAttributeDepositBase: Balance = deposit(1, 0); diff --git a/runtime/testnet/src/config/assets.rs b/runtime/testnet/src/config/assets.rs index bb08be0d..3e5f11b4 100644 --- a/runtime/testnet/src/config/assets.rs +++ b/runtime/testnet/src/config/assets.rs @@ -30,7 +30,7 @@ parameter_types! { parameter_types! { pub NftsPalletFeatures: PalletFeatures = PalletFeatures::all_enabled(); pub const NftsCollectionDeposit: Balance = 10 * UNIT; - pub const NftsCollectionApprovalDeposit: Balance = UNIT / 100; + pub const NftsCollectionApprovalDeposit: Balance = deposit(1, 0); pub const NftsItemDeposit: Balance = UNIT / 100; pub const NftsMetadataDepositBase: Balance = deposit(1, 129); pub const NftsAttributeDepositBase: Balance = deposit(1, 0);