difftreelog
Merge pull request #907 from UniqueNetwork/feature/nft-transfer-correct-weight
in: master
feat(weight): added benchs for decompose weight
23 files changed
Cargo.lockdiffbeforeafterboth626262626263[[package]]6263[[package]]6264name = "pallet-common"6264name = "pallet-common"6265version = "0.1.13"6265version = "0.1.14"6266dependencies = [6266dependencies = [6267 "ethereum",6267 "ethereum",6268 "evm-coder",6268 "evm-coder",655865586559[[package]]6559[[package]]6560name = "pallet-fungible"6560name = "pallet-fungible"6561version = "0.1.10"6561version = "0.1.11"6562dependencies = [6562dependencies = [6563 "evm-coder",6563 "evm-coder",6564 "frame-benchmarking",6564 "frame-benchmarking",681468146815[[package]]6815[[package]]6816name = "pallet-nonfungible"6816name = "pallet-nonfungible"6817version = "0.1.13"6817version = "0.1.14"6818dependencies = [6818dependencies = [6819 "evm-coder",6819 "evm-coder",6820 "frame-benchmarking",6820 "frame-benchmarking",pallets/app-promotion/src/lib.rsdiffbeforeafterboth845 /// - `staker`: staker account.845 /// - `staker`: staker account.846 pub fn total_staked_by_id(staker: impl EncodeLike<T::AccountId>) -> Option<BalanceOf<T>> {846 pub fn total_staked_by_id(staker: impl EncodeLike<T::AccountId>) -> Option<BalanceOf<T>> {847 let staked = Staked::<T>::iter_prefix((staker,))847 let staked = Staked::<T>::iter_prefix((staker,))848 .into_iter()849 .fold(<BalanceOf<T>>::default(), |acc, (_, (amount, _))| {848 .fold(<BalanceOf<T>>::default(), |acc, (_, (amount, _))| {850 acc + amount849 acc + amount851 });850 });864 staker: impl EncodeLike<T::AccountId>,863 staker: impl EncodeLike<T::AccountId>,865 ) -> Option<Vec<(T::BlockNumber, BalanceOf<T>)>> {864 ) -> Option<Vec<(T::BlockNumber, BalanceOf<T>)>> {866 let mut staked = Staked::<T>::iter_prefix((staker,))865 let mut staked = Staked::<T>::iter_prefix((staker,))867 .into_iter()868 .map(|(block, (amount, _))| (block, amount))866 .map(|(block, (amount, _))| (block, amount))869 .collect::<Vec<_>>();867 .collect::<Vec<_>>();870 staked.sort_by_key(|(block, _)| *block);868 staked.sort_by_key(|(block, _)| *block);884 })882 })885 }883 }886887 // pub fn cross_id_locked_balance(staker: T::CrossAccountId) -> BalanceOf<T> {888 // Self::get_locked_balance(staker.as_sub())889 // .map(|l| l.amount)890 // .unwrap_or_default()891 // }892884893 /// Returns all relay block numbers when stake was made,885 /// Returns all relay block numbers when stake was made,894 /// the amount of the stake.886 /// the amount of the stake.pallets/common/CHANGELOG.mddiffbeforeafterboth445<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->667## [0.1.14] - 2023-03-2889### Added1011- Added benchmark to check if user is contained in AllowList (`check_accesslist()`).127## [0.1.13] - 2023-01-2013## [0.1.13] - 2023-01-208149### Changed15### Changedpallets/common/Cargo.tomldiffbeforeafterboth2edition = "2021"2edition = "2021"3license = "GPLv3"3license = "GPLv3"4name = "pallet-common"4name = "pallet-common"5version = "0.1.13"5version = "0.1.14"667[dependencies]7[dependencies]8# Note: `package = "parity-scale-codec"` must be supplied since the `Encode` macro searches for it.8# Note: `package = "parity-scale-codec"` must be supplied since the `Encode` macro searches for it.pallets/common/src/benchmarking.rsdiffbeforeafterboth22use frame_benchmarking::{benchmarks, account};22use frame_benchmarking::{benchmarks, account};23use up_data_structs::{23use up_data_structs::{24 CollectionMode, CollectionFlags, CreateCollectionData, CollectionId, Property, PropertyKey,24 CollectionMode, CollectionFlags, CreateCollectionData, CollectionId, Property, PropertyKey,25 PropertyValue, CollectionPermissions, NestingPermissions, MAX_COLLECTION_NAME_LENGTH,25 PropertyValue, CollectionPermissions, NestingPermissions, AccessMode,26 MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH, MAX_PROPERTIES_PER_ITEM,26 MAX_COLLECTION_NAME_LENGTH, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH,27 MAX_PROPERTIES_PER_ITEM,27};28};194 let to_delete = (0..b).map(|p| property_key(p as usize)).collect::<Vec<_>>();195 let to_delete = (0..b).map(|p| property_key(p as usize)).collect::<Vec<_>>();195 }: {<Pallet<T>>::delete_collection_properties(&collection, &owner, to_delete.into_iter())?}196 }: {<Pallet<T>>::delete_collection_properties(&collection, &owner, to_delete.into_iter())?}197198 check_accesslist{199 bench_init!{200 owner: sub; collection: collection(owner);201 sender: cross_from_sub(owner);202 };203204 let mut collection_handle = <CollectionHandle<T>>::try_get(collection.id)?;205 <Pallet<T>>::update_permissions(206 &sender,207 &mut collection_handle,208 CollectionPermissions { access: Some(AccessMode::AllowList), ..Default::default() }209 )?;210211 <Pallet<T>>::toggle_allowlist(212 &collection,213 &sender,214 &sender,215 true,216 )?;217218 assert_eq!(collection_handle.permissions.access(), AccessMode::AllowList);219220 }: {collection_handle.check_allowlist(&sender)?;}196}221}197222pallets/common/src/helpers.rsdiffbeforeafterbothno changes
pallets/common/src/lib.rsdiffbeforeafterboth92pub mod dispatch;92pub mod dispatch;93pub mod erc;93pub mod erc;94pub mod eth;94pub mod eth;95pub mod helpers;95#[allow(missing_docs)]96#[allow(missing_docs)]96pub mod weights;97pub mod weights;97pallets/common/src/weights.rsdiffbeforeafterboth36pub trait WeightInfo {36pub trait WeightInfo {37 fn set_collection_properties(b: u32, ) -> Weight;37 fn set_collection_properties(b: u32, ) -> Weight;38 fn delete_collection_properties(b: u32, ) -> Weight;38 fn delete_collection_properties(b: u32, ) -> Weight;39 fn check_accesslist() -> Weight;39}40}404141/// Weights for pallet_common using the Substrate node and recommended hardware.42/// Weights for pallet_common using the Substrate node and recommended hardware.69 .saturating_add(T::DbWeight::get().reads(1_u64))70 .saturating_add(T::DbWeight::get().reads(1_u64))70 .saturating_add(T::DbWeight::get().writes(1_u64))71 .saturating_add(T::DbWeight::get().writes(1_u64))71 }72 }73 /// Storage: Common Allowlist (r:1 w:0)74 /// Proof: Common Allowlist (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen)75 fn check_accesslist() -> Weight {76 // Proof Size summary in bytes:77 // Measured: `340`78 // Estimated: `2545`79 // Minimum execution time: 2_887_000 picoseconds.80 Weight::from_parts(3_072_000, 2545)81 .saturating_add(T::DbWeight::get().reads(1_u64))82 }72}83}738474// For backwards compatibility and tests85// For backwards compatibility and tests101 .saturating_add(RocksDbWeight::get().reads(1_u64))112 .saturating_add(RocksDbWeight::get().reads(1_u64))102 .saturating_add(RocksDbWeight::get().writes(1_u64))113 .saturating_add(RocksDbWeight::get().writes(1_u64))103 }114 }115 /// Storage: Common Allowlist (r:1 w:0)116 /// Proof: Common Allowlist (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen)117 fn check_accesslist() -> Weight {118 // Proof Size summary in bytes:119 // Measured: `340`120 // Estimated: `2545`121 // Minimum execution time: 2_887_000 picoseconds.122 Weight::from_parts(3_072_000, 2545)123 .saturating_add(RocksDbWeight::get().reads(1_u64))124 }104}125}105126106127pallets/foreign-assets/src/impl_fungibles.rsdiffbeforeafterboth453 amount.into(),453 amount.into(),454 &Value::new(0),454 &Value::new(0),455 )?;455 )456 .map_err(|e| e.error)?;456457457 Ok(amount)458 Ok(amount)458 }459 }pallets/fungible/CHANGELOG.mddiffbeforeafterboth445<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->667## [0.1.11] - 2023-03-2889### Fixed1011- The weight of `transfer` and `transfer_from`.127## [0.1.10] - 2023-02-0113## [0.1.10] - 2023-02-018149### Added15### Addedpallets/fungible/Cargo.tomldiffbeforeafterboth2edition = "2021"2edition = "2021"3license = "GPLv3"3license = "GPLv3"4name = "pallet-fungible"4name = "pallet-fungible"5version = "0.1.10"5version = "0.1.11"667[dependencies]7[dependencies]8# Note: `package = "parity-scale-codec"` must be supplied since the `Encode` macro searches for it.8# Note: `package = "parity-scale-codec"` must be supplied since the `Encode` macro searches for it.pallets/fungible/src/benchmarking.rsdiffbeforeafterboth66 <Pallet<T>>::create_item(&collection, &owner, (burner.clone(), 200), &Unlimited)?;66 <Pallet<T>>::create_item(&collection, &owner, (burner.clone(), 200), &Unlimited)?;67 }: {<Pallet<T>>::burn(&collection, &burner, 100)?}67 }: {<Pallet<T>>::burn(&collection, &burner, 100)?}686869 transfer {69 transfer_raw {70 bench_init!{70 bench_init!{71 owner: sub; collection: collection(owner);71 owner: sub; collection: collection(owner);72 owner: cross_from_sub; sender: cross_sub; to: cross_sub;72 owner: cross_from_sub; sender: cross_sub; to: cross_sub;92 <Pallet<T>>::create_item(&collection, &owner, (owner_eth.clone(), 200), &Unlimited)?;92 <Pallet<T>>::create_item(&collection, &owner, (owner_eth.clone(), 200), &Unlimited)?;93 }: {<Pallet<T>>::set_allowance_from(&collection, &sender, &owner_eth, &spender, 100)?}93 }: {<Pallet<T>>::set_allowance_from(&collection, &sender, &owner_eth, &spender, 100)?}949495 transfer_from {95 check_allowed_raw {96 bench_init!{96 bench_init!{97 owner: sub; collection: collection(owner);97 owner: sub; collection: collection(owner);98 owner: cross_from_sub; sender: cross_sub; spender: cross_sub; receiver: cross_sub;98 owner: cross_from_sub; sender: cross_sub; spender: cross_sub;99 };99 };100 <Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;100 <Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;101 <Pallet<T>>::set_allowance(&collection, &sender, &spender, 200)?;101 <Pallet<T>>::set_allowance(&collection, &sender, &spender, 200)?;102 }: {<Pallet<T>>::transfer_from(&collection, &spender, &sender, &receiver, 100, &Unlimited)?}102 }: {<Pallet<T>>::check_allowed(&collection, &spender, &sender, 200, &Unlimited)?;}103104 set_allowance_unchecked_raw {105 bench_init!{106 owner: sub; collection: collection(owner);107 owner: cross_from_sub; sender: cross_sub; spender: cross_sub;108 };109 <Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;110 }: {<Pallet<T>>::set_allowance_unchecked(&collection, &sender, &spender, 200);}103111104 burn_from {112 burn_from {105 bench_init!{113 bench_init!{pallets/fungible/src/common.rsdiffbeforeafterboth22};22};23use pallet_common::{23use pallet_common::{24 CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight,24 CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight,25 weights::WeightInfo as _,25 weights::WeightInfo as _, SelfWeightOf as PalletCommonWeightOf,26};26};27use pallet_structure::Error as StructureError;27use pallet_structure::Error as StructureError;28use sp_runtime::ArithmeticError;28use sp_runtime::ArithmeticError;78 }78 }797980 fn transfer() -> Weight {80 fn transfer() -> Weight {81 <SelfWeightOf<T>>::transfer()81 <SelfWeightOf<T>>::transfer_raw() + <PalletCommonWeightOf<T>>::check_accesslist() * 282 }82 }838384 fn approve() -> Weight {84 fn approve() -> Weight {90 }90 }919192 fn transfer_from() -> Weight {92 fn transfer_from() -> Weight {93 Self::transfer()94 + <SelfWeightOf<T>>::check_allowed_raw()93 <SelfWeightOf<T>>::transfer_from()95 + <SelfWeightOf<T>>::set_allowance_unchecked_raw()94 }96 }959796 fn burn_from() -> Weight {98 fn burn_from() -> Weight {232 <Error<T>>::FungibleItemsHaveNoId234 <Error<T>>::FungibleItemsHaveNoId233 );235 );234236235 with_weight(236 <Pallet<T>>::transfer(self, &from, &to, amount, nesting_budget),237 <Pallet<T>>::transfer(self, &from, &to, amount, nesting_budget)237 <CommonWeights<T>>::transfer(),238 )239 }238 }240239241 fn approve(240 fn approve(289 <Error<T>>::FungibleItemsHaveNoId288 <Error<T>>::FungibleItemsHaveNoId290 );289 );291290292 with_weight(293 <Pallet<T>>::transfer_from(self, &sender, &from, &to, amount, nesting_budget),291 <Pallet<T>>::transfer_from(self, &sender, &from, &to, amount, nesting_budget)294 <CommonWeights<T>>::transfer_from(),295 )296 }292 }297293298 fn burn_from(294 fn burn_from(pallets/fungible/src/erc.rsdiffbeforeafterboth26 CollectionHandle,26 CollectionHandle,27 erc::{CommonEvmHandler, PrecompileResult, CollectionCall},27 erc::{CommonEvmHandler, PrecompileResult, CollectionCall},28 eth::CrossAddress,28 eth::CrossAddress,29 CommonWeightInfo as _,29};30};30use sp_std::vec::Vec;31use sp_std::vec::Vec;31use pallet_evm::{account::CrossAccountId, PrecompileHandle};32use pallet_evm::{account::CrossAccountId, PrecompileHandle};394040use crate::{41use crate::{41 Allowance, Balance, Config, FungibleHandle, Pallet, TotalSupply, SelfWeightOf,42 Allowance, Balance, Config, FungibleHandle, Pallet, TotalSupply, SelfWeightOf,42 weights::WeightInfo,43 weights::WeightInfo, common::CommonWeights,43};44};444545frontier_contract! {46frontier_contract! {99 let balance = <Balance<T>>::get((self.id, owner));100 let balance = <Balance<T>>::get((self.id, owner));100 Ok(balance.into())101 Ok(balance.into())101 }102 }102 #[weight(<SelfWeightOf<T>>::transfer())]103 #[weight(<CommonWeights<T>>::transfer())]103 fn transfer(&mut self, caller: Caller, to: Address, amount: U256) -> Result<bool> {104 fn transfer(&mut self, caller: Caller, to: Address, amount: U256) -> Result<bool> {104 let caller = T::CrossAccountId::from_eth(caller);105 let caller = T::CrossAccountId::from_eth(caller);105 let to = T::CrossAccountId::from_eth(to);106 let to = T::CrossAccountId::from_eth(to);112 Ok(true)113 Ok(true)113 }114 }114115115 #[weight(<SelfWeightOf<T>>::transfer_from())]116 #[weight(<CommonWeights<T>>::transfer_from())]116 fn transfer_from(117 fn transfer_from(117 &mut self,118 &mut self,118 caller: Caller,119 caller: Caller,129 .weight_calls_budget(<StructureWeight<T>>::find_parent());130 .weight_calls_budget(<StructureWeight<T>>::find_parent());130131131 <Pallet<T>>::transfer_from(self, &caller, &from, &to, amount, &budget)132 <Pallet<T>>::transfer_from(self, &caller, &from, &to, amount, &budget)132 .map_err(dispatch_to_evm::<T>)?;133 .map_err(|e| dispatch_to_evm::<T>(e.error))?;133 Ok(true)134 Ok(true)134 }135 }135 #[weight(<SelfWeightOf<T>>::approve())]136 #[weight(<SelfWeightOf<T>>::approve())]201 let budget = self202 let budget = self202 .recorder203 .recorder203 .weight_calls_budget(<StructureWeight<T>>::find_parent());204 .weight_calls_budget(<StructureWeight<T>>::find_parent());204 <Pallet<T>>::create_item(&self, &caller, (to, amount), &budget)205 <Pallet<T>>::create_item(self, &caller, (to, amount), &budget)205 .map_err(dispatch_to_evm::<T>)?;206 .map_err(dispatch_to_evm::<T>)?;206 Ok(true)207 Ok(true)207 }208 }289 Ok(true)290 Ok(true)290 }291 }291292292 #[weight(<SelfWeightOf<T>>::transfer())]293 #[weight(<CommonWeights<T>>::transfer())]293 fn transfer_cross(&mut self, caller: Caller, to: CrossAddress, amount: U256) -> Result<bool> {294 fn transfer_cross(&mut self, caller: Caller, to: CrossAddress, amount: U256) -> Result<bool> {294 let caller = T::CrossAccountId::from_eth(caller);295 let caller = T::CrossAccountId::from_eth(caller);295 let to = to.into_sub_cross_account::<T>()?;296 let to = to.into_sub_cross_account::<T>()?;302 Ok(true)303 Ok(true)303 }304 }304305305 #[weight(<SelfWeightOf<T>>::transfer_from())]306 #[weight(<CommonWeights<T>>::transfer_from())]306 fn transfer_from_cross(307 fn transfer_from_cross(307 &mut self,308 &mut self,308 caller: Caller,309 caller: Caller,319 .weight_calls_budget(<StructureWeight<T>>::find_parent());320 .weight_calls_budget(<StructureWeight<T>>::find_parent());320321321 <Pallet<T>>::transfer_from(self, &caller, &from, &to, amount, &budget)322 <Pallet<T>>::transfer_from(self, &caller, &from, &to, amount, &budget)322 .map_err(dispatch_to_evm::<T>)?;323 .map_err(|e| dispatch_to_evm::<T>(e.error))?;323 Ok(true)324 Ok(true)324 }325 }325326pallets/fungible/src/lib.rsdiffbeforeafterboth808081use core::ops::Deref;81use core::ops::Deref;82use evm_coder::ToLog;82use evm_coder::ToLog;83use frame_support::ensure;83use frame_support::{84 ensure,85 pallet_prelude::{DispatchResultWithPostInfo, Pays},86 dispatch::PostDispatchInfo,87};84use pallet_evm::account::CrossAccountId;88use pallet_evm::account::CrossAccountId;85use up_data_structs::{89use up_data_structs::{86 AccessMode, CollectionId, CollectionFlags, TokenId, CreateCollectionData,90 AccessMode, CollectionId, CollectionFlags, TokenId, CreateCollectionData,87 mapping::TokenAddressMapping, budget::Budget, PropertyKey, Property,91 mapping::TokenAddressMapping, budget::Budget, PropertyKey, Property,88};92};89use pallet_common::{93use pallet_common::{90 Error as CommonError, Event as CommonEvent, Pallet as PalletCommon,94 Error as CommonError, Event as CommonEvent, Pallet as PalletCommon,91 eth::collection_id_to_address,95 eth::collection_id_to_address, SelfWeightOf as PalletCommonWeightOf,96 weights::WeightInfo as CommonWeightInfo, helpers::add_weight_to_post_info,92};97};93use pallet_evm::Pallet as PalletEvm;98use pallet_evm::Pallet as PalletEvm;94use pallet_structure::Pallet as PalletStructure;99use pallet_structure::Pallet as PalletStructure;95use pallet_evm_coder_substrate::WithRecorder;100use pallet_evm_coder_substrate::WithRecorder;96use sp_core::H160;101use sp_core::H160;97use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};102use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};98use sp_std::{collections::btree_map::BTreeMap, vec::Vec};103use sp_std::{collections::btree_map::BTreeMap, vec::Vec};99104use weights::WeightInfo;100pub use pallet::*;105pub use pallet::*;101106102use crate::erc::ERC20Events;107use crate::erc::ERC20Events;389 to: &T::CrossAccountId,394 to: &T::CrossAccountId,390 amount: u128,395 amount: u128,391 nesting_budget: &dyn Budget,396 nesting_budget: &dyn Budget,392 ) -> DispatchResult {397 ) -> DispatchResultWithPostInfo {393 ensure!(398 ensure!(394 collection.limits.transfers_enabled(),399 collection.limits.transfers_enabled(),395 <CommonError<T>>::TransferNotAllowed,400 <CommonError<T>>::TransferNotAllowed,396 );401 );402403 let mut actual_weight = <SelfWeightOf<T>>::transfer_raw();397404398 if collection.permissions.access() == AccessMode::AllowList {405 if collection.permissions.access() == AccessMode::AllowList {399 collection.check_allowlist(from)?;406 collection.check_allowlist(from)?;400 collection.check_allowlist(to)?;407 collection.check_allowlist(to)?;408 actual_weight += <PalletCommonWeightOf<T>>::check_accesslist() * 2;401 }409 }402 <PalletCommon<T>>::ensure_correct_receiver(to)?;410 <PalletCommon<T>>::ensure_correct_receiver(to)?;403452 amount,459 amount,453 ));460 ));461454 Ok(())462 Ok(PostDispatchInfo {463 actual_weight: Some(actual_weight),464 pays_fee: Pays::Yes,465 })455 }466 }456467457 /// Minting tokens for multiple IDs.468 /// Minting tokens for multiple IDs.464 nesting_budget: &dyn Budget,475 nesting_budget: &dyn Budget,465 ) -> DispatchResult {476 ) -> DispatchResult {466 let total_supply = data477 let total_supply = data467 .iter()478 .values()468 .map(|(_, v)| *v)479 .copied()469 .try_fold(<TotalSupply<T>>::get(collection.id), |acc, v| {480 .try_fold(<TotalSupply<T>>::get(collection.id), |acc, v| {470 acc.checked_add(v)481 acc.checked_add(v)471 })482 })726 to: &T::CrossAccountId,736 to: &T::CrossAccountId,727 amount: u128,737 amount: u128,728 nesting_budget: &dyn Budget,738 nesting_budget: &dyn Budget,729 ) -> DispatchResult {739 ) -> DispatchResultWithPostInfo {730 let allowance = Self::check_allowed(collection, spender, from, amount, nesting_budget)?;740 let allowance = Self::check_allowed(collection, spender, from, amount, nesting_budget)?;731741732 // =========742 // =========733743734 Self::transfer(collection, from, to, amount, nesting_budget)?;744 let mut result = Self::transfer(collection, from, to, amount, nesting_budget);745 add_weight_to_post_info(&mut result, <SelfWeightOf<T>>::check_allowed_raw());746 result?;747735 if let Some(allowance) = allowance {748 if let Some(allowance) = allowance {736 Self::set_allowance_unchecked(collection, from, spender, allowance);749 Self::set_allowance_unchecked(collection, from, spender, allowance);750 add_weight_to_post_info(751 &mut result,752 <SelfWeightOf<T>>::set_allowance_unchecked_raw(),753 )737 }754 }738 Ok(())755 result739 }756 }740757741 /// Burn fungible tokens from the account.758 /// Burn fungible tokens from the account.pallets/fungible/src/weights.rsdiffbeforeafterboth37 fn create_item() -> Weight;37 fn create_item() -> Weight;38 fn create_multiple_items_ex(b: u32, ) -> Weight;38 fn create_multiple_items_ex(b: u32, ) -> Weight;39 fn burn_item() -> Weight;39 fn burn_item() -> Weight;40 fn transfer() -> Weight;40 fn transfer_raw() -> Weight;41 fn approve() -> Weight;41 fn approve() -> Weight;42 fn approve_from() -> Weight;42 fn approve_from() -> Weight;43 fn transfer_from() -> Weight;43 fn check_allowed_raw() -> Weight;44 fn set_allowance_unchecked_raw() -> Weight;44 fn burn_from() -> Weight;45 fn burn_from() -> Weight;45}46}464794 }95 }95 /// Storage: Fungible Balance (r:2 w:2)96 /// Storage: Fungible Balance (r:2 w:2)96 /// Proof: Fungible Balance (max_values: None, max_size: Some(77), added: 2552, mode: MaxEncodedLen)97 /// Proof: Fungible Balance (max_values: None, max_size: Some(77), added: 2552, mode: MaxEncodedLen)97 fn transfer() -> Weight {98 fn transfer_raw() -> Weight {98 // Proof Size summary in bytes:99 // Proof Size summary in bytes:99 // Measured: `182`100 // Measured: `182`100 // Estimated: `5104`101 // Estimated: `5104`101 // Minimum execution time: 13_832_000 picoseconds.102 // Minimum execution time: 6_678_000 picoseconds.102 Weight::from_parts(14_064_000, 5104)103 Weight::from_parts(7_151_000, 5104)103 .saturating_add(T::DbWeight::get().reads(2_u64))104 .saturating_add(T::DbWeight::get().reads(2_u64))104 .saturating_add(T::DbWeight::get().writes(2_u64))105 .saturating_add(T::DbWeight::get().writes(2_u64))105 }106 }129 .saturating_add(T::DbWeight::get().reads(1_u64))130 .saturating_add(T::DbWeight::get().reads(1_u64))130 .saturating_add(T::DbWeight::get().writes(1_u64))131 .saturating_add(T::DbWeight::get().writes(1_u64))131 }132 }133 /// Storage: Fungible Allowance (r:1 w:0)134 /// Proof: Fungible Allowance (max_values: None, max_size: Some(93), added: 2568, mode: MaxEncodedLen)135 fn check_allowed_raw() -> Weight {136 // Proof Size summary in bytes:137 // Measured: `210`138 // Estimated: `2568`139 // Minimum execution time: 2_842_000 picoseconds.140 Weight::from_parts(3_077_000, 2568)141 .saturating_add(T::DbWeight::get().reads(1_u64))142 }132 /// Storage: Fungible Allowance (r:1 w:1)143 /// Storage: Fungible Allowance (r:0 w:1)133 /// Proof: Fungible Allowance (max_values: None, max_size: Some(93), added: 2568, mode: MaxEncodedLen)144 /// Proof: Fungible Allowance (max_values: None, max_size: Some(93), added: 2568, mode: MaxEncodedLen)134 /// Storage: Fungible Balance (r:2 w:2)135 /// Proof: Fungible Balance (max_values: None, max_size: Some(77), added: 2552, mode: MaxEncodedLen)136 fn transfer_from() -> Weight {145 fn set_allowance_unchecked_raw() -> Weight {137 // Proof Size summary in bytes:146 // Proof Size summary in bytes:138 // Measured: `300`147 // Measured: `0`139 // Estimated: `7672`148 // Estimated: `0`140 // Minimum execution time: 21_667_000 picoseconds.149 // Minimum execution time: 2_532_000 picoseconds.141 Weight::from_parts(22_166_000, 7672)150 Weight::from_parts(2_680_000, 0)142 .saturating_add(T::DbWeight::get().reads(3_u64))143 .saturating_add(T::DbWeight::get().writes(3_u64))151 .saturating_add(T::DbWeight::get().writes(1_u64))144 }152 }145 /// Storage: Fungible Allowance (r:1 w:1)153 /// Storage: Fungible Allowance (r:1 w:1)146 /// Proof: Fungible Allowance (max_values: None, max_size: Some(93), added: 2568, mode: MaxEncodedLen)154 /// Proof: Fungible Allowance (max_values: None, max_size: Some(93), added: 2568, mode: MaxEncodedLen)208 }216 }209 /// Storage: Fungible Balance (r:2 w:2)217 /// Storage: Fungible Balance (r:2 w:2)210 /// Proof: Fungible Balance (max_values: None, max_size: Some(77), added: 2552, mode: MaxEncodedLen)218 /// Proof: Fungible Balance (max_values: None, max_size: Some(77), added: 2552, mode: MaxEncodedLen)211 fn transfer() -> Weight {219 fn transfer_raw() -> Weight {212 // Proof Size summary in bytes:220 // Proof Size summary in bytes:213 // Measured: `182`221 // Measured: `182`214 // Estimated: `5104`222 // Estimated: `5104`215 // Minimum execution time: 13_832_000 picoseconds.223 // Minimum execution time: 6_678_000 picoseconds.216 Weight::from_parts(14_064_000, 5104)224 Weight::from_parts(7_151_000, 5104)217 .saturating_add(RocksDbWeight::get().reads(2_u64))225 .saturating_add(RocksDbWeight::get().reads(2_u64))218 .saturating_add(RocksDbWeight::get().writes(2_u64))226 .saturating_add(RocksDbWeight::get().writes(2_u64))219 }227 }243 .saturating_add(RocksDbWeight::get().reads(1_u64))251 .saturating_add(RocksDbWeight::get().reads(1_u64))244 .saturating_add(RocksDbWeight::get().writes(1_u64))252 .saturating_add(RocksDbWeight::get().writes(1_u64))245 }253 }254 /// Storage: Fungible Allowance (r:1 w:0)255 /// Proof: Fungible Allowance (max_values: None, max_size: Some(93), added: 2568, mode: MaxEncodedLen)256 fn check_allowed_raw() -> Weight {257 // Proof Size summary in bytes:258 // Measured: `210`259 // Estimated: `2568`260 // Minimum execution time: 2_842_000 picoseconds.261 Weight::from_parts(3_077_000, 2568)262 .saturating_add(RocksDbWeight::get().reads(1_u64))263 }246 /// Storage: Fungible Allowance (r:1 w:1)264 /// Storage: Fungible Allowance (r:0 w:1)247 /// Proof: Fungible Allowance (max_values: None, max_size: Some(93), added: 2568, mode: MaxEncodedLen)265 /// Proof: Fungible Allowance (max_values: None, max_size: Some(93), added: 2568, mode: MaxEncodedLen)248 /// Storage: Fungible Balance (r:2 w:2)249 /// Proof: Fungible Balance (max_values: None, max_size: Some(77), added: 2552, mode: MaxEncodedLen)250 fn transfer_from() -> Weight {266 fn set_allowance_unchecked_raw() -> Weight {251 // Proof Size summary in bytes:267 // Proof Size summary in bytes:252 // Measured: `300`268 // Measured: `0`253 // Estimated: `7672`269 // Estimated: `0`254 // Minimum execution time: 21_667_000 picoseconds.270 // Minimum execution time: 2_532_000 picoseconds.255 Weight::from_parts(22_166_000, 7672)271 Weight::from_parts(2_680_000, 0)256 .saturating_add(RocksDbWeight::get().reads(3_u64))257 .saturating_add(RocksDbWeight::get().writes(3_u64))272 .saturating_add(RocksDbWeight::get().writes(1_u64))258 }273 }259 /// Storage: Fungible Allowance (r:1 w:1)274 /// Storage: Fungible Allowance (r:1 w:1)260 /// Proof: Fungible Allowance (max_values: None, max_size: Some(93), added: 2568, mode: MaxEncodedLen)275 /// Proof: Fungible Allowance (max_values: None, max_size: Some(93), added: 2568, mode: MaxEncodedLen)pallets/nonfungible/CHANGELOG.mddiffbeforeafterboth445<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->667## [0.1.14] - 2023-03-2889### Fixed1011- The weight of `transfer` and `transfer_from`.127## [0.1.13] - 2023-01-2013## [0.1.13] - 2023-01-208149### Fixed15### Fixedpallets/nonfungible/Cargo.tomldiffbeforeafterboth2edition = "2021"2edition = "2021"3license = "GPLv3"3license = "GPLv3"4name = "pallet-nonfungible"4name = "pallet-nonfungible"5version = "0.1.13"5version = "0.1.14"667[dependencies]7[dependencies]8# Note: `package = "parity-scale-codec"` must be supplied since the `Encode` macro searches for it.8# Note: `package = "parity-scale-codec"` must be supplied since the `Encode` macro searches for it.pallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth121 }121 }122 }: {<Pallet<T>>::burn_recursively(&collection, &burner, item, &Unlimited, &Unlimited)?}122 }: {<Pallet<T>>::burn_recursively(&collection, &burner, item, &Unlimited, &Unlimited)?}123123124 transfer {124 transfer_raw {125 bench_init!{125 bench_init!{126 owner: sub; collection: collection(owner);126 owner: sub; collection: collection(owner);127 owner: cross_from_sub; sender: cross_sub; receiver: cross_sub;127 owner: cross_from_sub; sender: cross_sub; receiver: cross_sub;146 let item = create_max_item(&collection, &owner, owner_eth.clone())?;146 let item = create_max_item(&collection, &owner, owner_eth.clone())?;147 }: {<Pallet<T>>::set_allowance_from(&collection, &sender, &owner_eth, item, Some(&spender))?}147 }: {<Pallet<T>>::set_allowance_from(&collection, &sender, &owner_eth, item, Some(&spender))?}148148149 transfer_from {149 check_allowed_raw {150 bench_init!{150 bench_init!{151 owner: sub; collection: collection(owner);151 owner: sub; collection: collection(owner);152 owner: cross_from_sub; sender: cross_sub; spender: cross_sub; receiver: cross_sub;152 owner: cross_from_sub; sender: cross_sub; spender: cross_sub; receiver: cross_sub;153 };153 };154 let item = create_max_item(&collection, &owner, sender.clone())?;154 let item = create_max_item(&collection, &owner, sender.clone())?;155 <Pallet<T>>::set_allowance(&collection, &sender, item, Some(&spender))?;155 <Pallet<T>>::set_allowance(&collection, &sender, item, Some(&spender))?;156 }: {<Pallet<T>>::transfer_from(&collection, &spender, &sender, &receiver, item, &Unlimited)?}156 }: {<Pallet<T>>::check_allowed(&collection, &spender, &sender, item, &Unlimited)?}157157158 burn_from {158 burn_from {159 bench_init!{159 bench_init!{pallets/nonfungible/src/common.rsdiffbeforeafterboth23};23};24use pallet_common::{24use pallet_common::{25 CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight,25 CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight,26 weights::WeightInfo as _,26 weights::WeightInfo as _, SelfWeightOf as PalletCommonWeightOf,27};27};28use sp_runtime::DispatchError;28use sp_runtime::DispatchError;29use sp_std::{vec::Vec, vec};29use sp_std::{vec::Vec, vec};91 }91 }929293 fn transfer() -> Weight {93 fn transfer() -> Weight {94 <SelfWeightOf<T>>::transfer()94 <SelfWeightOf<T>>::transfer_raw() + <PalletCommonWeightOf<T>>::check_accesslist() * 295 }95 }969697 fn approve() -> Weight {97 fn approve() -> Weight {103 }103 }104104105 fn transfer_from() -> Weight {105 fn transfer_from() -> Weight {106 <SelfWeightOf<T>>::transfer_from()106 Self::transfer() + <SelfWeightOf<T>>::check_allowed_raw()107 }107 }108108109 fn burn_from() -> Weight {109 fn burn_from() -> Weight {325 ) -> DispatchResultWithPostInfo {325 ) -> DispatchResultWithPostInfo {326 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);326 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);327 if amount == 1 {327 if amount == 1 {328 with_weight(329 <Pallet<T>>::transfer(self, &from, &to, token, nesting_budget),328 <Pallet<T>>::transfer(self, &from, &to, token, nesting_budget)330 <CommonWeights<T>>::transfer(),331 )332 } else {329 } else {333 <Pallet<T>>::check_token_immediate_ownership(self, token, &from)?;330 <Pallet<T>>::check_token_immediate_ownership(self, token, &from)?;334 Ok(().into())331 Ok(().into())386 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);383 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);387384388 if amount == 1 {385 if amount == 1 {389 with_weight(390 <Pallet<T>>::transfer_from(self, &sender, &from, &to, token, nesting_budget),386 <Pallet<T>>::transfer_from(self, &sender, &from, &to, token, nesting_budget)391 <CommonWeights<T>>::transfer_from(),392 )393 } else {387 } else {394 <Pallet<T>>::check_allowed(self, &sender, &from, token, nesting_budget)?;388 <Pallet<T>>::check_allowed(self, &sender, &from, token, nesting_budget)?;395389pallets/nonfungible/src/erc.rsdiffbeforeafterboth39 CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations,39 CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations,40 erc::{CommonEvmHandler, PrecompileResult, CollectionCall, static_property::key},40 erc::{CommonEvmHandler, PrecompileResult, CollectionCall, static_property::key},41 eth::{self, TokenUri},41 eth::{self, TokenUri},42 CommonWeightInfo,42};43};43use pallet_evm::{account::CrossAccountId, PrecompileHandle};44use pallet_evm::{account::CrossAccountId, PrecompileHandle};44use pallet_evm_coder_substrate::call;45use pallet_evm_coder_substrate::call;474848use crate::{49use crate::{49 AccountBalance, Config, CreateItemData, NonfungibleHandle, Pallet, TokenData, TokensMinted,50 AccountBalance, Config, CreateItemData, NonfungibleHandle, Pallet, TokenData, TokensMinted,50 TokenProperties, SelfWeightOf, weights::WeightInfo,51 TokenProperties, SelfWeightOf, weights::WeightInfo, common::CommonWeights,51};52};525353/// Nft events.54/// Nft events.458 /// @param from The current owner of the NFT459 /// @param from The current owner of the NFT459 /// @param to The new owner460 /// @param to The new owner460 /// @param tokenId The NFT to transfer461 /// @param tokenId The NFT to transfer461 #[weight(<SelfWeightOf<T>>::transfer_from())]462 #[weight(<CommonWeights<T>>::transfer_from())]462 fn transfer_from(463 fn transfer_from(463 &mut self,464 &mut self,464 caller: Caller,465 caller: Caller,475 .weight_calls_budget(<StructureWeight<T>>::find_parent());476 .weight_calls_budget(<StructureWeight<T>>::find_parent());476477477 <Pallet<T>>::transfer_from(self, &caller, &from, &to, token, &budget)478 <Pallet<T>>::transfer_from(self, &caller, &from, &to, token, &budget)478 .map_err(dispatch_to_evm::<T>)?;479 .map_err(|e| dispatch_to_evm::<T>(e.error))?;479 Ok(())480 Ok(())480 }481 }481482824 /// is the zero address. Throws if `tokenId` is not a valid NFT.825 /// is the zero address. Throws if `tokenId` is not a valid NFT.825 /// @param to The new owner826 /// @param to The new owner826 /// @param tokenId The NFT to transfer827 /// @param tokenId The NFT to transfer827 #[weight(<SelfWeightOf<T>>::transfer())]828 #[weight(<CommonWeights<T>>::transfer())]828 fn transfer(&mut self, caller: Caller, to: Address, token_id: U256) -> Result<()> {829 fn transfer(&mut self, caller: Caller, to: Address, token_id: U256) -> Result<()> {829 let caller = T::CrossAccountId::from_eth(caller);830 let caller = T::CrossAccountId::from_eth(caller);830 let to = T::CrossAccountId::from_eth(to);831 let to = T::CrossAccountId::from_eth(to);834 .weight_calls_budget(<StructureWeight<T>>::find_parent());835 .weight_calls_budget(<StructureWeight<T>>::find_parent());835836836 <Pallet<T>>::transfer(self, &caller, &to, token, &budget).map_err(dispatch_to_evm::<T>)?;837 <Pallet<T>>::transfer(self, &caller, &to, token, &budget)838 .map_err(|e| dispatch_to_evm::<T>(e.error))?;837 Ok(())839 Ok(())838 }840 }839841842 /// is the zero address. Throws if `tokenId` is not a valid NFT.844 /// is the zero address. Throws if `tokenId` is not a valid NFT.843 /// @param to The new owner845 /// @param to The new owner844 /// @param tokenId The NFT to transfer846 /// @param tokenId The NFT to transfer845 #[weight(<SelfWeightOf<T>>::transfer())]847 #[weight(<CommonWeights<T>>::transfer())]846 fn transfer_cross(848 fn transfer_cross(847 &mut self,849 &mut self,848 caller: Caller,850 caller: Caller,857 .weight_calls_budget(<StructureWeight<T>>::find_parent());859 .weight_calls_budget(<StructureWeight<T>>::find_parent());858860859 <Pallet<T>>::transfer(self, &caller, &to, token, &budget).map_err(dispatch_to_evm::<T>)?;861 <Pallet<T>>::transfer(self, &caller, &to, token, &budget)862 .map_err(|e| dispatch_to_evm::<T>(e.error))?;860 Ok(())863 Ok(())861 }864 }862865866 /// @param from Cross acccount address of current owner869 /// @param from Cross acccount address of current owner867 /// @param to Cross acccount address of new owner870 /// @param to Cross acccount address of new owner868 /// @param tokenId The NFT to transfer871 /// @param tokenId The NFT to transfer869 #[weight(<SelfWeightOf<T>>::transfer())]872 #[weight(<CommonWeights<T>>::transfer_from())]870 fn transfer_from_cross(873 fn transfer_from_cross(871 &mut self,874 &mut self,872 caller: Caller,875 caller: Caller,882 .recorder885 .recorder883 .weight_calls_budget(<StructureWeight<T>>::find_parent());886 .weight_calls_budget(<StructureWeight<T>>::find_parent());884 Pallet::<T>::transfer_from(self, &caller, &from, &to, token_id, &budget)887 Pallet::<T>::transfer_from(self, &caller, &from, &to, token_id, &budget)885 .map_err(dispatch_to_evm::<T>)?;888 .map_err(|e| dispatch_to_evm::<T>(e.error))?;886 Ok(())889 Ok(())887 }890 }888891pallets/nonfungible/src/lib.rsdiffbeforeafterboth108use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};108use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};109use pallet_common::{109use pallet_common::{110 Error as CommonError, Pallet as PalletCommon, Event as CommonEvent, CollectionHandle,110 Error as CommonError, Pallet as PalletCommon, Event as CommonEvent, CollectionHandle,111 eth::collection_id_to_address,111 eth::collection_id_to_address, SelfWeightOf as PalletCommonWeightOf,112 weights::WeightInfo as CommonWeightInfo, helpers::add_weight_to_post_info,112};113};113use pallet_structure::{Pallet as PalletStructure, Error as StructureError};114use pallet_structure::{Pallet as PalletStructure, Error as StructureError};114use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};115use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};802 to: &T::CrossAccountId,803 to: &T::CrossAccountId,803 token: TokenId,804 token: TokenId,804 nesting_budget: &dyn Budget,805 nesting_budget: &dyn Budget,805 ) -> DispatchResult {806 ) -> DispatchResultWithPostInfo {806 ensure!(807 ensure!(807 collection.limits.transfers_enabled(),808 collection.limits.transfers_enabled(),808 <CommonError<T>>::TransferNotAllowed809 <CommonError<T>>::TransferNotAllowed809 );810 );810811812 let mut actual_weight = <SelfWeightOf<T>>::transfer_raw();811 let token_data =813 let token_data =812 <TokenData<T>>::get((collection.id, token)).ok_or(<CommonError<T>>::TokenNotFound)?;814 <TokenData<T>>::get((collection.id, token)).ok_or(<CommonError<T>>::TokenNotFound)?;813 ensure!(&token_data.owner == from, <CommonError<T>>::NoPermission);815 ensure!(&token_data.owner == from, <CommonError<T>>::NoPermission);814816815 if collection.permissions.access() == AccessMode::AllowList {817 if collection.permissions.access() == AccessMode::AllowList {816 collection.check_allowlist(from)?;818 collection.check_allowlist(from)?;817 collection.check_allowlist(to)?;819 collection.check_allowlist(to)?;820 actual_weight += <PalletCommonWeightOf<T>>::check_accesslist() * 2;818 }821 }819 <PalletCommon<T>>::ensure_correct_receiver(to)?;822 <PalletCommon<T>>::ensure_correct_receiver(to)?;820823885 1,888 1,886 ));889 ));890887 Ok(())891 Ok(PostDispatchInfo {892 actual_weight: Some(actual_weight),893 pays_fee: Pays::Yes,894 })888 }895 }889896890 /// Batch operation to mint multiple NFT tokens.897 /// Batch operation to mint multiple NFT tokens.1228 to: &T::CrossAccountId,1235 to: &T::CrossAccountId,1229 token: TokenId,1236 token: TokenId,1230 nesting_budget: &dyn Budget,1237 nesting_budget: &dyn Budget,1231 ) -> DispatchResult {1238 ) -> DispatchResultWithPostInfo {1232 Self::check_allowed(collection, spender, from, token, nesting_budget)?;1239 Self::check_allowed(collection, spender, from, token, nesting_budget)?;123312401234 // =========1241 // =========123512421236 // Allowance is reset in [`transfer`]1243 // Allowance is reset in [`transfer`]1237 Self::transfer(collection, from, to, token, nesting_budget)1244 let mut result = Self::transfer(collection, from, to, token, nesting_budget);1245 add_weight_to_post_info(&mut result, <SelfWeightOf<T>>::check_allowed_raw());1246 result1238 }1247 }123912481240 /// Burn NFT token for `from` account.1249 /// Burn NFT token for `from` account.pallets/nonfungible/src/weights.rsdiffbeforeafterboth40 fn burn_item() -> Weight;40 fn burn_item() -> Weight;41 fn burn_recursively_self_raw() -> Weight;41 fn burn_recursively_self_raw() -> Weight;42 fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(b: u32, ) -> Weight;42 fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(b: u32, ) -> Weight;43 fn transfer() -> Weight;43 fn transfer_raw() -> Weight;44 fn approve() -> Weight;44 fn approve() -> Weight;45 fn approve_from() -> Weight;45 fn approve_from() -> Weight;46 fn transfer_from() -> Weight;46 fn check_allowed_raw() -> Weight;47 fn burn_from() -> Weight;47 fn burn_from() -> Weight;48 fn set_token_property_permissions(b: u32, ) -> Weight;48 fn set_token_property_permissions(b: u32, ) -> Weight;49 fn set_token_properties(b: u32, ) -> Weight;49 fn set_token_properties(b: u32, ) -> Weight;217 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)217 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)218 /// Storage: Nonfungible Owned (r:0 w:2)218 /// Storage: Nonfungible Owned (r:0 w:2)219 /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)219 /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)220 fn transfer() -> Weight {220 fn transfer_raw() -> Weight {221 // Proof Size summary in bytes:221 // Proof Size summary in bytes:222 // Measured: `412`222 // Measured: `412`223 // Estimated: `10144`223 // Estimated: `10144`224 // Minimum execution time: 18_629_000 picoseconds.224 // Minimum execution time: 9_307_000 picoseconds.225 Weight::from_parts(18_997_000, 10144)225 Weight::from_parts(10_108_000, 10144)226 .saturating_add(T::DbWeight::get().reads(4_u64))226 .saturating_add(T::DbWeight::get().reads(4_u64))227 .saturating_add(T::DbWeight::get().writes(5_u64))227 .saturating_add(T::DbWeight::get().writes(5_u64))228 }228 }252 .saturating_add(T::DbWeight::get().reads(2_u64))252 .saturating_add(T::DbWeight::get().reads(2_u64))253 .saturating_add(T::DbWeight::get().writes(1_u64))253 .saturating_add(T::DbWeight::get().writes(1_u64))254 }254 }255 /// Storage: Nonfungible Allowance (r:1 w:1)255 /// Storage: Nonfungible Allowance (r:1 w:0)256 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)256 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)257 /// Storage: Nonfungible TokenData (r:1 w:1)258 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)259 /// Storage: Nonfungible AccountBalance (r:2 w:2)260 /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)261 /// Storage: Nonfungible Owned (r:0 w:2)262 /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)263 fn transfer_from() -> Weight {257 fn check_allowed_raw() -> Weight {264 // Proof Size summary in bytes:258 // Proof Size summary in bytes:265 // Measured: `527`259 // Measured: `394`266 // Estimated: `10144`260 // Estimated: `2532`267 // Minimum execution time: 24_919_000 picoseconds.261 // Minimum execution time: 2_668_000 picoseconds.268 Weight::from_parts(25_333_000, 10144)262 Weight::from_parts(2_877_000, 2532)269 .saturating_add(T::DbWeight::get().reads(4_u64))270 .saturating_add(T::DbWeight::get().writes(6_u64))263 .saturating_add(T::DbWeight::get().reads(1_u64))271 }264 }272 /// Storage: Nonfungible Allowance (r:1 w:1)265 /// Storage: Nonfungible Allowance (r:1 w:1)273 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)266 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)543 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)536 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)544 /// Storage: Nonfungible Owned (r:0 w:2)537 /// Storage: Nonfungible Owned (r:0 w:2)545 /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)538 /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)546 fn transfer() -> Weight {539 fn transfer_raw() -> Weight {547 // Proof Size summary in bytes:540 // Proof Size summary in bytes:548 // Measured: `412`541 // Measured: `412`549 // Estimated: `10144`542 // Estimated: `10144`550 // Minimum execution time: 18_629_000 picoseconds.543 // Minimum execution time: 9_307_000 picoseconds.551 Weight::from_parts(18_997_000, 10144)544 Weight::from_parts(10_108_000, 10144)552 .saturating_add(RocksDbWeight::get().reads(4_u64))545 .saturating_add(RocksDbWeight::get().reads(4_u64))553 .saturating_add(RocksDbWeight::get().writes(5_u64))546 .saturating_add(RocksDbWeight::get().writes(5_u64))554 }547 }578 .saturating_add(RocksDbWeight::get().reads(2_u64))571 .saturating_add(RocksDbWeight::get().reads(2_u64))579 .saturating_add(RocksDbWeight::get().writes(1_u64))572 .saturating_add(RocksDbWeight::get().writes(1_u64))580 }573 }581 /// Storage: Nonfungible Allowance (r:1 w:1)574 /// Storage: Nonfungible Allowance (r:1 w:0)582 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)575 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)583 /// Storage: Nonfungible TokenData (r:1 w:1)584 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)585 /// Storage: Nonfungible AccountBalance (r:2 w:2)586 /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)587 /// Storage: Nonfungible Owned (r:0 w:2)588 /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)589 fn transfer_from() -> Weight {576 fn check_allowed_raw() -> Weight {590 // Proof Size summary in bytes:577 // Proof Size summary in bytes:591 // Measured: `527`578 // Measured: `394`592 // Estimated: `10144`579 // Estimated: `2532`593 // Minimum execution time: 24_919_000 picoseconds.580 // Minimum execution time: 2_668_000 picoseconds.594 Weight::from_parts(25_333_000, 10144)581 Weight::from_parts(2_877_000, 2532)595 .saturating_add(RocksDbWeight::get().reads(4_u64))596 .saturating_add(RocksDbWeight::get().writes(6_u64))582 .saturating_add(RocksDbWeight::get().reads(1_u64))597 }583 }598 /// Storage: Nonfungible Allowance (r:1 w:1)584 /// Storage: Nonfungible Allowance (r:1 w:1)599 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)585 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)