difftreelog
minor: add bechmarks for RFT collection & token properties
in: master
3 files changed
pallets/refungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/refungible/src/benchmarking.rs
+++ b/pallets/refungible/src/benchmarking.rs
@@ -18,9 +18,9 @@
use crate::{Pallet, Config, RefungibleHandle};
use sp_std::prelude::*;
-use pallet_common::benchmarking::{create_collection_raw, create_data};
+use pallet_common::benchmarking::{create_collection_raw, property_key, property_value, create_data};
use frame_benchmarking::{benchmarks, account};
-use up_data_structs::{CollectionMode, MAX_ITEMS_PER_BATCH, CUSTOM_DATA_LIMIT, budget::Unlimited};
+use up_data_structs::{CollectionMode, MAX_ITEMS_PER_BATCH, MAX_PROPERTIES_PER_ITEM, CUSTOM_DATA_LIMIT, budget::Unlimited};
use pallet_common::bench_init;
use core::convert::TryInto;
use core::iter::IntoIterator;
@@ -205,6 +205,68 @@
<Pallet<T>>::set_allowance(&collection, &sender, &burner, item, 200)?;
}: {<Pallet<T>>::burn_from(&collection, &burner, &sender, item, 200, &Unlimited)?}
+ set_token_property_permissions {
+ let b in 0..MAX_PROPERTIES_PER_ITEM;
+ bench_init!{
+ owner: sub; collection: collection(owner);
+ owner: cross_from_sub;
+ };
+ let perms = (0..b).map(|k| PropertyKeyPermission {
+ key: property_key(k as usize),
+ permission: PropertyPermission {
+ mutable: false,
+ collection_admin: false,
+ token_owner: false,
+ },
+ }).collect::<Vec<_>>();
+ }: {<Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?}
+
+ set_token_properties {
+ let b in 0..MAX_PROPERTIES_PER_ITEM;
+ bench_init!{
+ owner: sub; collection: collection(owner);
+ owner: cross_from_sub;
+ };
+ let perms = (0..b).map(|k| PropertyKeyPermission {
+ key: property_key(k as usize),
+ permission: PropertyPermission {
+ mutable: false,
+ collection_admin: true,
+ token_owner: true,
+ },
+ }).collect::<Vec<_>>();
+ <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
+ let props = (0..b).map(|k| Property {
+ key: property_key(k as usize),
+ value: property_value(),
+ }).collect::<Vec<_>>();
+ let item = create_max_item(&collection, &owner, [(owner.clone(), 200)])?;
+ }: {<Pallet<T>>::set_token_properties(&collection, &owner, item, props.into_iter(), false, &Unlimited)?}
+
+ delete_token_properties {
+ let b in 0..MAX_PROPERTIES_PER_ITEM;
+ bench_init!{
+ owner: sub; collection: collection(owner);
+ owner: cross_from_sub;
+ };
+ let perms = (0..b).map(|k| PropertyKeyPermission {
+ key: property_key(k as usize),
+ permission: PropertyPermission {
+ mutable: true,
+ collection_admin: true,
+ token_owner: true,
+ },
+ }).collect::<Vec<_>>();
+ <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
+ let props = (0..b).map(|k| Property {
+ key: property_key(k as usize),
+ value: property_value(),
+ }).collect::<Vec<_>>();
+ let item = create_max_item(&collection, &owner, [(owner.clone(), 200)])?;
+ <Pallet<T>>::set_token_properties(&collection, &owner, item, props.into_iter(), false, &Unlimited)?;
+ let to_delete = (0..b).map(|k| property_key(k as usize)).collect::<Vec<_>>();
+ }: {<Pallet<T>>::delete_token_properties(&collection, &owner, item, to_delete.into_iter(), &Unlimited)?}
+
repartition_item {
bench_init!{
owner: sub; collection: collection(owner);
pallets/refungible/src/common.rsdiffbeforeafterboth--- a/pallets/refungible/src/common.rs
+++ b/pallets/refungible/src/common.rs
@@ -22,7 +22,7 @@
CollectionId, TokenId, CreateItemExData, CreateRefungibleExData, budget::Budget, Property,
PropertyKey, PropertyValue, PropertyKeyPermission, CreateItemData,
};
-use pallet_common::{CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight};
+use pallet_common::{CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight, weights::WeightInfo as _};
use pallet_structure::Error as StructureError;
use sp_runtime::{DispatchError};
use sp_std::{vec::Vec, vec};
@@ -67,29 +67,24 @@
max_weight_of!(burn_item_partial(), burn_item_fully())
}
- fn set_collection_properties(_amount: u32) -> Weight {
- // Error
- 0
+ fn set_collection_properties(amount: u32) -> Weight {
+ <pallet_common::SelfWeightOf<T>>::set_collection_properties(amount)
}
- fn delete_collection_properties(_amount: u32) -> Weight {
- // Error
- 0
+ fn delete_collection_properties(amount: u32) -> Weight {
+ <pallet_common::SelfWeightOf<T>>::delete_collection_properties(amount)
}
- fn set_token_properties(_amount: u32) -> Weight {
- // Error
- 0
+ fn set_token_properties(amount: u32) -> Weight {
+ <SelfWeightOf<T>>::set_token_properties(amount)
}
- fn delete_token_properties(_amount: u32) -> Weight {
- // Error
- 0
+ fn delete_token_properties(amount: u32) -> Weight {
+ <SelfWeightOf<T>>::delete_token_properties(amount)
}
- fn set_token_property_permissions(_amount: u32) -> Weight {
- // Error
- 0
+ fn set_token_property_permissions(amount: u32) -> Weight {
+ <SelfWeightOf<T>>::set_token_property_permissions(amount)
}
fn transfer() -> Weight {
pallets/refungible/src/weights.rsdiffbeforeafterboth1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_refungible4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2022-06-27, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 102489// Executed Command:10// target/release/unique-collator11// benchmark12// pallet13// --pallet14// pallet-refungible15// --wasm-execution16// compiled17// --extrinsic18// *19// --template20// .maintain/frame-weight-template.hbs21// --steps=5022// --repeat=8023// --heap-pages=409624// --output=./pallets/refungible/src/weights.rs2526#![cfg_attr(rustfmt, rustfmt_skip)]27#![allow(unused_parens)]28#![allow(unused_imports)]29#![allow(clippy::unnecessary_cast)]3031use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};32use sp_std::marker::PhantomData;3334/// Weight functions needed for pallet_refungible.35pub trait WeightInfo {36 fn create_item() -> Weight;37 fn create_multiple_items(b: u32, ) -> Weight;38 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight;39 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight;40 fn burn_item_partial() -> Weight;41 fn burn_item_fully() -> Weight;42 fn transfer_normal() -> Weight;43 fn transfer_creating() -> Weight;44 fn transfer_removing() -> Weight;45 fn transfer_creating_removing() -> Weight;46 fn approve() -> Weight;47 fn transfer_from_normal() -> Weight;48 fn transfer_from_creating() -> Weight;49 fn transfer_from_removing() -> Weight;50 fn transfer_from_creating_removing() -> Weight;51 fn burn_from() -> Weight;52 fn repartition_item() -> Weight;53}5455/// Weights for pallet_refungible using the Substrate node and recommended hardware.56pub struct SubstrateWeight<T>(PhantomData<T>);57impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {58 // Storage: Refungible TokensMinted (r:1 w:1)59 // Storage: Refungible AccountBalance (r:1 w:1)60 // Storage: Refungible Balance (r:0 w:1)61 // Storage: Refungible TotalSupply (r:0 w:1)62 // Storage: Refungible TokenData (r:0 w:1)63 // Storage: Refungible Owned (r:0 w:1)64 fn create_item() -> Weight {65 (17_553_000 as Weight)66 .saturating_add(T::DbWeight::get().reads(2 as Weight))67 .saturating_add(T::DbWeight::get().writes(6 as Weight))68 }69 // Storage: Refungible TokensMinted (r:1 w:1)70 // Storage: Refungible AccountBalance (r:1 w:1)71 // Storage: Refungible Balance (r:0 w:4)72 // Storage: Refungible TotalSupply (r:0 w:4)73 // Storage: Refungible TokenData (r:0 w:4)74 // Storage: Refungible Owned (r:0 w:4)75 fn create_multiple_items(b: u32, ) -> Weight {76 (10_654_000 as Weight)77 // Standard Error: 1_00078 .saturating_add((5_114_000 as Weight).saturating_mul(b as Weight))79 .saturating_add(T::DbWeight::get().reads(2 as Weight))80 .saturating_add(T::DbWeight::get().writes(2 as Weight))81 .saturating_add(T::DbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))82 }83 // Storage: Refungible TokensMinted (r:1 w:1)84 // Storage: Refungible AccountBalance (r:4 w:4)85 // Storage: Refungible Balance (r:0 w:4)86 // Storage: Refungible TotalSupply (r:0 w:4)87 // Storage: Refungible TokenData (r:0 w:4)88 // Storage: Refungible Owned (r:0 w:4)89 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {90 (3_587_000 as Weight)91 // Standard Error: 2_00092 .saturating_add((7_931_000 as Weight).saturating_mul(b as Weight))93 .saturating_add(T::DbWeight::get().reads(1 as Weight))94 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))95 .saturating_add(T::DbWeight::get().writes(1 as Weight))96 .saturating_add(T::DbWeight::get().writes((5 as Weight).saturating_mul(b as Weight)))97 }98 // Storage: Refungible TokensMinted (r:1 w:1)99 // Storage: Refungible TotalSupply (r:0 w:1)100 // Storage: Refungible TokenData (r:0 w:1)101 // Storage: Refungible AccountBalance (r:4 w:4)102 // Storage: Refungible Balance (r:0 w:4)103 // Storage: Refungible Owned (r:0 w:4)104 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {105 (1_980_000 as Weight)106 // Standard Error: 2_000107 .saturating_add((6_305_000 as Weight).saturating_mul(b as Weight))108 .saturating_add(T::DbWeight::get().reads(1 as Weight))109 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))110 .saturating_add(T::DbWeight::get().writes(3 as Weight))111 .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))112 }113 // Storage: Refungible TotalSupply (r:1 w:1)114 // Storage: Refungible Balance (r:1 w:1)115 // Storage: Refungible AccountBalance (r:1 w:1)116 // Storage: Refungible Owned (r:0 w:1)117 fn burn_item_partial() -> Weight {118 (21_010_000 as Weight)119 .saturating_add(T::DbWeight::get().reads(3 as Weight))120 .saturating_add(T::DbWeight::get().writes(4 as Weight))121 }122 // Storage: Refungible TotalSupply (r:1 w:1)123 // Storage: Refungible Balance (r:1 w:1)124 // Storage: Refungible AccountBalance (r:1 w:1)125 // Storage: Refungible TokensBurnt (r:1 w:1)126 // Storage: Refungible TokenData (r:0 w:1)127 // Storage: Refungible Owned (r:0 w:1)128 fn burn_item_fully() -> Weight {129 (28_413_000 as Weight)130 .saturating_add(T::DbWeight::get().reads(4 as Weight))131 .saturating_add(T::DbWeight::get().writes(6 as Weight))132 }133 // Storage: Refungible Balance (r:2 w:2)134 fn transfer_normal() -> Weight {135 (17_513_000 as Weight)136 .saturating_add(T::DbWeight::get().reads(2 as Weight))137 .saturating_add(T::DbWeight::get().writes(2 as Weight))138 }139 // Storage: Refungible Balance (r:2 w:2)140 // Storage: Refungible AccountBalance (r:1 w:1)141 // Storage: Refungible Owned (r:0 w:1)142 fn transfer_creating() -> Weight {143 (20_469_000 as Weight)144 .saturating_add(T::DbWeight::get().reads(3 as Weight))145 .saturating_add(T::DbWeight::get().writes(4 as Weight))146 }147 // Storage: Refungible Balance (r:2 w:2)148 // Storage: Refungible AccountBalance (r:1 w:1)149 // Storage: Refungible Owned (r:0 w:1)150 fn transfer_removing() -> Weight {151 (22_472_000 as Weight)152 .saturating_add(T::DbWeight::get().reads(3 as Weight))153 .saturating_add(T::DbWeight::get().writes(4 as Weight))154 }155 // Storage: Refungible Balance (r:2 w:2)156 // Storage: Refungible AccountBalance (r:2 w:2)157 // Storage: Refungible Owned (r:0 w:2)158 fn transfer_creating_removing() -> Weight {159 (24_866_000 as Weight)160 .saturating_add(T::DbWeight::get().reads(4 as Weight))161 .saturating_add(T::DbWeight::get().writes(6 as Weight))162 }163 // Storage: Refungible Balance (r:1 w:0)164 // Storage: Refungible Allowance (r:0 w:1)165 fn approve() -> Weight {166 (13_475_000 as Weight)167 .saturating_add(T::DbWeight::get().reads(1 as Weight))168 .saturating_add(T::DbWeight::get().writes(1 as Weight))169 }170 // Storage: Refungible Allowance (r:1 w:1)171 // Storage: Refungible Balance (r:2 w:2)172 fn transfer_from_normal() -> Weight {173 (24_707_000 as Weight)174 .saturating_add(T::DbWeight::get().reads(3 as Weight))175 .saturating_add(T::DbWeight::get().writes(3 as Weight))176 }177 // Storage: Refungible Allowance (r:1 w:1)178 // Storage: Refungible Balance (r:2 w:2)179 // Storage: Refungible AccountBalance (r:1 w:1)180 // Storage: Refungible Owned (r:0 w:1)181 fn transfer_from_creating() -> Weight {182 (27_812_000 as Weight)183 .saturating_add(T::DbWeight::get().reads(4 as Weight))184 .saturating_add(T::DbWeight::get().writes(5 as Weight))185 }186 // Storage: Refungible Allowance (r:1 w:1)187 // Storage: Refungible Balance (r:2 w:2)188 // Storage: Refungible AccountBalance (r:1 w:1)189 // Storage: Refungible Owned (r:0 w:1)190 fn transfer_from_removing() -> Weight {191 (29_966_000 as Weight)192 .saturating_add(T::DbWeight::get().reads(4 as Weight))193 .saturating_add(T::DbWeight::get().writes(5 as Weight))194 }195 // Storage: Refungible Allowance (r:1 w:1)196 // Storage: Refungible Balance (r:2 w:2)197 // Storage: Refungible AccountBalance (r:2 w:2)198 // Storage: Refungible Owned (r:0 w:2)199 fn transfer_from_creating_removing() -> Weight {200 (31_660_000 as Weight)201 .saturating_add(T::DbWeight::get().reads(5 as Weight))202 .saturating_add(T::DbWeight::get().writes(7 as Weight))203 }204 // Storage: Refungible Allowance (r:1 w:1)205 // Storage: Refungible TotalSupply (r:1 w:1)206 // Storage: Refungible Balance (r:1 w:1)207 // Storage: Refungible AccountBalance (r:1 w:1)208 // Storage: Refungible TokensBurnt (r:1 w:1)209 // Storage: Refungible TokenData (r:0 w:1)210 // Storage: Refungible Owned (r:0 w:1)211 fn burn_from() -> Weight {212 (36_248_000 as Weight)213 .saturating_add(T::DbWeight::get().reads(5 as Weight))214 .saturating_add(T::DbWeight::get().writes(7 as Weight))215 }216 // Storage: Refungible TotalSupply (r:1 w:1)217 // Storage: Refungible Balance (r:1 w:1)218 fn repartition_item() -> Weight {219 (8_226_000 as Weight)220 .saturating_add(T::DbWeight::get().reads(2 as Weight))221 .saturating_add(T::DbWeight::get().writes(2 as Weight))222 }223}224225// For backwards compatibility and tests226impl WeightInfo for () {227 // Storage: Refungible TokensMinted (r:1 w:1)228 // Storage: Refungible AccountBalance (r:1 w:1)229 // Storage: Refungible Balance (r:0 w:1)230 // Storage: Refungible TotalSupply (r:0 w:1)231 // Storage: Refungible TokenData (r:0 w:1)232 // Storage: Refungible Owned (r:0 w:1)233 fn create_item() -> Weight {234 (17_553_000 as Weight)235 .saturating_add(RocksDbWeight::get().reads(2 as Weight))236 .saturating_add(RocksDbWeight::get().writes(6 as Weight))237 }238 // Storage: Refungible TokensMinted (r:1 w:1)239 // Storage: Refungible AccountBalance (r:1 w:1)240 // Storage: Refungible Balance (r:0 w:4)241 // Storage: Refungible TotalSupply (r:0 w:4)242 // Storage: Refungible TokenData (r:0 w:4)243 // Storage: Refungible Owned (r:0 w:4)244 fn create_multiple_items(b: u32, ) -> Weight {245 (10_654_000 as Weight)246 // Standard Error: 1_000247 .saturating_add((5_114_000 as Weight).saturating_mul(b as Weight))248 .saturating_add(RocksDbWeight::get().reads(2 as Weight))249 .saturating_add(RocksDbWeight::get().writes(2 as Weight))250 .saturating_add(RocksDbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))251 }252 // Storage: Refungible TokensMinted (r:1 w:1)253 // Storage: Refungible AccountBalance (r:4 w:4)254 // Storage: Refungible Balance (r:0 w:4)255 // Storage: Refungible TotalSupply (r:0 w:4)256 // Storage: Refungible TokenData (r:0 w:4)257 // Storage: Refungible Owned (r:0 w:4)258 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {259 (3_587_000 as Weight)260 // Standard Error: 2_000261 .saturating_add((7_931_000 as Weight).saturating_mul(b as Weight))262 .saturating_add(RocksDbWeight::get().reads(1 as Weight))263 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))264 .saturating_add(RocksDbWeight::get().writes(1 as Weight))265 .saturating_add(RocksDbWeight::get().writes((5 as Weight).saturating_mul(b as Weight)))266 }267 // Storage: Refungible TokensMinted (r:1 w:1)268 // Storage: Refungible TotalSupply (r:0 w:1)269 // Storage: Refungible TokenData (r:0 w:1)270 // Storage: Refungible AccountBalance (r:4 w:4)271 // Storage: Refungible Balance (r:0 w:4)272 // Storage: Refungible Owned (r:0 w:4)273 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {274 (1_980_000 as Weight)275 // Standard Error: 2_000276 .saturating_add((6_305_000 as Weight).saturating_mul(b as Weight))277 .saturating_add(RocksDbWeight::get().reads(1 as Weight))278 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))279 .saturating_add(RocksDbWeight::get().writes(3 as Weight))280 .saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))281 }282 // Storage: Refungible TotalSupply (r:1 w:1)283 // Storage: Refungible Balance (r:1 w:1)284 // Storage: Refungible AccountBalance (r:1 w:1)285 // Storage: Refungible Owned (r:0 w:1)286 fn burn_item_partial() -> Weight {287 (21_010_000 as Weight)288 .saturating_add(RocksDbWeight::get().reads(3 as Weight))289 .saturating_add(RocksDbWeight::get().writes(4 as Weight))290 }291 // Storage: Refungible TotalSupply (r:1 w:1)292 // Storage: Refungible Balance (r:1 w:1)293 // Storage: Refungible AccountBalance (r:1 w:1)294 // Storage: Refungible TokensBurnt (r:1 w:1)295 // Storage: Refungible TokenData (r:0 w:1)296 // Storage: Refungible Owned (r:0 w:1)297 fn burn_item_fully() -> Weight {298 (28_413_000 as Weight)299 .saturating_add(RocksDbWeight::get().reads(4 as Weight))300 .saturating_add(RocksDbWeight::get().writes(6 as Weight))301 }302 // Storage: Refungible Balance (r:2 w:2)303 fn transfer_normal() -> Weight {304 (17_513_000 as Weight)305 .saturating_add(RocksDbWeight::get().reads(2 as Weight))306 .saturating_add(RocksDbWeight::get().writes(2 as Weight))307 }308 // Storage: Refungible Balance (r:2 w:2)309 // Storage: Refungible AccountBalance (r:1 w:1)310 // Storage: Refungible Owned (r:0 w:1)311 fn transfer_creating() -> Weight {312 (20_469_000 as Weight)313 .saturating_add(RocksDbWeight::get().reads(3 as Weight))314 .saturating_add(RocksDbWeight::get().writes(4 as Weight))315 }316 // Storage: Refungible Balance (r:2 w:2)317 // Storage: Refungible AccountBalance (r:1 w:1)318 // Storage: Refungible Owned (r:0 w:1)319 fn transfer_removing() -> Weight {320 (22_472_000 as Weight)321 .saturating_add(RocksDbWeight::get().reads(3 as Weight))322 .saturating_add(RocksDbWeight::get().writes(4 as Weight))323 }324 // Storage: Refungible Balance (r:2 w:2)325 // Storage: Refungible AccountBalance (r:2 w:2)326 // Storage: Refungible Owned (r:0 w:2)327 fn transfer_creating_removing() -> Weight {328 (24_866_000 as Weight)329 .saturating_add(RocksDbWeight::get().reads(4 as Weight))330 .saturating_add(RocksDbWeight::get().writes(6 as Weight))331 }332 // Storage: Refungible Balance (r:1 w:0)333 // Storage: Refungible Allowance (r:0 w:1)334 fn approve() -> Weight {335 (13_475_000 as Weight)336 .saturating_add(RocksDbWeight::get().reads(1 as Weight))337 .saturating_add(RocksDbWeight::get().writes(1 as Weight))338 }339 // Storage: Refungible Allowance (r:1 w:1)340 // Storage: Refungible Balance (r:2 w:2)341 fn transfer_from_normal() -> Weight {342 (24_707_000 as Weight)343 .saturating_add(RocksDbWeight::get().reads(3 as Weight))344 .saturating_add(RocksDbWeight::get().writes(3 as Weight))345 }346 // Storage: Refungible Allowance (r:1 w:1)347 // Storage: Refungible Balance (r:2 w:2)348 // Storage: Refungible AccountBalance (r:1 w:1)349 // Storage: Refungible Owned (r:0 w:1)350 fn transfer_from_creating() -> Weight {351 (27_812_000 as Weight)352 .saturating_add(RocksDbWeight::get().reads(4 as Weight))353 .saturating_add(RocksDbWeight::get().writes(5 as Weight))354 }355 // Storage: Refungible Allowance (r:1 w:1)356 // Storage: Refungible Balance (r:2 w:2)357 // Storage: Refungible AccountBalance (r:1 w:1)358 // Storage: Refungible Owned (r:0 w:1)359 fn transfer_from_removing() -> Weight {360 (29_966_000 as Weight)361 .saturating_add(RocksDbWeight::get().reads(4 as Weight))362 .saturating_add(RocksDbWeight::get().writes(5 as Weight))363 }364 // Storage: Refungible Allowance (r:1 w:1)365 // Storage: Refungible Balance (r:2 w:2)366 // Storage: Refungible AccountBalance (r:2 w:2)367 // Storage: Refungible Owned (r:0 w:2)368 fn transfer_from_creating_removing() -> Weight {369 (31_660_000 as Weight)370 .saturating_add(RocksDbWeight::get().reads(5 as Weight))371 .saturating_add(RocksDbWeight::get().writes(7 as Weight))372 }373 // Storage: Refungible Allowance (r:1 w:1)374 // Storage: Refungible TotalSupply (r:1 w:1)375 // Storage: Refungible Balance (r:1 w:1)376 // Storage: Refungible AccountBalance (r:1 w:1)377 // Storage: Refungible TokensBurnt (r:1 w:1)378 // Storage: Refungible TokenData (r:0 w:1)379 // Storage: Refungible Owned (r:0 w:1)380 fn burn_from() -> Weight {381 (36_248_000 as Weight)382 .saturating_add(RocksDbWeight::get().reads(5 as Weight))383 .saturating_add(RocksDbWeight::get().writes(7 as Weight))384 }385 // Storage: Refungible TotalSupply (r:1 w:1)386 // Storage: Refungible Balance (r:1 w:1)387 fn repartition_item() -> Weight {388 (8_226_000 as Weight)389 .saturating_add(RocksDbWeight::get().reads(2 as Weight))390 .saturating_add(RocksDbWeight::get().writes(2 as Weight))391 }392}1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_refungible4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2022-07-20, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 102489// Executed Command:10// target/release/unique-collator11// benchmark12// pallet13// --pallet14// pallet-refungible15// --wasm-execution16// compiled17// --extrinsic18// *19// --template20// .maintain/frame-weight-template.hbs21// --steps=5022// --repeat=8023// --heap-pages=409624// --output=./pallets/refungible/src/weights.rs2526#![cfg_attr(rustfmt, rustfmt_skip)]27#![allow(unused_parens)]28#![allow(unused_imports)]29#![allow(clippy::unnecessary_cast)]3031use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};32use sp_std::marker::PhantomData;3334/// Weight functions needed for pallet_refungible.35pub trait WeightInfo {36 fn create_item() -> Weight;37 fn create_multiple_items(b: u32, ) -> Weight;38 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight;39 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight;40 fn burn_item_partial() -> Weight;41 fn burn_item_fully() -> Weight;42 fn transfer_normal() -> Weight;43 fn transfer_creating() -> Weight;44 fn transfer_removing() -> Weight;45 fn transfer_creating_removing() -> Weight;46 fn approve() -> Weight;47 fn transfer_from_normal() -> Weight;48 fn transfer_from_creating() -> Weight;49 fn transfer_from_removing() -> Weight;50 fn transfer_from_creating_removing() -> Weight;51 fn burn_from() -> Weight;52 fn set_token_property_permissions(b: u32, ) -> Weight;53 fn set_token_properties(b: u32, ) -> Weight;54 fn delete_token_properties(b: u32, ) -> Weight;55 fn repartition_item() -> Weight;56}5758/// Weights for pallet_refungible using the Substrate node and recommended hardware.59pub struct SubstrateWeight<T>(PhantomData<T>);60impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {61 // Storage: Refungible TokensMinted (r:1 w:1)62 // Storage: Refungible AccountBalance (r:1 w:1)63 // Storage: Refungible Balance (r:0 w:1)64 // Storage: Refungible TotalSupply (r:0 w:1)65 // Storage: Refungible TokenData (r:0 w:1)66 // Storage: Refungible Owned (r:0 w:1)67 fn create_item() -> Weight {68 (21_310_000 as Weight)69 .saturating_add(T::DbWeight::get().reads(2 as Weight))70 .saturating_add(T::DbWeight::get().writes(6 as Weight))71 }72 // Storage: Refungible TokensMinted (r:1 w:1)73 // Storage: Refungible AccountBalance (r:1 w:1)74 // Storage: Refungible Balance (r:0 w:4)75 // Storage: Refungible TotalSupply (r:0 w:4)76 // Storage: Refungible TokenData (r:0 w:4)77 // Storage: Refungible Owned (r:0 w:4)78 fn create_multiple_items(b: u32, ) -> Weight {79 (9_552_000 as Weight)80 // Standard Error: 2_00081 .saturating_add((7_056_000 as Weight).saturating_mul(b as Weight))82 .saturating_add(T::DbWeight::get().reads(2 as Weight))83 .saturating_add(T::DbWeight::get().writes(2 as Weight))84 .saturating_add(T::DbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))85 }86 // Storage: Refungible TokensMinted (r:1 w:1)87 // Storage: Refungible AccountBalance (r:4 w:4)88 // Storage: Refungible Balance (r:0 w:4)89 // Storage: Refungible TotalSupply (r:0 w:4)90 // Storage: Refungible TokenData (r:0 w:4)91 // Storage: Refungible Owned (r:0 w:4)92 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {93 (4_857_000 as Weight)94 // Standard Error: 2_00095 .saturating_add((9_838_000 as Weight).saturating_mul(b as Weight))96 .saturating_add(T::DbWeight::get().reads(1 as Weight))97 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))98 .saturating_add(T::DbWeight::get().writes(1 as Weight))99 .saturating_add(T::DbWeight::get().writes((5 as Weight).saturating_mul(b as Weight)))100 }101 // Storage: Refungible TokensMinted (r:1 w:1)102 // Storage: Refungible TotalSupply (r:0 w:1)103 // Storage: Refungible TokenData (r:0 w:1)104 // Storage: Refungible AccountBalance (r:4 w:4)105 // Storage: Refungible Balance (r:0 w:4)106 // Storage: Refungible Owned (r:0 w:4)107 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {108 (11_335_000 as Weight)109 // Standard Error: 2_000110 .saturating_add((6_784_000 as Weight).saturating_mul(b as Weight))111 .saturating_add(T::DbWeight::get().reads(1 as Weight))112 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))113 .saturating_add(T::DbWeight::get().writes(3 as Weight))114 .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))115 }116 // Storage: Refungible TotalSupply (r:1 w:1)117 // Storage: Refungible Balance (r:1 w:1)118 // Storage: Refungible AccountBalance (r:1 w:1)119 // Storage: Refungible Owned (r:0 w:1)120 fn burn_item_partial() -> Weight {121 (21_239_000 as Weight)122 .saturating_add(T::DbWeight::get().reads(3 as Weight))123 .saturating_add(T::DbWeight::get().writes(4 as Weight))124 }125 // Storage: Refungible TotalSupply (r:1 w:1)126 // Storage: Refungible Balance (r:1 w:1)127 // Storage: Refungible AccountBalance (r:1 w:1)128 // Storage: Refungible TokensBurnt (r:1 w:1)129 // Storage: Refungible TokenData (r:0 w:1)130 // Storage: Refungible Owned (r:0 w:1)131 // Storage: Refungible TokenProperties (r:0 w:1)132 fn burn_item_fully() -> Weight {133 (29_426_000 as Weight)134 .saturating_add(T::DbWeight::get().reads(4 as Weight))135 .saturating_add(T::DbWeight::get().writes(7 as Weight))136 }137 // Storage: Refungible Balance (r:2 w:2)138 fn transfer_normal() -> Weight {139 (17_743_000 as Weight)140 .saturating_add(T::DbWeight::get().reads(2 as Weight))141 .saturating_add(T::DbWeight::get().writes(2 as Weight))142 }143 // Storage: Refungible Balance (r:2 w:2)144 // Storage: Refungible AccountBalance (r:1 w:1)145 // Storage: Refungible Owned (r:0 w:1)146 fn transfer_creating() -> Weight {147 (20_699_000 as Weight)148 .saturating_add(T::DbWeight::get().reads(3 as Weight))149 .saturating_add(T::DbWeight::get().writes(4 as Weight))150 }151 // Storage: Refungible Balance (r:2 w:2)152 // Storage: Refungible AccountBalance (r:1 w:1)153 // Storage: Refungible Owned (r:0 w:1)154 fn transfer_removing() -> Weight {155 (22_833_000 as Weight)156 .saturating_add(T::DbWeight::get().reads(3 as Weight))157 .saturating_add(T::DbWeight::get().writes(4 as Weight))158 }159 // Storage: Refungible Balance (r:2 w:2)160 // Storage: Refungible AccountBalance (r:2 w:2)161 // Storage: Refungible Owned (r:0 w:2)162 fn transfer_creating_removing() -> Weight {163 (24_936_000 as Weight)164 .saturating_add(T::DbWeight::get().reads(4 as Weight))165 .saturating_add(T::DbWeight::get().writes(6 as Weight))166 }167 // Storage: Refungible Balance (r:1 w:0)168 // Storage: Refungible Allowance (r:0 w:1)169 fn approve() -> Weight {170 (13_446_000 as Weight)171 .saturating_add(T::DbWeight::get().reads(1 as Weight))172 .saturating_add(T::DbWeight::get().writes(1 as Weight))173 }174 // Storage: Refungible Allowance (r:1 w:1)175 // Storage: Refungible Balance (r:2 w:2)176 fn transfer_from_normal() -> Weight {177 (24_777_000 as Weight)178 .saturating_add(T::DbWeight::get().reads(3 as Weight))179 .saturating_add(T::DbWeight::get().writes(3 as Weight))180 }181 // Storage: Refungible Allowance (r:1 w:1)182 // Storage: Refungible Balance (r:2 w:2)183 // Storage: Refungible AccountBalance (r:1 w:1)184 // Storage: Refungible Owned (r:0 w:1)185 fn transfer_from_creating() -> Weight {186 (28_483_000 as Weight)187 .saturating_add(T::DbWeight::get().reads(4 as Weight))188 .saturating_add(T::DbWeight::get().writes(5 as Weight))189 }190 // Storage: Refungible Allowance (r:1 w:1)191 // Storage: Refungible Balance (r:2 w:2)192 // Storage: Refungible AccountBalance (r:1 w:1)193 // Storage: Refungible Owned (r:0 w:1)194 fn transfer_from_removing() -> Weight {195 (29_896_000 as Weight)196 .saturating_add(T::DbWeight::get().reads(4 as Weight))197 .saturating_add(T::DbWeight::get().writes(5 as Weight))198 }199 // Storage: Refungible Allowance (r:1 w:1)200 // Storage: Refungible Balance (r:2 w:2)201 // Storage: Refungible AccountBalance (r:2 w:2)202 // Storage: Refungible Owned (r:0 w:2)203 fn transfer_from_creating_removing() -> Weight {204 (32_070_000 as Weight)205 .saturating_add(T::DbWeight::get().reads(5 as Weight))206 .saturating_add(T::DbWeight::get().writes(7 as Weight))207 }208 // Storage: Refungible Allowance (r:1 w:1)209 // Storage: Refungible TotalSupply (r:1 w:1)210 // Storage: Refungible Balance (r:1 w:1)211 // Storage: Refungible AccountBalance (r:1 w:1)212 // Storage: Refungible TokensBurnt (r:1 w:1)213 // Storage: Refungible TokenData (r:0 w:1)214 // Storage: Refungible Owned (r:0 w:1)215 // Storage: Refungible TokenProperties (r:0 w:1)216 fn burn_from() -> Weight {217 (36_789_000 as Weight)218 .saturating_add(T::DbWeight::get().reads(5 as Weight))219 .saturating_add(T::DbWeight::get().writes(8 as Weight))220 }221 // Storage: Common CollectionPropertyPermissions (r:1 w:1)222 fn set_token_property_permissions(b: u32, ) -> Weight {223 (0 as Weight)224 // Standard Error: 62_000225 .saturating_add((15_803_000 as Weight).saturating_mul(b as Weight))226 .saturating_add(T::DbWeight::get().reads(1 as Weight))227 .saturating_add(T::DbWeight::get().writes(1 as Weight))228 }229 // Storage: Common CollectionPropertyPermissions (r:1 w:0)230 // Storage: Refungible TokenProperties (r:1 w:1)231 fn set_token_properties(b: u32, ) -> Weight {232 (0 as Weight)233 // Standard Error: 1_668_000234 .saturating_add((302_308_000 as Weight).saturating_mul(b as Weight))235 .saturating_add(T::DbWeight::get().reads(2 as Weight))236 .saturating_add(T::DbWeight::get().writes(1 as Weight))237 }238 // Storage: Common CollectionPropertyPermissions (r:1 w:0)239 // Storage: Refungible TokenProperties (r:1 w:1)240 fn delete_token_properties(b: u32, ) -> Weight {241 (0 as Weight)242 // Standard Error: 1_619_000243 .saturating_add((294_574_000 as Weight).saturating_mul(b as Weight))244 .saturating_add(T::DbWeight::get().reads(2 as Weight))245 .saturating_add(T::DbWeight::get().writes(1 as Weight))246 }247 // Storage: Refungible TotalSupply (r:1 w:1)248 // Storage: Refungible Balance (r:1 w:1)249 fn repartition_item() -> Weight {250 (8_325_000 as Weight)251 .saturating_add(T::DbWeight::get().reads(2 as Weight))252 .saturating_add(T::DbWeight::get().writes(2 as Weight))253 }254}255256// For backwards compatibility and tests257impl WeightInfo for () {258 // Storage: Refungible TokensMinted (r:1 w:1)259 // Storage: Refungible AccountBalance (r:1 w:1)260 // Storage: Refungible Balance (r:0 w:1)261 // Storage: Refungible TotalSupply (r:0 w:1)262 // Storage: Refungible TokenData (r:0 w:1)263 // Storage: Refungible Owned (r:0 w:1)264 fn create_item() -> Weight {265 (21_310_000 as Weight)266 .saturating_add(RocksDbWeight::get().reads(2 as Weight))267 .saturating_add(RocksDbWeight::get().writes(6 as Weight))268 }269 // Storage: Refungible TokensMinted (r:1 w:1)270 // Storage: Refungible AccountBalance (r:1 w:1)271 // Storage: Refungible Balance (r:0 w:4)272 // Storage: Refungible TotalSupply (r:0 w:4)273 // Storage: Refungible TokenData (r:0 w:4)274 // Storage: Refungible Owned (r:0 w:4)275 fn create_multiple_items(b: u32, ) -> Weight {276 (9_552_000 as Weight)277 // Standard Error: 2_000278 .saturating_add((7_056_000 as Weight).saturating_mul(b as Weight))279 .saturating_add(RocksDbWeight::get().reads(2 as Weight))280 .saturating_add(RocksDbWeight::get().writes(2 as Weight))281 .saturating_add(RocksDbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))282 }283 // Storage: Refungible TokensMinted (r:1 w:1)284 // Storage: Refungible AccountBalance (r:4 w:4)285 // Storage: Refungible Balance (r:0 w:4)286 // Storage: Refungible TotalSupply (r:0 w:4)287 // Storage: Refungible TokenData (r:0 w:4)288 // Storage: Refungible Owned (r:0 w:4)289 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {290 (4_857_000 as Weight)291 // Standard Error: 2_000292 .saturating_add((9_838_000 as Weight).saturating_mul(b as Weight))293 .saturating_add(RocksDbWeight::get().reads(1 as Weight))294 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))295 .saturating_add(RocksDbWeight::get().writes(1 as Weight))296 .saturating_add(RocksDbWeight::get().writes((5 as Weight).saturating_mul(b as Weight)))297 }298 // Storage: Refungible TokensMinted (r:1 w:1)299 // Storage: Refungible TotalSupply (r:0 w:1)300 // Storage: Refungible TokenData (r:0 w:1)301 // Storage: Refungible AccountBalance (r:4 w:4)302 // Storage: Refungible Balance (r:0 w:4)303 // Storage: Refungible Owned (r:0 w:4)304 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {305 (11_335_000 as Weight)306 // Standard Error: 2_000307 .saturating_add((6_784_000 as Weight).saturating_mul(b as Weight))308 .saturating_add(RocksDbWeight::get().reads(1 as Weight))309 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))310 .saturating_add(RocksDbWeight::get().writes(3 as Weight))311 .saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))312 }313 // Storage: Refungible TotalSupply (r:1 w:1)314 // Storage: Refungible Balance (r:1 w:1)315 // Storage: Refungible AccountBalance (r:1 w:1)316 // Storage: Refungible Owned (r:0 w:1)317 fn burn_item_partial() -> Weight {318 (21_239_000 as Weight)319 .saturating_add(RocksDbWeight::get().reads(3 as Weight))320 .saturating_add(RocksDbWeight::get().writes(4 as Weight))321 }322 // Storage: Refungible TotalSupply (r:1 w:1)323 // Storage: Refungible Balance (r:1 w:1)324 // Storage: Refungible AccountBalance (r:1 w:1)325 // Storage: Refungible TokensBurnt (r:1 w:1)326 // Storage: Refungible TokenData (r:0 w:1)327 // Storage: Refungible Owned (r:0 w:1)328 // Storage: Refungible TokenProperties (r:0 w:1)329 fn burn_item_fully() -> Weight {330 (29_426_000 as Weight)331 .saturating_add(RocksDbWeight::get().reads(4 as Weight))332 .saturating_add(RocksDbWeight::get().writes(7 as Weight))333 }334 // Storage: Refungible Balance (r:2 w:2)335 fn transfer_normal() -> Weight {336 (17_743_000 as Weight)337 .saturating_add(RocksDbWeight::get().reads(2 as Weight))338 .saturating_add(RocksDbWeight::get().writes(2 as Weight))339 }340 // Storage: Refungible Balance (r:2 w:2)341 // Storage: Refungible AccountBalance (r:1 w:1)342 // Storage: Refungible Owned (r:0 w:1)343 fn transfer_creating() -> Weight {344 (20_699_000 as Weight)345 .saturating_add(RocksDbWeight::get().reads(3 as Weight))346 .saturating_add(RocksDbWeight::get().writes(4 as Weight))347 }348 // Storage: Refungible Balance (r:2 w:2)349 // Storage: Refungible AccountBalance (r:1 w:1)350 // Storage: Refungible Owned (r:0 w:1)351 fn transfer_removing() -> Weight {352 (22_833_000 as Weight)353 .saturating_add(RocksDbWeight::get().reads(3 as Weight))354 .saturating_add(RocksDbWeight::get().writes(4 as Weight))355 }356 // Storage: Refungible Balance (r:2 w:2)357 // Storage: Refungible AccountBalance (r:2 w:2)358 // Storage: Refungible Owned (r:0 w:2)359 fn transfer_creating_removing() -> Weight {360 (24_936_000 as Weight)361 .saturating_add(RocksDbWeight::get().reads(4 as Weight))362 .saturating_add(RocksDbWeight::get().writes(6 as Weight))363 }364 // Storage: Refungible Balance (r:1 w:0)365 // Storage: Refungible Allowance (r:0 w:1)366 fn approve() -> Weight {367 (13_446_000 as Weight)368 .saturating_add(RocksDbWeight::get().reads(1 as Weight))369 .saturating_add(RocksDbWeight::get().writes(1 as Weight))370 }371 // Storage: Refungible Allowance (r:1 w:1)372 // Storage: Refungible Balance (r:2 w:2)373 fn transfer_from_normal() -> Weight {374 (24_777_000 as Weight)375 .saturating_add(RocksDbWeight::get().reads(3 as Weight))376 .saturating_add(RocksDbWeight::get().writes(3 as Weight))377 }378 // Storage: Refungible Allowance (r:1 w:1)379 // Storage: Refungible Balance (r:2 w:2)380 // Storage: Refungible AccountBalance (r:1 w:1)381 // Storage: Refungible Owned (r:0 w:1)382 fn transfer_from_creating() -> Weight {383 (28_483_000 as Weight)384 .saturating_add(RocksDbWeight::get().reads(4 as Weight))385 .saturating_add(RocksDbWeight::get().writes(5 as Weight))386 }387 // Storage: Refungible Allowance (r:1 w:1)388 // Storage: Refungible Balance (r:2 w:2)389 // Storage: Refungible AccountBalance (r:1 w:1)390 // Storage: Refungible Owned (r:0 w:1)391 fn transfer_from_removing() -> Weight {392 (29_896_000 as Weight)393 .saturating_add(RocksDbWeight::get().reads(4 as Weight))394 .saturating_add(RocksDbWeight::get().writes(5 as Weight))395 }396 // Storage: Refungible Allowance (r:1 w:1)397 // Storage: Refungible Balance (r:2 w:2)398 // Storage: Refungible AccountBalance (r:2 w:2)399 // Storage: Refungible Owned (r:0 w:2)400 fn transfer_from_creating_removing() -> Weight {401 (32_070_000 as Weight)402 .saturating_add(RocksDbWeight::get().reads(5 as Weight))403 .saturating_add(RocksDbWeight::get().writes(7 as Weight))404 }405 // Storage: Refungible Allowance (r:1 w:1)406 // Storage: Refungible TotalSupply (r:1 w:1)407 // Storage: Refungible Balance (r:1 w:1)408 // Storage: Refungible AccountBalance (r:1 w:1)409 // Storage: Refungible TokensBurnt (r:1 w:1)410 // Storage: Refungible TokenData (r:0 w:1)411 // Storage: Refungible Owned (r:0 w:1)412 // Storage: Refungible TokenProperties (r:0 w:1)413 fn burn_from() -> Weight {414 (36_789_000 as Weight)415 .saturating_add(RocksDbWeight::get().reads(5 as Weight))416 .saturating_add(RocksDbWeight::get().writes(8 as Weight))417 }418 // Storage: Common CollectionPropertyPermissions (r:1 w:1)419 fn set_token_property_permissions(b: u32, ) -> Weight {420 (0 as Weight)421 // Standard Error: 62_000422 .saturating_add((15_803_000 as Weight).saturating_mul(b as Weight))423 .saturating_add(RocksDbWeight::get().reads(1 as Weight))424 .saturating_add(RocksDbWeight::get().writes(1 as Weight))425 }426 // Storage: Common CollectionPropertyPermissions (r:1 w:0)427 // Storage: Refungible TokenProperties (r:1 w:1)428 fn set_token_properties(b: u32, ) -> Weight {429 (0 as Weight)430 // Standard Error: 1_668_000431 .saturating_add((302_308_000 as Weight).saturating_mul(b as Weight))432 .saturating_add(RocksDbWeight::get().reads(2 as Weight))433 .saturating_add(RocksDbWeight::get().writes(1 as Weight))434 }435 // Storage: Common CollectionPropertyPermissions (r:1 w:0)436 // Storage: Refungible TokenProperties (r:1 w:1)437 fn delete_token_properties(b: u32, ) -> Weight {438 (0 as Weight)439 // Standard Error: 1_619_000440 .saturating_add((294_574_000 as Weight).saturating_mul(b as Weight))441 .saturating_add(RocksDbWeight::get().reads(2 as Weight))442 .saturating_add(RocksDbWeight::get().writes(1 as Weight))443 }444 // Storage: Refungible TotalSupply (r:1 w:1)445 // Storage: Refungible Balance (r:1 w:1)446 fn repartition_item() -> Weight {447 (8_325_000 as Weight)448 .saturating_add(RocksDbWeight::get().reads(2 as Weight))449 .saturating_add(RocksDbWeight::get().writes(2 as Weight))450 }451}