difftreelog
feat(rmrk) benchmark burn_nft
in: master
3 files changed
pallets/proxy-rmrk-core/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/proxy-rmrk-core/src/benchmarking.rs
+++ b/pallets/proxy-rmrk-core/src/benchmarking.rs
@@ -148,6 +148,35 @@
Ok((root_nft_id, deepest_nft_id))
}
+
+ fn build_wide_tree<T: Config>(
+ &mut self,
+ owner: &T::AccountId,
+ width: u32,
+ ) -> Result<RmrkNftId, DispatchError> {
+ self.build::<T>(owner)?;
+
+ let root_nft_id = self.current_nft_id;
+
+ let root_owner =
+ <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(
+ self.collection_id,
+ root_nft_id,
+ );
+
+ for _ in 0..width {
+ self.build::<T>(owner)?;
+
+ <Pallet<T>>::send(
+ RawOrigin::Signed(owner.clone()).into(),
+ self.collection_id,
+ self.current_nft_id,
+ root_owner.clone(),
+ )?;
+ }
+
+ Ok(root_nft_id)
+ }
}
benchmarks! {
@@ -205,6 +234,23 @@
transferable
)
+ burn_nft {
+ let b in 0..200;
+
+ let caller: T::AccountId = account("caller", 0, SEED);
+ create_max_collection::<T>(&caller)?;
+ let collection_id = 0;
+
+ let mut nft_builder = NftBuilder::new(collection_id);
+ let root_nft_id = nft_builder.build_wide_tree::<T>(&caller, b)?;
+ let max_burns = b + 1;
+ }: _(
+ RawOrigin::Signed(caller),
+ collection_id,
+ root_nft_id,
+ max_burns
+ )
+
send {
let caller: T::AccountId = account("caller", 0, SEED);
create_max_collection::<T>(&caller)?;
pallets/proxy-rmrk-core/src/lib.rsdiffbeforeafterboth400 }400 }401401402 /// burn nft402 /// burn nft403 #[transactional]403 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]404 #[pallet::weight(<SelfWeightOf<T>>::burn_nft(*max_burns))]404 #[transactional]405 pub fn burn_nft(405 pub fn burn_nft(406 origin: OriginFor<T>,406 origin: OriginFor<T>,407 collection_id: RmrkCollectionId,407 collection_id: RmrkCollectionId,pallets/proxy-rmrk-core/src/weights.rsdiffbeforeafterboth--- a/pallets/proxy-rmrk-core/src/weights.rs
+++ b/pallets/proxy-rmrk-core/src/weights.rs
@@ -38,6 +38,7 @@
fn change_collection_issuer() -> Weight;
fn lock_collection() -> Weight;
fn mint_nft() -> Weight;
+ fn burn_nft(b: u32, ) -> Weight;
fn send() -> Weight;
fn accept_nft() -> Weight;
fn reject_nft() -> Weight;
@@ -63,7 +64,7 @@
// Storage: Common CollectionById (r:0 w:1)
// Storage: RmrkCore UniqueCollectionId (r:0 w:1)
fn create_collection() -> Weight {
- (40_456_000 as Weight)
+ (40_837_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(8 as Weight))
}
@@ -76,7 +77,7 @@
// Storage: Nonfungible TokensBurnt (r:0 w:1)
// Storage: Common AdminAmount (r:0 w:1)
fn destroy_collection() -> Weight {
- (43_812_000 as Weight)
+ (44_544_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
}
@@ -84,7 +85,7 @@
// Storage: Common CollectionById (r:1 w:1)
// Storage: Common CollectionProperties (r:1 w:0)
fn change_collection_issuer() -> Weight {
- (22_032_000 as Weight)
+ (22_151_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -94,7 +95,7 @@
// Storage: Nonfungible TokensMinted (r:1 w:0)
// Storage: Nonfungible TokensBurnt (r:1 w:0)
fn lock_collection() -> Weight {
- (23_314_000 as Weight)
+ (23_766_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -107,13 +108,32 @@
// Storage: Nonfungible TokenData (r:0 w:1)
// Storage: Nonfungible Owned (r:0 w:1)
fn mint_nft() -> Weight {
- (40_075_000 as Weight)
+ (40_237_000 as Weight)
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
}
// Storage: RmrkCore UniqueCollectionId (r:1 w:0)
// Storage: Common CollectionProperties (r:1 w:0)
// Storage: Common CollectionById (r:1 w:0)
+ // Storage: Nonfungible TokenData (r:1 w:1)
+ // Storage: Nonfungible TokenChildren (r:1 w:0)
+ // Storage: Nonfungible TokensBurnt (r:1 w:1)
+ // Storage: Nonfungible AccountBalance (r:1 w:1)
+ // Storage: Nonfungible Allowance (r:1 w:0)
+ // Storage: Nonfungible Owned (r:0 w:1)
+ // Storage: Nonfungible TokenProperties (r:0 w:1)
+ fn burn_nft(b: u32, ) -> Weight {
+ (0 as Weight)
+ // Standard Error: 1_023_000
+ .saturating_add((318_424_000 as Weight).saturating_mul(b as Weight))
+ .saturating_add(T::DbWeight::get().reads(9 as Weight))
+ .saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(b as Weight)))
+ .saturating_add(T::DbWeight::get().writes(6 as Weight))
+ .saturating_add(T::DbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))
+ }
+ // Storage: RmrkCore UniqueCollectionId (r:1 w:0)
+ // Storage: Common CollectionProperties (r:1 w:0)
+ // Storage: Common CollectionById (r:1 w:0)
// Storage: Nonfungible TokenData (r:5 w:1)
// Storage: Nonfungible TokenProperties (r:1 w:0)
// Storage: Nonfungible AccountBalance (r:2 w:2)
@@ -121,7 +141,7 @@
// Storage: Nonfungible TokenChildren (r:0 w:1)
// Storage: Nonfungible Owned (r:0 w:2)
fn send() -> Weight {
- (71_474_000 as Weight)
+ (71_055_000 as Weight)
.saturating_add(T::DbWeight::get().reads(12 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
}
@@ -135,7 +155,7 @@
// Storage: Nonfungible TokenChildren (r:0 w:1)
// Storage: Nonfungible Owned (r:0 w:2)
fn accept_nft() -> Weight {
- (79_890_000 as Weight)
+ (79_098_000 as Weight)
.saturating_add(T::DbWeight::get().reads(15 as Weight))
.saturating_add(T::DbWeight::get().writes(7 as Weight))
}
@@ -150,7 +170,7 @@
// Storage: Nonfungible Allowance (r:5 w:0)
// Storage: Nonfungible Owned (r:0 w:5)
fn reject_nft() -> Weight {
- (236_754_000 as Weight)
+ (237_777_000 as Weight)
.saturating_add(T::DbWeight::get().reads(29 as Weight))
.saturating_add(T::DbWeight::get().writes(25 as Weight))
}
@@ -160,7 +180,7 @@
// Storage: Nonfungible TokenProperties (r:1 w:1)
// Storage: Nonfungible TokenData (r:5 w:0)
fn set_property() -> Weight {
- (48_370_000 as Weight)
+ (47_359_000 as Weight)
.saturating_add(T::DbWeight::get().reads(9 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -170,7 +190,7 @@
// Storage: Nonfungible TokenProperties (r:1 w:1)
// Storage: Nonfungible TokenData (r:5 w:0)
fn set_priority() -> Weight {
- (47_128_000 as Weight)
+ (46_537_000 as Weight)
.saturating_add(T::DbWeight::get().reads(9 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -187,7 +207,7 @@
// Storage: Nonfungible Owned (r:0 w:1)
// Storage: Common CollectionPropertyPermissions (r:0 w:1)
fn add_basic_resource() -> Weight {
- (101_501_000 as Weight)
+ (100_939_000 as Weight)
.saturating_add(T::DbWeight::get().reads(16 as Weight))
.saturating_add(T::DbWeight::get().writes(12 as Weight))
}
@@ -204,7 +224,7 @@
// Storage: Nonfungible Owned (r:0 w:1)
// Storage: Common CollectionPropertyPermissions (r:0 w:1)
fn add_composable_resource() -> Weight {
- (103_004_000 as Weight)
+ (101_821_000 as Weight)
.saturating_add(T::DbWeight::get().reads(16 as Weight))
.saturating_add(T::DbWeight::get().writes(12 as Weight))
}
@@ -221,7 +241,7 @@
// Storage: Nonfungible Owned (r:0 w:1)
// Storage: Common CollectionPropertyPermissions (r:0 w:1)
fn add_slot_resource() -> Weight {
- (102_613_000 as Weight)
+ (100_880_000 as Weight)
.saturating_add(T::DbWeight::get().reads(16 as Weight))
.saturating_add(T::DbWeight::get().writes(12 as Weight))
}
@@ -236,7 +256,7 @@
// Storage: Nonfungible Allowance (r:1 w:0)
// Storage: Nonfungible Owned (r:0 w:1)
fn remove_resource() -> Weight {
- (82_084_000 as Weight)
+ (79_831_000 as Weight)
.saturating_add(T::DbWeight::get().reads(16 as Weight))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
}
@@ -246,7 +266,7 @@
// Storage: Nonfungible TokenData (r:5 w:0)
// Storage: Nonfungible TokenProperties (r:2 w:1)
fn accept_resource() -> Weight {
- (56_426_000 as Weight)
+ (54_573_000 as Weight)
.saturating_add(T::DbWeight::get().reads(10 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -261,7 +281,7 @@
// Storage: Nonfungible Allowance (r:1 w:0)
// Storage: Nonfungible Owned (r:0 w:1)
fn accept_resource_removal() -> Weight {
- (85_631_000 as Weight)
+ (83_426_000 as Weight)
.saturating_add(T::DbWeight::get().reads(17 as Weight))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
}
@@ -278,7 +298,7 @@
// Storage: Common CollectionById (r:0 w:1)
// Storage: RmrkCore UniqueCollectionId (r:0 w:1)
fn create_collection() -> Weight {
- (40_456_000 as Weight)
+ (40_837_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(8 as Weight))
}
@@ -291,7 +311,7 @@
// Storage: Nonfungible TokensBurnt (r:0 w:1)
// Storage: Common AdminAmount (r:0 w:1)
fn destroy_collection() -> Weight {
- (43_812_000 as Weight)
+ (44_544_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
}
@@ -299,7 +319,7 @@
// Storage: Common CollectionById (r:1 w:1)
// Storage: Common CollectionProperties (r:1 w:0)
fn change_collection_issuer() -> Weight {
- (22_032_000 as Weight)
+ (22_151_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
@@ -309,7 +329,7 @@
// Storage: Nonfungible TokensMinted (r:1 w:0)
// Storage: Nonfungible TokensBurnt (r:1 w:0)
fn lock_collection() -> Weight {
- (23_314_000 as Weight)
+ (23_766_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
@@ -322,13 +342,32 @@
// Storage: Nonfungible TokenData (r:0 w:1)
// Storage: Nonfungible Owned (r:0 w:1)
fn mint_nft() -> Weight {
- (40_075_000 as Weight)
+ (40_237_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
}
// Storage: RmrkCore UniqueCollectionId (r:1 w:0)
// Storage: Common CollectionProperties (r:1 w:0)
// Storage: Common CollectionById (r:1 w:0)
+ // Storage: Nonfungible TokenData (r:1 w:1)
+ // Storage: Nonfungible TokenChildren (r:1 w:0)
+ // Storage: Nonfungible TokensBurnt (r:1 w:1)
+ // Storage: Nonfungible AccountBalance (r:1 w:1)
+ // Storage: Nonfungible Allowance (r:1 w:0)
+ // Storage: Nonfungible Owned (r:0 w:1)
+ // Storage: Nonfungible TokenProperties (r:0 w:1)
+ fn burn_nft(b: u32, ) -> Weight {
+ (0 as Weight)
+ // Standard Error: 1_023_000
+ .saturating_add((318_424_000 as Weight).saturating_mul(b as Weight))
+ .saturating_add(RocksDbWeight::get().reads(9 as Weight))
+ .saturating_add(RocksDbWeight::get().reads((4 as Weight).saturating_mul(b as Weight)))
+ .saturating_add(RocksDbWeight::get().writes(6 as Weight))
+ .saturating_add(RocksDbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))
+ }
+ // Storage: RmrkCore UniqueCollectionId (r:1 w:0)
+ // Storage: Common CollectionProperties (r:1 w:0)
+ // Storage: Common CollectionById (r:1 w:0)
// Storage: Nonfungible TokenData (r:5 w:1)
// Storage: Nonfungible TokenProperties (r:1 w:0)
// Storage: Nonfungible AccountBalance (r:2 w:2)
@@ -336,7 +375,7 @@
// Storage: Nonfungible TokenChildren (r:0 w:1)
// Storage: Nonfungible Owned (r:0 w:2)
fn send() -> Weight {
- (71_474_000 as Weight)
+ (71_055_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(12 as Weight))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
}
@@ -350,7 +389,7 @@
// Storage: Nonfungible TokenChildren (r:0 w:1)
// Storage: Nonfungible Owned (r:0 w:2)
fn accept_nft() -> Weight {
- (79_890_000 as Weight)
+ (79_098_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(15 as Weight))
.saturating_add(RocksDbWeight::get().writes(7 as Weight))
}
@@ -365,7 +404,7 @@
// Storage: Nonfungible Allowance (r:5 w:0)
// Storage: Nonfungible Owned (r:0 w:5)
fn reject_nft() -> Weight {
- (236_754_000 as Weight)
+ (237_777_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(29 as Weight))
.saturating_add(RocksDbWeight::get().writes(25 as Weight))
}
@@ -375,7 +414,7 @@
// Storage: Nonfungible TokenProperties (r:1 w:1)
// Storage: Nonfungible TokenData (r:5 w:0)
fn set_property() -> Weight {
- (48_370_000 as Weight)
+ (47_359_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(9 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
@@ -385,7 +424,7 @@
// Storage: Nonfungible TokenProperties (r:1 w:1)
// Storage: Nonfungible TokenData (r:5 w:0)
fn set_priority() -> Weight {
- (47_128_000 as Weight)
+ (46_537_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(9 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
@@ -402,7 +441,7 @@
// Storage: Nonfungible Owned (r:0 w:1)
// Storage: Common CollectionPropertyPermissions (r:0 w:1)
fn add_basic_resource() -> Weight {
- (101_501_000 as Weight)
+ (100_939_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(16 as Weight))
.saturating_add(RocksDbWeight::get().writes(12 as Weight))
}
@@ -419,7 +458,7 @@
// Storage: Nonfungible Owned (r:0 w:1)
// Storage: Common CollectionPropertyPermissions (r:0 w:1)
fn add_composable_resource() -> Weight {
- (103_004_000 as Weight)
+ (101_821_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(16 as Weight))
.saturating_add(RocksDbWeight::get().writes(12 as Weight))
}
@@ -436,7 +475,7 @@
// Storage: Nonfungible Owned (r:0 w:1)
// Storage: Common CollectionPropertyPermissions (r:0 w:1)
fn add_slot_resource() -> Weight {
- (102_613_000 as Weight)
+ (100_880_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(16 as Weight))
.saturating_add(RocksDbWeight::get().writes(12 as Weight))
}
@@ -451,7 +490,7 @@
// Storage: Nonfungible Allowance (r:1 w:0)
// Storage: Nonfungible Owned (r:0 w:1)
fn remove_resource() -> Weight {
- (82_084_000 as Weight)
+ (79_831_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(16 as Weight))
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
}
@@ -461,7 +500,7 @@
// Storage: Nonfungible TokenData (r:5 w:0)
// Storage: Nonfungible TokenProperties (r:2 w:1)
fn accept_resource() -> Weight {
- (56_426_000 as Weight)
+ (54_573_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(10 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
@@ -476,7 +515,7 @@
// Storage: Nonfungible Allowance (r:1 w:0)
// Storage: Nonfungible Owned (r:0 w:1)
fn accept_resource_removal() -> Weight {
- (85_631_000 as Weight)
+ (83_426_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(17 as Weight))
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
}