difftreelog
refactor(weight) bench rename `transfer` to `transfer_raw`
in: master
8 files changed
pallets/fungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/fungible/src/benchmarking.rs
+++ b/pallets/fungible/src/benchmarking.rs
@@ -66,7 +66,7 @@
<Pallet<T>>::create_item(&collection, &owner, (burner.clone(), 200), &Unlimited)?;
}: {<Pallet<T>>::burn(&collection, &burner, 100)?}
- transfer {
+ transfer_raw {
bench_init!{
owner: sub; collection: collection(owner);
owner: cross_from_sub; sender: cross_sub; to: cross_sub;
pallets/fungible/src/common.rsdiffbeforeafterboth--- a/pallets/fungible/src/common.rs
+++ b/pallets/fungible/src/common.rs
@@ -78,7 +78,7 @@
}
fn transfer() -> Weight {
- <SelfWeightOf<T>>::transfer() + <PalletCommonWeightOf<T>>::check_accesslist() * 2
+ <SelfWeightOf<T>>::transfer_raw() + <PalletCommonWeightOf<T>>::check_accesslist() * 2
}
fn approve() -> Weight {
pallets/fungible/src/lib.rsdiffbeforeafterboth--- a/pallets/fungible/src/lib.rs
+++ b/pallets/fungible/src/lib.rs
@@ -400,7 +400,7 @@
<CommonError<T>>::TransferNotAllowed,
);
- let mut actual_weight = <SelfWeightOf<T>>::transfer();
+ let mut actual_weight = <SelfWeightOf<T>>::transfer_raw();
if collection.permissions.access() == AccessMode::AllowList {
collection.check_allowlist(from)?;
pallets/fungible/src/weights.rsdiffbeforeafterboth--- a/pallets/fungible/src/weights.rs
+++ b/pallets/fungible/src/weights.rs
@@ -37,7 +37,7 @@
fn create_item() -> Weight;
fn create_multiple_items_ex(b: u32, ) -> Weight;
fn burn_item() -> Weight;
- fn transfer() -> Weight;
+ fn transfer_raw() -> Weight;
fn approve() -> Weight;
fn approve_from() -> Weight;
fn check_allowed_raw() -> Weight;
@@ -93,16 +93,11 @@
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
- /// Storage: Fungible Balance (r:2 w:2)
- /// Proof: Fungible Balance (max_values: None, max_size: Some(77), added: 2552, mode: MaxEncodedLen)
- fn transfer() -> Weight {
- // Proof Size summary in bytes:
- // Measured: `182`
- // Estimated: `5104`
- // Minimum execution time: 13_832_000 picoseconds.
- Weight::from_parts(14_064_000, 5104)
- .saturating_add(T::DbWeight::get().reads(2_u64))
- .saturating_add(T::DbWeight::get().writes(2_u64))
+ // Storage: Fungible Balance (r:2 w:2)
+ fn transfer_raw() -> Weight {
+ Weight::from_ref_time(12_041_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
}
/// Storage: Fungible Balance (r:1 w:0)
/// Proof: Fungible Balance (max_values: None, max_size: Some(77), added: 2552, mode: MaxEncodedLen)
@@ -205,16 +200,11 @@
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
- /// Storage: Fungible Balance (r:2 w:2)
- /// Proof: Fungible Balance (max_values: None, max_size: Some(77), added: 2552, mode: MaxEncodedLen)
- fn transfer() -> Weight {
- // Proof Size summary in bytes:
- // Measured: `182`
- // Estimated: `5104`
- // Minimum execution time: 13_832_000 picoseconds.
- Weight::from_parts(14_064_000, 5104)
- .saturating_add(RocksDbWeight::get().reads(2_u64))
- .saturating_add(RocksDbWeight::get().writes(2_u64))
+ // Storage: Fungible Balance (r:2 w:2)
+ fn transfer_raw() -> Weight {
+ Weight::from_ref_time(12_041_000 as u64)
+ .saturating_add(RocksDbWeight::get().reads(2 as u64))
+ .saturating_add(RocksDbWeight::get().writes(2 as u64))
}
/// Storage: Fungible Balance (r:1 w:0)
/// Proof: Fungible Balance (max_values: None, max_size: Some(77), added: 2552, mode: MaxEncodedLen)
pallets/nonfungible/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 super::*;18use crate::{Pallet, Config, NonfungibleHandle};1920use frame_benchmarking::{benchmarks, account};21use pallet_common::{22 bench_init,23 benchmarking::{create_collection_raw, property_key, property_value},24 CommonCollectionOperations,25};26use sp_std::prelude::*;27use up_data_structs::{28 CollectionMode, MAX_ITEMS_PER_BATCH, MAX_PROPERTIES_PER_ITEM, budget::Unlimited,29 PropertyPermission,30};3132const SEED: u32 = 1;3334fn create_max_item_data<T: Config>(owner: T::CrossAccountId) -> CreateItemData<T> {35 CreateItemData::<T> {36 owner,37 properties: Default::default(),38 }39}40fn create_max_item<T: Config>(41 collection: &NonfungibleHandle<T>,42 sender: &T::CrossAccountId,43 owner: T::CrossAccountId,44) -> Result<TokenId, DispatchError> {45 <Pallet<T>>::create_item(46 &collection,47 sender,48 create_max_item_data::<T>(owner),49 &Unlimited,50 )?;51 Ok(TokenId(<TokensMinted<T>>::get(&collection.id)))52}5354fn create_collection<T: Config>(55 owner: T::CrossAccountId,56) -> Result<NonfungibleHandle<T>, DispatchError> {57 create_collection_raw(58 owner,59 CollectionMode::NFT,60 |owner: T::CrossAccountId, data| {61 <Pallet<T>>::init_collection(owner.clone(), owner, data, Default::default())62 },63 NonfungibleHandle::cast,64 )65}6667benchmarks! {68 create_item {69 bench_init!{70 owner: sub; collection: collection(owner);71 sender: cross_from_sub(owner); to: cross_sub;72 };73 }: {create_max_item(&collection, &sender, to.clone())?}7475 create_multiple_items {76 let b in 0..MAX_ITEMS_PER_BATCH;77 bench_init!{78 owner: sub; collection: collection(owner);79 sender: cross_from_sub(owner); to: cross_sub;80 };81 let data = (0..b).map(|_| create_max_item_data::<T>(to.clone())).collect();82 }: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}8384 create_multiple_items_ex {85 let b in 0..MAX_ITEMS_PER_BATCH;86 bench_init!{87 owner: sub; collection: collection(owner);88 sender: cross_from_sub(owner);89 };90 let data = (0..b).map(|i| {91 bench_init!(to: cross_sub(i););92 create_max_item_data::<T>(to)93 }).collect();94 }: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}9596 burn_item {97 bench_init!{98 owner: sub; collection: collection(owner);99 sender: cross_from_sub(owner); burner: cross_sub;100 };101 let item = create_max_item(&collection, &sender, burner.clone())?;102 }: {<Pallet<T>>::burn(&collection, &burner, item)?}103104 burn_recursively_self_raw {105 bench_init!{106 owner: sub; collection: collection(owner);107 sender: cross_from_sub(owner); burner: cross_sub;108 };109 let item = create_max_item(&collection, &sender, burner.clone())?;110 }: {<Pallet<T>>::burn_recursively(&collection, &burner, item, &Unlimited, &Unlimited)?}111112 burn_recursively_breadth_plus_self_plus_self_per_each_raw {113 let b in 0..200;114 bench_init!{115 owner: sub; collection: collection(owner);116 sender: cross_from_sub(owner); burner: cross_sub;117 };118 let item = create_max_item(&collection, &sender, burner.clone())?;119 for i in 0..b {120 create_max_item(&collection, &sender, T::CrossTokenAddressMapping::token_to_address(collection.id, item))?;121 }122 }: {<Pallet<T>>::burn_recursively(&collection, &burner, item, &Unlimited, &Unlimited)?}123124 transfer {125 bench_init!{126 owner: sub; collection: collection(owner);127 owner: cross_from_sub; sender: cross_sub; receiver: cross_sub;128 };129 let item = create_max_item(&collection, &owner, sender.clone())?;130 }: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, &Unlimited)?}131132 approve {133 bench_init!{134 owner: sub; collection: collection(owner);135 owner: cross_from_sub; sender: cross_sub; spender: cross_sub;136 };137 let item = create_max_item(&collection, &owner, sender.clone())?;138 }: {<Pallet<T>>::set_allowance(&collection, &sender, item, Some(&spender))?}139140 approve_from {141 bench_init!{142 owner: sub; collection: collection(owner);143 owner: cross_from_sub; sender: cross_sub; spender: cross_sub;144 };145 let owner_eth = T::CrossAccountId::from_eth(*sender.as_eth());146 let item = create_max_item(&collection, &owner, owner_eth.clone())?;147 }: {<Pallet<T>>::set_allowance_from(&collection, &sender, &owner_eth, item, Some(&spender))?}148149 checks_allowed_raw {150 bench_init!{151 owner: sub; collection: collection(owner);152 owner: cross_from_sub; sender: cross_sub; spender: cross_sub; receiver: cross_sub;153 };154 let item = create_max_item(&collection, &owner, sender.clone())?;155 <Pallet<T>>::set_allowance(&collection, &sender, item, Some(&spender))?;156 }: {<Pallet<T>>::check_allowed(&collection, &spender, &sender, item, &Unlimited)?}157158 burn_from {159 bench_init!{160 owner: sub; collection: collection(owner);161 owner: cross_from_sub; sender: cross_sub; burner: cross_sub;162 };163 let item = create_max_item(&collection, &owner, sender.clone())?;164 <Pallet<T>>::set_allowance(&collection, &sender, item, Some(&burner))?;165 }: {<Pallet<T>>::burn_from(&collection, &burner, &sender, item, &Unlimited)?}166167 set_token_property_permissions {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 perms = (0..b).map(|k| PropertyKeyPermission {174 key: property_key(k as usize),175 permission: PropertyPermission {176 mutable: false,177 collection_admin: false,178 token_owner: false,179 },180 }).collect::<Vec<_>>();181 }: {<Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?}182183 set_token_properties {184 let b in 0..MAX_PROPERTIES_PER_ITEM;185 bench_init!{186 owner: sub; collection: collection(owner);187 owner: cross_from_sub;188 };189 let perms = (0..b).map(|k| PropertyKeyPermission {190 key: property_key(k as usize),191 permission: PropertyPermission {192 mutable: false,193 collection_admin: true,194 token_owner: true,195 },196 }).collect::<Vec<_>>();197 <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;198 let props = (0..b).map(|k| Property {199 key: property_key(k as usize),200 value: property_value(),201 }).collect::<Vec<_>>();202 let item = create_max_item(&collection, &owner, owner.clone())?;203 }: {<Pallet<T>>::set_token_properties(&collection, &owner, item, props.into_iter(), false, &Unlimited)?}204205 delete_token_properties {206 let b in 0..MAX_PROPERTIES_PER_ITEM;207 bench_init!{208 owner: sub; collection: collection(owner);209 owner: cross_from_sub;210 };211 let perms = (0..b).map(|k| PropertyKeyPermission {212 key: property_key(k as usize),213 permission: PropertyPermission {214 mutable: true,215 collection_admin: true,216 token_owner: true,217 },218 }).collect::<Vec<_>>();219 <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;220 let props = (0..b).map(|k| Property {221 key: property_key(k as usize),222 value: property_value(),223 }).collect::<Vec<_>>();224 let item = create_max_item(&collection, &owner, owner.clone())?;225 <Pallet<T>>::set_token_properties(&collection, &owner, item, props.into_iter(), false, &Unlimited)?;226 let to_delete = (0..b).map(|k| property_key(k as usize)).collect::<Vec<_>>();227 }: {<Pallet<T>>::delete_token_properties(&collection, &owner, item, to_delete.into_iter(), &Unlimited)?}228229 token_owner {230 bench_init!{231 owner: sub; collection: collection(owner);232 owner: cross_from_sub;233 };234 let item = create_max_item(&collection, &owner, owner.clone())?;235 }: {collection.token_owner(item).unwrap()}236237 set_allowance_for_all {238 bench_init!{239 owner: sub; collection: collection(owner); owner: cross_from_sub;240 operator: cross_sub;241 };242 }: {<Pallet<T>>::set_allowance_for_all(&collection, &owner, &operator, true)?}243244 allowance_for_all {245 bench_init!{246 owner: sub; collection: collection(owner); owner: cross_from_sub;247 operator: cross_sub;248 };249 }: {<Pallet<T>>::allowance_for_all(&collection, &owner, &operator)}250251 repair_item {252 bench_init!{253 owner: sub; collection: collection(owner);254 owner: cross_from_sub;255 };256 let item = create_max_item(&collection, &owner, owner.clone())?;257 }: {<Pallet<T>>::repair_item(&collection, item)?}258}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 super::*;18use crate::{Pallet, Config, NonfungibleHandle};1920use frame_benchmarking::{benchmarks, account};21use pallet_common::{22 bench_init,23 benchmarking::{create_collection_raw, property_key, property_value},24 CommonCollectionOperations,25};26use sp_std::prelude::*;27use up_data_structs::{28 CollectionMode, MAX_ITEMS_PER_BATCH, MAX_PROPERTIES_PER_ITEM, budget::Unlimited,29 PropertyPermission,30};3132const SEED: u32 = 1;3334fn create_max_item_data<T: Config>(owner: T::CrossAccountId) -> CreateItemData<T> {35 CreateItemData::<T> {36 owner,37 properties: Default::default(),38 }39}40fn create_max_item<T: Config>(41 collection: &NonfungibleHandle<T>,42 sender: &T::CrossAccountId,43 owner: T::CrossAccountId,44) -> Result<TokenId, DispatchError> {45 <Pallet<T>>::create_item(46 &collection,47 sender,48 create_max_item_data::<T>(owner),49 &Unlimited,50 )?;51 Ok(TokenId(<TokensMinted<T>>::get(&collection.id)))52}5354fn create_collection<T: Config>(55 owner: T::CrossAccountId,56) -> Result<NonfungibleHandle<T>, DispatchError> {57 create_collection_raw(58 owner,59 CollectionMode::NFT,60 |owner: T::CrossAccountId, data| {61 <Pallet<T>>::init_collection(owner.clone(), owner, data, Default::default())62 },63 NonfungibleHandle::cast,64 )65}6667benchmarks! {68 create_item {69 bench_init!{70 owner: sub; collection: collection(owner);71 sender: cross_from_sub(owner); to: cross_sub;72 };73 }: {create_max_item(&collection, &sender, to.clone())?}7475 create_multiple_items {76 let b in 0..MAX_ITEMS_PER_BATCH;77 bench_init!{78 owner: sub; collection: collection(owner);79 sender: cross_from_sub(owner); to: cross_sub;80 };81 let data = (0..b).map(|_| create_max_item_data::<T>(to.clone())).collect();82 }: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}8384 create_multiple_items_ex {85 let b in 0..MAX_ITEMS_PER_BATCH;86 bench_init!{87 owner: sub; collection: collection(owner);88 sender: cross_from_sub(owner);89 };90 let data = (0..b).map(|i| {91 bench_init!(to: cross_sub(i););92 create_max_item_data::<T>(to)93 }).collect();94 }: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}9596 burn_item {97 bench_init!{98 owner: sub; collection: collection(owner);99 sender: cross_from_sub(owner); burner: cross_sub;100 };101 let item = create_max_item(&collection, &sender, burner.clone())?;102 }: {<Pallet<T>>::burn(&collection, &burner, item)?}103104 burn_recursively_self_raw {105 bench_init!{106 owner: sub; collection: collection(owner);107 sender: cross_from_sub(owner); burner: cross_sub;108 };109 let item = create_max_item(&collection, &sender, burner.clone())?;110 }: {<Pallet<T>>::burn_recursively(&collection, &burner, item, &Unlimited, &Unlimited)?}111112 burn_recursively_breadth_plus_self_plus_self_per_each_raw {113 let b in 0..200;114 bench_init!{115 owner: sub; collection: collection(owner);116 sender: cross_from_sub(owner); burner: cross_sub;117 };118 let item = create_max_item(&collection, &sender, burner.clone())?;119 for i in 0..b {120 create_max_item(&collection, &sender, T::CrossTokenAddressMapping::token_to_address(collection.id, item))?;121 }122 }: {<Pallet<T>>::burn_recursively(&collection, &burner, item, &Unlimited, &Unlimited)?}123124 transfer_raw {125 bench_init!{126 owner: sub; collection: collection(owner);127 owner: cross_from_sub; sender: cross_sub; receiver: cross_sub;128 };129 let item = create_max_item(&collection, &owner, sender.clone())?;130 }: {<Pallet<T>>::transfer(&collection, &sender, &receiver, item, &Unlimited)?}131132 approve {133 bench_init!{134 owner: sub; collection: collection(owner);135 owner: cross_from_sub; sender: cross_sub; spender: cross_sub;136 };137 let item = create_max_item(&collection, &owner, sender.clone())?;138 }: {<Pallet<T>>::set_allowance(&collection, &sender, item, Some(&spender))?}139140 approve_from {141 bench_init!{142 owner: sub; collection: collection(owner);143 owner: cross_from_sub; sender: cross_sub; spender: cross_sub;144 };145 let owner_eth = T::CrossAccountId::from_eth(*sender.as_eth());146 let item = create_max_item(&collection, &owner, owner_eth.clone())?;147 }: {<Pallet<T>>::set_allowance_from(&collection, &sender, &owner_eth, item, Some(&spender))?}148149 checks_allowed_raw {150 bench_init!{151 owner: sub; collection: collection(owner);152 owner: cross_from_sub; sender: cross_sub; spender: cross_sub; receiver: cross_sub;153 };154 let item = create_max_item(&collection, &owner, sender.clone())?;155 <Pallet<T>>::set_allowance(&collection, &sender, item, Some(&spender))?;156 }: {<Pallet<T>>::check_allowed(&collection, &spender, &sender, item, &Unlimited)?}157158 burn_from {159 bench_init!{160 owner: sub; collection: collection(owner);161 owner: cross_from_sub; sender: cross_sub; burner: cross_sub;162 };163 let item = create_max_item(&collection, &owner, sender.clone())?;164 <Pallet<T>>::set_allowance(&collection, &sender, item, Some(&burner))?;165 }: {<Pallet<T>>::burn_from(&collection, &burner, &sender, item, &Unlimited)?}166167 set_token_property_permissions {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 perms = (0..b).map(|k| PropertyKeyPermission {174 key: property_key(k as usize),175 permission: PropertyPermission {176 mutable: false,177 collection_admin: false,178 token_owner: false,179 },180 }).collect::<Vec<_>>();181 }: {<Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?}182183 set_token_properties {184 let b in 0..MAX_PROPERTIES_PER_ITEM;185 bench_init!{186 owner: sub; collection: collection(owner);187 owner: cross_from_sub;188 };189 let perms = (0..b).map(|k| PropertyKeyPermission {190 key: property_key(k as usize),191 permission: PropertyPermission {192 mutable: false,193 collection_admin: true,194 token_owner: true,195 },196 }).collect::<Vec<_>>();197 <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;198 let props = (0..b).map(|k| Property {199 key: property_key(k as usize),200 value: property_value(),201 }).collect::<Vec<_>>();202 let item = create_max_item(&collection, &owner, owner.clone())?;203 }: {<Pallet<T>>::set_token_properties(&collection, &owner, item, props.into_iter(), false, &Unlimited)?}204205 delete_token_properties {206 let b in 0..MAX_PROPERTIES_PER_ITEM;207 bench_init!{208 owner: sub; collection: collection(owner);209 owner: cross_from_sub;210 };211 let perms = (0..b).map(|k| PropertyKeyPermission {212 key: property_key(k as usize),213 permission: PropertyPermission {214 mutable: true,215 collection_admin: true,216 token_owner: true,217 },218 }).collect::<Vec<_>>();219 <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;220 let props = (0..b).map(|k| Property {221 key: property_key(k as usize),222 value: property_value(),223 }).collect::<Vec<_>>();224 let item = create_max_item(&collection, &owner, owner.clone())?;225 <Pallet<T>>::set_token_properties(&collection, &owner, item, props.into_iter(), false, &Unlimited)?;226 let to_delete = (0..b).map(|k| property_key(k as usize)).collect::<Vec<_>>();227 }: {<Pallet<T>>::delete_token_properties(&collection, &owner, item, to_delete.into_iter(), &Unlimited)?}228229 token_owner {230 bench_init!{231 owner: sub; collection: collection(owner);232 owner: cross_from_sub;233 };234 let item = create_max_item(&collection, &owner, owner.clone())?;235 }: {collection.token_owner(item).unwrap()}236237 set_allowance_for_all {238 bench_init!{239 owner: sub; collection: collection(owner); owner: cross_from_sub;240 operator: cross_sub;241 };242 }: {<Pallet<T>>::set_allowance_for_all(&collection, &owner, &operator, true)?}243244 allowance_for_all {245 bench_init!{246 owner: sub; collection: collection(owner); owner: cross_from_sub;247 operator: cross_sub;248 };249 }: {<Pallet<T>>::allowance_for_all(&collection, &owner, &operator)}250251 repair_item {252 bench_init!{253 owner: sub; collection: collection(owner);254 owner: cross_from_sub;255 };256 let item = create_max_item(&collection, &owner, owner.clone())?;257 }: {<Pallet<T>>::repair_item(&collection, item)?}258}pallets/nonfungible/src/common.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -91,7 +91,7 @@
}
fn transfer() -> Weight {
- <SelfWeightOf<T>>::transfer() + <PalletCommonWeightOf<T>>::check_accesslist() * 2
+ <SelfWeightOf<T>>::transfer_raw() + <PalletCommonWeightOf<T>>::check_accesslist() * 2
}
fn approve() -> Weight {
pallets/nonfungible/src/lib.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -809,7 +809,7 @@
<CommonError<T>>::TransferNotAllowed
);
- let mut actual_weight = <SelfWeightOf<T>>::transfer();
+ let mut actual_weight = <SelfWeightOf<T>>::transfer_raw();
let token_data =
<TokenData<T>>::get((collection.id, token)).ok_or(<CommonError<T>>::TokenNotFound)?;
ensure!(&token_data.owner == from, <CommonError<T>>::NoPermission);
pallets/nonfungible/src/weights.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/weights.rs
+++ b/pallets/nonfungible/src/weights.rs
@@ -40,7 +40,7 @@
fn burn_item() -> Weight;
fn burn_recursively_self_raw() -> Weight;
fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(b: u32, ) -> Weight;
- fn transfer() -> Weight;
+ fn transfer_raw() -> Weight;
fn approve() -> Weight;
fn approve_from() -> Weight;
fn checks_allowed_raw() -> Weight;
@@ -209,22 +209,14 @@
.saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(b.into())))
.saturating_add(Weight::from_parts(0, 10097).saturating_mul(b.into()))
}
- /// Storage: Nonfungible TokenData (r:1 w:1)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible AccountBalance (r:2 w:2)
- /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Nonfungible Allowance (r:1 w:0)
- /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible Owned (r:0 w:2)
- /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
- fn transfer() -> Weight {
- // Proof Size summary in bytes:
- // Measured: `412`
- // Estimated: `10144`
- // Minimum execution time: 18_629_000 picoseconds.
- Weight::from_parts(18_997_000, 10144)
- .saturating_add(T::DbWeight::get().reads(4_u64))
- .saturating_add(T::DbWeight::get().writes(5_u64))
+ // Storage: Nonfungible TokenData (r:1 w:1)
+ // Storage: Nonfungible AccountBalance (r:2 w:2)
+ // Storage: Nonfungible Allowance (r:1 w:0)
+ // Storage: Nonfungible Owned (r:0 w:2)
+ fn transfer_raw() -> Weight {
+ Weight::from_ref_time(14_909_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(4 as u64))
+ .saturating_add(T::DbWeight::get().writes(5 as u64))
}
/// Storage: Nonfungible TokenData (r:1 w:0)
/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
@@ -523,22 +515,14 @@
.saturating_add(RocksDbWeight::get().writes((4_u64).saturating_mul(b.into())))
.saturating_add(Weight::from_parts(0, 10097).saturating_mul(b.into()))
}
- /// Storage: Nonfungible TokenData (r:1 w:1)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible AccountBalance (r:2 w:2)
- /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Nonfungible Allowance (r:1 w:0)
- /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible Owned (r:0 w:2)
- /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
- fn transfer() -> Weight {
- // Proof Size summary in bytes:
- // Measured: `412`
- // Estimated: `10144`
- // Minimum execution time: 18_629_000 picoseconds.
- Weight::from_parts(18_997_000, 10144)
- .saturating_add(RocksDbWeight::get().reads(4_u64))
- .saturating_add(RocksDbWeight::get().writes(5_u64))
+ // Storage: Nonfungible TokenData (r:1 w:1)
+ // Storage: Nonfungible AccountBalance (r:2 w:2)
+ // Storage: Nonfungible Allowance (r:1 w:0)
+ // Storage: Nonfungible Owned (r:0 w:2)
+ fn transfer_raw() -> Weight {
+ Weight::from_ref_time(14_909_000 as u64)
+ .saturating_add(RocksDbWeight::get().reads(4 as u64))
+ .saturating_add(RocksDbWeight::get().writes(5 as u64))
}
/// Storage: Nonfungible TokenData (r:1 w:0)
/// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)