From 954f85a85c5376947edf9f86309f50cd2efeca25 Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Thu, 15 Jul 2021 10:51:31 -0400 Subject: [PATCH] Add Uniques to Westmint and Statemint (#493) * Add uniques to westmint and statemint * update cargo * Update Cargo.lock * Update lib.rs * fix merge * Apply suggestions from code review Co-authored-by: Alexander Popiak * fix build Co-authored-by: Alexander Popiak Co-authored-by: joepetrowski --- Cargo.lock | 2 + polkadot-parachains/statemint/Cargo.toml | 5 +- polkadot-parachains/statemint/src/lib.rs | 55 +++++- .../statemint/src/weights/mod.rs | 1 + .../statemint/src/weights/pallet_uniques.rs | 171 ++++++++++++++++++ polkadot-parachains/westmint/Cargo.toml | 5 +- polkadot-parachains/westmint/src/lib.rs | 62 ++++++- .../westmint/src/weights/mod.rs | 1 + .../westmint/src/weights/pallet_uniques.rs | 171 ++++++++++++++++++ 9 files changed, 465 insertions(+), 8 deletions(-) create mode 100644 polkadot-parachains/statemint/src/weights/pallet_uniques.rs create mode 100644 polkadot-parachains/westmint/src/weights/pallet_uniques.rs diff --git a/Cargo.lock b/Cargo.lock index 7af887573a..dc54c7442c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10917,6 +10917,7 @@ dependencies = [ "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", + "pallet-uniques", "pallet-utility", "pallet-xcm", "parachain-info", @@ -12613,6 +12614,7 @@ dependencies = [ "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", + "pallet-uniques", "pallet-utility", "pallet-xcm", "parachain-info", diff --git a/polkadot-parachains/statemint/Cargo.toml b/polkadot-parachains/statemint/Cargo.toml index 7990074073..cb7269130b 100644 --- a/polkadot-parachains/statemint/Cargo.toml +++ b/polkadot-parachains/statemint/Cargo.toml @@ -45,6 +45,7 @@ pallet-sudo = { git = "https://github.com/paritytech/substrate", default-feature pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-uniques = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-utility = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } node-primitives = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } @@ -81,6 +82,7 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran [features] default = [ "std" ] runtime-benchmarks = [ + 'cumulus-pallet-session-benchmarking/runtime-benchmarks', 'hex-literal', 'sp-runtime/runtime-benchmarks', 'xcm-builder/runtime-benchmarks', @@ -92,7 +94,7 @@ runtime-benchmarks = [ 'pallet-balances/runtime-benchmarks', 'pallet-multisig/runtime-benchmarks', 'pallet-proxy/runtime-benchmarks', - 'cumulus-pallet-session-benchmarking/runtime-benchmarks', + 'pallet-uniques/runtime-benchmarks', 'pallet-utility/runtime-benchmarks', 'pallet-timestamp/runtime-benchmarks', 'pallet-xcm/runtime-benchmarks', @@ -129,6 +131,7 @@ std = [ "pallet-timestamp/std", "pallet-transaction-payment/std", "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-uniques/std", "pallet-utility/std", "parachain-info/std", "cumulus-pallet-aura-ext/std", diff --git a/polkadot-parachains/statemint/src/lib.rs b/polkadot-parachains/statemint/src/lib.rs index 051eff5c41..ff14c66ee0 100644 --- a/polkadot-parachains/statemint/src/lib.rs +++ b/polkadot-parachains/statemint/src/lib.rs @@ -327,14 +327,20 @@ impl InstanceFilter for ProxyType { fn filter(&self, c: &Call) -> bool { match self { ProxyType::Any => true, - ProxyType::NonTransfer => !matches!(c, Call::Balances(..) | Call::Assets(..)), + ProxyType::NonTransfer => !matches!( + c, + Call::Balances(..) | Call::Assets(..) | Call::Uniques(..) + ), ProxyType::CancelProxy => matches!( c, Call::Proxy(pallet_proxy::Call::reject_announcement(..)) | Call::Utility(..) | Call::Multisig(..) ), ProxyType::Assets => { - matches!(c, Call::Assets(..) | Call::Utility(..) | Call::Multisig(..)) + matches!( + c, + Call::Assets(..) | Call::Utility(..) | Call::Multisig(..) | Call::Uniques(..) + ) } ProxyType::AssetOwner => matches!( c, @@ -344,6 +350,16 @@ impl InstanceFilter for ProxyType { | Call::Assets(pallet_assets::Call::set_team(..)) | Call::Assets(pallet_assets::Call::set_metadata(..)) | Call::Assets(pallet_assets::Call::clear_metadata(..)) + | Call::Uniques(pallet_uniques::Call::create(..)) + | Call::Uniques(pallet_uniques::Call::destroy(..)) + | Call::Uniques(pallet_uniques::Call::transfer_ownership(..)) + | Call::Uniques(pallet_uniques::Call::set_team(..)) + | Call::Uniques(pallet_uniques::Call::set_metadata(..)) + | Call::Uniques(pallet_uniques::Call::set_attribute(..)) + | Call::Uniques(pallet_uniques::Call::set_class_metadata(..)) + | Call::Uniques(pallet_uniques::Call::clear_metadata(..)) + | Call::Uniques(pallet_uniques::Call::clear_attribute(..)) + | Call::Uniques(pallet_uniques::Call::clear_class_metadata(..)) | Call::Utility(..) | Call::Multisig(..) ), ProxyType::AssetManager => matches!( @@ -354,6 +370,12 @@ impl InstanceFilter for ProxyType { | Call::Assets(pallet_assets::Call::thaw(..)) | Call::Assets(pallet_assets::Call::freeze_asset(..)) | Call::Assets(pallet_assets::Call::thaw_asset(..)) + | Call::Uniques(pallet_uniques::Call::mint(..)) + | Call::Uniques(pallet_uniques::Call::burn(..)) + | Call::Uniques(pallet_uniques::Call::freeze(..)) + | Call::Uniques(pallet_uniques::Call::thaw(..)) + | Call::Uniques(pallet_uniques::Call::freeze_class(..)) + | Call::Uniques(pallet_uniques::Call::thaw_class(..)) | Call::Utility(..) | Call::Multisig(..) ), ProxyType::Collator => matches!( @@ -603,6 +625,34 @@ impl pallet_collator_selection::Config for Runtime { type WeightInfo = weights::pallet_collator_selection::WeightInfo; } +parameter_types! { + pub const ClassDeposit: Balance = UNITS; // 1 UNIT deposit to create asset class + pub const InstanceDeposit: Balance = UNITS / 100; // 1/100 UNIT deposit to create asset instance + pub const KeyLimit: u32 = 32; // Max 32 bytes per key + pub const ValueLimit: u32 = 64; // Max 64 bytes per value + pub const UniquesMetadataDepositBase: Balance = deposit(1, 129); + pub const AttributeDepositBase: Balance = deposit(1, 0); + pub const DepositPerByte: Balance = deposit(0, 1); + pub const UniquesStringLimit: u32 = 128; +} + +impl pallet_uniques::Config for Runtime { + type Event = Event; + type ClassId = u32; + type InstanceId = u32; + type Currency = Balances; + type ForceOrigin = AssetsForceOrigin; + type ClassDeposit = ClassDeposit; + type InstanceDeposit = InstanceDeposit; + type MetadataDepositBase = UniquesMetadataDepositBase; + type AttributeDepositBase = AttributeDepositBase; + type DepositPerByte = DepositPerByte; + type StringLimit = UniquesStringLimit; + type KeyLimit = KeyLimit; + type ValueLimit = ValueLimit; + type WeightInfo = weights::pallet_uniques::WeightInfo; +} + // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime where @@ -643,6 +693,7 @@ construct_runtime!( // The main stage. To include pallet-assets-freezer and pallet-uniques. Assets: pallet_assets::{Pallet, Call, Storage, Event} = 50, + Uniques: pallet_uniques::{Pallet, Call, Storage, Event} = 51, } ); diff --git a/polkadot-parachains/statemint/src/weights/mod.rs b/polkadot-parachains/statemint/src/weights/mod.rs index 85e91c2791..0e4e48b1a1 100644 --- a/polkadot-parachains/statemint/src/weights/mod.rs +++ b/polkadot-parachains/statemint/src/weights/mod.rs @@ -5,4 +5,5 @@ pub mod pallet_collator_selection; pub mod pallet_proxy; pub mod pallet_session; pub mod pallet_timestamp; +pub mod pallet_uniques; pub mod pallet_utility; diff --git a/polkadot-parachains/statemint/src/weights/pallet_uniques.rs b/polkadot-parachains/statemint/src/weights/pallet_uniques.rs new file mode 100644 index 0000000000..4cab4dffbf --- /dev/null +++ b/polkadot-parachains/statemint/src/weights/pallet_uniques.rs @@ -0,0 +1,171 @@ +// Copyright 2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +//! Autogenerated weights for pallet_uniques +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 +//! DATE: 2021-06-02, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 128 + +// Executed Command: +// ./target/release/polkadot-collator +// benchmark +// --chain=statemine-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_uniques +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./polkadot-parachains/statemine-runtime/src/weights/ + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for pallet_uniques. +pub struct WeightInfo(PhantomData); +impl pallet_uniques::WeightInfo for WeightInfo { + fn create() -> Weight { + (42_199_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn force_create() -> Weight { + (21_030_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn destroy(n: u32, m: u32, a: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 14_000 + .saturating_add((16_814_000 as Weight).saturating_mul(n as Weight)) + // Standard Error: 14_000 + .saturating_add((1_026_000 as Weight).saturating_mul(m as Weight)) + // Standard Error: 14_000 + .saturating_add((952_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(2 as Weight)) + .saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(n as Weight))) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(m as Weight))) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(a as Weight))) + } + fn mint() -> Weight { + (57_236_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + fn burn() -> Weight { + (58_129_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + fn transfer() -> Weight { + (42_980_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + fn redeposit(i: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 11_000 + .saturating_add((26_921_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)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + } + fn freeze() -> Weight { + (30_427_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn thaw() -> Weight { + (29_789_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn freeze_class() -> Weight { + (21_380_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn thaw_class() -> Weight { + (21_430_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn transfer_ownership() -> Weight { + (49_331_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn set_team() -> Weight { + (22_305_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn force_asset_status() -> Weight { + (21_965_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn set_attribute() -> Weight { + (70_386_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn clear_attribute() -> Weight { + (63_932_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn set_metadata() -> Weight { + (53_647_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn clear_metadata() -> Weight { + (52_353_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn set_class_metadata() -> Weight { + (51_900_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn clear_class_metadata() -> Weight { + (46_929_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn approve_transfer() -> Weight { + (32_693_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn cancel_approval() -> Weight { + (32_418_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } +} diff --git a/polkadot-parachains/westmint/Cargo.toml b/polkadot-parachains/westmint/Cargo.toml index 36388769f3..fdc4c5063c 100644 --- a/polkadot-parachains/westmint/Cargo.toml +++ b/polkadot-parachains/westmint/Cargo.toml @@ -45,6 +45,7 @@ pallet-sudo = { git = "https://github.com/paritytech/substrate", default-feature pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-uniques = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-utility = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } node-primitives = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } @@ -81,6 +82,7 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran [features] default = [ "std" ] runtime-benchmarks = [ + 'cumulus-pallet-session-benchmarking/runtime-benchmarks', 'hex-literal', 'sp-runtime/runtime-benchmarks', 'xcm-builder/runtime-benchmarks', @@ -92,7 +94,7 @@ runtime-benchmarks = [ 'pallet-balances/runtime-benchmarks', 'pallet-multisig/runtime-benchmarks', 'pallet-proxy/runtime-benchmarks', - 'cumulus-pallet-session-benchmarking/runtime-benchmarks', + 'pallet-uniques/runtime-benchmarks', 'pallet-utility/runtime-benchmarks', 'pallet-timestamp/runtime-benchmarks', 'pallet-xcm/runtime-benchmarks', @@ -129,6 +131,7 @@ std = [ "pallet-timestamp/std", "pallet-transaction-payment/std", "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-uniques/std", "pallet-utility/std", "parachain-info/std", "cumulus-pallet-aura-ext/std", diff --git a/polkadot-parachains/westmint/src/lib.rs b/polkadot-parachains/westmint/src/lib.rs index 97bde2dd0c..6447e09107 100644 --- a/polkadot-parachains/westmint/src/lib.rs +++ b/polkadot-parachains/westmint/src/lib.rs @@ -144,7 +144,6 @@ parameter_types! { } // Configure FRAME pallets to include in runtime. - impl frame_system::Config for Runtime { type BaseCallFilter = (); type BlockWeights = RuntimeBlockWeights; @@ -234,6 +233,8 @@ impl pallet_sudo::Config for Runtime { type Call = Call; } +pub type AssetsForceOrigin = EnsureRoot; + parameter_types! { pub const AssetDeposit: Balance = 100 * UNITS; // 100 WND deposit to create asset pub const ApprovalDeposit: Balance = EXISTENTIAL_DEPOSIT; @@ -249,7 +250,7 @@ impl pallet_assets::Config for Runtime { type Balance = Balance; type AssetId = u32; type Currency = Balances; - type ForceOrigin = EnsureRoot; + type ForceOrigin = AssetsForceOrigin; type AssetDeposit = AssetDeposit; type MetadataDepositBase = MetadataDepositBase; type MetadataDepositPerByte = MetadataDepositPerByte; @@ -325,14 +326,20 @@ impl InstanceFilter for ProxyType { fn filter(&self, c: &Call) -> bool { match self { ProxyType::Any => true, - ProxyType::NonTransfer => !matches!(c, Call::Balances(..) | Call::Assets(..)), + ProxyType::NonTransfer => !matches!( + c, + Call::Balances(..) | Call::Assets(..) | Call::Uniques(..) + ), ProxyType::CancelProxy => matches!( c, Call::Proxy(pallet_proxy::Call::reject_announcement(..)) | Call::Utility(..) | Call::Multisig(..) ), ProxyType::Assets => { - matches!(c, Call::Assets(..) | Call::Utility(..) | Call::Multisig(..)) + matches!( + c, + Call::Assets(..) | Call::Utility(..) | Call::Multisig(..) | Call::Uniques(..) + ) } ProxyType::AssetOwner => matches!( c, @@ -342,6 +349,16 @@ impl InstanceFilter for ProxyType { | Call::Assets(pallet_assets::Call::set_team(..)) | Call::Assets(pallet_assets::Call::set_metadata(..)) | Call::Assets(pallet_assets::Call::clear_metadata(..)) + | Call::Uniques(pallet_uniques::Call::create(..)) + | Call::Uniques(pallet_uniques::Call::destroy(..)) + | Call::Uniques(pallet_uniques::Call::transfer_ownership(..)) + | Call::Uniques(pallet_uniques::Call::set_team(..)) + | Call::Uniques(pallet_uniques::Call::set_metadata(..)) + | Call::Uniques(pallet_uniques::Call::set_attribute(..)) + | Call::Uniques(pallet_uniques::Call::set_class_metadata(..)) + | Call::Uniques(pallet_uniques::Call::clear_metadata(..)) + | Call::Uniques(pallet_uniques::Call::clear_attribute(..)) + | Call::Uniques(pallet_uniques::Call::clear_class_metadata(..)) | Call::Utility(..) | Call::Multisig(..) ), ProxyType::AssetManager => matches!( @@ -352,6 +369,12 @@ impl InstanceFilter for ProxyType { | Call::Assets(pallet_assets::Call::thaw(..)) | Call::Assets(pallet_assets::Call::freeze_asset(..)) | Call::Assets(pallet_assets::Call::thaw_asset(..)) + | Call::Uniques(pallet_uniques::Call::mint(..)) + | Call::Uniques(pallet_uniques::Call::burn(..)) + | Call::Uniques(pallet_uniques::Call::freeze(..)) + | Call::Uniques(pallet_uniques::Call::thaw(..)) + | Call::Uniques(pallet_uniques::Call::freeze_class(..)) + | Call::Uniques(pallet_uniques::Call::thaw_class(..)) | Call::Utility(..) | Call::Multisig(..) ), ProxyType::Collator => matches!( @@ -593,6 +616,34 @@ impl pallet_collator_selection::Config for Runtime { type WeightInfo = weights::pallet_collator_selection::WeightInfo; } +parameter_types! { + pub const ClassDeposit: Balance = UNITS; // 1 UNIT deposit to create asset class + pub const InstanceDeposit: Balance = UNITS / 100; // 1/100 UNIT deposit to create asset instance + pub const KeyLimit: u32 = 32; // Max 32 bytes per key + pub const ValueLimit: u32 = 64; // Max 64 bytes per value + pub const UniquesMetadataDepositBase: Balance = deposit(1, 129); + pub const AttributeDepositBase: Balance = deposit(1, 0); + pub const DepositPerByte: Balance = deposit(0, 1); + pub const UniquesStringLimit: u32 = 128; +} + +impl pallet_uniques::Config for Runtime { + type Event = Event; + type ClassId = u32; + type InstanceId = u32; + type Currency = Balances; + type ForceOrigin = AssetsForceOrigin; + type ClassDeposit = ClassDeposit; + type InstanceDeposit = InstanceDeposit; + type MetadataDepositBase = UniquesMetadataDepositBase; + type AttributeDepositBase = AttributeDepositBase; + type DepositPerByte = DepositPerByte; + type StringLimit = UniquesStringLimit; + type KeyLimit = KeyLimit; + type ValueLimit = ValueLimit; + type WeightInfo = weights::pallet_uniques::WeightInfo; +} + // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime where @@ -632,6 +683,9 @@ construct_runtime!( PolkadotXcm: pallet_xcm::{Pallet, Call, Event, Origin}, CumulusXcm: cumulus_pallet_xcm::{Pallet, Event, Origin}, DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event}, + + // More things for the main stage + Uniques: pallet_uniques::{Pallet, Call, Storage, Event}, } ); diff --git a/polkadot-parachains/westmint/src/weights/mod.rs b/polkadot-parachains/westmint/src/weights/mod.rs index 85e91c2791..0e4e48b1a1 100644 --- a/polkadot-parachains/westmint/src/weights/mod.rs +++ b/polkadot-parachains/westmint/src/weights/mod.rs @@ -5,4 +5,5 @@ pub mod pallet_collator_selection; pub mod pallet_proxy; pub mod pallet_session; pub mod pallet_timestamp; +pub mod pallet_uniques; pub mod pallet_utility; diff --git a/polkadot-parachains/westmint/src/weights/pallet_uniques.rs b/polkadot-parachains/westmint/src/weights/pallet_uniques.rs new file mode 100644 index 0000000000..4cab4dffbf --- /dev/null +++ b/polkadot-parachains/westmint/src/weights/pallet_uniques.rs @@ -0,0 +1,171 @@ +// Copyright 2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +//! Autogenerated weights for pallet_uniques +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 +//! DATE: 2021-06-02, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 128 + +// Executed Command: +// ./target/release/polkadot-collator +// benchmark +// --chain=statemine-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_uniques +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./polkadot-parachains/statemine-runtime/src/weights/ + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for pallet_uniques. +pub struct WeightInfo(PhantomData); +impl pallet_uniques::WeightInfo for WeightInfo { + fn create() -> Weight { + (42_199_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn force_create() -> Weight { + (21_030_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn destroy(n: u32, m: u32, a: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 14_000 + .saturating_add((16_814_000 as Weight).saturating_mul(n as Weight)) + // Standard Error: 14_000 + .saturating_add((1_026_000 as Weight).saturating_mul(m as Weight)) + // Standard Error: 14_000 + .saturating_add((952_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(2 as Weight)) + .saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(n as Weight))) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(m as Weight))) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(a as Weight))) + } + fn mint() -> Weight { + (57_236_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + fn burn() -> Weight { + (58_129_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + fn transfer() -> Weight { + (42_980_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + fn redeposit(i: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 11_000 + .saturating_add((26_921_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)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + } + fn freeze() -> Weight { + (30_427_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn thaw() -> Weight { + (29_789_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn freeze_class() -> Weight { + (21_380_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn thaw_class() -> Weight { + (21_430_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn transfer_ownership() -> Weight { + (49_331_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn set_team() -> Weight { + (22_305_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn force_asset_status() -> Weight { + (21_965_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn set_attribute() -> Weight { + (70_386_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn clear_attribute() -> Weight { + (63_932_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn set_metadata() -> Weight { + (53_647_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn clear_metadata() -> Weight { + (52_353_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn set_class_metadata() -> Weight { + (51_900_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn clear_class_metadata() -> Weight { + (46_929_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn approve_transfer() -> Weight { + (32_693_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + fn cancel_approval() -> Weight { + (32_418_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } +}