Use 'Items' and 'Collections' in uniques pallet (#11389)

* Rename class to collection

* Use "assets collection" instead of "asset collection"

* Rename 'instance' to 'asset'

* Change "asset `collection`" to "`collection`"

* A bit more clean up

* Rename Asset to Item

* Add a storage hack

* Typos

* fix compile

* fmt

* Fix

* cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=pallet_uniques --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/uniques/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* Update frame/uniques/src/lib.rs

* cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=pallet_uniques --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/uniques/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* Change 'items collection' to 'collection'

* Apply suggestions

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Parity Bot <admin@parity.io>
This commit is contained in:
Jegor Sidorenko
2022-05-16 15:38:12 +02:00
committed by GitHub
parent 359849b169
commit ed7d1e7ac0
13 changed files with 1114 additions and 1076 deletions
+81 -84
View File
@@ -18,12 +18,13 @@
//! Autogenerated weights for pallet_uniques
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-01-31, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2022-05-12, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
// Executed Command:
// ./target/production/substrate
// target/production/substrate
// benchmark
// pallet
// --chain=dev
// --steps=50
// --repeat=20
@@ -33,9 +34,7 @@
// --wasm-execution=compiled
// --heap-pages=4096
// --output=./frame/uniques/src/weights.rs
// --template=.maintain/frame-weight-template.hbs
// --header=HEADER-APACHE2
// --raw
// --template=./.maintain/frame-weight-template.hbs
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
@@ -55,17 +54,17 @@ pub trait WeightInfo {
fn redeposit(i: u32, ) -> Weight;
fn freeze() -> Weight;
fn thaw() -> Weight;
fn freeze_class() -> Weight;
fn thaw_class() -> Weight;
fn freeze_collection() -> Weight;
fn thaw_collection() -> Weight;
fn transfer_ownership() -> Weight;
fn set_team() -> Weight;
fn force_asset_status() -> Weight;
fn force_item_status() -> Weight;
fn set_attribute() -> Weight;
fn clear_attribute() -> Weight;
fn set_metadata() -> Weight;
fn clear_metadata() -> Weight;
fn set_class_metadata() -> Weight;
fn clear_class_metadata() -> Weight;
fn set_collection_metadata() -> Weight;
fn clear_collection_metadata() -> Weight;
fn approve_transfer() -> Weight;
fn cancel_approval() -> Weight;
fn set_accept_ownership() -> Weight;
@@ -77,14 +76,14 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques ClassAccount (r:0 w:1)
fn create() -> Weight {
(24_063_000 as Weight)
(24_319_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques ClassAccount (r:0 w:1)
fn force_create() -> Weight {
(13_017_000 as Weight)
(13_572_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
@@ -97,12 +96,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Uniques Account (r:0 w:20)
fn destroy(n: u32, m: u32, a: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 14_000
.saturating_add((9_248_000 as Weight).saturating_mul(n as Weight))
// Standard Error: 14_000
.saturating_add((854_000 as Weight).saturating_mul(m as Weight))
// Standard Error: 14_000
.saturating_add((758_000 as Weight).saturating_mul(a as Weight))
// Standard Error: 15_000
.saturating_add((9_433_000 as Weight).saturating_mul(n as Weight))
// Standard Error: 15_000
.saturating_add((980_000 as Weight).saturating_mul(m as Weight))
// Standard Error: 15_000
.saturating_add((852_000 as Weight).saturating_mul(a as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(n as Weight)))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
@@ -114,7 +113,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques Account (r:0 w:1)
fn mint() -> Weight {
(29_865_000 as Weight)
(29_884_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
@@ -122,7 +121,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Uniques Asset (r:1 w:1)
// Storage: Uniques Account (r:0 w:1)
fn burn() -> Weight {
(31_603_000 as Weight)
(31_384_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
@@ -130,7 +129,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Uniques Asset (r:1 w:1)
// Storage: Uniques Account (r:0 w:2)
fn transfer() -> Weight {
(23_331_000 as Weight)
(23_254_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
@@ -138,8 +137,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Uniques Asset (r:100 w:100)
fn redeposit(i: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 12_000
.saturating_add((11_527_000 as Weight).saturating_mul(i as Weight))
// Standard Error: 13_000
.saturating_add((11_718_000 as Weight).saturating_mul(i as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(i as Weight)))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
@@ -148,47 +147,47 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Uniques Asset (r:1 w:1)
// Storage: Uniques Class (r:1 w:0)
fn freeze() -> Weight {
(18_617_000 as Weight)
(17_807_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Asset (r:1 w:1)
// Storage: Uniques Class (r:1 w:0)
fn thaw() -> Weight {
(18_618_000 as Weight)
(17_904_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
fn freeze_class() -> Weight {
(13_570_000 as Weight)
fn freeze_collection() -> Weight {
(13_828_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
fn thaw_class() -> Weight {
(13_937_000 as Weight)
fn thaw_collection() -> Weight {
(13_636_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Uniques OwnershipAcceptance (r:1 w:1)
// Storage: Uniques Class (r:1 w:1)
// Storage: System Account (r:1 w:1)
// Storage: Uniques ClassAccount (r:0 w:2)
fn transfer_ownership() -> Weight {
(31_021_000 as Weight)
(20_897_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
fn set_team() -> Weight {
(14_739_000 as Weight)
(14_340_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques ClassAccount (r:0 w:1)
fn force_asset_status() -> Weight {
(16_826_000 as Weight)
fn force_item_status() -> Weight {
(16_355_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
@@ -196,7 +195,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Uniques InstanceMetadataOf (r:1 w:0)
// Storage: Uniques Attribute (r:1 w:1)
fn set_attribute() -> Weight {
(37_010_000 as Weight)
(37_035_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
@@ -204,56 +203,55 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Uniques InstanceMetadataOf (r:1 w:0)
// Storage: Uniques Attribute (r:1 w:1)
fn clear_attribute() -> Weight {
(34_432_000 as Weight)
(34_957_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques InstanceMetadataOf (r:1 w:1)
fn set_metadata() -> Weight {
(28_575_000 as Weight)
(28_337_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques InstanceMetadataOf (r:1 w:1)
fn clear_metadata() -> Weight {
(28_730_000 as Weight)
(29_166_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques ClassMetadataOf (r:1 w:1)
fn set_class_metadata() -> Weight {
(28_225_000 as Weight)
fn set_collection_metadata() -> Weight {
(28_246_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: Uniques Class (r:1 w:0)
// Storage: Uniques ClassMetadataOf (r:1 w:1)
fn clear_class_metadata() -> Weight {
(26_455_000 as Weight)
fn clear_collection_metadata() -> Weight {
(26_637_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Class (r:1 w:0)
// Storage: Uniques Asset (r:1 w:1)
fn approve_transfer() -> Weight {
(19_587_000 as Weight)
(18_938_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Class (r:1 w:0)
// Storage: Uniques Asset (r:1 w:1)
fn cancel_approval() -> Weight {
(19_417_000 as Weight)
(18_465_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Class (r:1 w:0)
// Storage: Uniques Asset (r:1 w:1)
// Storage: Uniques OwnershipAcceptance (r:1 w:1)
fn set_accept_ownership() -> Weight {
(19_417_000 as Weight)
(16_675_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -264,14 +262,14 @@ impl WeightInfo for () {
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques ClassAccount (r:0 w:1)
fn create() -> Weight {
(24_063_000 as Weight)
(24_319_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques ClassAccount (r:0 w:1)
fn force_create() -> Weight {
(13_017_000 as Weight)
(13_572_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
@@ -284,12 +282,12 @@ impl WeightInfo for () {
// Storage: Uniques Account (r:0 w:20)
fn destroy(n: u32, m: u32, a: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 14_000
.saturating_add((9_248_000 as Weight).saturating_mul(n as Weight))
// Standard Error: 14_000
.saturating_add((854_000 as Weight).saturating_mul(m as Weight))
// Standard Error: 14_000
.saturating_add((758_000 as Weight).saturating_mul(a as Weight))
// Standard Error: 15_000
.saturating_add((9_433_000 as Weight).saturating_mul(n as Weight))
// Standard Error: 15_000
.saturating_add((980_000 as Weight).saturating_mul(m as Weight))
// Standard Error: 15_000
.saturating_add((852_000 as Weight).saturating_mul(a as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(n as Weight)))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
@@ -301,7 +299,7 @@ impl WeightInfo for () {
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques Account (r:0 w:1)
fn mint() -> Weight {
(29_865_000 as Weight)
(29_884_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
}
@@ -309,7 +307,7 @@ impl WeightInfo for () {
// Storage: Uniques Asset (r:1 w:1)
// Storage: Uniques Account (r:0 w:1)
fn burn() -> Weight {
(31_603_000 as Weight)
(31_384_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
}
@@ -317,7 +315,7 @@ impl WeightInfo for () {
// Storage: Uniques Asset (r:1 w:1)
// Storage: Uniques Account (r:0 w:2)
fn transfer() -> Weight {
(23_331_000 as Weight)
(23_254_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
}
@@ -325,8 +323,8 @@ impl WeightInfo for () {
// Storage: Uniques Asset (r:100 w:100)
fn redeposit(i: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 12_000
.saturating_add((11_527_000 as Weight).saturating_mul(i as Weight))
// Standard Error: 13_000
.saturating_add((11_718_000 as Weight).saturating_mul(i as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(i as Weight)))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
@@ -335,47 +333,47 @@ impl WeightInfo for () {
// Storage: Uniques Asset (r:1 w:1)
// Storage: Uniques Class (r:1 w:0)
fn freeze() -> Weight {
(18_617_000 as Weight)
(17_807_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Asset (r:1 w:1)
// Storage: Uniques Class (r:1 w:0)
fn thaw() -> Weight {
(18_618_000 as Weight)
(17_904_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
fn freeze_class() -> Weight {
(13_570_000 as Weight)
fn freeze_collection() -> Weight {
(13_828_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
fn thaw_class() -> Weight {
(13_937_000 as Weight)
fn thaw_collection() -> Weight {
(13_636_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Uniques OwnershipAcceptance (r:1 w:1)
// Storage: Uniques Class (r:1 w:1)
// Storage: System Account (r:1 w:1)
// Storage: Uniques ClassAccount (r:0 w:2)
fn transfer_ownership() -> Weight {
(31_021_000 as Weight)
(20_897_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
fn set_team() -> Weight {
(14_739_000 as Weight)
(14_340_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques ClassAccount (r:0 w:1)
fn force_asset_status() -> Weight {
(16_826_000 as Weight)
fn force_item_status() -> Weight {
(16_355_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
@@ -383,7 +381,7 @@ impl WeightInfo for () {
// Storage: Uniques InstanceMetadataOf (r:1 w:0)
// Storage: Uniques Attribute (r:1 w:1)
fn set_attribute() -> Weight {
(37_010_000 as Weight)
(37_035_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
@@ -391,56 +389,55 @@ impl WeightInfo for () {
// Storage: Uniques InstanceMetadataOf (r:1 w:0)
// Storage: Uniques Attribute (r:1 w:1)
fn clear_attribute() -> Weight {
(34_432_000 as Weight)
(34_957_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques InstanceMetadataOf (r:1 w:1)
fn set_metadata() -> Weight {
(28_575_000 as Weight)
(28_337_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques InstanceMetadataOf (r:1 w:1)
fn clear_metadata() -> Weight {
(28_730_000 as Weight)
(29_166_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques ClassMetadataOf (r:1 w:1)
fn set_class_metadata() -> Weight {
(28_225_000 as Weight)
fn set_collection_metadata() -> Weight {
(28_246_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
// Storage: Uniques Class (r:1 w:0)
// Storage: Uniques ClassMetadataOf (r:1 w:1)
fn clear_class_metadata() -> Weight {
(26_455_000 as Weight)
fn clear_collection_metadata() -> Weight {
(26_637_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Class (r:1 w:0)
// Storage: Uniques Asset (r:1 w:1)
fn approve_transfer() -> Weight {
(19_587_000 as Weight)
(18_938_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Class (r:1 w:0)
// Storage: Uniques Asset (r:1 w:1)
fn cancel_approval() -> Weight {
(19_417_000 as Weight)
(18_465_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Class (r:1 w:0)
// Storage: Uniques Asset (r:1 w:1)
// Storage: Uniques OwnershipAcceptance (r:1 w:1)
fn set_accept_ownership() -> Weight {
(19_417_000 as Weight)
(16_675_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}