difftreelog
Merge pull request #398 from UniqueNetwork/release-v923000
in: master
Release v923000
16 files changed
pallets/common/src/benchmarking.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use sp_std::vec::Vec;18use crate::{Config, CollectionHandle, Pallet};19use pallet_evm::account::CrossAccountId;20use frame_benchmarking::{benchmarks, account};21use up_data_structs::{22 CollectionMode, CreateCollectionData, CollectionId, Property, PropertyKey, PropertyValue,23 CollectionPermissions, NestingPermissions, MAX_COLLECTION_NAME_LENGTH,24 MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH, MAX_PROPERTIES_PER_ITEM,25};26use frame_support::{27 traits::{Currency, Get},28 pallet_prelude::ConstU32,29 BoundedVec,30};31use core::convert::TryInto;32use sp_runtime::DispatchError;3334const SEED: u32 = 1;3536pub fn create_data<const S: u32>() -> BoundedVec<u8, ConstU32<S>> {37 create_var_data::<S>(S)38}39pub fn create_u16_data<const S: u32>() -> BoundedVec<u16, ConstU32<S>> {40 (0..S)41 .map(|v| (v & 0xffff) as u16)42 .collect::<Vec<_>>()43 .try_into()44 .unwrap()45}46pub fn create_var_data<const S: u32>(size: u32) -> BoundedVec<u8, ConstU32<S>> {47 assert!(48 size <= S,49 "size ({}) should be less within bound ({})",50 size,51 S52 );53 (0..size)54 .map(|v| (v & 0xff) as u8)55 .collect::<Vec<_>>()56 .try_into()57 .unwrap()58}59pub fn property_key(id: usize) -> PropertyKey {60 #[cfg(not(feature = "std"))]61 use alloc::string::ToString;62 let mut data = create_data();63 // No DerefMut available for .fill64 for i in 0..data.len() {65 data[i] = b'0';66 }67 let bytes = id.to_string();68 let len = data.len();69 data[len - bytes.len()..].copy_from_slice(&bytes.as_bytes());70 data71}72pub fn property_value() -> PropertyValue {73 create_data()74}7576pub fn create_collection_raw<T: Config, R>(77 owner: T::CrossAccountId,78 mode: CollectionMode,79 handler: impl FnOnce(80 T::CrossAccountId,81 CreateCollectionData<T::AccountId>,82 ) -> Result<CollectionId, DispatchError>,83 cast: impl FnOnce(CollectionHandle<T>) -> R,84) -> Result<R, DispatchError> {85 <T as Config>::Currency::deposit_creating(&owner.as_sub(), T::CollectionCreationPrice::get());86 let name = create_u16_data::<MAX_COLLECTION_NAME_LENGTH>();87 let description = create_u16_data::<MAX_COLLECTION_DESCRIPTION_LENGTH>();88 let token_prefix = create_data::<MAX_TOKEN_PREFIX_LENGTH>();89 handler(90 owner,91 CreateCollectionData {92 mode,93 name,94 description,95 token_prefix,96 permissions: Some(CollectionPermissions {97 nesting: Some(NestingPermissions {98 token_owner: false,99 collection_admin: false,100 restricted: None,101 permissive: true,102 }),103 mint_mode: Some(true),104 ..Default::default()105 }),106 ..Default::default()107 },108 )109 .and_then(CollectionHandle::try_get)110 .map(cast)111}112fn create_collection<T: Config>(113 owner: T::CrossAccountId,114) -> Result<CollectionHandle<T>, DispatchError> {115 create_collection_raw(116 owner,117 CollectionMode::NFT,118 |owner, data| <Pallet<T>>::init_collection(owner, data, true),119 |h| h,120 )121}122123/// Helper macros, which handles all benchmarking preparation in semi-declarative way124///125/// `name` is a substrate account126/// - name: sub[(id)]127/// `name` is a collection with owner `owner`128/// - name: collection(owner)129/// `name` is a cross account based on substrate130/// - name: cross_sub[(id)]131/// `name` is a cross account, which maps to substrate account `name`132/// - name: cross_from_sub133/// `name` is a cross account, which maps to substrate account `other_name`134/// - name: cross_from_sub(other_name)135#[macro_export]136macro_rules! bench_init {137 ($name:ident: sub $(($id:expr))?; $($rest:tt)*) => {138 let $name: T::AccountId = account(stringify!($name), 0 $(+ $id)?, SEED);139 bench_init!($($rest)*);140 };141 ($name:ident: collection($owner:ident); $($rest:tt)*) => {142 let $name = create_collection::<T>(T::CrossAccountId::from_sub($owner.clone()))?;143 bench_init!($($rest)*);144 };145 ($name:ident: cross; $($rest:tt)*) => {146 let $name = T::CrossAccountId::from_sub($name);147 bench_init!($($rest)*);148 };149 ($name:ident: cross_sub $(($id:expr))?; $($rest:tt)*) => {150 let account: T::AccountId = account(stringify!($name), 0 $(+ $id)?, SEED);151 let $name = T::CrossAccountId::from_sub(account);152 bench_init!($($rest)*);153 };154 ($name:ident: cross_from_sub; $($rest:tt)*) => {155 let $name = T::CrossAccountId::from_sub($name);156 bench_init!($($rest)*);157 };158 ($name:ident: cross_from_sub($from:ident); $($rest:tt)*) => {159 let $name = T::CrossAccountId::from_sub($from);160 bench_init!($($rest)*);161 };162 () => {}163}164165benchmarks! {166 set_collection_properties {167 let b in 0..MAX_PROPERTIES_PER_ITEM;168 bench_init!{169 owner: sub; collection: collection(owner);170 owner: cross_from_sub;171 };172 let props = (0..b).map(|p| Property {173 key: property_key(p as usize),174 value: property_value(),175 }).collect::<Vec<_>>();176 }: {<Pallet<T>>::set_collection_properties(&collection, &owner, props)?}177178 delete_collection_properties {179 let b in 0..MAX_PROPERTIES_PER_ITEM;180 bench_init!{181 owner: sub; collection: collection(owner);182 owner: cross_from_sub;183 };184 let props = (0..b).map(|p| Property {185 key: property_key(p as usize),186 value: property_value(),187 }).collect::<Vec<_>>();188 <Pallet<T>>::set_collection_properties(&collection, &owner, props)?;189 let to_delete = (0..b).map(|p| property_key(p as usize)).collect::<Vec<_>>();190 }: {<Pallet<T>>::delete_collection_properties(&collection, &owner, to_delete)?}191}1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use sp_std::vec::Vec;18use crate::{Config, CollectionHandle, Pallet};19use pallet_evm::account::CrossAccountId;20use frame_benchmarking::{benchmarks, account};21use up_data_structs::{22 CollectionMode, CreateCollectionData, CollectionId, Property, PropertyKey, PropertyValue,23 CollectionPermissions, NestingPermissions, MAX_COLLECTION_NAME_LENGTH,24 MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH, MAX_PROPERTIES_PER_ITEM,25};26use frame_support::{27 traits::{Currency, Get},28 pallet_prelude::ConstU32,29 BoundedVec,30};31use core::convert::TryInto;32use sp_runtime::DispatchError;3334const SEED: u32 = 1;3536pub fn create_data<const S: u32>() -> BoundedVec<u8, ConstU32<S>> {37 create_var_data::<S>(S)38}39pub fn create_u16_data<const S: u32>() -> BoundedVec<u16, ConstU32<S>> {40 (0..S)41 .map(|v| (v & 0xffff) as u16)42 .collect::<Vec<_>>()43 .try_into()44 .unwrap()45}46pub fn create_var_data<const S: u32>(size: u32) -> BoundedVec<u8, ConstU32<S>> {47 assert!(48 size <= S,49 "size ({}) should be less within bound ({})",50 size,51 S52 );53 (0..size)54 .map(|v| (v & 0xff) as u8)55 .collect::<Vec<_>>()56 .try_into()57 .unwrap()58}59pub fn property_key(id: usize) -> PropertyKey {60 #[cfg(not(feature = "std"))]61 use alloc::string::ToString;62 let mut data = create_data();63 // No DerefMut available for .fill64 for i in 0..data.len() {65 data[i] = b'0';66 }67 let bytes = id.to_string();68 let len = data.len();69 data[len - bytes.len()..].copy_from_slice(&bytes.as_bytes());70 data71}72pub fn property_value() -> PropertyValue {73 create_data()74}7576pub fn create_collection_raw<T: Config, R>(77 owner: T::CrossAccountId,78 mode: CollectionMode,79 handler: impl FnOnce(80 T::CrossAccountId,81 CreateCollectionData<T::AccountId>,82 ) -> Result<CollectionId, DispatchError>,83 cast: impl FnOnce(CollectionHandle<T>) -> R,84) -> Result<R, DispatchError> {85 <T as Config>::Currency::deposit_creating(&owner.as_sub(), T::CollectionCreationPrice::get());86 let name = create_u16_data::<MAX_COLLECTION_NAME_LENGTH>();87 let description = create_u16_data::<MAX_COLLECTION_DESCRIPTION_LENGTH>();88 let token_prefix = create_data::<MAX_TOKEN_PREFIX_LENGTH>();89 handler(90 owner,91 CreateCollectionData {92 mode,93 name,94 description,95 token_prefix,96 permissions: Some(CollectionPermissions {97 nesting: Some(NestingPermissions {98 token_owner: false,99 collection_admin: false,100 restricted: None,101 #[cfg(feature = "runtime-benchmarks")]102 permissive: true,103 }),104 mint_mode: Some(true),105 ..Default::default()106 }),107 ..Default::default()108 },109 )110 .and_then(CollectionHandle::try_get)111 .map(cast)112}113fn create_collection<T: Config>(114 owner: T::CrossAccountId,115) -> Result<CollectionHandle<T>, DispatchError> {116 create_collection_raw(117 owner,118 CollectionMode::NFT,119 |owner, data| <Pallet<T>>::init_collection(owner, data, true),120 |h| h,121 )122}123124/// Helper macros, which handles all benchmarking preparation in semi-declarative way125///126/// `name` is a substrate account127/// - name: sub[(id)]128/// `name` is a collection with owner `owner`129/// - name: collection(owner)130/// `name` is a cross account based on substrate131/// - name: cross_sub[(id)]132/// `name` is a cross account, which maps to substrate account `name`133/// - name: cross_from_sub134/// `name` is a cross account, which maps to substrate account `other_name`135/// - name: cross_from_sub(other_name)136#[macro_export]137macro_rules! bench_init {138 ($name:ident: sub $(($id:expr))?; $($rest:tt)*) => {139 let $name: T::AccountId = account(stringify!($name), 0 $(+ $id)?, SEED);140 bench_init!($($rest)*);141 };142 ($name:ident: collection($owner:ident); $($rest:tt)*) => {143 let $name = create_collection::<T>(T::CrossAccountId::from_sub($owner.clone()))?;144 bench_init!($($rest)*);145 };146 ($name:ident: cross; $($rest:tt)*) => {147 let $name = T::CrossAccountId::from_sub($name);148 bench_init!($($rest)*);149 };150 ($name:ident: cross_sub $(($id:expr))?; $($rest:tt)*) => {151 let account: T::AccountId = account(stringify!($name), 0 $(+ $id)?, SEED);152 let $name = T::CrossAccountId::from_sub(account);153 bench_init!($($rest)*);154 };155 ($name:ident: cross_from_sub; $($rest:tt)*) => {156 let $name = T::CrossAccountId::from_sub($name);157 bench_init!($($rest)*);158 };159 ($name:ident: cross_from_sub($from:ident); $($rest:tt)*) => {160 let $name = T::CrossAccountId::from_sub($from);161 bench_init!($($rest)*);162 };163 () => {}164}165166benchmarks! {167 set_collection_properties {168 let b in 0..MAX_PROPERTIES_PER_ITEM;169 bench_init!{170 owner: sub; collection: collection(owner);171 owner: cross_from_sub;172 };173 let props = (0..b).map(|p| Property {174 key: property_key(p as usize),175 value: property_value(),176 }).collect::<Vec<_>>();177 }: {<Pallet<T>>::set_collection_properties(&collection, &owner, props)?}178179 delete_collection_properties {180 let b in 0..MAX_PROPERTIES_PER_ITEM;181 bench_init!{182 owner: sub; collection: collection(owner);183 owner: cross_from_sub;184 };185 let props = (0..b).map(|p| Property {186 key: property_key(p as usize),187 value: property_value(),188 }).collect::<Vec<_>>();189 <Pallet<T>>::set_collection_properties(&collection, &owner, props)?;190 let to_delete = (0..b).map(|p| property_key(p as usize)).collect::<Vec<_>>();191 }: {<Pallet<T>>::delete_collection_properties(&collection, &owner, to_delete)?}192}pallets/common/src/lib.rsdiffbeforeafterboth--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -1212,14 +1212,7 @@
limit_default_clone!(old_limit, new_limit,
access => {},
mint_mode => {},
- nesting => {
- #[cfg(not(feature = "runtime-benchmarks"))]
- ensure!(
- // Permissive is only allowed for tests and internal usage of chain for now
- old_limit.permissive || !new_limit.permissive,
- <Error<T>>::NoPermission,
- )
- },
+ nesting => { /* todo check for permissive, if only it gets out of benchmarks */ },
);
Ok(new_limit)
}
pallets/nonfungible/src/lib.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -1038,7 +1038,13 @@
nesting_budget: &dyn Budget,
) -> DispatchResult {
let nesting = handle.permissions.nesting();
- if nesting.permissive {
+
+ #[cfg(not(feature = "runtime-benchmarks"))]
+ let permissive = false;
+ #[cfg(feature = "runtime-benchmarks")]
+ let permissive = nesting.permissive;
+
+ if permissive {
// Pass
} else if nesting.token_owner
&& <PalletStructure<T>>::check_indirectly_owned(
pallets/proxy-rmrk-core/src/lib.rsdiffbeforeafterboth--- a/pallets/proxy-rmrk-core/src/lib.rs
+++ b/pallets/proxy-rmrk-core/src/lib.rs
@@ -205,7 +205,7 @@
token_owner: true,
collection_admin: false,
restricted: None,
-
+ #[cfg(feature = "runtime-benchmarks")]
permissive: false,
}),
..Default::default()
pallets/proxy-rmrk-core/src/weights.rsdiffbeforeafterboth--- a/pallets/proxy-rmrk-core/src/weights.rs
+++ b/pallets/proxy-rmrk-core/src/weights.rs
@@ -3,7 +3,7 @@
//! Autogenerated weights for pallet_proxy_rmrk_core
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2022-06-17, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2022-06-21, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
@@ -64,7 +64,7 @@
// Storage: Common CollectionById (r:0 w:1)
// Storage: RmrkCore UniqueCollectionId (r:0 w:1)
fn create_collection() -> Weight {
- (42_359_000 as Weight)
+ (49_986_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(8 as Weight))
}
@@ -77,7 +77,7 @@
// Storage: Nonfungible TokensBurnt (r:0 w:1)
// Storage: Common AdminAmount (r:0 w:1)
fn destroy_collection() -> Weight {
- (45_375_000 as Weight)
+ (50_177_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
}
@@ -85,7 +85,7 @@
// Storage: Common CollectionById (r:1 w:1)
// Storage: Common CollectionProperties (r:1 w:0)
fn change_collection_issuer() -> Weight {
- (22_753_000 as Weight)
+ (25_949_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -95,7 +95,7 @@
// Storage: Nonfungible TokensMinted (r:1 w:0)
// Storage: Nonfungible TokensBurnt (r:1 w:0)
fn lock_collection() -> Weight {
- (24_356_000 as Weight)
+ (27_183_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -109,9 +109,9 @@
// Storage: Nonfungible Owned (r:0 w:1)
// Storage: Nonfungible TokenAuxProperties (r:2 w:2)
fn mint_nft(b: u32, ) -> Weight {
- (44_853_000 as Weight)
- // Standard Error: 2_000
- .saturating_add((10_721_000 as Weight).saturating_mul(b as Weight))
+ (65_512_000 as Weight)
+ // Standard Error: 12_000
+ .saturating_add((11_525_000 as Weight).saturating_mul(b as Weight))
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
@@ -129,8 +129,8 @@
// Storage: Nonfungible TokenProperties (r:0 w:1)
fn burn_nft(b: u32, ) -> Weight {
(0 as Weight)
- // Standard Error: 1_590_000
- .saturating_add((319_825_000 as Weight).saturating_mul(b as Weight))
+ // Standard Error: 1_472_000
+ .saturating_add((296_221_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))
@@ -146,7 +146,7 @@
// Storage: Nonfungible TokenChildren (r:0 w:1)
// Storage: Nonfungible Owned (r:0 w:2)
fn send() -> Weight {
- (72_576_000 as Weight)
+ (82_778_000 as Weight)
.saturating_add(T::DbWeight::get().reads(12 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
}
@@ -160,7 +160,7 @@
// Storage: Nonfungible TokenChildren (r:0 w:1)
// Storage: Nonfungible Owned (r:0 w:2)
fn accept_nft() -> Weight {
- (79_670_000 as Weight)
+ (90_190_000 as Weight)
.saturating_add(T::DbWeight::get().reads(15 as Weight))
.saturating_add(T::DbWeight::get().writes(7 as Weight))
}
@@ -175,7 +175,7 @@
// Storage: Nonfungible Allowance (r:5 w:0)
// Storage: Nonfungible Owned (r:0 w:5)
fn reject_nft() -> Weight {
- (254_989_000 as Weight)
+ (262_238_000 as Weight)
.saturating_add(T::DbWeight::get().reads(29 as Weight))
.saturating_add(T::DbWeight::get().writes(25 as Weight))
}
@@ -185,7 +185,7 @@
// Storage: Nonfungible TokenProperties (r:1 w:1)
// Storage: Nonfungible TokenData (r:5 w:0)
fn set_property() -> Weight {
- (48_651_000 as Weight)
+ (55_187_000 as Weight)
.saturating_add(T::DbWeight::get().reads(9 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -195,7 +195,7 @@
// Storage: Nonfungible TokenProperties (r:1 w:1)
// Storage: Nonfungible TokenData (r:5 w:0)
fn set_priority() -> Weight {
- (47_579_000 as Weight)
+ (54_092_000 as Weight)
.saturating_add(T::DbWeight::get().reads(9 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -206,7 +206,7 @@
// Storage: Nonfungible TokenProperties (r:1 w:1)
// Storage: Nonfungible TokenAuxProperties (r:1 w:1)
fn add_basic_resource() -> Weight {
- (55_013_000 as Weight)
+ (62_551_000 as Weight)
.saturating_add(T::DbWeight::get().reads(10 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
@@ -217,7 +217,7 @@
// Storage: Nonfungible TokenProperties (r:1 w:1)
// Storage: Nonfungible TokenAuxProperties (r:1 w:1)
fn add_composable_resource() -> Weight {
- (55_184_000 as Weight)
+ (61_778_000 as Weight)
.saturating_add(T::DbWeight::get().reads(10 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
@@ -228,7 +228,7 @@
// Storage: Nonfungible TokenProperties (r:1 w:1)
// Storage: Nonfungible TokenAuxProperties (r:1 w:1)
fn add_slot_resource() -> Weight {
- (54_792_000 as Weight)
+ (62_700_000 as Weight)
.saturating_add(T::DbWeight::get().reads(10 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
@@ -238,7 +238,7 @@
// Storage: Nonfungible TokenAuxProperties (r:1 w:1)
// Storage: Nonfungible TokenData (r:5 w:0)
fn remove_resource() -> Weight {
- (46_447_000 as Weight)
+ (52_920_000 as Weight)
.saturating_add(T::DbWeight::get().reads(9 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -248,7 +248,7 @@
// Storage: Nonfungible TokenData (r:5 w:0)
// Storage: Nonfungible TokenAuxProperties (r:1 w:1)
fn accept_resource() -> Weight {
- (45_096_000 as Weight)
+ (52_450_000 as Weight)
.saturating_add(T::DbWeight::get().reads(9 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -258,7 +258,7 @@
// Storage: Nonfungible TokenData (r:5 w:0)
// Storage: Nonfungible TokenAuxProperties (r:1 w:1)
fn accept_resource_removal() -> Weight {
- (45_445_000 as Weight)
+ (50_901_000 as Weight)
.saturating_add(T::DbWeight::get().reads(9 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -275,7 +275,7 @@
// Storage: Common CollectionById (r:0 w:1)
// Storage: RmrkCore UniqueCollectionId (r:0 w:1)
fn create_collection() -> Weight {
- (42_359_000 as Weight)
+ (49_986_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(8 as Weight))
}
@@ -288,7 +288,7 @@
// Storage: Nonfungible TokensBurnt (r:0 w:1)
// Storage: Common AdminAmount (r:0 w:1)
fn destroy_collection() -> Weight {
- (45_375_000 as Weight)
+ (50_177_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
}
@@ -296,7 +296,7 @@
// Storage: Common CollectionById (r:1 w:1)
// Storage: Common CollectionProperties (r:1 w:0)
fn change_collection_issuer() -> Weight {
- (22_753_000 as Weight)
+ (25_949_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
@@ -306,7 +306,7 @@
// Storage: Nonfungible TokensMinted (r:1 w:0)
// Storage: Nonfungible TokensBurnt (r:1 w:0)
fn lock_collection() -> Weight {
- (24_356_000 as Weight)
+ (27_183_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
@@ -320,9 +320,9 @@
// Storage: Nonfungible Owned (r:0 w:1)
// Storage: Nonfungible TokenAuxProperties (r:2 w:2)
fn mint_nft(b: u32, ) -> Weight {
- (44_853_000 as Weight)
- // Standard Error: 2_000
- .saturating_add((10_721_000 as Weight).saturating_mul(b as Weight))
+ (65_512_000 as Weight)
+ // Standard Error: 12_000
+ .saturating_add((11_525_000 as Weight).saturating_mul(b as Weight))
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
@@ -340,8 +340,8 @@
// Storage: Nonfungible TokenProperties (r:0 w:1)
fn burn_nft(b: u32, ) -> Weight {
(0 as Weight)
- // Standard Error: 1_590_000
- .saturating_add((319_825_000 as Weight).saturating_mul(b as Weight))
+ // Standard Error: 1_472_000
+ .saturating_add((296_221_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))
@@ -357,7 +357,7 @@
// Storage: Nonfungible TokenChildren (r:0 w:1)
// Storage: Nonfungible Owned (r:0 w:2)
fn send() -> Weight {
- (72_576_000 as Weight)
+ (82_778_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(12 as Weight))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
}
@@ -371,7 +371,7 @@
// Storage: Nonfungible TokenChildren (r:0 w:1)
// Storage: Nonfungible Owned (r:0 w:2)
fn accept_nft() -> Weight {
- (79_670_000 as Weight)
+ (90_190_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(15 as Weight))
.saturating_add(RocksDbWeight::get().writes(7 as Weight))
}
@@ -386,7 +386,7 @@
// Storage: Nonfungible Allowance (r:5 w:0)
// Storage: Nonfungible Owned (r:0 w:5)
fn reject_nft() -> Weight {
- (254_989_000 as Weight)
+ (262_238_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(29 as Weight))
.saturating_add(RocksDbWeight::get().writes(25 as Weight))
}
@@ -396,7 +396,7 @@
// Storage: Nonfungible TokenProperties (r:1 w:1)
// Storage: Nonfungible TokenData (r:5 w:0)
fn set_property() -> Weight {
- (48_651_000 as Weight)
+ (55_187_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(9 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
@@ -406,7 +406,7 @@
// Storage: Nonfungible TokenProperties (r:1 w:1)
// Storage: Nonfungible TokenData (r:5 w:0)
fn set_priority() -> Weight {
- (47_579_000 as Weight)
+ (54_092_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(9 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
@@ -417,7 +417,7 @@
// Storage: Nonfungible TokenProperties (r:1 w:1)
// Storage: Nonfungible TokenAuxProperties (r:1 w:1)
fn add_basic_resource() -> Weight {
- (55_013_000 as Weight)
+ (62_551_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(10 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
@@ -428,7 +428,7 @@
// Storage: Nonfungible TokenProperties (r:1 w:1)
// Storage: Nonfungible TokenAuxProperties (r:1 w:1)
fn add_composable_resource() -> Weight {
- (55_184_000 as Weight)
+ (61_778_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(10 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
@@ -439,7 +439,7 @@
// Storage: Nonfungible TokenProperties (r:1 w:1)
// Storage: Nonfungible TokenAuxProperties (r:1 w:1)
fn add_slot_resource() -> Weight {
- (54_792_000 as Weight)
+ (62_700_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(10 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
@@ -449,7 +449,7 @@
// Storage: Nonfungible TokenAuxProperties (r:1 w:1)
// Storage: Nonfungible TokenData (r:5 w:0)
fn remove_resource() -> Weight {
- (46_447_000 as Weight)
+ (52_920_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(9 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
@@ -459,7 +459,7 @@
// Storage: Nonfungible TokenData (r:5 w:0)
// Storage: Nonfungible TokenAuxProperties (r:1 w:1)
fn accept_resource() -> Weight {
- (45_096_000 as Weight)
+ (52_450_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(9 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
@@ -469,7 +469,7 @@
// Storage: Nonfungible TokenData (r:5 w:0)
// Storage: Nonfungible TokenAuxProperties (r:1 w:1)
fn accept_resource_removal() -> Weight {
- (45_445_000 as Weight)
+ (50_901_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(9 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
pallets/proxy-rmrk-equip/src/weights.rsdiffbeforeafterboth--- a/pallets/proxy-rmrk-equip/src/weights.rs
+++ b/pallets/proxy-rmrk-equip/src/weights.rs
@@ -3,7 +3,7 @@
//! Autogenerated weights for pallet_proxy_rmrk_equip
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2022-06-20, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2022-06-21, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
@@ -54,9 +54,9 @@
// Storage: Nonfungible TokenData (r:0 w:1)
// Storage: Nonfungible Owned (r:0 w:1)
fn create_base(b: u32, ) -> Weight {
- (44_927_000 as Weight)
- // Standard Error: 9_000
- .saturating_add((18_896_000 as Weight).saturating_mul(b as Weight))
+ (62_832_000 as Weight)
+ // Standard Error: 22_000
+ .saturating_add((20_106_000 as Weight).saturating_mul(b as Weight))
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(b as Weight)))
.saturating_add(T::DbWeight::get().writes(8 as Weight))
@@ -71,9 +71,9 @@
// Storage: Nonfungible TokenData (r:0 w:1)
// Storage: Nonfungible Owned (r:0 w:1)
fn theme_add(b: u32, ) -> Weight {
- (39_120_000 as Weight)
- // Standard Error: 11_000
- .saturating_add((2_367_000 as Weight).saturating_mul(b as Weight))
+ (46_793_000 as Weight)
+ // Standard Error: 61_000
+ .saturating_add((3_061_000 as Weight).saturating_mul(b as Weight))
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
}
@@ -82,7 +82,7 @@
// Storage: RmrkEquip InernalPartId (r:1 w:0)
// Storage: Nonfungible TokenProperties (r:1 w:1)
fn equippable() -> Weight {
- (27_172_000 as Weight)
+ (32_495_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -103,9 +103,9 @@
// Storage: Nonfungible TokenData (r:0 w:1)
// Storage: Nonfungible Owned (r:0 w:1)
fn create_base(b: u32, ) -> Weight {
- (44_927_000 as Weight)
- // Standard Error: 9_000
- .saturating_add((18_896_000 as Weight).saturating_mul(b as Weight))
+ (62_832_000 as Weight)
+ // Standard Error: 22_000
+ .saturating_add((20_106_000 as Weight).saturating_mul(b as Weight))
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
.saturating_add(RocksDbWeight::get().reads((2 as Weight).saturating_mul(b as Weight)))
.saturating_add(RocksDbWeight::get().writes(8 as Weight))
@@ -120,9 +120,9 @@
// Storage: Nonfungible TokenData (r:0 w:1)
// Storage: Nonfungible Owned (r:0 w:1)
fn theme_add(b: u32, ) -> Weight {
- (39_120_000 as Weight)
- // Standard Error: 11_000
- .saturating_add((2_367_000 as Weight).saturating_mul(b as Weight))
+ (46_793_000 as Weight)
+ // Standard Error: 61_000
+ .saturating_add((3_061_000 as Weight).saturating_mul(b as Weight))
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
}
@@ -131,7 +131,7 @@
// Storage: RmrkEquip InernalPartId (r:1 w:0)
// Storage: Nonfungible TokenProperties (r:1 w:1)
fn equippable() -> Weight {
- (27_172_000 as Weight)
+ (32_495_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
primitives/data-structs/src/lib.rsdiffbeforeafterboth--- a/primitives/data-structs/src/lib.rs
+++ b/primitives/data-structs/src/lib.rs
@@ -454,7 +454,7 @@
token_owner: false,
collection_admin: false,
restricted: None,
-
+ #[cfg(feature = "runtime-benchmarks")]
permissive: false,
};
self.nesting.as_ref().unwrap_or(&DEFAULT)
@@ -499,6 +499,7 @@
/// If set - only tokens from specified collections can be nested
pub restricted: Option<OwnerRestrictedSet>,
+ #[cfg(feature = "runtime-benchmarks")]
/// Anyone can nest tokens, mutually exclusive with `token_owner`, `admin`
pub permissive: bool,
}
runtime/common/src/constants.rsdiffbeforeafterboth--- a/runtime/common/src/constants.rs
+++ b/runtime/common/src/constants.rs
@@ -35,9 +35,10 @@
pub const CENTIUNIQUE: Balance = 10 * MILLIUNIQUE;
pub const UNIQUE: Balance = 100 * CENTIUNIQUE;
-pub const WEIGHT_TO_FEE_COEFF: u32 = 142_688_000;
+// Targeting 0.1 UNQ per transfer
+pub const WEIGHT_TO_FEE_COEFF: u32 = 207_890_902;
-// Targeting 0.15 UNQ per transfer
+// Targeting 0.15 UNQ per transfer via ETH
pub const MIN_GAS_PRICE: u64 = 1_019_493_469_850;
/// We assume that ~10% of the block weight is consumed by `on_initalize` handlers.
@@ -52,5 +53,5 @@
parameter_types! {
pub const DefaultSponsoringRateLimit: BlockNumber = 1 * DAYS;
- pub const TransactionByteFee: Balance = 501 * MICROUNIQUE; // Targeting 0.1 Unique per NFT transfer
+ pub const TransactionByteFee: Balance = 501 * MICROUNIQUE;
}
runtime/opal/src/lib.rsdiffbeforeafterboth--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -508,7 +508,6 @@
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
smallvec!(WeightToFeeCoefficient {
- // Targeting 0.1 Unique per NFT transfer
coeff_integer: WEIGHT_TO_FEE_COEFF.into(),
coeff_frac: Perbill::zero(),
negative: false,
runtime/quartz/src/lib.rsdiffbeforeafterboth--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -507,7 +507,6 @@
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
smallvec!(WeightToFeeCoefficient {
- // Targeting 0.1 Unique per NFT transfer
coeff_integer: WEIGHT_TO_FEE_COEFF.into(),
coeff_frac: Perbill::zero(),
negative: false,
@@ -805,13 +804,8 @@
type LocationInverter = LocationInverter<Ancestry>;
type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
- type Trader = UsingOnlySelfCurrencyComponents<
- LinearFee<Balance>,
- RelayLocation,
- AccountId,
- Balances,
- (),
- >;
+ type Trader =
+ UsingOnlySelfCurrencyComponents<LinearFee<Balance>, RelayLocation, AccountId, Balances, ()>;
type ResponseHandler = (); // Don't handle responses for now.
type SubscriptionService = PolkadotXcm;
runtime/unique/src/lib.rsdiffbeforeafterboth--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -506,7 +506,6 @@
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
smallvec!(WeightToFeeCoefficient {
- // Targeting 0.1 Unique per NFT transfer
coeff_integer: WEIGHT_TO_FEE_COEFF.into(),
coeff_frac: Perbill::zero(),
negative: false,
@@ -804,13 +803,8 @@
type LocationInverter = LocationInverter<Ancestry>;
type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
- type Trader = UsingOnlySelfCurrencyComponents<
- LinearFee<Balance>,
- RelayLocation,
- AccountId,
- Balances,
- (),
- >;
+ type Trader =
+ UsingOnlySelfCurrencyComponents<LinearFee<Balance>, RelayLocation, AccountId, Balances, ()>;
type ResponseHandler = (); // Don't handle responses for now.
type SubscriptionService = PolkadotXcm;
tests/src/createItem.test.tsdiffbeforeafterboth--- a/tests/src/createItem.test.ts
+++ b/tests/src/createItem.test.ts
@@ -158,7 +158,7 @@
const newCollectionID = await createCollectionWithPropsExpectSuccess();
- createItemWithPropsExpectFailure(alice, newCollectionID, 'NFT', prps);
+ await createItemWithPropsExpectFailure(alice, newCollectionID, 'NFT', prps);
});
});
@@ -166,7 +166,7 @@
await usingApi(async () => {
const newCollectionID = await createCollectionWithPropsExpectSuccess();
- createItemWithPropsExpectFailure(alice, newCollectionID, 'NFT', [{key: 'k', value: 'vvvvvv'.repeat(5000)}, {key: 'k2', value: 'vvv'.repeat(5000)}]);
+ await createItemWithPropsExpectFailure(alice, newCollectionID, 'NFT', [{key: 'k', value: 'vvvvvv'.repeat(5000)}, {key: 'k2', value: 'vvv'.repeat(5000)}]);
});
});
});
tests/src/nesting/unnest.test.tsdiffbeforeafterboth--- a/tests/src/nesting/unnest.test.ts
+++ b/tests/src/nesting/unnest.test.ts
@@ -153,6 +153,6 @@
// Create a nested token ouroboros
const nestedToken = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: tokenIdToAddress(collection, targetToken)});
- expect(transferExpectSuccess(collection, targetToken, alice, {Ethereum: tokenIdToAddress(collection, nestedToken)})).to.be.rejectedWith(/^structure\.OuroborosDetected$/);
+ await expect(transferExpectSuccess(collection, targetToken, alice, {Ethereum: tokenIdToAddress(collection, nestedToken)})).to.be.rejectedWith(/^structure\.OuroborosDetected$/);
});
});
tests/update_apps.shdiffbeforeafterboth--- a/tests/update_apps.sh
+++ b/tests/update_apps.sh
@@ -1,5 +1,7 @@
#!/usr/bin/env sh
+set -eux
+
./update_types.sh
if [ ! -d polkadot-apps ]; then
@@ -8,4 +10,4 @@
pushd polkadot-apps
yarn link ../unique-types-js
-popd
\ No newline at end of file
+popd
tests/update_apps_start.shdiffbeforeafterboth--- a/tests/update_apps_start.sh
+++ b/tests/update_apps_start.sh
@@ -1,7 +1,9 @@
#!/usr/bin/env sh
+set -eux
+
./update_apps.sh
pushd polkadot-apps
yarn start
-popd
\ No newline at end of file
+popd
tests/update_types.shdiffbeforeafterboth--- a/tests/update_types.sh
+++ b/tests/update_types.sh
@@ -1,5 +1,7 @@
#!/usr/bin/env sh
+set -eux
+
yarn polkadot-types
if [ ! -d unique-types-js ]; then