difftreelog
Merge pull request #1007 from UniqueNetwork/fix/token-properties-benchmarks
in: master
Fix token properties and nesting weights
32 files changed
pallets/balances-adapter/src/common.rsdiffbeforeafterboth--- a/pallets/balances-adapter/src/common.rs
+++ b/pallets/balances-adapter/src/common.rs
@@ -30,15 +30,7 @@
Weight::default()
}
- fn delete_collection_properties(_amount: u32) -> Weight {
- Weight::default()
- }
-
fn set_token_properties(_amount: u32) -> Weight {
- Weight::default()
- }
-
- fn delete_token_properties(_amount: u32) -> Weight {
Weight::default()
}
@@ -63,18 +55,6 @@
}
fn burn_from() -> Weight {
- Weight::default()
- }
-
- fn burn_recursively_self_raw() -> Weight {
- Weight::default()
- }
-
- fn burn_recursively_breadth_raw(_amount: u32) -> Weight {
- Weight::default()
- }
-
- fn token_owner() -> Weight {
Weight::default()
}
@@ -124,16 +104,6 @@
_sender: <T>::CrossAccountId,
_token: TokenId,
_amount: u128,
- ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {
- fail!(<pallet_common::Error<T>>::UnsupportedOperation);
- }
-
- fn burn_item_recursively(
- &self,
- _sender: <T>::CrossAccountId,
- _token: TokenId,
- _self_budget: &dyn up_data_structs::budget::Budget,
- _breadth_budget: &dyn up_data_structs::budget::Budget,
) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {
fail!(<pallet_common::Error<T>>::UnsupportedOperation);
}
pallets/common/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/common/src/benchmarking.rs
+++ b/pallets/common/src/benchmarking.rs
@@ -29,12 +29,11 @@
use sp_std::{vec, vec::Vec};
use up_data_structs::{
AccessMode, CollectionId, CollectionMode, CollectionPermissions, CreateCollectionData,
- NestingPermissions, PropertiesPermissionMap, Property, PropertyKey, PropertyValue,
- MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_COLLECTION_NAME_LENGTH, MAX_PROPERTIES_PER_ITEM,
- MAX_TOKEN_PREFIX_LENGTH,
+ NestingPermissions, Property, PropertyKey, PropertyValue, MAX_COLLECTION_DESCRIPTION_LENGTH,
+ MAX_COLLECTION_NAME_LENGTH, MAX_PROPERTIES_PER_ITEM, MAX_TOKEN_PREFIX_LENGTH,
};
-use crate::{CollectionHandle, Config, Pallet};
+use crate::{BenchmarkPropertyWriter, CollectionHandle, Config, Pallet};
const SEED: u32 = 1;
@@ -126,16 +125,6 @@
)
}
-pub fn load_is_admin_and_property_permissions<T: Config>(
- collection: &CollectionHandle<T>,
- sender: &T::CrossAccountId,
-) -> (bool, PropertiesPermissionMap) {
- (
- collection.is_owner_or_admin(sender),
- <Pallet<T>>::property_permissions(collection.id),
- )
-}
-
/// Helper macros, which handles all benchmarking preparation in semi-declarative way
///
/// `name` is a substrate account
@@ -200,31 +189,6 @@
#[block]
{
<Pallet<T>>::set_collection_properties(&collection, &owner, props.into_iter())?;
- }
-
- Ok(())
- }
-
- #[benchmark]
- fn delete_collection_properties(
- b: Linear<0, MAX_PROPERTIES_PER_ITEM>,
- ) -> Result<(), BenchmarkError> {
- bench_init! {
- owner: sub; collection: collection(owner);
- owner: cross_from_sub;
- };
- let props = (0..b)
- .map(|p| Property {
- key: property_key(p as usize),
- value: property_value(),
- })
- .collect::<Vec<_>>();
- <Pallet<T>>::set_collection_properties(&collection, &owner, props.into_iter())?;
- let to_delete = (0..b).map(|p| property_key(p as usize)).collect::<Vec<_>>();
-
- #[block]
- {
- <Pallet<T>>::delete_collection_properties(&collection, &owner, to_delete.into_iter())?;
}
Ok(())
@@ -263,7 +227,7 @@
}
#[benchmark]
- fn init_token_properties_common() -> Result<(), BenchmarkError> {
+ fn property_writer_load_collection_info() -> Result<(), BenchmarkError> {
bench_init! {
owner: sub; collection: collection(owner);
sender: sub;
@@ -272,7 +236,7 @@
#[block]
{
- load_is_admin_and_property_permissions(&collection, &sender);
+ <BenchmarkPropertyWriter<T>>::load_collection_info(&&collection, &sender);
}
Ok(())
pallets/common/src/erc.rsdiffbeforeafterboth--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -126,7 +126,7 @@
///
/// @param key Property key.
#[solidity(hide)]
- #[weight(<SelfWeightOf<T>>::delete_collection_properties(1))]
+ #[weight(<SelfWeightOf<T>>::set_collection_properties(1))]
fn delete_collection_property(&mut self, caller: Caller, key: String) -> Result<()> {
let caller = T::CrossAccountId::from_eth(caller);
let key = <Vec<u8>>::from(key)
@@ -139,7 +139,7 @@
/// Delete collection properties.
///
/// @param keys Properties keys.
- #[weight(<SelfWeightOf<T>>::delete_collection_properties(keys.len() as u32))]
+ #[weight(<SelfWeightOf<T>>::set_collection_properties(keys.len() as u32))]
fn delete_collection_properties(&mut self, caller: Caller, keys: Vec<String>) -> Result<()> {
let caller = T::CrossAccountId::from_eth(caller);
let keys = keys
pallets/common/src/lib.rsdiffbeforeafterboth53#![cfg_attr(not(feature = "std"), no_std)]53#![cfg_attr(not(feature = "std"), no_std)]54extern crate alloc;54extern crate alloc;555556use alloc::boxed::Box;56use core::{57use core::{57 marker::PhantomData,58 marker::PhantomData,58 ops::{Deref, DerefMut},59 ops::{Deref, DerefMut},59 slice::from_ref,60 slice::from_ref,61 unreachable,60};62};616362use evm_coder::ToLog;64use evm_coder::ToLog;871 >;873 >;872}874}873875876enum LazyValueState<'a, T> {877 Pending(Box<dyn FnOnce() -> T + 'a>),878 InProgress,879 Computed(T),880}881874/// Value representation with delayed initialization time.882/// Value representation with delayed initialization time.875pub struct LazyValue<T, F: FnOnce() -> T> {883pub struct LazyValue<'a, T> {876 value: Option<T>,884 state: LazyValueState<'a, T>,877 f: Option<F>,878}885}879886880impl<T, F: FnOnce() -> T> LazyValue<T, F> {887impl<'a, T> LazyValue<'a, T> {881 /// Create a new LazyValue.888 /// Create a new LazyValue.882 pub fn new(f: F) -> Self {889 pub fn new(f: impl FnOnce() -> T + 'a) -> Self {883 Self {890 Self {884 value: None,891 state: LazyValueState::Pending(Box::new(f)),885 f: Some(f),886 }892 }887 }893 }888894889 /// Get the value. If it is called the first time, the value will be initialized.895 /// Get the value. If it is called the first time, the value will be initialized.890 pub fn value(&mut self) -> &T {896 pub fn value(&mut self) -> &T {891 self.force_value();897 self.force_value();892 self.value.as_ref().unwrap()898 self.value_mut()893 }899 }894900895 /// Get the value. If it is called the first time, the value will be initialized.901 /// Get the value. If it is called the first time, the value will be initialized.896 pub fn value_mut(&mut self) -> &mut T {902 pub fn value_mut(&mut self) -> &mut T {897 self.force_value();903 self.force_value();904898 self.value.as_mut().unwrap()905 if let LazyValueState::Computed(value) = &mut self.state {906 value907 } else {908 unreachable!()909 }899 }910 }900911901 fn into_inner(mut self) -> T {912 fn into_inner(mut self) -> T {902 self.force_value();913 self.force_value();903 self.value.unwrap()914 if let LazyValueState::Computed(value) = self.state {915 value916 } else {917 unreachable!()918 }904 }919 }905920906 /// Is value initialized?921 /// Is value initialized?907 pub fn has_value(&self) -> bool {922 pub fn has_value(&self) -> bool {908 self.value.is_some()923 matches!(self.state, LazyValueState::Computed(_))909 }924 }910925911 fn force_value(&mut self) {926 fn force_value(&mut self) {912 if self.value.is_none() {927 use LazyValueState::*;928929 if self.has_value() {913 self.value = Some(self.f.take().unwrap()())930 return;914 }931 }932933 match sp_std::mem::replace(&mut self.state, InProgress) {934 Pending(f) => self.state = Computed(f()),935 _ => panic!("recursion isn't supported"),936 }915 }937 }916}938}917939918fn check_token_permissions<T, FCA, FTO, FTE>(940fn check_token_permissions<T: Config>(919 collection_admin_permitted: bool,941 collection_admin_permitted: bool,920 token_owner_permitted: bool,942 token_owner_permitted: bool,921 is_collection_admin: &mut LazyValue<bool, FCA>,943 is_collection_admin: &mut LazyValue<bool>,922 is_token_owner: &mut LazyValue<Result<bool, DispatchError>, FTO>,944 is_token_owner: &mut LazyValue<Result<bool, DispatchError>>,923 is_token_exist: &mut LazyValue<bool, FTE>,945 is_token_exist: &mut LazyValue<bool>,924) -> DispatchResult946) -> DispatchResult {925where926 T: Config,927 FCA: FnOnce() -> bool,928 FTO: FnOnce() -> Result<bool, DispatchError>,929 FTE: FnOnce() -> bool,930{931 if !(collection_admin_permitted && *is_collection_admin.value()947 if !(collection_admin_permitted && *is_collection_admin.value()932 || token_owner_permitted && (*is_token_owner.value())?)948 || token_owner_permitted && (*is_token_owner.value())?)933 {949 {1902 /// Collection property deletion weight.1918 /// Collection property deletion weight.1903 ///1919 ///1904 /// * `amount`- The number of properties to set.1920 /// * `amount`- The number of properties to set.1905 fn delete_collection_properties(amount: u32) -> Weight;1921 fn delete_collection_properties(amount: u32) -> Weight {1922 Self::set_collection_properties(amount)1923 }190619241907 /// Token property setting weight.1925 /// Token property setting weight.1908 ///1926 ///1912 /// Token property deletion weight.1930 /// Token property deletion weight.1913 ///1931 ///1914 /// * `amount`- The number of properties to delete.1932 /// * `amount`- The number of properties to delete.1915 fn delete_token_properties(amount: u32) -> Weight;1933 fn delete_token_properties(amount: u32) -> Weight {1934 Self::set_token_properties(amount)1935 }191619361917 /// Token property permissions set weight.1937 /// Token property permissions set weight.1918 ///1938 ///1934 /// The price of burning a token from another user.1954 /// The price of burning a token from another user.1935 fn burn_from() -> Weight;1955 fn burn_from() -> Weight;193619561937 /// Differs from burn_item in case of Fungible and Refungible, as it should burn1938 /// whole users's balance.1939 ///1940 /// This method shouldn't be used directly, as it doesn't count breadth price, use [burn_recursively](CommonWeightInfo::burn_recursively) instead1941 fn burn_recursively_self_raw() -> Weight;19421943 /// Cost of iterating over `amount` children while burning, without counting child burning itself.1944 ///1945 /// This method shouldn't be used directly, as it doesn't count depth price, use [burn_recursively](CommonWeightInfo::burn_recursively) instead1946 fn burn_recursively_breadth_raw(amount: u32) -> Weight;19471948 /// The price of recursive burning a token.1949 ///1950 /// `max_selfs` - The maximum burning weight of the token itself.1951 /// `max_breadth` - The maximum number of nested tokens to burn.1952 fn burn_recursively(max_selfs: u32, max_breadth: u32) -> Weight {1953 Self::burn_recursively_self_raw()1954 .saturating_mul(max_selfs.max(1) as u64)1955 .saturating_add(Self::burn_recursively_breadth_raw(max_breadth))1956 }19571958 /// The price of retrieving token owner1959 fn token_owner() -> Weight;19601961 /// The price of setting approval for all1957 /// The price of setting approval for all1962 fn set_allowance_for_all() -> Weight;1958 fn set_allowance_for_all() -> Weight;196319592029 amount: u128,2025 amount: u128,2030 ) -> DispatchResultWithPostInfo;2026 ) -> DispatchResultWithPostInfo;203120272032 /// Burn token and all nested tokens recursievly.2033 ///2034 /// * `sender` - The user who owns the token.2035 /// * `token` - Token id that will burned.2036 /// * `self_budget` - The budget that can be spent on burning tokens.2037 /// * `breadth_budget` - The budget that can be spent on burning nested tokens.2038 fn burn_item_recursively(2039 &self,2040 sender: T::CrossAccountId,2041 token: TokenId,2042 self_budget: &dyn Budget,2043 breadth_budget: &dyn Budget,2044 ) -> DispatchResultWithPostInfo;20452046 /// Set collection properties.2028 /// Set collection properties.2047 ///2029 ///2048 /// * `sender` - Must be either the owner of the collection or its admin.2030 /// * `sender` - Must be either the owner of the collection or its admin.2374 }2356 }2375}2357}237623582377/// A marker structure that enables the writer implementation2378/// to provide the interface to write properties to **newly created** tokens.2379pub struct NewTokenPropertyWriter;23802381/// A marker structure that enables the writer implementation2382/// to provide the interface to write properties to **already existing** tokens.2383pub struct ExistingTokenPropertyWriter;23842385/// The type-safe interface for writing properties (setting or deleting) to tokens.2359/// The type-safe interface for writing properties (setting or deleting) to tokens.2386/// It has two distinct implementations for newly created tokens and existing ones.2360/// It has two distinct implementations for newly created tokens and existing ones.2387///2361///2388/// This type utilizes the lazy evaluation to avoid repeating the computation2362/// This type utilizes the lazy evaluation to avoid repeating the computation2389/// of several performance-heavy or PoV-heavy tasks,2363/// of several performance-heavy or PoV-heavy tasks,2390/// such as checking the indirect ownership or reading the token property permissions.2364/// such as checking the indirect ownership or reading the token property permissions.2391pub struct PropertyWriter<2365pub struct PropertyWriter<'a, WriterVariant, T, Handle> {2392 'a,2393 T,2394 Handle,2395 WriterVariant,2396 FIsAdmin,2397 FPropertyPermissions,2398 FCheckTokenExist,2399 FGetProperties,2400> where2401 T: Config,2402 FIsAdmin: FnOnce() -> bool,2403 FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,2404{2405 collection: &'a Handle,2366 collection: &'a Handle,2406 is_collection_admin: LazyValue<bool, FIsAdmin>,2367 collection_lazy_info: PropertyWriterLazyCollectionInfo<'a>,2407 property_permissions: LazyValue<PropertiesPermissionMap, FPropertyPermissions>,2408 check_token_exist: FCheckTokenExist,2409 get_properties: FGetProperties,2410 _phantom: PhantomData<(T, WriterVariant)>,2368 _phantom: PhantomData<(T, WriterVariant)>,2411}2369}241223702413impl<'a, T, Handle, FIsAdmin, FPropertyPermissions, FCheckTokenExist, FGetProperties>2371impl<'a, T, Handle, WriterVariant> PropertyWriter<'a, WriterVariant, T, Handle>2414 PropertyWriter<2415 'a,2416 T,2417 Handle,2418 NewTokenPropertyWriter,2419 FIsAdmin,2420 FPropertyPermissions,2421 FCheckTokenExist,2422 FGetProperties,2423 > where2372where2424 T: Config,2373 T: Config,2425 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2374 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2426 FIsAdmin: FnOnce() -> bool,2427 FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,2428 FCheckTokenExist: Copy + FnOnce(TokenId) -> bool,2429 FGetProperties: Copy + FnOnce(TokenId) -> TokenProperties,2430{2375{2431 /// A function to write properties to a **newly created** token.2376 fn internal_write_token_properties(2432 pub fn write_token_properties(2433 &mut self,2377 &mut self,2434 mint_target_is_sender: bool,2435 token_id: TokenId,2378 token_id: TokenId,2436 properties_updates: impl Iterator<Item = Property>,2379 mut token_lazy_info: PropertyWriterLazyTokenInfo,2437 log: evm_coder::ethereum::Log,2438 ) -> DispatchResult {2439 self.internal_write_token_properties(2440 token_id,2441 properties_updates.map(|p| (p.key, Some(p.value))),2442 |_| Ok(mint_target_is_sender),2443 log,2444 )2445 }2446}24472448impl<'a, T, Handle, FIsAdmin, FPropertyPermissions, FCheckTokenExist, FGetProperties>2449 PropertyWriter<2450 'a,2451 T,2452 Handle,2453 ExistingTokenPropertyWriter,2454 FIsAdmin,2455 FPropertyPermissions,2456 FCheckTokenExist,2457 FGetProperties,2458 > where2459 T: Config,2460 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2461 FIsAdmin: FnOnce() -> bool,2462 FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,2463 FCheckTokenExist: Copy + FnOnce(TokenId) -> bool,2464 FGetProperties: Copy + FnOnce(TokenId) -> TokenProperties,2465{2466 /// A function to write properties to an **already existing** token.2467 pub fn write_token_properties(2468 &mut self,2469 sender: &T::CrossAccountId,2470 token_id: TokenId,2471 properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,2380 properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,2472 nesting_budget: &dyn Budget,2473 log: evm_coder::ethereum::Log,2381 log: evm_coder::ethereum::Log,2474 ) -> DispatchResult {2382 ) -> DispatchResult {2475 self.internal_write_token_properties(2476 token_id,2477 properties_updates,2478 |collection| collection.check_token_indirect_owner(token_id, sender, nesting_budget),2479 log,2480 )2481 }2482}24832484impl<2485 'a,2486 T,2487 Handle,2488 WriterVariant,2489 FIsAdmin,2490 FPropertyPermissions,2491 FCheckTokenExist,2492 FGetProperties,2493 >2494 PropertyWriter<2495 'a,2496 T,2497 Handle,2498 WriterVariant,2499 FIsAdmin,2500 FPropertyPermissions,2501 FCheckTokenExist,2502 FGetProperties,2503 > where2504 T: Config,2505 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2506 FIsAdmin: FnOnce() -> bool,2507 FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,2508 FCheckTokenExist: Copy + FnOnce(TokenId) -> bool,2509 FGetProperties: Copy + FnOnce(TokenId) -> TokenProperties,2510{2511 fn internal_write_token_properties<FCheckTokenOwner>(2512 &mut self,2513 token_id: TokenId,2514 properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,2515 check_token_owner: FCheckTokenOwner,2516 log: evm_coder::ethereum::Log,2517 ) -> DispatchResult2518 where2519 FCheckTokenOwner: FnOnce(&Handle) -> Result<bool, DispatchError>,2520 {2521 let get_properties = self.get_properties;2522 let mut stored_properties = LazyValue::new(move || get_properties(token_id));25232524 let mut is_token_owner = LazyValue::new(|| check_token_owner(self.collection));25252526 let check_token_exist = self.check_token_exist;2527 let mut is_token_exist = LazyValue::new(move || check_token_exist(token_id));25282529 for (key, value) in properties_updates {2383 for (key, value) in properties_updates {2530 let permission = self2384 let permission = self2385 .collection_lazy_info2531 .property_permissions2386 .property_permissions2532 .value()2387 .value()2533 .get(&key)2388 .get(&key)253623912537 match permission {2392 match permission {2538 PropertyPermission { mutable: false, .. }2393 PropertyPermission { mutable: false, .. }2539 if stored_properties.value().get(&key).is_some() =>2394 if token_lazy_info2395 .stored_properties2396 .value()2397 .get(&key)2398 .is_some() =>2540 {2399 {2541 return Err(<Error<T>>::NoPermission.into());2400 return Err(<Error<T>>::NoPermission.into());2542 }2401 }2545 collection_admin,2404 collection_admin,2546 token_owner,2405 token_owner,2547 ..2406 ..2548 } => check_token_permissions::<T, _, _, _>(2407 } => check_token_permissions::<T>(2549 collection_admin,2408 collection_admin,2550 token_owner,2409 token_owner,2551 &mut self.is_collection_admin,2410 &mut self.collection_lazy_info.is_collection_admin,2552 &mut is_token_owner,2411 &mut token_lazy_info.is_token_owner,2553 &mut is_token_exist,2412 &mut token_lazy_info.is_token_exist,2554 )?,2413 )?,2555 }2414 }255624152557 match value {2416 match value {2558 Some(value) => {2417 Some(value) => {2559 stored_properties2418 token_lazy_info2419 .stored_properties2560 .value_mut()2420 .value_mut()2561 .try_set(key.clone(), value)2421 .try_set(key.clone(), value)2562 .map_err(<Error<T>>::from)?;2422 .map_err(<Error<T>>::from)?;2568 ));2428 ));2569 }2429 }2570 None => {2430 None => {2571 stored_properties2431 token_lazy_info2432 .stored_properties2572 .value_mut()2433 .value_mut()2573 .remove(&key)2434 .remove(&key)2574 .map_err(<Error<T>>::from)?;2435 .map_err(<Error<T>>::from)?;2582 }2443 }2583 }2444 }258424452585 let properties_changed = stored_properties.has_value();2446 let properties_changed = token_lazy_info.stored_properties.has_value();2586 if properties_changed {2447 if properties_changed {2587 <PalletEvm<T>>::deposit_log(log);2448 <PalletEvm<T>>::deposit_log(log);258824492589 self.collection2450 self.collection2590 .set_token_properties_raw(token_id, stored_properties.into_inner());2451 .set_token_properties_raw(token_id, token_lazy_info.stored_properties.into_inner());2591 }2452 }259224532593 Ok(())2454 Ok(())2594 }2455 }2595}2456}259624572597/// Create a [`PropertyWriter`] for newly created tokens.2458/// A helper structure for the [`PropertyWriter`] that holds2459/// the collection-related info. The info is loaded using lazy evaluation.2460/// This info is common for any token for which we write properties.2598pub fn property_writer_for_new_token<'a, T, Handle>(2461pub struct PropertyWriterLazyCollectionInfo<'a> {2599 collection: &'a Handle,2462 is_collection_admin: LazyValue<'a, bool>,2600 sender: &'a T::CrossAccountId,2463 property_permissions: LazyValue<'a, PropertiesPermissionMap>,2464}24652601) -> PropertyWriter<2466/// A helper structure for the [`PropertyWriter`] that holds2467/// the token-related info. The info is loaded using lazy evaluation.2468pub struct PropertyWriterLazyTokenInfo<'a> {2602 'a,2469 is_token_exist: LazyValue<'a, bool>,2603 T,2470 is_token_owner: LazyValue<'a, Result<bool, DispatchError>>,2604 Handle,2471 stored_properties: LazyValue<'a, TokenProperties>,2472}24732474impl<'a> PropertyWriterLazyTokenInfo<'a> {2605 NewTokenPropertyWriter,2475 /// Create a lazy token info.2606 impl FnOnce() -> bool + 'a,2476 pub fn new(2477 check_token_exist: impl FnOnce() -> bool + 'a,2607 impl FnOnce() -> PropertiesPermissionMap + 'a,2478 check_token_owner: impl FnOnce() -> Result<bool, DispatchError> + 'a,2608 impl Copy + FnOnce(TokenId) -> bool + 'a,2479 get_token_properties: impl FnOnce() -> TokenProperties + 'a,2609 impl Copy + FnOnce(TokenId) -> TokenProperties + 'a,2480 ) -> Self {2481 Self {2482 is_token_exist: LazyValue::new(check_token_exist),2483 is_token_owner: LazyValue::new(check_token_owner),2484 stored_properties: LazyValue::new(get_token_properties),2485 }2486 }2487}24882489/// A marker structure that enables the writer implementation2490/// to provide the interface to write properties to **newly created** tokens.2491pub struct NewTokenPropertyWriter<T>(PhantomData<T>);2492impl<T: Config> NewTokenPropertyWriter<T> {2493 /// Creates a [`PropertyWriter`] for **newly created** tokens.2494 pub fn new<'a, Handle>(2495 collection: &'a Handle,2496 sender: &'a T::CrossAccountId,2497 ) -> PropertyWriter<'a, Self, T, Handle>2498 where2499 T: Config,2500 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2501 {2502 PropertyWriter {2503 collection,2504 collection_lazy_info: PropertyWriterLazyCollectionInfo {2505 is_collection_admin: LazyValue::new(|| collection.is_owner_or_admin(sender)),2506 property_permissions: LazyValue::new(|| {2507 <Pallet<T>>::property_permissions(collection.id)2508 }),2509 },2510 _phantom: PhantomData,2511 }2512 }2513}25142610>2515impl<'a, T, Handle> PropertyWriter<'a, NewTokenPropertyWriter<T>, T, Handle>2611where2516where2612 T: Config,2517 T: Config,2613 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2518 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2614{2519{2615 PropertyWriter {2520 /// A function to write properties to a **newly created** token.2616 collection,2521 pub fn write_token_properties(2522 &mut self,2617 is_collection_admin: LazyValue::new(|| collection.is_owner_or_admin(sender)),2523 mint_target_is_sender: bool,2524 token_id: TokenId,2618 property_permissions: LazyValue::new(|| <Pallet<T>>::property_permissions(collection.id)),2525 properties_updates: impl Iterator<Item = Property>,2526 log: evm_coder::ethereum::Log,2619 check_token_exist: |token_id| {2527 ) -> DispatchResult {2528 let check_token_exist = || {2620 debug_assert!(collection.token_exists(token_id));2529 debug_assert!(self.collection.token_exists(token_id));2621 true2530 true2622 },2531 };25322623 get_properties: |token_id| {2533 let check_token_owner = || Ok(mint_target_is_sender);25342535 let get_token_properties = || {2624 debug_assert!(collection.get_token_properties_raw(token_id).is_none());2536 debug_assert!(self.collection.get_token_properties_raw(token_id).is_none());2625 TokenProperties::new()2537 TokenProperties::new()2626 },2538 };25392540 self.internal_write_token_properties(2541 token_id,2627 _phantom: PhantomData,2542 PropertyWriterLazyTokenInfo::new(2543 check_token_exist,2544 check_token_owner,2545 get_token_properties,2546 ),2547 properties_updates.map(|p| (p.key, Some(p.value))),2548 log,2549 )2628 }2550 }2629}2551}263025522631#[cfg(feature = "runtime-benchmarks")]2632/// Create a `PropertyWriter` with preloaded `is_collection_admin` and `property_permissions.2553/// A marker structure that enables the writer implementation2633/// Also:2554/// to provide the interface to write properties to **already existing** tokens.2634/// * it will return `true` for the token ownership check.2635/// * it will return empty stored properties without reading them from the storage.2555pub struct ExistingTokenPropertyWriter<T>(PhantomData<T>);2556impl<T: Config> ExistingTokenPropertyWriter<T> {2557 /// Creates a [`PropertyWriter`] for **already existing** tokens.2636pub fn collection_info_loaded_property_writer<T, Handle>(2558 pub fn new<'a, Handle>(2637 collection: &Handle,2559 collection: &'a Handle,2638 is_collection_admin: bool,2560 sender: &'a T::CrossAccountId,2639 property_permissions: PropertiesPermissionMap,2561 ) -> PropertyWriter<'a, Self, T, Handle>2640) -> PropertyWriter<2641 T,2642 Handle,2562 where2563 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2643 NewTokenPropertyWriter,2564 {2565 PropertyWriter {2566 collection,2644 impl FnOnce() -> bool,2567 collection_lazy_info: PropertyWriterLazyCollectionInfo {2645 impl FnOnce() -> PropertiesPermissionMap,2568 is_collection_admin: LazyValue::new(|| collection.is_owner_or_admin(sender)),2646 impl Copy + FnOnce(TokenId) -> bool,2569 property_permissions: LazyValue::new(|| {2570 <Pallet<T>>::property_permissions(collection.id)2571 }),2572 },2573 _phantom: PhantomData,2647 impl Copy + FnOnce(TokenId) -> TokenProperties,2574 }2575 }2576}25772648>2578impl<'a, T, Handle> PropertyWriter<'a, ExistingTokenPropertyWriter<T>, T, Handle>2649where2579where2650 T: Config,2580 T: Config,2651 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2581 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2652{2582{2653 PropertyWriter {2583 /// A function to write properties to an **already existing** token.2654 collection,2584 pub fn write_token_properties(2585 &mut self,2655 is_collection_admin: LazyValue::new(move || is_collection_admin),2586 sender: &T::CrossAccountId,2587 token_id: TokenId,2588 properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,2656 property_permissions: LazyValue::new(move || property_permissions),2589 nesting_budget: &dyn Budget,2590 log: evm_coder::ethereum::Log,2591 ) -> DispatchResult {2592 let check_token_exist = || self.collection.token_exists(token_id);2657 check_token_exist: |_token_id| true,2593 let check_token_owner = || {2594 self.collection2595 .check_token_indirect_owner(token_id, sender, nesting_budget)2658 get_properties: |_token_id| TokenProperties::new(),2596 };2597 let get_token_properties = || {2598 self.collection2599 .get_token_properties_raw(token_id)2600 .unwrap_or_default()2601 };26022603 self.internal_write_token_properties(2604 token_id,2605 PropertyWriterLazyTokenInfo::new(2606 check_token_exist,2607 check_token_owner,2608 get_token_properties,2609 ),2659 _phantom: PhantomData,2610 properties_updates,2611 log,2612 )2660 }2613 }2661}2614}266226152663/// Create a [`PropertyWriter`] for already existing tokens.2616/// A marker structure that enables the writer implementation2617/// to benchmark the token properties writing.2618#[cfg(feature = "runtime-benchmarks")]2619pub struct BenchmarkPropertyWriter<T>(PhantomData<T>);26202621#[cfg(feature = "runtime-benchmarks")]2622impl<T: Config> BenchmarkPropertyWriter<T> {2623 /// Creates a [`PropertyWriter`] for benchmarking tokens properties writing.2664pub fn property_writer_for_existing_token<'a, T, Handle>(2624 pub fn new<'a, Handle>(2665 collection: &'a Handle,2625 collection: &'a Handle,2666 sender: &'a T::CrossAccountId,2626 collection_lazy_info: PropertyWriterLazyCollectionInfo<'a>,2667) -> PropertyWriter<2627 ) -> PropertyWriter<'a, Self, T, Handle>2668 'a,2669 T,2628 where2629 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2670 Handle,2630 {2631 PropertyWriter {2632 collection,2671 ExistingTokenPropertyWriter,2633 collection_lazy_info,2672 impl FnOnce() -> bool + 'a,2634 _phantom: PhantomData,2635 }2636 }26372638 /// Load the [`PropertyWriterLazyCollectionInfo`] from the storage.2639 pub fn load_collection_info<Handle>(2640 collection_handle: &Handle,2641 sender: &T::CrossAccountId,2642 ) -> PropertyWriterLazyCollectionInfo<'static>2643 where2644 Handle: Deref<Target = CollectionHandle<T>>,2673 impl FnOnce() -> PropertiesPermissionMap + 'a,2645 {2646 let is_collection_admin = collection_handle.is_owner_or_admin(sender);2647 let property_permissions = <Pallet<T>>::property_permissions(collection_handle.id);26482649 PropertyWriterLazyCollectionInfo {2650 is_collection_admin: LazyValue::new(move || is_collection_admin),2674 impl Copy + FnOnce(TokenId) -> bool + 'a,2651 property_permissions: LazyValue::new(move || property_permissions),2652 }2653 }26542655 /// Load the [`PropertyWriterLazyTokenInfo`] with token properties from the storage.2656 pub fn load_token_properties<Handle>(2657 collection: &Handle,2658 token_id: TokenId,2659 ) -> PropertyWriterLazyTokenInfo2660 where2661 Handle: CommonCollectionOperations<T>,2662 {2663 let stored_properties = collection2664 .get_token_properties_raw(token_id)2665 .unwrap_or_default();26662667 PropertyWriterLazyTokenInfo {2668 is_token_exist: LazyValue::new(|| true),2675 impl Copy + FnOnce(TokenId) -> TokenProperties + 'a,2669 is_token_owner: LazyValue::new(|| Ok(true)),2670 stored_properties: LazyValue::new(move || stored_properties),2671 }2672 }2673}26742675#[cfg(feature = "runtime-benchmarks")]2676>2676impl<'a, T, Handle> PropertyWriter<'a, BenchmarkPropertyWriter<T>, T, Handle>2677where2677where2678 T: Config,2678 T: Config,2679 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2679 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2680{2680{2681 PropertyWriter {2681 /// A function to benchmark the writing of token properties.2682 collection,2682 pub fn write_token_properties(2683 &mut self,2683 is_collection_admin: LazyValue::new(|| collection.is_owner_or_admin(sender)),2684 token_id: TokenId,2685 properties_updates: impl Iterator<Item = Property>,2684 property_permissions: LazyValue::new(|| <Pallet<T>>::property_permissions(collection.id)),2686 log: evm_coder::ethereum::Log,2685 check_token_exist: |token_id| collection.token_exists(token_id),2687 ) -> DispatchResult {2688 let check_token_exist = || true;2689 let check_token_owner = || Ok(true);2690 let get_token_properties = TokenProperties::new;26912692 self.internal_write_token_properties(2693 token_id,2686 get_properties: |token_id| {2694 PropertyWriterLazyTokenInfo::new(2687 collection2695 check_token_exist,2688 .get_token_properties_raw(token_id)2696 check_token_owner,2697 get_token_properties,2698 ),2689 .unwrap_or_default()2699 properties_updates.map(|p| (p.key, Some(p.value))),2690 },2700 log,2691 _phantom: PhantomData,2701 )2692 }2702 }2693}2703}269427042695/// Computes the weight delta for newly created tokens with properties.2705/// Computes the weight of writing properties to tokens.2696/// * `properties_nums` - The properties num of each created token.2706/// * `properties_nums` - The properties num of each created token.2697/// * `init_token_properties` - The function to obtain the weight from a token's properties num.2707/// * `per_token_weight_weight` - The function to obtain the weight2708/// of writing properties from a token's properties num.2698pub fn init_token_properties_delta<T: Config, I: Fn(u32) -> Weight>(2709pub fn write_token_properties_total_weight<T: Config, I: Fn(u32) -> Weight>(2699 properties_nums: impl Iterator<Item = u32>,2710 properties_nums: impl Iterator<Item = u32>,2700 init_token_properties: I,2711 per_token_weight: I,2701) -> Weight {2712) -> Weight {2702 let mut delta = properties_nums2713 let mut weight = properties_nums2703 .filter_map(|properties_num| {2714 .filter_map(|properties_num| {2704 if properties_num > 0 {2715 if properties_num > 0 {2705 Some(init_token_properties(properties_num))2716 Some(per_token_weight(properties_num))2706 } else {2717 } else {2707 None2718 None2708 }2719 }2709 })2720 })2710 .fold(Weight::zero(), |a, b| a.saturating_add(b));2721 .fold(Weight::zero(), |a, b| a.saturating_add(b));271127222712 // If at least once the `init_token_properties` was called,2723 if !weight.is_zero() {2713 // it means at least one newly created token has properties.2724 // If we are here, it means the token properties were written at least once.2714 // Becuase of that, some common collection data also was loaded and we need to add this weight.2725 // Because of that, some common collection data was also loaded; we must add this weight.2715 // However, these common data was loaded only once which is guaranteed by the `PropertyWriter`.2726 // However, this common data was loaded only once, which is guaranteed by the `PropertyWriter`.2716 if !delta.is_zero() {27272717 delta = delta.saturating_add(<SelfWeightOf<T>>::init_token_properties_common())2728 weight = weight.saturating_add(<SelfWeightOf<T>>::property_writer_load_collection_info());2718 }2729 }271927302720 delta2731 weight2721}2732}272227332723#[cfg(any(feature = "tests", test))]2734#[cfg(any(feature = "tests", test))]2781 /* 15*/ TestCase::new(1, 1, 1, 1, 0),2792 /* 15*/ TestCase::new(1, 1, 1, 1, 0),2782 ];2793 ];278327942784 pub fn check_token_permissions<T, FCA, FTO, FTE>(2795 pub fn check_token_permissions<T: Config>(2785 collection_admin_permitted: bool,2796 collection_admin_permitted: bool,2786 token_owner_permitted: bool,2797 token_owner_permitted: bool,2787 is_collection_admin: &mut LazyValue<bool, FCA>,2798 is_collection_admin: &mut LazyValue<bool>,2788 check_token_ownership: &mut LazyValue<Result<bool, DispatchError>, FTO>,2799 check_token_ownership: &mut LazyValue<Result<bool, DispatchError>>,2789 check_token_existence: &mut LazyValue<bool, FTE>,2800 check_token_existence: &mut LazyValue<bool>,2790 ) -> DispatchResult2801 ) -> DispatchResult {2791 where2792 T: Config,2793 FCA: FnOnce() -> bool,2794 FTO: FnOnce() -> Result<bool, DispatchError>,2795 FTE: FnOnce() -> bool,2796 {2797 crate::check_token_permissions::<T, FCA, FTO, FTE>(2802 crate::check_token_permissions::<T>(2798 collection_admin_permitted,2803 collection_admin_permitted,2799 token_owner_permitted,2804 token_owner_permitted,2800 is_collection_admin,2805 is_collection_admin,pallets/common/src/weights.rsdiffbeforeafterboth--- a/pallets/common/src/weights.rs
+++ b/pallets/common/src/weights.rs
@@ -3,13 +3,13 @@
//! Autogenerated weights for pallet_common
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-09-30, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-10-13, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
-//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`
-//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
+//! HOSTNAME: `hearthstone`, CPU: `AMD Ryzen 9 7950X3D 16-Core Processor`
+//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
-// target/production/unique-collator
+// ./target/production/unique-collator
// benchmark
// pallet
// --pallet
@@ -20,7 +20,7 @@
// *
// --template=.maintain/frame-weight-template.hbs
// --steps=50
-// --repeat=400
+// --repeat=80
// --heap-pages=4096
// --output=./pallets/common/src/weights.rs
@@ -34,116 +34,87 @@
/// Weight functions needed for pallet_common.
pub trait WeightInfo {
fn set_collection_properties(b: u32, ) -> Weight;
- fn delete_collection_properties(b: u32, ) -> Weight;
fn check_accesslist() -> Weight;
- fn init_token_properties_common() -> Weight;
+ fn property_writer_load_collection_info() -> Weight;
}
/// Weights for pallet_common using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
- /// Storage: Common CollectionProperties (r:1 w:1)
- /// Proof: Common CollectionProperties (max_values: None, max_size: Some(40992), added: 43467, mode: MaxEncodedLen)
+ /// Storage: `Common::CollectionProperties` (r:1 w:1)
+ /// Proof: `Common::CollectionProperties` (`max_values`: None, `max_size`: Some(40992), added: 43467, mode: `MaxEncodedLen`)
/// The range of component `b` is `[0, 64]`.
fn set_collection_properties(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `298`
// Estimated: `44457`
- // Minimum execution time: 4_987_000 picoseconds.
- Weight::from_parts(5_119_000, 44457)
- // Standard Error: 7_609
- .saturating_add(Weight::from_parts(5_750_459, 0).saturating_mul(b.into()))
- .saturating_add(T::DbWeight::get().reads(1_u64))
- .saturating_add(T::DbWeight::get().writes(1_u64))
- }
- /// Storage: Common CollectionProperties (r:1 w:1)
- /// Proof: Common CollectionProperties (max_values: None, max_size: Some(40992), added: 43467, mode: MaxEncodedLen)
- /// The range of component `b` is `[0, 64]`.
- fn delete_collection_properties(b: u32, ) -> Weight {
- // Proof Size summary in bytes:
- // Measured: `303 + b * (33030 ±0)`
- // Estimated: `44457`
- // Minimum execution time: 4_923_000 picoseconds.
- Weight::from_parts(5_074_000, 44457)
- // Standard Error: 36_651
- .saturating_add(Weight::from_parts(23_145_677, 0).saturating_mul(b.into()))
+ // Minimum execution time: 4_560_000 picoseconds.
+ Weight::from_parts(28_643_440, 44457)
+ // Standard Error: 28_941
+ .saturating_add(Weight::from_parts(18_277_422, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
- /// Storage: Common Allowlist (r:1 w:0)
- /// Proof: Common Allowlist (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen)
+ /// Storage: `Common::Allowlist` (r:1 w:0)
+ /// Proof: `Common::Allowlist` (`max_values`: None, `max_size`: Some(70), added: 2545, mode: `MaxEncodedLen`)
fn check_accesslist() -> Weight {
// Proof Size summary in bytes:
// Measured: `373`
// Estimated: `3535`
- // Minimum execution time: 4_271_000 picoseconds.
- Weight::from_parts(4_461_000, 3535)
+ // Minimum execution time: 4_290_000 picoseconds.
+ Weight::from_parts(4_460_000, 3535)
.saturating_add(T::DbWeight::get().reads(1_u64))
}
- /// Storage: Common IsAdmin (r:1 w:0)
- /// Proof: Common IsAdmin (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen)
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
- fn init_token_properties_common() -> Weight {
+ /// Storage: `Common::IsAdmin` (r:1 w:0)
+ /// Proof: `Common::IsAdmin` (`max_values`: None, `max_size`: Some(70), added: 2545, mode: `MaxEncodedLen`)
+ /// Storage: `Common::CollectionPropertyPermissions` (r:1 w:0)
+ /// Proof: `Common::CollectionPropertyPermissions` (`max_values`: None, `max_size`: Some(16726), added: 19201, mode: `MaxEncodedLen`)
+ fn property_writer_load_collection_info() -> Weight {
// Proof Size summary in bytes:
// Measured: `326`
// Estimated: `20191`
- // Minimum execution time: 5_889_000 picoseconds.
- Weight::from_parts(6_138_000, 20191)
+ // Minimum execution time: 6_100_000 picoseconds.
+ Weight::from_parts(6_350_000, 20191)
.saturating_add(T::DbWeight::get().reads(2_u64))
}
}
// For backwards compatibility and tests
impl WeightInfo for () {
- /// Storage: Common CollectionProperties (r:1 w:1)
- /// Proof: Common CollectionProperties (max_values: None, max_size: Some(40992), added: 43467, mode: MaxEncodedLen)
+ /// Storage: `Common::CollectionProperties` (r:1 w:1)
+ /// Proof: `Common::CollectionProperties` (`max_values`: None, `max_size`: Some(40992), added: 43467, mode: `MaxEncodedLen`)
/// The range of component `b` is `[0, 64]`.
fn set_collection_properties(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `298`
// Estimated: `44457`
- // Minimum execution time: 4_987_000 picoseconds.
- Weight::from_parts(5_119_000, 44457)
- // Standard Error: 7_609
- .saturating_add(Weight::from_parts(5_750_459, 0).saturating_mul(b.into()))
+ // Minimum execution time: 4_560_000 picoseconds.
+ Weight::from_parts(28_643_440, 44457)
+ // Standard Error: 28_941
+ .saturating_add(Weight::from_parts(18_277_422, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
- /// Storage: Common CollectionProperties (r:1 w:1)
- /// Proof: Common CollectionProperties (max_values: None, max_size: Some(40992), added: 43467, mode: MaxEncodedLen)
- /// The range of component `b` is `[0, 64]`.
- fn delete_collection_properties(b: u32, ) -> Weight {
- // Proof Size summary in bytes:
- // Measured: `303 + b * (33030 ±0)`
- // Estimated: `44457`
- // Minimum execution time: 4_923_000 picoseconds.
- Weight::from_parts(5_074_000, 44457)
- // Standard Error: 36_651
- .saturating_add(Weight::from_parts(23_145_677, 0).saturating_mul(b.into()))
- .saturating_add(RocksDbWeight::get().reads(1_u64))
- .saturating_add(RocksDbWeight::get().writes(1_u64))
- }
- /// Storage: Common Allowlist (r:1 w:0)
- /// Proof: Common Allowlist (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen)
+ /// Storage: `Common::Allowlist` (r:1 w:0)
+ /// Proof: `Common::Allowlist` (`max_values`: None, `max_size`: Some(70), added: 2545, mode: `MaxEncodedLen`)
fn check_accesslist() -> Weight {
// Proof Size summary in bytes:
// Measured: `373`
// Estimated: `3535`
- // Minimum execution time: 4_271_000 picoseconds.
- Weight::from_parts(4_461_000, 3535)
+ // Minimum execution time: 4_290_000 picoseconds.
+ Weight::from_parts(4_460_000, 3535)
.saturating_add(RocksDbWeight::get().reads(1_u64))
}
- /// Storage: Common IsAdmin (r:1 w:0)
- /// Proof: Common IsAdmin (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen)
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
- fn init_token_properties_common() -> Weight {
+ /// Storage: `Common::IsAdmin` (r:1 w:0)
+ /// Proof: `Common::IsAdmin` (`max_values`: None, `max_size`: Some(70), added: 2545, mode: `MaxEncodedLen`)
+ /// Storage: `Common::CollectionPropertyPermissions` (r:1 w:0)
+ /// Proof: `Common::CollectionPropertyPermissions` (`max_values`: None, `max_size`: Some(16726), added: 19201, mode: `MaxEncodedLen`)
+ fn property_writer_load_collection_info() -> Weight {
// Proof Size summary in bytes:
// Measured: `326`
// Estimated: `20191`
- // Minimum execution time: 5_889_000 picoseconds.
- Weight::from_parts(6_138_000, 20191)
+ // Minimum execution time: 6_100_000 picoseconds.
+ Weight::from_parts(6_350_000, 20191)
.saturating_add(RocksDbWeight::get().reads(2_u64))
}
}
pallets/evm-coder-substrate/src/lib.rsdiffbeforeafterboth--- a/pallets/evm-coder-substrate/src/lib.rs
+++ b/pallets/evm-coder-substrate/src/lib.rs
@@ -84,7 +84,7 @@
}
impl<T: Config> budget::Budget for GasCallsBudget<'_, T> {
fn consume_custom(&self, calls: u32) -> bool {
- let (gas, overflown) = (calls as u64).overflowing_add(self.gas_per_call);
+ let (gas, overflown) = (calls as u64).overflowing_mul(self.gas_per_call);
if overflown {
return false;
}
pallets/foreign-assets/src/impl_fungibles.rsdiffbeforeafterboth--- a/pallets/foreign-assets/src/impl_fungibles.rs
+++ b/pallets/foreign-assets/src/impl_fungibles.rs
@@ -23,7 +23,7 @@
use pallet_common::{CollectionHandle, CommonCollectionOperations};
use pallet_fungible::FungibleHandle;
use sp_runtime::traits::{CheckedAdd, CheckedSub};
-use up_data_structs::budget::Value;
+use up_data_structs::budget;
use super::*;
@@ -327,7 +327,7 @@
&collection,
&account,
amount_data,
- &Value::new(0),
+ &budget::Value::new(0),
)?;
Ok(amount)
@@ -440,7 +440,7 @@
&T::CrossAccountId::from_sub(source.clone()),
&T::CrossAccountId::from_sub(dest.clone()),
amount.into(),
- &Value::new(0),
+ &budget::Value::new(0),
)
.map_err(|e| e.error)?;
pallets/fungible/src/common.rsdiffbeforeafterboth--- a/pallets/fungible/src/common.rs
+++ b/pallets/fungible/src/common.rs
@@ -16,14 +16,11 @@
use core::marker::PhantomData;
-use frame_support::{
- dispatch::DispatchResultWithPostInfo, ensure, fail, traits::Get, weights::Weight,
-};
+use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight};
use pallet_common::{
weights::WeightInfo as _, with_weight, CommonCollectionOperations, CommonWeightInfo,
RefungibleExtensions, SelfWeightOf as PalletCommonWeightOf,
};
-use pallet_structure::Error as StructureError;
use sp_runtime::{ArithmeticError, DispatchError};
use sp_std::{vec, vec::Vec};
use up_data_structs::{
@@ -58,18 +55,9 @@
fn set_collection_properties(amount: u32) -> Weight {
<pallet_common::SelfWeightOf<T>>::set_collection_properties(amount)
- }
-
- fn delete_collection_properties(amount: u32) -> Weight {
- <pallet_common::SelfWeightOf<T>>::delete_collection_properties(amount)
}
fn set_token_properties(_amount: u32) -> Weight {
- // Error
- Weight::zero()
- }
-
- fn delete_token_properties(_amount: u32) -> Weight {
// Error
Weight::zero()
}
@@ -80,7 +68,8 @@
}
fn transfer() -> Weight {
- <SelfWeightOf<T>>::transfer_raw() + <PalletCommonWeightOf<T>>::check_accesslist() * 2
+ <SelfWeightOf<T>>::transfer_raw()
+ .saturating_add(<PalletCommonWeightOf<T>>::check_accesslist().saturating_mul(2))
}
fn approve() -> Weight {
@@ -93,28 +82,14 @@
fn transfer_from() -> Weight {
Self::transfer()
- + <SelfWeightOf<T>>::check_allowed_raw()
- + <SelfWeightOf<T>>::set_allowance_unchecked_raw()
+ .saturating_add(<SelfWeightOf<T>>::check_allowed_raw())
+ .saturating_add(<SelfWeightOf<T>>::set_allowance_unchecked_raw())
}
fn burn_from() -> Weight {
<SelfWeightOf<T>>::burn_from()
}
- fn burn_recursively_self_raw() -> Weight {
- // Read to get total balance
- Self::burn_item() + T::DbWeight::get().reads(1)
- }
-
- fn burn_recursively_breadth_raw(_amount: u32) -> Weight {
- // Fungible tokens can't have children
- Weight::zero()
- }
-
- fn token_owner() -> Weight {
- Weight::zero()
- }
-
fn set_allowance_for_all() -> Weight {
Weight::zero()
}
@@ -200,26 +175,6 @@
with_weight(
<Pallet<T>>::burn(self, &sender, amount),
<CommonWeights<T>>::burn_item(),
- )
- }
-
- fn burn_item_recursively(
- &self,
- sender: T::CrossAccountId,
- token: TokenId,
- self_budget: &dyn Budget,
- _breadth_budget: &dyn Budget,
- ) -> DispatchResultWithPostInfo {
- // Should not happen?
- ensure!(
- token == TokenId::default(),
- <Error<T>>::FungibleItemsHaveNoId
- );
- ensure!(self_budget.consume(), <StructureError<T>>::DepthLimit,);
-
- with_weight(
- <Pallet<T>>::burn(self, &sender, <Balance<T>>::get((self.id, &sender))),
- <CommonWeights<T>>::burn_recursively_self_raw(),
)
}
pallets/fungible/src/erc.rsdiffbeforeafterboth--- a/pallets/fungible/src/erc.rs
+++ b/pallets/fungible/src/erc.rs
@@ -32,12 +32,12 @@
use pallet_evm_coder_substrate::{
call, dispatch_to_evm,
execution::{PreDispatch, Result},
- frontier_contract,
+ frontier_contract, SubstrateRecorder,
};
use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};
use sp_core::{Get, U256};
use sp_std::vec::Vec;
-use up_data_structs::CollectionMode;
+use up_data_structs::{budget::Budget, CollectionMode};
use crate::{
common::CommonWeights, weights::WeightInfo, Allowance, Balance, Config, FungibleHandle, Pallet,
@@ -73,6 +73,10 @@
amount: U256,
}
+fn nesting_budget<T: Config>(recorder: &SubstrateRecorder<T>) -> impl Budget + '_ {
+ recorder.weight_calls_budget(<StructureWeight<T>>::find_parent())
+}
+
#[solidity_interface(name = ERC20, events(ERC20Events), enum(derive(PreDispatch)), enum_attr(weight), expect_selector = 0x942e8b22)]
impl<T: Config> FungibleHandle<T> {
fn name(&self) -> Result<String> {
@@ -106,11 +110,8 @@
let caller = T::CrossAccountId::from_eth(caller);
let to = T::CrossAccountId::from_eth(to);
let amount = amount.try_into().map_err(|_| "amount overflow")?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
- <Pallet<T>>::transfer(self, &caller, &to, amount, &budget)
+ <Pallet<T>>::transfer(self, &caller, &to, amount, &nesting_budget(&self.recorder))
.map_err(|e| dispatch_to_evm::<T>(e.error))?;
Ok(true)
}
@@ -127,12 +128,16 @@
let from = T::CrossAccountId::from_eth(from);
let to = T::CrossAccountId::from_eth(to);
let amount = amount.try_into().map_err(|_| "amount overflow")?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
- <Pallet<T>>::transfer_from(self, &caller, &from, &to, amount, &budget)
- .map_err(|e| dispatch_to_evm::<T>(e.error))?;
+ <Pallet<T>>::transfer_from(
+ self,
+ &caller,
+ &from,
+ &to,
+ amount,
+ &nesting_budget(&self.recorder),
+ )
+ .map_err(|e| dispatch_to_evm::<T>(e.error))?;
Ok(true)
}
#[weight(<SelfWeightOf<T>>::approve())]
@@ -164,10 +169,8 @@
let caller = T::CrossAccountId::from_eth(caller);
let to = T::CrossAccountId::from_eth(to);
let amount = amount.try_into().map_err(|_| "amount overflow")?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
- <Pallet<T>>::create_item(self, &caller, (to, amount), &budget)
+
+ <Pallet<T>>::create_item(self, &caller, (to, amount), &nesting_budget(&self.recorder))
.map_err(dispatch_to_evm::<T>)?;
Ok(true)
}
@@ -201,10 +204,8 @@
let caller = T::CrossAccountId::from_eth(caller);
let to = to.into_sub_cross_account::<T>()?;
let amount = amount.try_into().map_err(|_| "amount overflow")?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
- <Pallet<T>>::create_item(self, &caller, (to, amount), &budget)
+
+ <Pallet<T>>::create_item(self, &caller, (to, amount), &nesting_budget(&self.recorder))
.map_err(dispatch_to_evm::<T>)?;
Ok(true)
}
@@ -236,12 +237,15 @@
let caller = T::CrossAccountId::from_eth(caller);
let from = T::CrossAccountId::from_eth(from);
let amount = amount.try_into().map_err(|_| "amount overflow")?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
- <Pallet<T>>::burn_from(self, &caller, &from, amount, &budget)
- .map_err(dispatch_to_evm::<T>)?;
+ <Pallet<T>>::burn_from(
+ self,
+ &caller,
+ &from,
+ amount,
+ &nesting_budget(&self.recorder),
+ )
+ .map_err(dispatch_to_evm::<T>)?;
Ok(true)
}
@@ -260,12 +264,15 @@
let caller = T::CrossAccountId::from_eth(caller);
let from = from.into_sub_cross_account::<T>()?;
let amount = amount.try_into().map_err(|_| "amount overflow")?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
- <Pallet<T>>::burn_from(self, &caller, &from, amount, &budget)
- .map_err(dispatch_to_evm::<T>)?;
+ <Pallet<T>>::burn_from(
+ self,
+ &caller,
+ &from,
+ amount,
+ &nesting_budget(&self.recorder),
+ )
+ .map_err(dispatch_to_evm::<T>)?;
Ok(true)
}
@@ -274,9 +281,6 @@
#[weight(<SelfWeightOf<T>>::create_multiple_items_ex(amounts.len() as u32))]
fn mint_bulk(&mut self, caller: Caller, amounts: Vec<AmountForAddress>) -> Result<bool> {
let caller = T::CrossAccountId::from_eth(caller);
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
let amounts = amounts
.into_iter()
.map(|AmountForAddress { to, amount }| {
@@ -287,7 +291,7 @@
})
.collect::<Result<_>>()?;
- <Pallet<T>>::create_multiple_items(self, &caller, amounts, &budget)
+ <Pallet<T>>::create_multiple_items(self, &caller, amounts, &nesting_budget(&self.recorder))
.map_err(dispatch_to_evm::<T>)?;
Ok(true)
}
@@ -297,11 +301,9 @@
let caller = T::CrossAccountId::from_eth(caller);
let to = to.into_sub_cross_account::<T>()?;
let amount = amount.try_into().map_err(|_| "amount overflow")?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
- <Pallet<T>>::transfer(self, &caller, &to, amount, &budget).map_err(|_| "transfer error")?;
+ <Pallet<T>>::transfer(self, &caller, &to, amount, &nesting_budget(&self.recorder))
+ .map_err(|_| "transfer error")?;
Ok(true)
}
@@ -317,12 +319,16 @@
let from = from.into_sub_cross_account::<T>()?;
let to = to.into_sub_cross_account::<T>()?;
let amount = amount.try_into().map_err(|_| "amount overflow")?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
- <Pallet<T>>::transfer_from(self, &caller, &from, &to, amount, &budget)
- .map_err(|e| dispatch_to_evm::<T>(e.error))?;
+ <Pallet<T>>::transfer_from(
+ self,
+ &caller,
+ &from,
+ &to,
+ amount,
+ &nesting_budget(&self.recorder),
+ )
+ .map_err(|e| dispatch_to_evm::<T>(e.error))?;
Ok(true)
}
pallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/benchmarking.rs
+++ b/pallets/nonfungible/src/benchmarking.rs
@@ -18,7 +18,6 @@
use pallet_common::{
bench_init,
benchmarking::{create_collection_raw, property_key, property_value},
- CommonCollectionOperations,
};
use sp_std::prelude::*;
use up_data_structs::{
@@ -131,49 +130,8 @@
#[block]
{
<Pallet<T>>::burn(&collection, &burner, item)?;
- }
-
- Ok(())
- }
-
- #[benchmark]
- fn burn_recursively_self_raw() -> Result<(), BenchmarkError> {
- bench_init! {
- owner: sub; collection: collection(owner);
- sender: cross_from_sub(owner); burner: cross_sub;
- };
- let item = create_max_item(&collection, &sender, burner.clone())?;
-
- #[block]
- {
- <Pallet<T>>::burn_recursively(&collection, &burner, item, &Unlimited, &Unlimited)?;
- }
-
- Ok(())
- }
-
- #[benchmark]
- fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(
- b: Linear<0, 200>,
- ) -> Result<(), BenchmarkError> {
- bench_init! {
- owner: sub; collection: collection(owner);
- sender: cross_from_sub(owner); burner: cross_sub;
- };
- let item = create_max_item(&collection, &sender, burner.clone())?;
- for _ in 0..b {
- create_max_item(
- &collection,
- &sender,
- T::CrossTokenAddressMapping::token_to_address(collection.id, item),
- )?;
}
- #[block]
- {
- <Pallet<T>>::burn_recursively(&collection, &burner, item, &Unlimited, &Unlimited)?;
- }
-
Ok(())
}
@@ -267,38 +225,29 @@
}
#[benchmark]
- fn set_token_property_permissions(
- b: Linear<0, MAX_PROPERTIES_PER_ITEM>,
- ) -> Result<(), BenchmarkError> {
+ fn load_token_properties() -> Result<(), BenchmarkError> {
bench_init! {
owner: sub; collection: collection(owner);
owner: cross_from_sub;
};
- let perms = (0..b)
- .map(|k| PropertyKeyPermission {
- key: property_key(k as usize),
- permission: PropertyPermission {
- mutable: false,
- collection_admin: false,
- token_owner: false,
- },
- })
- .collect::<Vec<_>>();
+ let item = create_max_item(&collection, &owner, owner.clone())?;
+
#[block]
{
- <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
+ pallet_common::BenchmarkPropertyWriter::<T>::load_token_properties(&collection, item);
}
Ok(())
}
#[benchmark]
- fn set_token_properties(b: Linear<0, MAX_PROPERTIES_PER_ITEM>) -> Result<(), BenchmarkError> {
+ fn write_token_properties(b: Linear<0, MAX_PROPERTIES_PER_ITEM>) -> Result<(), BenchmarkError> {
bench_init! {
owner: sub; collection: collection(owner);
owner: cross_from_sub;
};
+
let perms = (0..b)
.map(|k| PropertyKeyPermission {
key: property_key(k as usize),
@@ -318,71 +267,29 @@
.collect::<Vec<_>>();
let item = create_max_item(&collection, &owner, owner.clone())?;
+ let lazy_collection_info =
+ pallet_common::BenchmarkPropertyWriter::<T>::load_collection_info(&collection, &owner);
+
#[block]
{
- <Pallet<T>>::set_token_properties(
- &collection,
- &owner,
+ let mut property_writer =
+ pallet_common::BenchmarkPropertyWriter::new(&collection, lazy_collection_info);
+
+ property_writer.write_token_properties(
item,
props.into_iter(),
- &Unlimited,
+ crate::erc::ERC721TokenEvent::TokenChanged {
+ token_id: item.into(),
+ }
+ .to_log(T::ContractAddress::get()),
)?;
}
Ok(())
}
- // TODO:
#[benchmark]
- fn init_token_properties(b: Linear<0, MAX_PROPERTIES_PER_ITEM>) -> Result<(), BenchmarkError> {
- // bench_init! {
- // owner: sub; collection: collection(owner);
- // owner: cross_from_sub;
- // };
-
- // let perms = (0..b)
- // .map(|k| PropertyKeyPermission {
- // key: property_key(k as usize),
- // permission: PropertyPermission {
- // mutable: false,
- // collection_admin: true,
- // token_owner: true,
- // },
- // })
- // .collect::<Vec<_>>();
- // <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
- #[block]
- {}
- // let props = (0..b)
- // .map(|k| Property {
- // key: property_key(k as usize),
- // value: property_value(),
- // })
- // .collect::<Vec<_>>();
- // let item = create_max_item(&collection, &owner, owner.clone())?;
-
- // let (is_collection_admin, property_permissions) =
- // load_is_admin_and_property_permissions(&collection, &owner);
- // #[block]
- // {
- // let mut property_writer =
- // pallet_common::BenchmarkPropertyWriter::new(&collection, lazy_collection_info);
-
- // property_writer.write_token_properties(
- // item,
- // props.into_iter(),
- // crate::erc::ERC721TokenEvent::TokenChanged {
- // token_id: item.into(),
- // }
- // .to_log(T::ContractAddress::get()),
- // )?;
- // }
-
- Ok(())
- }
-
- #[benchmark]
- fn delete_token_properties(
+ fn set_token_property_permissions(
b: Linear<0, MAX_PROPERTIES_PER_ITEM>,
) -> Result<(), BenchmarkError> {
bench_init! {
@@ -393,54 +300,16 @@
.map(|k| PropertyKeyPermission {
key: property_key(k as usize),
permission: PropertyPermission {
- mutable: true,
- collection_admin: true,
- token_owner: true,
+ mutable: false,
+ collection_admin: false,
+ token_owner: false,
},
})
.collect::<Vec<_>>();
- <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
- let props = (0..b)
- .map(|k| Property {
- key: property_key(k as usize),
- value: property_value(),
- })
- .collect::<Vec<_>>();
- let item = create_max_item(&collection, &owner, owner.clone())?;
- <Pallet<T>>::set_token_properties(
- &collection,
- &owner,
- item,
- props.into_iter(),
- &Unlimited,
- )?;
- let to_delete = (0..b).map(|k| property_key(k as usize)).collect::<Vec<_>>();
#[block]
{
- <Pallet<T>>::delete_token_properties(
- &collection,
- &owner,
- item,
- to_delete.into_iter(),
- &Unlimited,
- )?;
- }
-
- Ok(())
- }
-
- #[benchmark]
- fn token_owner() -> Result<(), BenchmarkError> {
- bench_init! {
- owner: sub; collection: collection(owner);
- owner: cross_from_sub;
- };
- let item = create_max_item(&collection, &owner, owner.clone())?;
-
- #[block]
- {
- collection.token_owner(item).unwrap();
+ <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
}
Ok(())
pallets/nonfungible/src/common.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -18,8 +18,9 @@
use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight};
use pallet_common::{
- init_token_properties_delta, weights::WeightInfo as _, with_weight, CommonCollectionOperations,
- CommonWeightInfo, RefungibleExtensions, SelfWeightOf as PalletCommonWeightOf,
+ weights::WeightInfo as _, with_weight, write_token_properties_total_weight,
+ CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions,
+ SelfWeightOf as PalletCommonWeightOf,
};
use pallet_structure::Pallet as PalletStructure;
use sp_runtime::DispatchError;
@@ -38,24 +39,21 @@
impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {
fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {
match data {
- CreateItemExData::NFT(t) => <SelfWeightOf<T>>::create_multiple_items_ex(t.len() as u32)
- .saturating_add(init_token_properties_delta::<T, _>(
- t.iter().map(|t| t.properties.len() as u32),
- <SelfWeightOf<T>>::init_token_properties,
- )),
+ CreateItemExData::NFT(t) => mint_with_props_weight::<T>(
+ <SelfWeightOf<T>>::create_multiple_items_ex(t.len() as u32),
+ t.iter().map(|t| t.properties.len() as u32),
+ ),
_ => Weight::zero(),
}
}
fn create_multiple_items(data: &[up_data_structs::CreateItemData]) -> Weight {
- <SelfWeightOf<T>>::create_multiple_items(data.len() as u32).saturating_add(
- init_token_properties_delta::<T, _>(
- data.iter().map(|t| match t {
- up_data_structs::CreateItemData::NFT(n) => n.properties.len() as u32,
- _ => 0,
- }),
- <SelfWeightOf<T>>::init_token_properties,
- ),
+ mint_with_props_weight::<T>(
+ <SelfWeightOf<T>>::create_multiple_items(data.len() as u32),
+ data.iter().map(|t| match t {
+ up_data_structs::CreateItemData::NFT(n) => n.properties.len() as u32,
+ _ => 0,
+ }),
)
}
@@ -65,18 +63,17 @@
fn set_collection_properties(amount: u32) -> Weight {
<pallet_common::SelfWeightOf<T>>::set_collection_properties(amount)
- }
-
- fn delete_collection_properties(amount: u32) -> Weight {
- <pallet_common::SelfWeightOf<T>>::delete_collection_properties(amount)
}
fn set_token_properties(amount: u32) -> Weight {
- <SelfWeightOf<T>>::set_token_properties(amount)
+ write_token_properties_total_weight::<T, _>([amount].into_iter(), |amount| {
+ <SelfWeightOf<T>>::load_token_properties()
+ .saturating_add(<SelfWeightOf<T>>::write_token_properties(amount))
+ })
}
fn delete_token_properties(amount: u32) -> Weight {
- <SelfWeightOf<T>>::delete_token_properties(amount)
+ Self::set_token_properties(amount)
}
fn set_token_property_permissions(amount: u32) -> Weight {
@@ -84,7 +81,8 @@
}
fn transfer() -> Weight {
- <SelfWeightOf<T>>::transfer_raw() + <PalletCommonWeightOf<T>>::check_accesslist() * 2
+ <SelfWeightOf<T>>::transfer_raw()
+ .saturating_add(<PalletCommonWeightOf<T>>::check_accesslist().saturating_mul(2))
}
fn approve() -> Weight {
@@ -96,24 +94,11 @@
}
fn transfer_from() -> Weight {
- Self::transfer() + <SelfWeightOf<T>>::check_allowed_raw()
+ Self::transfer().saturating_add(<SelfWeightOf<T>>::check_allowed_raw())
}
fn burn_from() -> Weight {
<SelfWeightOf<T>>::burn_from()
- }
-
- fn burn_recursively_self_raw() -> Weight {
- <SelfWeightOf<T>>::burn_recursively_self_raw()
- }
-
- fn burn_recursively_breadth_raw(amount: u32) -> Weight {
- <SelfWeightOf<T>>::burn_recursively_breadth_plus_self_plus_self_per_each_raw(amount)
- .saturating_sub(Self::burn_recursively_self_raw().saturating_mul(amount as u64 + 1))
- }
-
- fn token_owner() -> Weight {
- <SelfWeightOf<T>>::token_owner()
}
fn set_allowance_for_all() -> Weight {
@@ -125,6 +110,20 @@
}
}
+/// Weight of minting tokens with properties
+/// * `create_no_data_weight` -- the weight of minting without properties
+/// * `token_properties_nums` -- number of properties of each token
+#[inline]
+pub(crate) fn mint_with_props_weight<T: Config>(
+ create_no_data_weight: Weight,
+ token_properties_nums: impl Iterator<Item = u32> + Clone,
+) -> Weight {
+ create_no_data_weight.saturating_add(write_token_properties_total_weight::<T, _>(
+ token_properties_nums,
+ <SelfWeightOf<T>>::write_token_properties,
+ ))
+}
+
fn map_create_data<T: Config>(
data: up_data_structs::CreateItemData,
to: &T::CrossAccountId,
@@ -306,16 +305,6 @@
<Pallet<T>>::check_token_immediate_ownership(self, token, &sender)?;
Ok(().into())
}
- }
-
- fn burn_item_recursively(
- &self,
- sender: T::CrossAccountId,
- token: TokenId,
- self_budget: &dyn Budget,
- breadth_budget: &dyn Budget,
- ) -> DispatchResultWithPostInfo {
- <Pallet<T>>::burn_recursively(self, &sender, token, self_budget, breadth_budget)
}
fn transfer(
pallets/nonfungible/src/erc.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -38,19 +38,21 @@
use pallet_evm_coder_substrate::{
call, dispatch_to_evm,
execution::{Error, PreDispatch, Result},
- frontier_contract,
+ frontier_contract, SubstrateRecorder,
};
use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};
use sp_core::{Get, U256};
use sp_std::{vec, vec::Vec};
use up_data_structs::{
- CollectionId, CollectionPropertiesVec, Property, PropertyKey, PropertyKeyPermission,
- PropertyPermission, TokenId,
+ budget::Budget, CollectionId, CollectionPropertiesVec, Property, PropertyKey,
+ PropertyKeyPermission, PropertyPermission, TokenId,
};
use crate::{
- common::CommonWeights, weights::WeightInfo, AccountBalance, Config, CreateItemData,
- NonfungibleHandle, Pallet, SelfWeightOf, TokenData, TokenProperties, TokensMinted,
+ common::{mint_with_props_weight, CommonWeights},
+ weights::WeightInfo,
+ AccountBalance, Config, CreateItemData, NonfungibleHandle, Pallet, SelfWeightOf, TokenData,
+ TokenProperties, TokensMinted,
};
/// Nft events.
@@ -78,6 +80,10 @@
impl<T: Config> Contract for NonfungibleHandle<T> {...}
}
+fn nesting_budget<T: Config>(recorder: &SubstrateRecorder<T>) -> impl Budget + '_ {
+ recorder.weight_calls_budget(<StructureWeight<T>>::find_parent())
+}
+
/// @title A contract that allows to set and delete token properties and change token property permissions.
#[solidity_interface(name = TokenProperties, events(ERC721TokenEvent), enum(derive(PreDispatch)), enum_attr(weight))]
impl<T: Config> NonfungibleHandle<T> {
@@ -146,7 +152,7 @@
/// @param key Property key.
/// @param value Property value.
#[solidity(hide)]
- #[weight(<SelfWeightOf<T>>::set_token_properties(1))]
+ #[weight(<CommonWeights<T>>::set_token_properties(1))]
fn set_property(
&mut self,
caller: Caller,
@@ -161,16 +167,12 @@
.map_err(|_| "key too long")?;
let value = value.0.try_into().map_err(|_| "value too long")?;
- let nesting_budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
-
<Pallet<T>>::set_token_property(
self,
&caller,
TokenId(token_id),
Property { key, value },
- &nesting_budget,
+ &nesting_budget(&self.recorder),
)
.map_err(dispatch_to_evm::<T>)
}
@@ -179,7 +181,7 @@
/// @dev Throws error if `msg.sender` has no permission to edit the property.
/// @param tokenId ID of the token.
/// @param properties settable properties
- #[weight(<SelfWeightOf<T>>::set_token_properties(properties.len() as u32))]
+ #[weight(<CommonWeights<T>>::set_token_properties(properties.len() as u32))]
fn set_properties(
&mut self,
caller: Caller,
@@ -189,10 +191,6 @@
let caller = T::CrossAccountId::from_eth(caller);
let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
- let nesting_budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
-
let properties = properties
.into_iter()
.map(eth::Property::try_into)
@@ -203,7 +201,7 @@
&caller,
TokenId(token_id),
properties.into_iter(),
- &nesting_budget,
+ &nesting_budget(&self.recorder),
)
.map_err(dispatch_to_evm::<T>)
}
@@ -213,7 +211,7 @@
/// @param tokenId ID of the token.
/// @param key Property key.
#[solidity(hide)]
- #[weight(<SelfWeightOf<T>>::delete_token_properties(1))]
+ #[weight(<CommonWeights<T>>::delete_token_properties(1))]
fn delete_property(&mut self, token_id: U256, caller: Caller, key: String) -> Result<()> {
let caller = T::CrossAccountId::from_eth(caller);
let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
@@ -221,19 +219,21 @@
.try_into()
.map_err(|_| "key too long")?;
- let nesting_budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
-
- <Pallet<T>>::delete_token_property(self, &caller, TokenId(token_id), key, &nesting_budget)
- .map_err(dispatch_to_evm::<T>)
+ <Pallet<T>>::delete_token_property(
+ self,
+ &caller,
+ TokenId(token_id),
+ key,
+ &nesting_budget(&self.recorder),
+ )
+ .map_err(dispatch_to_evm::<T>)
}
/// @notice Delete token properties value.
/// @dev Throws error if `msg.sender` has no permission to edit the property.
/// @param tokenId ID of the token.
/// @param keys Properties key.
- #[weight(<SelfWeightOf<T>>::delete_token_properties(keys.len() as u32))]
+ #[weight(<CommonWeights<T>>::delete_token_properties(keys.len() as u32))]
fn delete_properties(
&mut self,
token_id: U256,
@@ -247,16 +247,12 @@
.map(|k| Ok(<Vec<u8>>::from(k).try_into().map_err(|_| "key too long")?))
.collect::<Result<Vec<_>>>()?;
- let nesting_budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
-
<Pallet<T>>::delete_token_properties(
self,
&caller,
TokenId(token_id),
keys.into_iter(),
- &nesting_budget,
+ &nesting_budget(&self.recorder),
)
.map_err(dispatch_to_evm::<T>)
}
@@ -481,12 +477,16 @@
let from = T::CrossAccountId::from_eth(from);
let to = T::CrossAccountId::from_eth(to);
let token = token_id.try_into()?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
- <Pallet<T>>::transfer_from(self, &caller, &from, &to, token, &budget)
- .map_err(|e| dispatch_to_evm::<T>(e.error))?;
+ <Pallet<T>>::transfer_from(
+ self,
+ &caller,
+ &from,
+ &to,
+ token,
+ &nesting_budget(&self.recorder),
+ )
+ .map_err(|e| dispatch_to_evm::<T>(e.error))?;
Ok(())
}
@@ -594,9 +594,6 @@
let caller = T::CrossAccountId::from_eth(caller);
let to = T::CrossAccountId::from_eth(to);
let token_id: u32 = token_id.try_into()?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
if <TokensMinted<T>>::get(self.id)
.checked_add(1)
@@ -613,7 +610,7 @@
properties: BoundedVec::default(),
owner: to,
},
- &budget,
+ &nesting_budget(&self.recorder),
)
.map_err(dispatch_to_evm::<T>)?;
@@ -625,7 +622,7 @@
/// @param tokenUri Token URI that would be stored in the NFT properties
/// @return uint256 The id of the newly minted token
#[solidity(rename_selector = "mintWithTokenURI")]
- #[weight(<SelfWeightOf<T>>::create_item() + <SelfWeightOf<T>>::set_token_properties(1))]
+ #[weight(mint_with_props_weight::<T>(<SelfWeightOf<T>>::create_item(), [1].into_iter()))]
fn mint_with_token_uri(
&mut self,
caller: Caller,
@@ -647,7 +644,7 @@
/// @param tokenId ID of the minted NFT
/// @param tokenUri Token URI that would be stored in the NFT properties
#[solidity(hide, rename_selector = "mintWithTokenURI")]
- #[weight(<SelfWeightOf<T>>::create_item() + <SelfWeightOf<T>>::set_token_properties(1))]
+ #[weight(mint_with_props_weight::<T>(<SelfWeightOf<T>>::create_item(), [1].into_iter()))]
fn mint_with_token_uri_check_id(
&mut self,
caller: Caller,
@@ -664,9 +661,6 @@
let caller = T::CrossAccountId::from_eth(caller);
let to = T::CrossAccountId::from_eth(to);
let token_id: u32 = token_id.try_into().map_err(|_| "amount overflow")?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
if <TokensMinted<T>>::get(self.id)
.checked_add(1)
@@ -694,7 +688,7 @@
properties,
owner: to,
},
- &budget,
+ &nesting_budget(&self.recorder),
)
.map_err(dispatch_to_evm::<T>)?;
Ok(true)
@@ -840,11 +834,8 @@
let caller = T::CrossAccountId::from_eth(caller);
let to = T::CrossAccountId::from_eth(to);
let token = token_id.try_into()?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
- <Pallet<T>>::transfer(self, &caller, &to, token, &budget)
+ <Pallet<T>>::transfer(self, &caller, &to, token, &nesting_budget(&self.recorder))
.map_err(|e| dispatch_to_evm::<T>(e.error))?;
Ok(())
}
@@ -864,11 +855,8 @@
let caller = T::CrossAccountId::from_eth(caller);
let to = to.into_sub_cross_account::<T>()?;
let token = token_id.try_into()?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
- <Pallet<T>>::transfer(self, &caller, &to, token, &budget)
+ <Pallet<T>>::transfer(self, &caller, &to, token, &nesting_budget(&self.recorder))
.map_err(|e| dispatch_to_evm::<T>(e.error))?;
Ok(())
}
@@ -891,11 +879,16 @@
let from = from.into_sub_cross_account::<T>()?;
let to = to.into_sub_cross_account::<T>()?;
let token_id = token_id.try_into()?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
- Pallet::<T>::transfer_from(self, &caller, &from, &to, token_id, &budget)
- .map_err(|e| dispatch_to_evm::<T>(e.error))?;
+
+ Pallet::<T>::transfer_from(
+ self,
+ &caller,
+ &from,
+ &to,
+ token_id,
+ &nesting_budget(&self.recorder),
+ )
+ .map_err(|e| dispatch_to_evm::<T>(e.error))?;
Ok(())
}
@@ -911,11 +904,8 @@
let caller = T::CrossAccountId::from_eth(caller);
let from = T::CrossAccountId::from_eth(from);
let token = token_id.try_into()?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
- <Pallet<T>>::burn_from(self, &caller, &from, token, &budget)
+ <Pallet<T>>::burn_from(self, &caller, &from, token, &nesting_budget(&self.recorder))
.map_err(dispatch_to_evm::<T>)?;
Ok(())
}
@@ -936,11 +926,8 @@
let caller = T::CrossAccountId::from_eth(caller);
let from = from.into_sub_cross_account::<T>()?;
let token = token_id.try_into()?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
- <Pallet<T>>::burn_from(self, &caller, &from, token, &budget)
+ <Pallet<T>>::burn_from(self, &caller, &from, token, &nesting_budget(&self.recorder))
.map_err(dispatch_to_evm::<T>)?;
Ok(())
}
@@ -966,9 +953,6 @@
let mut expected_index = <TokensMinted<T>>::get(self.id)
.checked_add(1)
.ok_or("item id overflow")?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
let total_tokens = token_ids.len();
for id in token_ids.into_iter() {
@@ -985,19 +969,21 @@
})
.collect();
- <Pallet<T>>::create_multiple_items(self, &caller, data, &budget)
+ <Pallet<T>>::create_multiple_items(self, &caller, data, &nesting_budget(&self.recorder))
.map_err(dispatch_to_evm::<T>)?;
Ok(true)
}
/// @notice Function to mint a token.
/// @param data Array of pairs of token owner and token's properties for minted token
- #[weight(<SelfWeightOf<T>>::create_multiple_items(data.len() as u32) + <SelfWeightOf<T>>::set_token_properties(data.len() as u32))]
+ #[weight(
+ mint_with_props_weight::<T>(
+ <SelfWeightOf<T>>::create_multiple_items_ex(data.len() as u32),
+ data.iter().map(|d| d.properties.len() as u32),
+ )
+ )]
fn mint_bulk_cross(&mut self, caller: Caller, data: Vec<MintTokenData>) -> Result<bool> {
let caller = T::CrossAccountId::from_eth(caller);
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
let mut create_nft_data = Vec::with_capacity(data.len());
for MintTokenData { owner, properties } in data {
@@ -1013,8 +999,13 @@
});
}
- <Pallet<T>>::create_multiple_items(self, &caller, create_nft_data, &budget)
- .map_err(dispatch_to_evm::<T>)?;
+ <Pallet<T>>::create_multiple_items(
+ self,
+ &caller,
+ create_nft_data,
+ &nesting_budget(&self.recorder),
+ )
+ .map_err(dispatch_to_evm::<T>)?;
Ok(true)
}
@@ -1024,7 +1015,12 @@
/// @param to The new owner
/// @param tokens array of pairs of token ID and token URI for minted tokens
#[solidity(hide, rename_selector = "mintBulkWithTokenURI")]
- #[weight(<SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32) + <SelfWeightOf<T>>::set_token_properties(tokens.len() as u32))]
+ #[weight(
+ mint_with_props_weight::<T>(
+ <SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32),
+ tokens.iter().map(|_| 1),
+ )
+ )]
fn mint_bulk_with_token_uri(
&mut self,
caller: Caller,
@@ -1037,9 +1033,6 @@
let mut expected_index = <TokensMinted<T>>::get(self.id)
.checked_add(1)
.ok_or("item id overflow")?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
let mut data = Vec::with_capacity(tokens.len());
for TokenUri { id, uri } in tokens {
@@ -1066,7 +1059,7 @@
});
}
- <Pallet<T>>::create_multiple_items(self, &caller, data, &budget)
+ <Pallet<T>>::create_multiple_items(self, &caller, data, &nesting_budget(&self.recorder))
.map_err(dispatch_to_evm::<T>)?;
Ok(true)
}
@@ -1075,7 +1068,7 @@
/// @param to The new owner crossAccountId
/// @param properties Properties of minted token
/// @return uint256 The id of the newly minted token
- #[weight(<SelfWeightOf<T>>::create_item() + <SelfWeightOf<T>>::set_token_properties(properties.len() as u32))]
+ #[weight(mint_with_props_weight::<T>(<SelfWeightOf<T>>::create_item(), [properties.len() as u32].into_iter()))]
fn mint_cross(
&mut self,
caller: Caller,
@@ -1096,10 +1089,6 @@
.map_err(|_| Error::Revert("too many properties".to_string()))?;
let caller = T::CrossAccountId::from_eth(caller);
-
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
<Pallet<T>>::create_item(
self,
@@ -1108,7 +1097,7 @@
properties,
owner: to,
},
- &budget,
+ &nesting_budget(&self.recorder),
)
.map_err(dispatch_to_evm::<T>)?;
pallets/nonfungible/src/lib.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -109,7 +109,7 @@
};
use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};
use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
-use pallet_structure::{Error as StructureError, Pallet as PalletStructure};
+use pallet_structure::Pallet as PalletStructure;
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_core::{Get, H160};
@@ -502,52 +502,7 @@
));
Ok(())
}
-
- /// Same as [`burn`] but burns all the tokens that are nested in the token first
- ///
- /// - `self_budget`: Limit for searching children in depth.
- /// - `breadth_budget`: Limit of breadth of searching children.
- ///
- /// [`burn`]: struct.Pallet.html#method.burn
- #[transactional]
- pub fn burn_recursively(
- collection: &NonfungibleHandle<T>,
- sender: &T::CrossAccountId,
- token: TokenId,
- self_budget: &dyn Budget,
- breadth_budget: &dyn Budget,
- ) -> DispatchResultWithPostInfo {
- ensure!(self_budget.consume(), <StructureError<T>>::DepthLimit,);
- let current_token_account =
- T::CrossTokenAddressMapping::token_to_address(collection.id, token);
-
- let mut weight = Weight::zero();
-
- // This method is transactional, if user in fact doesn't have permissions to remove token -
- // tokens removed here will be restored after rejected transaction
- for ((collection, token), _) in <TokenChildren<T>>::iter_prefix((collection.id, token)) {
- ensure!(breadth_budget.consume(), <StructureError<T>>::BreadthLimit,);
- let PostDispatchInfo { actual_weight, .. } =
- <PalletStructure<T>>::burn_item_recursively(
- current_token_account.clone(),
- collection,
- token,
- self_budget,
- breadth_budget,
- )?;
- if let Some(actual_weight) = actual_weight {
- weight = weight.saturating_add(actual_weight);
- }
- }
-
- Self::burn(collection, sender, token)?;
- DispatchResultWithPostInfo::Ok(PostDispatchInfo {
- actual_weight: Some(weight + <SelfWeightOf<T>>::burn_item()),
- pays_fee: Pays::Yes,
- })
- }
-
/// A batch operation to add, edit or remove properties for a token.
///
/// - `nesting_budget`: Limit for searching parents in-depth to check ownership.
@@ -568,7 +523,7 @@
nesting_budget: &dyn Budget,
) -> DispatchResult {
let mut property_writer =
- pallet_common::property_writer_for_existing_token(collection, sender);
+ pallet_common::ExistingTokenPropertyWriter::new(collection, sender);
property_writer.write_token_properties(
sender,
@@ -915,7 +870,7 @@
// =========
- let mut property_writer = pallet_common::property_writer_for_new_token(collection, sender);
+ let mut property_writer = pallet_common::NewTokenPropertyWriter::new(collection, sender);
with_transaction(|| {
for (i, data) in data.iter().enumerate() {
pallets/nonfungible/src/weights.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/weights.rs
+++ b/pallets/nonfungible/src/weights.rs
@@ -3,13 +3,13 @@
//! Autogenerated weights for pallet_nonfungible
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-09-30, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-10-13, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
-//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`
-//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
+//! HOSTNAME: `hearthstone`, CPU: `AMD Ryzen 9 7950X3D 16-Core Processor`
+//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
-// target/production/unique-collator
+// ./target/production/unique-collator
// benchmark
// pallet
// --pallet
@@ -20,7 +20,7 @@
// *
// --template=.maintain/frame-weight-template.hbs
// --steps=50
-// --repeat=400
+// --repeat=80
// --heap-pages=4096
// --output=./pallets/nonfungible/src/weights.rs
@@ -37,18 +37,14 @@
fn create_multiple_items(b: u32, ) -> Weight;
fn create_multiple_items_ex(b: u32, ) -> Weight;
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_raw() -> Weight;
fn approve() -> Weight;
fn approve_from() -> Weight;
fn check_allowed_raw() -> Weight;
fn burn_from() -> Weight;
+ fn load_token_properties() -> Weight;
+ fn write_token_properties(b: u32, ) -> Weight;
fn set_token_property_permissions(b: u32, ) -> Weight;
- fn set_token_properties(b: u32, ) -> Weight;
- fn init_token_properties(b: u32, ) -> Weight;
- fn delete_token_properties(b: u32, ) -> Weight;
- fn token_owner() -> Weight;
fn set_allowance_for_all() -> Weight;
fn allowance_for_all() -> Weight;
fn repair_item() -> Weight;
@@ -57,321 +53,231 @@
/// Weights for pallet_nonfungible using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
- /// Storage: Nonfungible TokensMinted (r:1 w:1)
- /// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Nonfungible AccountBalance (r:1 w:1)
- /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenData (r:0 w:1)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible Owned (r:0 w:1)
- /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::TokensMinted` (r:1 w:1)
+ /// Proof: `Nonfungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::TokenData` (r:0 w:1)
+ /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::Owned` (r:0 w:1)
+ /// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
fn create_item() -> Weight {
// Proof Size summary in bytes:
// Measured: `142`
// Estimated: `3530`
- // Minimum execution time: 9_726_000 picoseconds.
- Weight::from_parts(10_059_000, 3530)
+ // Minimum execution time: 15_410_000 picoseconds.
+ Weight::from_parts(15_850_000, 3530)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
- /// Storage: Nonfungible TokensMinted (r:1 w:1)
- /// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Nonfungible AccountBalance (r:1 w:1)
- /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenData (r:0 w:200)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible Owned (r:0 w:200)
- /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::TokensMinted` (r:1 w:1)
+ /// Proof: `Nonfungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::TokenData` (r:0 w:200)
+ /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::Owned` (r:0 w:200)
+ /// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
/// The range of component `b` is `[0, 200]`.
fn create_multiple_items(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `142`
// Estimated: `3530`
- // Minimum execution time: 3_270_000 picoseconds.
- Weight::from_parts(3_693_659, 3530)
- // Standard Error: 255
- .saturating_add(Weight::from_parts(3_024_284, 0).saturating_mul(b.into()))
+ // Minimum execution time: 3_300_000 picoseconds.
+ Weight::from_parts(5_992_994, 3530)
+ // Standard Error: 4_478
+ .saturating_add(Weight::from_parts(8_002_092, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
.saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(b.into())))
}
- /// Storage: Nonfungible TokensMinted (r:1 w:1)
- /// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Nonfungible AccountBalance (r:200 w:200)
- /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenData (r:0 w:200)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible Owned (r:0 w:200)
- /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::TokensMinted` (r:1 w:1)
+ /// Proof: `Nonfungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::AccountBalance` (r:200 w:200)
+ /// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::TokenData` (r:0 w:200)
+ /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::Owned` (r:0 w:200)
+ /// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
/// The range of component `b` is `[0, 200]`.
fn create_multiple_items_ex(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `142`
// Estimated: `3481 + b * (2540 ±0)`
- // Minimum execution time: 3_188_000 picoseconds.
- Weight::from_parts(3_307_000, 3481)
- // Standard Error: 567
- .saturating_add(Weight::from_parts(4_320_449, 0).saturating_mul(b.into()))
+ // Minimum execution time: 3_300_000 picoseconds.
+ Weight::from_parts(3_980_000, 3481)
+ // Standard Error: 1_382
+ .saturating_add(Weight::from_parts(11_259_286, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))
.saturating_add(T::DbWeight::get().writes(1_u64))
.saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into())))
.saturating_add(Weight::from_parts(0, 2540).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 TokenChildren (r:1 w:0)
- /// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokensBurnt (r:1 w:1)
- /// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Nonfungible AccountBalance (r:1 w:1)
- /// 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:1)
- /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenProperties (r:0 w:1)
- /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::TokenData` (r:1 w:1)
+ /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::TokenChildren` (r:1 w:0)
+ /// Proof: `Nonfungible::TokenChildren` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::TokensBurnt` (r:1 w:1)
+ /// Proof: `Nonfungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::AccountBalance` (r:1 w:1)
+ /// 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:1)
+ /// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::TokenProperties` (r:0 w:1)
+ /// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
fn burn_item() -> Weight {
// Proof Size summary in bytes:
// Measured: `380`
// Estimated: `3530`
- // Minimum execution time: 18_062_000 picoseconds.
- Weight::from_parts(18_433_000, 3530)
- .saturating_add(T::DbWeight::get().reads(5_u64))
- .saturating_add(T::DbWeight::get().writes(5_u64))
- }
- /// Storage: Nonfungible TokenChildren (r:1 w:0)
- /// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenData (r:1 w:1)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokensBurnt (r:1 w:1)
- /// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Nonfungible AccountBalance (r:1 w:1)
- /// 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:1)
- /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenProperties (r:0 w:1)
- /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- fn burn_recursively_self_raw() -> Weight {
- // Proof Size summary in bytes:
- // Measured: `380`
- // Estimated: `3530`
- // Minimum execution time: 22_942_000 picoseconds.
- Weight::from_parts(23_527_000, 3530)
+ // Minimum execution time: 26_360_000 picoseconds.
+ Weight::from_parts(26_850_000, 3530)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
- }
- /// Storage: Nonfungible TokenChildren (r:401 w:200)
- /// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)
- /// Storage: Common CollectionById (r:1 w:0)
- /// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenData (r:201 w:201)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokensBurnt (r:1 w:1)
- /// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, 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:201 w:0)
- /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible Owned (r:0 w:201)
- /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenProperties (r:0 w:201)
- /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- /// The range of component `b` is `[0, 200]`.
- fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(b: u32, ) -> Weight {
- // Proof Size summary in bytes:
- // Measured: `1500 + b * (58 ±0)`
- // Estimated: `5874 + b * (5032 ±0)`
- // Minimum execution time: 22_709_000 picoseconds.
- Weight::from_parts(23_287_000, 5874)
- // Standard Error: 89_471
- .saturating_add(Weight::from_parts(63_285_201, 0).saturating_mul(b.into()))
- .saturating_add(T::DbWeight::get().reads(7_u64))
- .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(b.into())))
- .saturating_add(T::DbWeight::get().writes(6_u64))
- .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(b.into())))
- .saturating_add(Weight::from_parts(0, 5032).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)
+ /// 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_raw() -> Weight {
// Proof Size summary in bytes:
// Measured: `380`
// Estimated: `6070`
- // Minimum execution time: 13_652_000 picoseconds.
- Weight::from_parts(13_981_000, 6070)
+ // Minimum execution time: 22_710_000 picoseconds.
+ Weight::from_parts(23_130_000, 6070)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
- /// Storage: Nonfungible TokenData (r:1 w:0)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible Allowance (r:1 w:1)
- /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::TokenData` (r:1 w:0)
+ /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::Allowance` (r:1 w:1)
+ /// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
fn approve() -> Weight {
// Proof Size summary in bytes:
// Measured: `326`
// Estimated: `3522`
- // Minimum execution time: 7_837_000 picoseconds.
- Weight::from_parts(8_113_000, 3522)
+ // Minimum execution time: 11_520_000 picoseconds.
+ Weight::from_parts(12_030_000, 3522)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
- /// Storage: Nonfungible TokenData (r:1 w:0)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible Allowance (r:1 w:1)
- /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::TokenData` (r:1 w:0)
+ /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::Allowance` (r:1 w:1)
+ /// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
fn approve_from() -> Weight {
// Proof Size summary in bytes:
// Measured: `313`
// Estimated: `3522`
- // Minimum execution time: 7_769_000 picoseconds.
- Weight::from_parts(7_979_000, 3522)
+ // Minimum execution time: 11_570_000 picoseconds.
+ Weight::from_parts(12_139_000, 3522)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
- /// Storage: Nonfungible Allowance (r:1 w:0)
- /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::Allowance` (r:1 w:0)
+ /// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
fn check_allowed_raw() -> Weight {
// Proof Size summary in bytes:
// Measured: `362`
// Estimated: `3522`
- // Minimum execution time: 4_194_000 picoseconds.
- Weight::from_parts(4_353_000, 3522)
+ // Minimum execution time: 4_210_000 picoseconds.
+ Weight::from_parts(4_350_000, 3522)
.saturating_add(T::DbWeight::get().reads(1_u64))
}
- /// Storage: Nonfungible Allowance (r:1 w:1)
- /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenData (r:1 w:1)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenChildren (r:1 w:0)
- /// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokensBurnt (r:1 w:1)
- /// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Nonfungible AccountBalance (r:1 w:1)
- /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Nonfungible Owned (r:0 w:1)
- /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenProperties (r:0 w:1)
- /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::Allowance` (r:1 w:1)
+ /// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::TokenData` (r:1 w:1)
+ /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::TokenChildren` (r:1 w:0)
+ /// Proof: `Nonfungible::TokenChildren` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::TokensBurnt` (r:1 w:1)
+ /// Proof: `Nonfungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::Owned` (r:0 w:1)
+ /// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::TokenProperties` (r:0 w:1)
+ /// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
fn burn_from() -> Weight {
// Proof Size summary in bytes:
// Measured: `463`
// Estimated: `3530`
- // Minimum execution time: 21_978_000 picoseconds.
- Weight::from_parts(22_519_000, 3530)
+ // Minimum execution time: 32_230_000 picoseconds.
+ Weight::from_parts(33_210_000, 3530)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(6_u64))
}
- /// Storage: Common CollectionPropertyPermissions (r:1 w:1)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
- /// The range of component `b` is `[0, 64]`.
- fn set_token_property_permissions(b: u32, ) -> Weight {
- // Proof Size summary in bytes:
- // Measured: `314`
- // Estimated: `20191`
- // Minimum execution time: 1_457_000 picoseconds.
- Weight::from_parts(1_563_000, 20191)
- // Standard Error: 14_041
- .saturating_add(Weight::from_parts(8_452_415, 0).saturating_mul(b.into()))
- .saturating_add(T::DbWeight::get().reads(1_u64))
- .saturating_add(T::DbWeight::get().writes(1_u64))
- }
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenProperties (r:1 w:1)
- /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenData (r:1 w:0)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// The range of component `b` is `[0, 64]`.
- fn set_token_properties(b: u32, ) -> Weight {
+ /// Storage: `Nonfungible::TokenProperties` (r:1 w:0)
+ /// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
+ fn load_token_properties() -> Weight {
// Proof Size summary in bytes:
- // Measured: `640 + b * (261 ±0)`
+ // Measured: `279`
// Estimated: `36269`
- // Minimum execution time: 963_000 picoseconds.
- Weight::from_parts(1_126_511, 36269)
- // Standard Error: 9_175
- .saturating_add(Weight::from_parts(5_096_011, 0).saturating_mul(b.into()))
- .saturating_add(T::DbWeight::get().reads(3_u64))
- .saturating_add(T::DbWeight::get().writes(1_u64))
+ // Minimum execution time: 3_180_000 picoseconds.
+ Weight::from_parts(3_370_000, 36269)
+ .saturating_add(T::DbWeight::get().reads(1_u64))
}
- /// Storage: Nonfungible TokenProperties (r:0 w:1)
- /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::TokenProperties` (r:0 w:1)
+ /// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
/// The range of component `b` is `[0, 64]`.
- fn init_token_properties(b: u32, ) -> Weight {
+ fn write_token_properties(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 194_000 picoseconds.
- Weight::from_parts(222_000, 0)
- // Standard Error: 7_295
- .saturating_add(Weight::from_parts(4_499_463, 0).saturating_mul(b.into()))
+ // Minimum execution time: 440_000 picoseconds.
+ Weight::from_parts(3_567_990, 0)
+ // Standard Error: 24_013
+ .saturating_add(Weight::from_parts(19_386_123, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenData (r:1 w:0)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenProperties (r:1 w:1)
- /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// Storage: `Common::CollectionPropertyPermissions` (r:1 w:1)
+ /// Proof: `Common::CollectionPropertyPermissions` (`max_values`: None, `max_size`: Some(16726), added: 19201, mode: `MaxEncodedLen`)
/// The range of component `b` is `[0, 64]`.
- fn delete_token_properties(b: u32, ) -> Weight {
+ fn set_token_property_permissions(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `699 + b * (33291 ±0)`
- // Estimated: `36269`
- // Minimum execution time: 992_000 picoseconds.
- Weight::from_parts(1_043_000, 36269)
- // Standard Error: 37_370
- .saturating_add(Weight::from_parts(23_672_870, 0).saturating_mul(b.into()))
- .saturating_add(T::DbWeight::get().reads(3_u64))
+ // Measured: `314`
+ // Estimated: `20191`
+ // Minimum execution time: 1_460_000 picoseconds.
+ Weight::from_parts(1_530_000, 20191)
+ // Standard Error: 124_929
+ .saturating_add(Weight::from_parts(28_397_581, 0).saturating_mul(b.into()))
+ .saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
- /// Storage: Nonfungible TokenData (r:1 w:0)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- fn token_owner() -> Weight {
- // Proof Size summary in bytes:
- // Measured: `326`
- // Estimated: `3522`
- // Minimum execution time: 3_743_000 picoseconds.
- Weight::from_parts(3_908_000, 3522)
- .saturating_add(T::DbWeight::get().reads(1_u64))
- }
- /// Storage: Nonfungible CollectionAllowance (r:0 w:1)
- /// Proof: Nonfungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::CollectionAllowance` (r:0 w:1)
+ /// Proof: `Nonfungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)
fn set_allowance_for_all() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 4_106_000 picoseconds.
- Weight::from_parts(4_293_000, 0)
+ // Minimum execution time: 6_840_000 picoseconds.
+ Weight::from_parts(7_160_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
- /// Storage: Nonfungible CollectionAllowance (r:1 w:0)
- /// Proof: Nonfungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::CollectionAllowance` (r:1 w:0)
+ /// Proof: `Nonfungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)
fn allowance_for_all() -> Weight {
// Proof Size summary in bytes:
// Measured: `142`
// Estimated: `3576`
- // Minimum execution time: 2_775_000 picoseconds.
- Weight::from_parts(2_923_000, 3576)
+ // Minimum execution time: 3_630_000 picoseconds.
+ Weight::from_parts(3_780_000, 3576)
.saturating_add(T::DbWeight::get().reads(1_u64))
}
- /// Storage: Nonfungible TokenProperties (r:1 w:1)
- /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::TokenProperties` (r:1 w:1)
+ /// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
fn repair_item() -> Weight {
// Proof Size summary in bytes:
// Measured: `279`
// Estimated: `36269`
- // Minimum execution time: 3_033_000 picoseconds.
- Weight::from_parts(3_174_000, 36269)
+ // Minimum execution time: 3_280_000 picoseconds.
+ Weight::from_parts(3_480_000, 36269)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -379,321 +285,231 @@
// For backwards compatibility and tests
impl WeightInfo for () {
- /// Storage: Nonfungible TokensMinted (r:1 w:1)
- /// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Nonfungible AccountBalance (r:1 w:1)
- /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenData (r:0 w:1)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible Owned (r:0 w:1)
- /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::TokensMinted` (r:1 w:1)
+ /// Proof: `Nonfungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::TokenData` (r:0 w:1)
+ /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::Owned` (r:0 w:1)
+ /// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
fn create_item() -> Weight {
// Proof Size summary in bytes:
// Measured: `142`
// Estimated: `3530`
- // Minimum execution time: 9_726_000 picoseconds.
- Weight::from_parts(10_059_000, 3530)
+ // Minimum execution time: 15_410_000 picoseconds.
+ Weight::from_parts(15_850_000, 3530)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
- /// Storage: Nonfungible TokensMinted (r:1 w:1)
- /// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Nonfungible AccountBalance (r:1 w:1)
- /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenData (r:0 w:200)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible Owned (r:0 w:200)
- /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::TokensMinted` (r:1 w:1)
+ /// Proof: `Nonfungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::TokenData` (r:0 w:200)
+ /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::Owned` (r:0 w:200)
+ /// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
/// The range of component `b` is `[0, 200]`.
fn create_multiple_items(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `142`
// Estimated: `3530`
- // Minimum execution time: 3_270_000 picoseconds.
- Weight::from_parts(3_693_659, 3530)
- // Standard Error: 255
- .saturating_add(Weight::from_parts(3_024_284, 0).saturating_mul(b.into()))
+ // Minimum execution time: 3_300_000 picoseconds.
+ Weight::from_parts(5_992_994, 3530)
+ // Standard Error: 4_478
+ .saturating_add(Weight::from_parts(8_002_092, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
.saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(b.into())))
}
- /// Storage: Nonfungible TokensMinted (r:1 w:1)
- /// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Nonfungible AccountBalance (r:200 w:200)
- /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenData (r:0 w:200)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible Owned (r:0 w:200)
- /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::TokensMinted` (r:1 w:1)
+ /// Proof: `Nonfungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::AccountBalance` (r:200 w:200)
+ /// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::TokenData` (r:0 w:200)
+ /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::Owned` (r:0 w:200)
+ /// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
/// The range of component `b` is `[0, 200]`.
fn create_multiple_items_ex(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `142`
// Estimated: `3481 + b * (2540 ±0)`
- // Minimum execution time: 3_188_000 picoseconds.
- Weight::from_parts(3_307_000, 3481)
- // Standard Error: 567
- .saturating_add(Weight::from_parts(4_320_449, 0).saturating_mul(b.into()))
+ // Minimum execution time: 3_300_000 picoseconds.
+ Weight::from_parts(3_980_000, 3481)
+ // Standard Error: 1_382
+ .saturating_add(Weight::from_parts(11_259_286, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(b.into())))
.saturating_add(RocksDbWeight::get().writes(1_u64))
.saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(b.into())))
.saturating_add(Weight::from_parts(0, 2540).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 TokenChildren (r:1 w:0)
- /// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokensBurnt (r:1 w:1)
- /// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Nonfungible AccountBalance (r:1 w:1)
- /// 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:1)
- /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenProperties (r:0 w:1)
- /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::TokenData` (r:1 w:1)
+ /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::TokenChildren` (r:1 w:0)
+ /// Proof: `Nonfungible::TokenChildren` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::TokensBurnt` (r:1 w:1)
+ /// Proof: `Nonfungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::AccountBalance` (r:1 w:1)
+ /// 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:1)
+ /// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::TokenProperties` (r:0 w:1)
+ /// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
fn burn_item() -> Weight {
// Proof Size summary in bytes:
// Measured: `380`
// Estimated: `3530`
- // Minimum execution time: 18_062_000 picoseconds.
- Weight::from_parts(18_433_000, 3530)
- .saturating_add(RocksDbWeight::get().reads(5_u64))
- .saturating_add(RocksDbWeight::get().writes(5_u64))
- }
- /// Storage: Nonfungible TokenChildren (r:1 w:0)
- /// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenData (r:1 w:1)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokensBurnt (r:1 w:1)
- /// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Nonfungible AccountBalance (r:1 w:1)
- /// 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:1)
- /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenProperties (r:0 w:1)
- /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- fn burn_recursively_self_raw() -> Weight {
- // Proof Size summary in bytes:
- // Measured: `380`
- // Estimated: `3530`
- // Minimum execution time: 22_942_000 picoseconds.
- Weight::from_parts(23_527_000, 3530)
+ // Minimum execution time: 26_360_000 picoseconds.
+ Weight::from_parts(26_850_000, 3530)
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(5_u64))
}
- /// Storage: Nonfungible TokenChildren (r:401 w:200)
- /// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)
- /// Storage: Common CollectionById (r:1 w:0)
- /// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenData (r:201 w:201)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokensBurnt (r:1 w:1)
- /// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, 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:201 w:0)
- /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible Owned (r:0 w:201)
- /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenProperties (r:0 w:201)
- /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- /// The range of component `b` is `[0, 200]`.
- fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(b: u32, ) -> Weight {
- // Proof Size summary in bytes:
- // Measured: `1500 + b * (58 ±0)`
- // Estimated: `5874 + b * (5032 ±0)`
- // Minimum execution time: 22_709_000 picoseconds.
- Weight::from_parts(23_287_000, 5874)
- // Standard Error: 89_471
- .saturating_add(Weight::from_parts(63_285_201, 0).saturating_mul(b.into()))
- .saturating_add(RocksDbWeight::get().reads(7_u64))
- .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(b.into())))
- .saturating_add(RocksDbWeight::get().writes(6_u64))
- .saturating_add(RocksDbWeight::get().writes((4_u64).saturating_mul(b.into())))
- .saturating_add(Weight::from_parts(0, 5032).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)
+ /// 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_raw() -> Weight {
// Proof Size summary in bytes:
// Measured: `380`
// Estimated: `6070`
- // Minimum execution time: 13_652_000 picoseconds.
- Weight::from_parts(13_981_000, 6070)
+ // Minimum execution time: 22_710_000 picoseconds.
+ Weight::from_parts(23_130_000, 6070)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(5_u64))
}
- /// Storage: Nonfungible TokenData (r:1 w:0)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible Allowance (r:1 w:1)
- /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::TokenData` (r:1 w:0)
+ /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::Allowance` (r:1 w:1)
+ /// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
fn approve() -> Weight {
// Proof Size summary in bytes:
// Measured: `326`
// Estimated: `3522`
- // Minimum execution time: 7_837_000 picoseconds.
- Weight::from_parts(8_113_000, 3522)
+ // Minimum execution time: 11_520_000 picoseconds.
+ Weight::from_parts(12_030_000, 3522)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
- /// Storage: Nonfungible TokenData (r:1 w:0)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible Allowance (r:1 w:1)
- /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::TokenData` (r:1 w:0)
+ /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::Allowance` (r:1 w:1)
+ /// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
fn approve_from() -> Weight {
// Proof Size summary in bytes:
// Measured: `313`
// Estimated: `3522`
- // Minimum execution time: 7_769_000 picoseconds.
- Weight::from_parts(7_979_000, 3522)
+ // Minimum execution time: 11_570_000 picoseconds.
+ Weight::from_parts(12_139_000, 3522)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
- /// Storage: Nonfungible Allowance (r:1 w:0)
- /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::Allowance` (r:1 w:0)
+ /// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
fn check_allowed_raw() -> Weight {
// Proof Size summary in bytes:
// Measured: `362`
// Estimated: `3522`
- // Minimum execution time: 4_194_000 picoseconds.
- Weight::from_parts(4_353_000, 3522)
+ // Minimum execution time: 4_210_000 picoseconds.
+ Weight::from_parts(4_350_000, 3522)
.saturating_add(RocksDbWeight::get().reads(1_u64))
}
- /// Storage: Nonfungible Allowance (r:1 w:1)
- /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenData (r:1 w:1)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenChildren (r:1 w:0)
- /// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokensBurnt (r:1 w:1)
- /// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Nonfungible AccountBalance (r:1 w:1)
- /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Nonfungible Owned (r:0 w:1)
- /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenProperties (r:0 w:1)
- /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::Allowance` (r:1 w:1)
+ /// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::TokenData` (r:1 w:1)
+ /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::TokenChildren` (r:1 w:0)
+ /// Proof: `Nonfungible::TokenChildren` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::TokensBurnt` (r:1 w:1)
+ /// Proof: `Nonfungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::Owned` (r:0 w:1)
+ /// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
+ /// Storage: `Nonfungible::TokenProperties` (r:0 w:1)
+ /// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
fn burn_from() -> Weight {
// Proof Size summary in bytes:
// Measured: `463`
// Estimated: `3530`
- // Minimum execution time: 21_978_000 picoseconds.
- Weight::from_parts(22_519_000, 3530)
+ // Minimum execution time: 32_230_000 picoseconds.
+ Weight::from_parts(33_210_000, 3530)
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(6_u64))
- }
- /// Storage: Common CollectionPropertyPermissions (r:1 w:1)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
- /// The range of component `b` is `[0, 64]`.
- fn set_token_property_permissions(b: u32, ) -> Weight {
- // Proof Size summary in bytes:
- // Measured: `314`
- // Estimated: `20191`
- // Minimum execution time: 1_457_000 picoseconds.
- Weight::from_parts(1_563_000, 20191)
- // Standard Error: 14_041
- .saturating_add(Weight::from_parts(8_452_415, 0).saturating_mul(b.into()))
- .saturating_add(RocksDbWeight::get().reads(1_u64))
- .saturating_add(RocksDbWeight::get().writes(1_u64))
}
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenProperties (r:1 w:1)
- /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenData (r:1 w:0)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// The range of component `b` is `[0, 64]`.
- fn set_token_properties(b: u32, ) -> Weight {
+ /// Storage: `Nonfungible::TokenProperties` (r:1 w:0)
+ /// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
+ fn load_token_properties() -> Weight {
// Proof Size summary in bytes:
- // Measured: `640 + b * (261 ±0)`
+ // Measured: `279`
// Estimated: `36269`
- // Minimum execution time: 963_000 picoseconds.
- Weight::from_parts(1_126_511, 36269)
- // Standard Error: 9_175
- .saturating_add(Weight::from_parts(5_096_011, 0).saturating_mul(b.into()))
- .saturating_add(RocksDbWeight::get().reads(3_u64))
- .saturating_add(RocksDbWeight::get().writes(1_u64))
+ // Minimum execution time: 3_180_000 picoseconds.
+ Weight::from_parts(3_370_000, 36269)
+ .saturating_add(RocksDbWeight::get().reads(1_u64))
}
- /// Storage: Nonfungible TokenProperties (r:0 w:1)
- /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::TokenProperties` (r:0 w:1)
+ /// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
/// The range of component `b` is `[0, 64]`.
- fn init_token_properties(b: u32, ) -> Weight {
+ fn write_token_properties(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 194_000 picoseconds.
- Weight::from_parts(222_000, 0)
- // Standard Error: 7_295
- .saturating_add(Weight::from_parts(4_499_463, 0).saturating_mul(b.into()))
+ // Minimum execution time: 440_000 picoseconds.
+ Weight::from_parts(3_567_990, 0)
+ // Standard Error: 24_013
+ .saturating_add(Weight::from_parts(19_386_123, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenData (r:1 w:0)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- /// Storage: Nonfungible TokenProperties (r:1 w:1)
- /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// Storage: `Common::CollectionPropertyPermissions` (r:1 w:1)
+ /// Proof: `Common::CollectionPropertyPermissions` (`max_values`: None, `max_size`: Some(16726), added: 19201, mode: `MaxEncodedLen`)
/// The range of component `b` is `[0, 64]`.
- fn delete_token_properties(b: u32, ) -> Weight {
+ fn set_token_property_permissions(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `699 + b * (33291 ±0)`
- // Estimated: `36269`
- // Minimum execution time: 992_000 picoseconds.
- Weight::from_parts(1_043_000, 36269)
- // Standard Error: 37_370
- .saturating_add(Weight::from_parts(23_672_870, 0).saturating_mul(b.into()))
- .saturating_add(RocksDbWeight::get().reads(3_u64))
+ // Measured: `314`
+ // Estimated: `20191`
+ // Minimum execution time: 1_460_000 picoseconds.
+ Weight::from_parts(1_530_000, 20191)
+ // Standard Error: 124_929
+ .saturating_add(Weight::from_parts(28_397_581, 0).saturating_mul(b.into()))
+ .saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
- /// Storage: Nonfungible TokenData (r:1 w:0)
- /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)
- fn token_owner() -> Weight {
- // Proof Size summary in bytes:
- // Measured: `326`
- // Estimated: `3522`
- // Minimum execution time: 3_743_000 picoseconds.
- Weight::from_parts(3_908_000, 3522)
- .saturating_add(RocksDbWeight::get().reads(1_u64))
- }
- /// Storage: Nonfungible CollectionAllowance (r:0 w:1)
- /// Proof: Nonfungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::CollectionAllowance` (r:0 w:1)
+ /// Proof: `Nonfungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)
fn set_allowance_for_all() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 4_106_000 picoseconds.
- Weight::from_parts(4_293_000, 0)
+ // Minimum execution time: 6_840_000 picoseconds.
+ Weight::from_parts(7_160_000, 0)
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
- /// Storage: Nonfungible CollectionAllowance (r:1 w:0)
- /// Proof: Nonfungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::CollectionAllowance` (r:1 w:0)
+ /// Proof: `Nonfungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)
fn allowance_for_all() -> Weight {
// Proof Size summary in bytes:
// Measured: `142`
// Estimated: `3576`
- // Minimum execution time: 2_775_000 picoseconds.
- Weight::from_parts(2_923_000, 3576)
+ // Minimum execution time: 3_630_000 picoseconds.
+ Weight::from_parts(3_780_000, 3576)
.saturating_add(RocksDbWeight::get().reads(1_u64))
}
- /// Storage: Nonfungible TokenProperties (r:1 w:1)
- /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// Storage: `Nonfungible::TokenProperties` (r:1 w:1)
+ /// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
fn repair_item() -> Weight {
// Proof Size summary in bytes:
// Measured: `279`
// Estimated: `36269`
- // Minimum execution time: 3_033_000 picoseconds.
- Weight::from_parts(3_174_000, 36269)
+ // Minimum execution time: 3_280_000 picoseconds.
+ Weight::from_parts(3_480_000, 36269)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
pallets/refungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/refungible/src/benchmarking.rs
+++ b/pallets/refungible/src/benchmarking.rs
@@ -19,10 +19,7 @@
use frame_benchmarking::v2::*;
use pallet_common::{
bench_init,
- benchmarking::{
- create_collection_raw, /*load_is_admin_and_property_permissions,*/ property_key,
- property_value,
- },
+ benchmarking::{create_collection_raw, property_key, property_value},
};
use sp_std::prelude::*;
use up_data_structs::{
@@ -425,38 +422,29 @@
}
#[benchmark]
- fn set_token_property_permissions(
- b: Linear<0, MAX_PROPERTIES_PER_ITEM>,
- ) -> Result<(), BenchmarkError> {
+ fn load_token_properties() -> Result<(), BenchmarkError> {
bench_init! {
owner: sub; collection: collection(owner);
owner: cross_from_sub;
};
- let perms = (0..b)
- .map(|k| PropertyKeyPermission {
- key: property_key(k as usize),
- permission: PropertyPermission {
- mutable: false,
- collection_admin: false,
- token_owner: false,
- },
- })
- .collect::<Vec<_>>();
+ let item = create_max_item(&collection, &owner, [(owner.clone(), 200)])?;
+
#[block]
{
- <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
+ pallet_common::BenchmarkPropertyWriter::<T>::load_token_properties(&collection, item);
}
Ok(())
}
#[benchmark]
- fn set_token_properties(b: Linear<0, MAX_PROPERTIES_PER_ITEM>) -> Result<(), BenchmarkError> {
+ fn write_token_properties(b: Linear<0, MAX_PROPERTIES_PER_ITEM>) -> Result<(), BenchmarkError> {
bench_init! {
owner: sub; collection: collection(owner);
owner: cross_from_sub;
};
+
let perms = (0..b)
.map(|k| PropertyKeyPermission {
key: property_key(k as usize),
@@ -476,73 +464,29 @@
.collect::<Vec<_>>();
let item = create_max_item(&collection, &owner, [(owner.clone(), 200)])?;
+ let lazy_collection_info =
+ pallet_common::BenchmarkPropertyWriter::<T>::load_collection_info(&collection, &owner);
+
#[block]
{
- <Pallet<T>>::set_token_properties(
- &collection,
- &owner,
+ let mut property_writer =
+ pallet_common::BenchmarkPropertyWriter::new(&collection, lazy_collection_info);
+
+ property_writer.write_token_properties(
item,
props.into_iter(),
- &Unlimited,
+ crate::erc::ERC721TokenEvent::TokenChanged {
+ token_id: item.into(),
+ }
+ .to_log(T::ContractAddress::get()),
)?;
}
Ok(())
}
- // TODO:
#[benchmark]
- fn init_token_properties(b: Linear<0, MAX_PROPERTIES_PER_ITEM>) -> Result<(), BenchmarkError> {
- // bench_init! {
- // owner: sub; collection: collection(owner);
- // owner: cross_from_sub;
- // };
-
- // let perms = (0..b)
- // .map(|k| PropertyKeyPermission {
- // key: property_key(k as usize),
- // permission: PropertyPermission {
- // mutable: false,
- // collection_admin: true,
- // token_owner: true,
- // },
- // })
- // .collect::<Vec<_>>();
- // <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
-
- #[block]
- {}
- // let props = (0..b).map(|k| Property {
- // key: property_key(k as usize),
- // value: property_value(),
- // }).collect::<Vec<_>>();
- // let item = create_max_item(&collection, &owner, [(owner.clone(), 200)])?;
-
- // let (is_collection_admin, property_permissions) = load_is_admin_and_property_permissions(&collection, &owner)
- // let mut property_writer = pallet_common::collection_info_loaded_property_writer(
- // &collection,
- // is_collection_admin,
- // property_permissions,
- // );
-
- // #[block]
- // {
- // property_writer.write_token_properties(
- // true,
- // item,
- // props.into_iter(),
- // crate::erc::ERC721TokenEvent::TokenChanged {
- // token_id: item.into(),
- // }
- // .to_log(T::ContractAddress::get()),
- // )?;
- // }
-
- Ok(())
- }
-
- #[benchmark]
- fn delete_token_properties(
+ fn set_token_property_permissions(
b: Linear<0, MAX_PROPERTIES_PER_ITEM>,
) -> Result<(), BenchmarkError> {
bench_init! {
@@ -553,38 +497,16 @@
.map(|k| PropertyKeyPermission {
key: property_key(k as usize),
permission: PropertyPermission {
- mutable: true,
- collection_admin: true,
- token_owner: true,
+ mutable: false,
+ collection_admin: false,
+ token_owner: false,
},
- })
- .collect::<Vec<_>>();
- <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
- let props = (0..b)
- .map(|k| Property {
- key: property_key(k as usize),
- value: property_value(),
})
.collect::<Vec<_>>();
- let item = create_max_item(&collection, &owner, [(owner.clone(), 200)])?;
- <Pallet<T>>::set_token_properties(
- &collection,
- &owner,
- item,
- props.into_iter(),
- &Unlimited,
- )?;
- let to_delete = (0..b).map(|k| property_key(k as usize)).collect::<Vec<_>>();
#[block]
{
- <Pallet<T>>::delete_token_properties(
- &collection,
- &owner,
- item,
- to_delete.into_iter(),
- &Unlimited,
- )?;
+ <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
}
Ok(())
@@ -601,22 +523,6 @@
#[block]
{
<Pallet<T>>::repartition(&collection, &owner, item, 200)?;
- }
-
- Ok(())
- }
-
- #[benchmark]
- fn token_owner() -> Result<(), BenchmarkError> {
- bench_init! {
- owner: sub; collection: collection(owner);
- sender: cross_from_sub(owner); owner: cross_sub;
- };
- let item = create_max_item(&collection, &sender, [(owner, 100)])?;
-
- #[block]
- {
- <Pallet<T>>::token_owner(collection.id, item).unwrap();
}
Ok(())
pallets/refungible/src/common.rsdiffbeforeafterboth--- a/pallets/refungible/src/common.rs
+++ b/pallets/refungible/src/common.rs
@@ -16,14 +16,12 @@
use core::marker::PhantomData;
-use frame_support::{
- dispatch::DispatchResultWithPostInfo, ensure, fail, traits::Get, weights::Weight,
-};
+use frame_support::{dispatch::DispatchResultWithPostInfo, fail, weights::Weight};
use pallet_common::{
- init_token_properties_delta, weights::WeightInfo as _, with_weight, CommonCollectionOperations,
- CommonWeightInfo, RefungibleExtensions,
+ weights::WeightInfo as _, with_weight, write_token_properties_total_weight,
+ CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions,
};
-use pallet_structure::{Error as StructureError, Pallet as PalletStructure};
+use pallet_structure::Pallet as PalletStructure;
use sp_runtime::DispatchError;
use sp_std::{collections::btree_map::BTreeMap, vec, vec::Vec};
use up_data_structs::{
@@ -49,35 +47,27 @@
pub struct CommonWeights<T: Config>(PhantomData<T>);
impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {
fn create_multiple_items(data: &[up_data_structs::CreateItemData]) -> Weight {
- <SelfWeightOf<T>>::create_multiple_items(data.len() as u32).saturating_add(
- init_token_properties_delta::<T, _>(
- data.iter().map(|data| match data {
- up_data_structs::CreateItemData::ReFungible(rft_data) => {
- rft_data.properties.len() as u32
- }
- _ => 0,
- }),
- <SelfWeightOf<T>>::init_token_properties,
- ),
+ mint_with_props_weight::<T>(
+ <SelfWeightOf<T>>::create_multiple_items(data.len() as u32),
+ data.iter().map(|data| match data {
+ up_data_structs::CreateItemData::ReFungible(rft_data) => {
+ rft_data.properties.len() as u32
+ }
+ _ => 0,
+ }),
)
}
fn create_multiple_items_ex(call: &CreateItemExData<T::CrossAccountId>) -> Weight {
match call {
- CreateItemExData::RefungibleMultipleOwners(i) => {
- <SelfWeightOf<T>>::create_multiple_items_ex_multiple_owners(i.users.len() as u32)
- .saturating_add(init_token_properties_delta::<T, _>(
- [i.properties.len() as u32].into_iter(),
- <SelfWeightOf<T>>::init_token_properties,
- ))
- }
- CreateItemExData::RefungibleMultipleItems(i) => {
- <SelfWeightOf<T>>::create_multiple_items_ex_multiple_items(i.len() as u32)
- .saturating_add(init_token_properties_delta::<T, _>(
- i.iter().map(|d| d.properties.len() as u32),
- <SelfWeightOf<T>>::init_token_properties,
- ))
- }
+ CreateItemExData::RefungibleMultipleOwners(i) => mint_with_props_weight::<T>(
+ <SelfWeightOf<T>>::create_multiple_items_ex_multiple_owners(i.users.len() as u32),
+ [i.properties.len() as u32].into_iter(),
+ ),
+ CreateItemExData::RefungibleMultipleItems(i) => mint_with_props_weight::<T>(
+ <SelfWeightOf<T>>::create_multiple_items_ex_multiple_items(i.len() as u32),
+ i.iter().map(|d| d.properties.len() as u32),
+ ),
_ => Weight::zero(),
}
}
@@ -88,18 +78,13 @@
fn set_collection_properties(amount: u32) -> Weight {
<pallet_common::SelfWeightOf<T>>::set_collection_properties(amount)
- }
-
- fn delete_collection_properties(amount: u32) -> Weight {
- <pallet_common::SelfWeightOf<T>>::delete_collection_properties(amount)
}
fn set_token_properties(amount: u32) -> Weight {
- <SelfWeightOf<T>>::set_token_properties(amount)
- }
-
- fn delete_token_properties(amount: u32) -> Weight {
- <SelfWeightOf<T>>::delete_token_properties(amount)
+ write_token_properties_total_weight::<T, _>([amount].into_iter(), |amount| {
+ <SelfWeightOf<T>>::load_token_properties()
+ .saturating_add(<SelfWeightOf<T>>::write_token_properties(amount))
+ })
}
fn set_token_property_permissions(amount: u32) -> Weight {
@@ -136,19 +121,6 @@
<SelfWeightOf<T>>::burn_from()
}
- fn burn_recursively_self_raw() -> Weight {
- // Read to get total balance
- Self::burn_item() + T::DbWeight::get().reads(1)
- }
- fn burn_recursively_breadth_raw(_amount: u32) -> Weight {
- // Refungible token can't have children
- Weight::zero()
- }
-
- fn token_owner() -> Weight {
- <SelfWeightOf<T>>::token_owner()
- }
-
fn set_allowance_for_all() -> Weight {
<SelfWeightOf<T>>::set_allowance_for_all()
}
@@ -158,6 +130,20 @@
}
}
+/// Weight of minting tokens with properties
+/// * `create_no_data_weight` -- the weight of minting without properties
+/// * `token_properties_nums` -- number of properties of each token
+#[inline]
+pub(crate) fn mint_with_props_weight<T: Config>(
+ create_no_data_weight: Weight,
+ token_properties_nums: impl Iterator<Item = u32> + Clone,
+) -> Weight {
+ create_no_data_weight.saturating_add(write_token_properties_total_weight::<T, _>(
+ token_properties_nums,
+ <SelfWeightOf<T>>::write_token_properties,
+ ))
+}
+
fn map_create_data<T: Config>(
data: up_data_structs::CreateItemData,
to: &T::CrossAccountId,
@@ -262,25 +248,6 @@
with_weight(
<Pallet<T>>::burn(self, &sender, token, amount),
<CommonWeights<T>>::burn_item(),
- )
- }
-
- fn burn_item_recursively(
- &self,
- sender: T::CrossAccountId,
- token: TokenId,
- self_budget: &dyn Budget,
- _breadth_budget: &dyn Budget,
- ) -> DispatchResultWithPostInfo {
- ensure!(self_budget.consume(), <StructureError<T>>::DepthLimit,);
- with_weight(
- <Pallet<T>>::burn(
- self,
- &sender,
- token,
- <Balance<T>>::get((self.id, token, &sender)),
- ),
- <CommonWeights<T>>::burn_recursively_self_raw(),
)
}
pallets/refungible/src/erc.rsdiffbeforeafterboth--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -32,26 +32,28 @@
use pallet_common::{
erc::{static_property::key, CollectionCall, CommonEvmHandler},
eth::{self, TokenUri},
- CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations,
+ CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations, CommonWeightInfo,
Error as CommonError,
};
use pallet_evm::{account::CrossAccountId, PrecompileHandle};
use pallet_evm_coder_substrate::{
call, dispatch_to_evm,
execution::{Error, PreDispatch, Result},
- frontier_contract,
+ frontier_contract, SubstrateRecorder,
};
use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};
use sp_core::{Get, H160, U256};
use sp_std::{collections::btree_map::BTreeMap, vec, vec::Vec};
use up_data_structs::{
- mapping::TokenAddressMapping, CollectionId, CollectionPropertiesVec, Property, PropertyKey,
- PropertyKeyPermission, PropertyPermission, TokenId, TokenOwnerError,
+ budget::Budget, mapping::TokenAddressMapping, CollectionId, CollectionPropertiesVec, Property,
+ PropertyKey, PropertyKeyPermission, PropertyPermission, TokenId, TokenOwnerError,
};
use crate::{
- weights::WeightInfo, AccountBalance, Balance, Config, CreateItemData, Pallet, RefungibleHandle,
- SelfWeightOf, TokenProperties, TokensMinted, TotalSupply,
+ common::{mint_with_props_weight, CommonWeights},
+ weights::WeightInfo,
+ AccountBalance, Balance, Config, CreateItemData, Pallet, RefungibleHandle, SelfWeightOf,
+ TokenProperties, TokensMinted, TotalSupply,
};
frontier_contract! {
@@ -90,6 +92,10 @@
pub properties: Vec<eth::Property>,
}
+pub fn nesting_budget<T: Config>(recorder: &SubstrateRecorder<T>) -> impl Budget + '_ {
+ recorder.weight_calls_budget(<StructureWeight<T>>::find_parent())
+}
+
/// @title A contract that allows to set and delete token properties and change token property permissions.
#[solidity_interface(name = TokenProperties, events(ERC721TokenEvent), enum(derive(PreDispatch)), enum_attr(weight))]
impl<T: Config> RefungibleHandle<T> {
@@ -158,7 +164,7 @@
/// @param key Property key.
/// @param value Property value.
#[solidity(hide)]
- #[weight(<SelfWeightOf<T>>::set_token_properties(1))]
+ #[weight(<CommonWeights<T>>::set_token_properties(1))]
fn set_property(
&mut self,
caller: Caller,
@@ -172,17 +178,13 @@
.try_into()
.map_err(|_| "key too long")?;
let value = value.0.try_into().map_err(|_| "value too long")?;
-
- let nesting_budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
<Pallet<T>>::set_token_property(
self,
&caller,
TokenId(token_id),
Property { key, value },
- &nesting_budget,
+ &nesting_budget(&self.recorder),
)
.map_err(dispatch_to_evm::<T>)
}
@@ -191,7 +193,7 @@
/// @dev Throws error if `msg.sender` has no permission to edit the property.
/// @param tokenId ID of the token.
/// @param properties settable properties
- #[weight(<SelfWeightOf<T>>::set_token_properties(properties.len() as u32))]
+ #[weight(<CommonWeights<T>>::set_token_properties(properties.len() as u32))]
fn set_properties(
&mut self,
caller: Caller,
@@ -201,10 +203,6 @@
let caller = T::CrossAccountId::from_eth(caller);
let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
- let nesting_budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
-
let properties = properties
.into_iter()
.map(eth::Property::try_into)
@@ -215,7 +213,7 @@
&caller,
TokenId(token_id),
properties.into_iter(),
- &nesting_budget,
+ &nesting_budget(&self.recorder),
)
.map_err(dispatch_to_evm::<T>)
}
@@ -225,7 +223,7 @@
/// @param tokenId ID of the token.
/// @param key Property key.
#[solidity(hide)]
- #[weight(<SelfWeightOf<T>>::delete_token_properties(1))]
+ #[weight(<CommonWeights<T>>::delete_token_properties(1))]
fn delete_property(&mut self, token_id: U256, caller: Caller, key: String) -> Result<()> {
let caller = T::CrossAccountId::from_eth(caller);
let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
@@ -233,19 +231,21 @@
.try_into()
.map_err(|_| "key too long")?;
- let nesting_budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
-
- <Pallet<T>>::delete_token_property(self, &caller, TokenId(token_id), key, &nesting_budget)
- .map_err(dispatch_to_evm::<T>)
+ <Pallet<T>>::delete_token_property(
+ self,
+ &caller,
+ TokenId(token_id),
+ key,
+ &nesting_budget(&self.recorder),
+ )
+ .map_err(dispatch_to_evm::<T>)
}
/// @notice Delete token properties value.
/// @dev Throws error if `msg.sender` has no permission to edit the property.
/// @param tokenId ID of the token.
/// @param keys Properties key.
- #[weight(<SelfWeightOf<T>>::delete_token_properties(keys.len() as u32))]
+ #[weight(<CommonWeights<T>>::delete_token_properties(keys.len() as u32))]
fn delete_properties(
&mut self,
token_id: U256,
@@ -259,16 +259,12 @@
.map(|k| Ok(<Vec<u8>>::from(k).try_into().map_err(|_| "key too long")?))
.collect::<Result<Vec<_>>>()?;
- let nesting_budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
-
<Pallet<T>>::delete_token_properties(
self,
&caller,
TokenId(token_id),
keys.into_iter(),
- &nesting_budget,
+ &nesting_budget(&self.recorder),
)
.map_err(dispatch_to_evm::<T>)
}
@@ -497,15 +493,20 @@
let from = T::CrossAccountId::from_eth(from);
let to = T::CrossAccountId::from_eth(to);
let token = token_id.try_into()?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
let balance = balance(self, token, &from)?;
ensure_single_owner(self, token, balance)?;
- <Pallet<T>>::transfer_from(self, &caller, &from, &to, token, balance, &budget)
- .map_err(dispatch_to_evm::<T>)?;
+ <Pallet<T>>::transfer_from(
+ self,
+ &caller,
+ &from,
+ &to,
+ token,
+ balance,
+ &nesting_budget(&self.recorder),
+ )
+ .map_err(dispatch_to_evm::<T>)?;
Ok(())
}
@@ -629,9 +630,6 @@
let caller = T::CrossAccountId::from_eth(caller);
let to = T::CrossAccountId::from_eth(to);
let token_id: u32 = token_id.try_into()?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
if <TokensMinted<T>>::get(self.id)
.checked_add(1)
@@ -653,7 +651,7 @@
users,
properties: CollectionPropertiesVec::default(),
},
- &budget,
+ &nesting_budget(&self.recorder),
)
.map_err(dispatch_to_evm::<T>)?;
@@ -665,7 +663,7 @@
/// @param tokenUri Token URI that would be stored in the NFT properties
/// @return uint256 The id of the newly minted token
#[solidity(rename_selector = "mintWithTokenURI")]
- #[weight(<SelfWeightOf<T>>::create_item() + <SelfWeightOf<T>>::set_token_properties(1))]
+ #[weight(mint_with_props_weight::<T>(<SelfWeightOf<T>>::create_item(), [1].into_iter()))]
fn mint_with_token_uri(
&mut self,
caller: Caller,
@@ -687,7 +685,7 @@
/// @param tokenId ID of the minted RFT
/// @param tokenUri Token URI that would be stored in the RFT properties
#[solidity(hide, rename_selector = "mintWithTokenURI")]
- #[weight(<SelfWeightOf<T>>::create_item() + <SelfWeightOf<T>>::set_token_properties(1))]
+ #[weight(mint_with_props_weight::<T>(<SelfWeightOf<T>>::create_item(), [1].into_iter()))]
fn mint_with_token_uri_check_id(
&mut self,
caller: Caller,
@@ -704,9 +702,6 @@
let caller = T::CrossAccountId::from_eth(caller);
let to = T::CrossAccountId::from_eth(to);
let token_id: u32 = token_id.try_into().map_err(|_| "amount overflow")?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
if <TokensMinted<T>>::get(self.id)
.checked_add(1)
@@ -736,7 +731,7 @@
self,
&caller,
CreateItemData::<T> { users, properties },
- &budget,
+ &nesting_budget(&self.recorder),
)
.map_err(dispatch_to_evm::<T>)?;
Ok(true)
@@ -865,15 +860,19 @@
let caller = T::CrossAccountId::from_eth(caller);
let to = T::CrossAccountId::from_eth(to);
let token = token_id.try_into()?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
let balance = balance(self, token, &caller)?;
ensure_single_owner(self, token, balance)?;
- <Pallet<T>>::transfer(self, &caller, &to, token, balance, &budget)
- .map_err(dispatch_to_evm::<T>)?;
+ <Pallet<T>>::transfer(
+ self,
+ &caller,
+ &to,
+ token,
+ balance,
+ &nesting_budget(&self.recorder),
+ )
+ .map_err(dispatch_to_evm::<T>)?;
Ok(())
}
@@ -893,15 +892,19 @@
let caller = T::CrossAccountId::from_eth(caller);
let to = to.into_sub_cross_account::<T>()?;
let token = token_id.try_into()?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
let balance = balance(self, token, &caller)?;
ensure_single_owner(self, token, balance)?;
- <Pallet<T>>::transfer(self, &caller, &to, token, balance, &budget)
- .map_err(dispatch_to_evm::<T>)?;
+ <Pallet<T>>::transfer(
+ self,
+ &caller,
+ &to,
+ token,
+ balance,
+ &nesting_budget(&self.recorder),
+ )
+ .map_err(dispatch_to_evm::<T>)?;
Ok(())
}
@@ -923,15 +926,20 @@
let from = from.into_sub_cross_account::<T>()?;
let to = to.into_sub_cross_account::<T>()?;
let token_id = token_id.try_into()?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
let balance = balance(self, token_id, &from)?;
ensure_single_owner(self, token_id, balance)?;
- Pallet::<T>::transfer_from(self, &caller, &from, &to, token_id, balance, &budget)
- .map_err(dispatch_to_evm::<T>)?;
+ Pallet::<T>::transfer_from(
+ self,
+ &caller,
+ &from,
+ &to,
+ token_id,
+ balance,
+ &nesting_budget(&self.recorder),
+ )
+ .map_err(dispatch_to_evm::<T>)?;
Ok(())
}
@@ -948,15 +956,19 @@
let caller = T::CrossAccountId::from_eth(caller);
let from = T::CrossAccountId::from_eth(from);
let token = token_id.try_into()?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
let balance = balance(self, token, &from)?;
ensure_single_owner(self, token, balance)?;
- <Pallet<T>>::burn_from(self, &caller, &from, token, balance, &budget)
- .map_err(dispatch_to_evm::<T>)?;
+ <Pallet<T>>::burn_from(
+ self,
+ &caller,
+ &from,
+ token,
+ balance,
+ &nesting_budget(&self.recorder),
+ )
+ .map_err(dispatch_to_evm::<T>)?;
Ok(())
}
@@ -977,15 +989,19 @@
let caller = T::CrossAccountId::from_eth(caller);
let from = from.into_sub_cross_account::<T>()?;
let token = token_id.try_into()?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
let balance = balance(self, token, &from)?;
ensure_single_owner(self, token, balance)?;
- <Pallet<T>>::burn_from(self, &caller, &from, token, balance, &budget)
- .map_err(dispatch_to_evm::<T>)?;
+ <Pallet<T>>::burn_from(
+ self,
+ &caller,
+ &from,
+ token,
+ balance,
+ &nesting_budget(&self.recorder),
+ )
+ .map_err(dispatch_to_evm::<T>)?;
Ok(())
}
@@ -1010,9 +1026,6 @@
let mut expected_index = <TokensMinted<T>>::get(self.id)
.checked_add(1)
.ok_or("item id overflow")?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
let total_tokens = token_ids.len();
for id in token_ids.into_iter() {
@@ -1035,31 +1048,32 @@
.map(|_| create_item_data.clone())
.collect();
- <Pallet<T>>::create_multiple_items(self, &caller, data, &budget)
+ <Pallet<T>>::create_multiple_items(self, &caller, data, &nesting_budget(&self.recorder))
.map_err(dispatch_to_evm::<T>)?;
Ok(true)
}
/// @notice Function to mint a token.
- /// @param tokenProperties Properties of minted token
- #[weight(if token_properties.len() == 1 {
- <SelfWeightOf<T>>::create_multiple_items_ex_multiple_owners(token_properties.iter().next().unwrap().owners.len() as u32)
+ /// @param tokensData Data of minted token(s)
+ #[weight(if tokens_data.len() == 1 {
+ let token_data = tokens_data.first().unwrap();
+
+ mint_with_props_weight::<T>(
+ <SelfWeightOf<T>>::create_multiple_items_ex_multiple_owners(token_data.owners.len() as u32),
+ [token_data.properties.len() as u32].into_iter(),
+ )
} else {
- <SelfWeightOf<T>>::create_multiple_items_ex_multiple_items(token_properties.len() as u32)
- } + <SelfWeightOf<T>>::set_token_properties(token_properties.len() as u32))]
- fn mint_bulk_cross(
- &mut self,
- caller: Caller,
- token_properties: Vec<MintTokenData>,
- ) -> Result<bool> {
+ mint_with_props_weight::<T>(
+ <SelfWeightOf<T>>::create_multiple_items_ex_multiple_items(tokens_data.len() as u32),
+ tokens_data.iter().map(|d| d.properties.len() as u32),
+ )
+ })]
+ fn mint_bulk_cross(&mut self, caller: Caller, tokens_data: Vec<MintTokenData>) -> Result<bool> {
let caller = T::CrossAccountId::from_eth(caller);
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
- let has_multiple_tokens = token_properties.len() > 1;
+ let has_multiple_tokens = tokens_data.len() > 1;
- let mut create_rft_data = Vec::with_capacity(token_properties.len());
- for MintTokenData { owners, properties } in token_properties {
+ let mut create_rft_data = Vec::with_capacity(tokens_data.len());
+ for MintTokenData { owners, properties } in tokens_data {
let has_multiple_owners = owners.len() > 1;
if has_multiple_tokens & has_multiple_owners {
return Err(
@@ -1084,8 +1098,13 @@
});
}
- <Pallet<T>>::create_multiple_items(self, &caller, create_rft_data, &budget)
- .map_err(dispatch_to_evm::<T>)?;
+ <Pallet<T>>::create_multiple_items(
+ self,
+ &caller,
+ create_rft_data,
+ &nesting_budget(&self.recorder),
+ )
+ .map_err(dispatch_to_evm::<T>)?;
Ok(true)
}
@@ -1095,7 +1114,12 @@
/// @param to The new owner
/// @param tokens array of pairs of token ID and token URI for minted tokens
#[solidity(hide, rename_selector = "mintBulkWithTokenURI")]
- #[weight(<SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32) + <SelfWeightOf<T>>::set_token_properties(tokens.len() as u32))]
+ #[weight(
+ mint_with_props_weight::<T>(
+ <SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32),
+ tokens.iter().map(|_| 1),
+ )
+ )]
fn mint_bulk_with_token_uri(
&mut self,
caller: Caller,
@@ -1108,9 +1132,6 @@
let mut expected_index = <TokensMinted<T>>::get(self.id)
.checked_add(1)
.ok_or("item id overflow")?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
let mut data = Vec::with_capacity(tokens.len());
let users: BoundedBTreeMap<_, _, _> = [(to, 1)]
@@ -1143,7 +1164,7 @@
data.push(create_item_data);
}
- <Pallet<T>>::create_multiple_items(self, &caller, data, &budget)
+ <Pallet<T>>::create_multiple_items(self, &caller, data, &nesting_budget(&self.recorder))
.map_err(dispatch_to_evm::<T>)?;
Ok(true)
}
@@ -1152,7 +1173,7 @@
/// @param to The new owner crossAccountId
/// @param properties Properties of minted token
/// @return uint256 The id of the newly minted token
- #[weight(<SelfWeightOf<T>>::create_item() + <SelfWeightOf<T>>::set_token_properties(properties.len() as u32))]
+ #[weight(mint_with_props_weight::<T>(<SelfWeightOf<T>>::create_item(), [properties.len() as u32].into_iter()))]
fn mint_cross(
&mut self,
caller: Caller,
@@ -1174,10 +1195,6 @@
let caller = T::CrossAccountId::from_eth(caller);
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
-
let users = [(to, 1)]
.into_iter()
.collect::<BTreeMap<_, _>>()
@@ -1187,7 +1204,7 @@
self,
&caller,
CreateItemData::<T> { users, properties },
- &budget,
+ &nesting_budget(&self.recorder),
)
.map_err(dispatch_to_evm::<T>)?;
pallets/refungible/src/erc_token.rsdiffbeforeafterboth--- a/pallets/refungible/src/erc_token.rs
+++ b/pallets/refungible/src/erc_token.rs
@@ -37,14 +37,13 @@
execution::{PreDispatch, Result},
frontier_contract, WithRecorder,
};
-use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};
use sp_core::U256;
use sp_std::vec::Vec;
use up_data_structs::TokenId;
use crate::{
- common::CommonWeights, weights::WeightInfo, Allowance, Balance, Config, Pallet,
- RefungibleHandle, SelfWeightOf, TotalSupply,
+ common::CommonWeights, erc::nesting_budget, weights::WeightInfo, Allowance, Balance, Config,
+ Pallet, RefungibleHandle, SelfWeightOf, TotalSupply,
};
/// Refungible token handle contains information about token's collection and id
@@ -140,12 +139,16 @@
let caller = T::CrossAccountId::from_eth(caller);
let to = T::CrossAccountId::from_eth(to);
let amount = amount.try_into().map_err(|_| "amount overflow")?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
- <Pallet<T>>::transfer(self, &caller, &to, self.1, amount, &budget)
- .map_err(dispatch_to_evm::<T>)?;
+ <Pallet<T>>::transfer(
+ self,
+ &caller,
+ &to,
+ self.1,
+ amount,
+ &nesting_budget(&self.recorder),
+ )
+ .map_err(dispatch_to_evm::<T>)?;
Ok(true)
}
@@ -165,12 +168,17 @@
let from = T::CrossAccountId::from_eth(from);
let to = T::CrossAccountId::from_eth(to);
let amount = amount.try_into().map_err(|_| "amount overflow")?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
- <Pallet<T>>::transfer_from(self, &caller, &from, &to, self.1, amount, &budget)
- .map_err(dispatch_to_evm::<T>)?;
+ <Pallet<T>>::transfer_from(
+ self,
+ &caller,
+ &from,
+ &to,
+ self.1,
+ amount,
+ &nesting_budget(&self.recorder),
+ )
+ .map_err(dispatch_to_evm::<T>)?;
Ok(true)
}
@@ -231,12 +239,16 @@
let caller = T::CrossAccountId::from_eth(caller);
let from = T::CrossAccountId::from_eth(from);
let amount = amount.try_into().map_err(|_| "amount overflow")?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
- <Pallet<T>>::burn_from(self, &caller, &from, self.1, amount, &budget)
- .map_err(dispatch_to_evm::<T>)?;
+ <Pallet<T>>::burn_from(
+ self,
+ &caller,
+ &from,
+ self.1,
+ amount,
+ &nesting_budget(&self.recorder),
+ )
+ .map_err(dispatch_to_evm::<T>)?;
Ok(true)
}
@@ -254,12 +266,16 @@
let caller = T::CrossAccountId::from_eth(caller);
let from = from.into_sub_cross_account::<T>()?;
let amount = amount.try_into().map_err(|_| "amount overflow")?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
- <Pallet<T>>::burn_from(self, &caller, &from, self.1, amount, &budget)
- .map_err(dispatch_to_evm::<T>)?;
+ <Pallet<T>>::burn_from(
+ self,
+ &caller,
+ &from,
+ self.1,
+ amount,
+ &nesting_budget(&self.recorder),
+ )
+ .map_err(dispatch_to_evm::<T>)?;
Ok(true)
}
@@ -315,12 +331,16 @@
let caller = T::CrossAccountId::from_eth(caller);
let to = to.into_sub_cross_account::<T>()?;
let amount = amount.try_into().map_err(|_| "amount overflow")?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
- <Pallet<T>>::transfer(self, &caller, &to, self.1, amount, &budget)
- .map_err(dispatch_to_evm::<T>)?;
+ <Pallet<T>>::transfer(
+ self,
+ &caller,
+ &to,
+ self.1,
+ amount,
+ &nesting_budget(&self.recorder),
+ )
+ .map_err(dispatch_to_evm::<T>)?;
Ok(true)
}
@@ -340,12 +360,17 @@
let from = from.into_sub_cross_account::<T>()?;
let to = to.into_sub_cross_account::<T>()?;
let amount = amount.try_into().map_err(|_| "amount overflow")?;
- let budget = self
- .recorder
- .weight_calls_budget(<StructureWeight<T>>::find_parent());
- <Pallet<T>>::transfer_from(self, &caller, &from, &to, self.1, amount, &budget)
- .map_err(dispatch_to_evm::<T>)?;
+ <Pallet<T>>::transfer_from(
+ self,
+ &caller,
+ &from,
+ &to,
+ self.1,
+ amount,
+ &nesting_budget(&self.recorder),
+ )
+ .map_err(dispatch_to_evm::<T>)?;
Ok(true)
}
}
pallets/refungible/src/lib.rsdiffbeforeafterboth--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -507,7 +507,7 @@
nesting_budget: &dyn Budget,
) -> DispatchResult {
let mut property_writer =
- pallet_common::property_writer_for_existing_token(collection, sender);
+ pallet_common::ExistingTokenPropertyWriter::new(collection, sender);
property_writer.write_token_properties(
sender,
@@ -858,7 +858,7 @@
// =========
- let mut property_writer = pallet_common::property_writer_for_new_token(collection, sender);
+ let mut property_writer = pallet_common::NewTokenPropertyWriter::new(collection, sender);
with_transaction(|| {
for (i, data) in data.iter().enumerate() {
pallets/refungible/src/weights.rsdiffbeforeafterboth--- a/pallets/refungible/src/weights.rs
+++ b/pallets/refungible/src/weights.rs
@@ -3,13 +3,13 @@
//! Autogenerated weights for pallet_refungible
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-09-30, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-10-13, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
-//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`
-//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
+//! HOSTNAME: `hearthstone`, CPU: `AMD Ryzen 9 7950X3D 16-Core Processor`
+//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
-// target/production/unique-collator
+// ./target/production/unique-collator
// benchmark
// pallet
// --pallet
@@ -20,7 +20,7 @@
// *
// --template=.maintain/frame-weight-template.hbs
// --steps=50
-// --repeat=400
+// --repeat=80
// --heap-pages=4096
// --output=./pallets/refungible/src/weights.rs
@@ -50,12 +50,10 @@
fn transfer_from_removing() -> Weight;
fn transfer_from_creating_removing() -> Weight;
fn burn_from() -> Weight;
+ fn load_token_properties() -> Weight;
+ fn write_token_properties(b: u32, ) -> Weight;
fn set_token_property_permissions(b: u32, ) -> Weight;
- fn set_token_properties(b: u32, ) -> Weight;
- fn init_token_properties(b: u32, ) -> Weight;
- fn delete_token_properties(b: u32, ) -> Weight;
fn repartition_item() -> Weight;
- fn token_owner() -> Weight;
fn set_allowance_for_all() -> Weight;
fn allowance_for_all() -> Weight;
fn repair_item() -> Weight;
@@ -64,435 +62,399 @@
/// Weights for pallet_refungible using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
- /// Storage: Refungible TokensMinted (r:1 w:1)
- /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:1 w:1)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible Balance (r:0 w:1)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:0 w:1)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:1)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Refungible::TokensMinted` (r:1 w:1)
+ /// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Balance` (r:0 w:1)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:0 w:1)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:1)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
fn create_item() -> Weight {
// Proof Size summary in bytes:
// Measured: `4`
// Estimated: `3530`
- // Minimum execution time: 11_341_000 picoseconds.
- Weight::from_parts(11_741_000, 3530)
+ // Minimum execution time: 19_400_000 picoseconds.
+ Weight::from_parts(19_890_000, 3530)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
- /// Storage: Refungible TokensMinted (r:1 w:1)
- /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:1 w:1)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible Balance (r:0 w:200)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:0 w:200)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:200)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Refungible::TokensMinted` (r:1 w:1)
+ /// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Balance` (r:0 w:200)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:0 w:200)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:200)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
/// The range of component `b` is `[0, 200]`.
fn create_multiple_items(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `4`
// Estimated: `3530`
- // Minimum execution time: 2_665_000 picoseconds.
- Weight::from_parts(2_791_000, 3530)
- // Standard Error: 996
- .saturating_add(Weight::from_parts(4_343_736, 0).saturating_mul(b.into()))
+ // Minimum execution time: 3_120_000 picoseconds.
+ Weight::from_parts(3_310_000, 3530)
+ // Standard Error: 2_748
+ .saturating_add(Weight::from_parts(11_489_631, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
.saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into())))
}
- /// Storage: Refungible TokensMinted (r:1 w:1)
- /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:200 w:200)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible Balance (r:0 w:200)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:0 w:200)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:200)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Refungible::TokensMinted` (r:1 w:1)
+ /// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:200 w:200)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Balance` (r:0 w:200)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:0 w:200)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:200)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
/// The range of component `b` is `[0, 200]`.
fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `4`
// Estimated: `3481 + b * (2540 ±0)`
- // Minimum execution time: 2_616_000 picoseconds.
- Weight::from_parts(2_726_000, 3481)
- // Standard Error: 665
- .saturating_add(Weight::from_parts(5_554_066, 0).saturating_mul(b.into()))
+ // Minimum execution time: 3_180_000 picoseconds.
+ Weight::from_parts(2_015_490, 3481)
+ // Standard Error: 6_052
+ .saturating_add(Weight::from_parts(14_837_077, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))
.saturating_add(T::DbWeight::get().writes(1_u64))
.saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(b.into())))
.saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))
}
- /// Storage: Refungible TokensMinted (r:1 w:1)
- /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:200 w:200)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible Balance (r:0 w:200)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:0 w:1)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:200)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Refungible::TokensMinted` (r:1 w:1)
+ /// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:200 w:200)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Balance` (r:0 w:200)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:0 w:1)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:200)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
/// The range of component `b` is `[0, 200]`.
fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `4`
// Estimated: `3481 + b * (2540 ±0)`
- // Minimum execution time: 3_697_000 picoseconds.
- Weight::from_parts(2_136_481, 3481)
- // Standard Error: 567
- .saturating_add(Weight::from_parts(4_390_621, 0).saturating_mul(b.into()))
+ // Minimum execution time: 5_200_000 picoseconds.
+ Weight::from_parts(25_301_631, 3481)
+ // Standard Error: 6_177
+ .saturating_add(Weight::from_parts(11_197_931, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))
.saturating_add(T::DbWeight::get().writes(2_u64))
.saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into())))
.saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))
}
- /// Storage: Refungible Balance (r:3 w:1)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:1)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:1 w:1)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:1)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Balance` (r:3 w:1)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:1)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:1)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
fn burn_item_partial() -> Weight {
// Proof Size summary in bytes:
// Measured: `456`
// Estimated: `8682`
- // Minimum execution time: 22_859_000 picoseconds.
- Weight::from_parts(23_295_000, 8682)
+ // Minimum execution time: 29_540_000 picoseconds.
+ Weight::from_parts(30_190_000, 8682)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
- /// Storage: Refungible Balance (r:1 w:1)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:1)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:1 w:1)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TokensBurnt (r:1 w:1)
- /// Proof: Refungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:1)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
- /// Storage: Refungible TokenProperties (r:0 w:1)
- /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Balance` (r:1 w:1)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:1)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TokensBurnt` (r:1 w:1)
+ /// Proof: `Refungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:1)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TokenProperties` (r:0 w:1)
+ /// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
fn burn_item_fully() -> Weight {
// Proof Size summary in bytes:
// Measured: `341`
// Estimated: `3554`
- // Minimum execution time: 21_477_000 picoseconds.
- Weight::from_parts(22_037_000, 3554)
+ // Minimum execution time: 30_650_000 picoseconds.
+ Weight::from_parts(31_370_000, 3554)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(6_u64))
}
- /// Storage: Refungible Balance (r:2 w:2)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:0)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Balance` (r:2 w:2)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:0)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
fn transfer_normal() -> Weight {
// Proof Size summary in bytes:
// Measured: `365`
// Estimated: `6118`
- // Minimum execution time: 13_714_000 picoseconds.
- Weight::from_parts(14_050_000, 6118)
+ // Minimum execution time: 18_530_000 picoseconds.
+ Weight::from_parts(19_010_000, 6118)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
- /// Storage: Refungible Balance (r:2 w:2)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:1 w:1)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:0)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:1)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Balance` (r:2 w:2)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:0)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:1)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
fn transfer_creating() -> Weight {
// Proof Size summary in bytes:
// Measured: `341`
// Estimated: `6118`
- // Minimum execution time: 15_879_000 picoseconds.
- Weight::from_parts(16_266_000, 6118)
+ // Minimum execution time: 24_240_000 picoseconds.
+ Weight::from_parts(24_760_000, 6118)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
- /// Storage: Refungible Balance (r:2 w:2)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:1 w:1)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:0)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:1)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Balance` (r:2 w:2)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:0)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:1)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
fn transfer_removing() -> Weight {
// Proof Size summary in bytes:
// Measured: `456`
// Estimated: `6118`
- // Minimum execution time: 18_186_000 picoseconds.
- Weight::from_parts(18_682_000, 6118)
+ // Minimum execution time: 25_990_000 picoseconds.
+ Weight::from_parts(26_650_000, 6118)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
- /// Storage: Refungible Balance (r:2 w:2)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:2 w:2)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:0)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:2)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Balance` (r:2 w:2)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:2 w:2)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:0)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:2)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
fn transfer_creating_removing() -> Weight {
// Proof Size summary in bytes:
// Measured: `341`
// Estimated: `6118`
- // Minimum execution time: 17_943_000 picoseconds.
- Weight::from_parts(18_333_000, 6118)
+ // Minimum execution time: 29_550_000 picoseconds.
+ Weight::from_parts(30_530_000, 6118)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(6_u64))
}
- /// Storage: Refungible Balance (r:1 w:0)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible Allowance (r:0 w:1)
- /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Balance` (r:1 w:0)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Allowance` (r:0 w:1)
+ /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
fn approve() -> Weight {
// Proof Size summary in bytes:
// Measured: `223`
// Estimated: `3554`
- // Minimum execution time: 8_391_000 picoseconds.
- Weight::from_parts(8_637_000, 3554)
+ // Minimum execution time: 11_420_000 picoseconds.
+ Weight::from_parts(11_810_000, 3554)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
- /// Storage: Refungible Balance (r:1 w:0)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible Allowance (r:0 w:1)
- /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Balance` (r:1 w:0)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Allowance` (r:0 w:1)
+ /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
fn approve_from() -> Weight {
// Proof Size summary in bytes:
// Measured: `211`
// Estimated: `3554`
- // Minimum execution time: 8_519_000 picoseconds.
- Weight::from_parts(8_760_000, 3554)
+ // Minimum execution time: 11_610_000 picoseconds.
+ Weight::from_parts(11_950_000, 3554)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
- /// Storage: Refungible Allowance (r:1 w:1)
- /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
- /// Storage: Refungible Balance (r:2 w:2)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:0)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Allowance` (r:1 w:1)
+ /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Balance` (r:2 w:2)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:0)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
fn transfer_from_normal() -> Weight {
// Proof Size summary in bytes:
// Measured: `495`
// Estimated: `6118`
- // Minimum execution time: 19_554_000 picoseconds.
- Weight::from_parts(20_031_000, 6118)
+ // Minimum execution time: 28_510_000 picoseconds.
+ Weight::from_parts(29_180_000, 6118)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
- /// Storage: Refungible Allowance (r:1 w:1)
- /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
- /// Storage: Refungible Balance (r:2 w:2)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:1 w:1)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:0)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:1)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Allowance` (r:1 w:1)
+ /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Balance` (r:2 w:2)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:0)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:1)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
fn transfer_from_creating() -> Weight {
// Proof Size summary in bytes:
// Measured: `471`
// Estimated: `6118`
- // Minimum execution time: 21_338_000 picoseconds.
- Weight::from_parts(21_803_000, 6118)
+ // Minimum execution time: 34_370_000 picoseconds.
+ Weight::from_parts(35_270_000, 6118)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
- /// Storage: Refungible Allowance (r:1 w:1)
- /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
- /// Storage: Refungible Balance (r:2 w:2)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:1 w:1)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:0)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:1)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Allowance` (r:1 w:1)
+ /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Balance` (r:2 w:2)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:0)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:1)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
fn transfer_from_removing() -> Weight {
// Proof Size summary in bytes:
// Measured: `586`
// Estimated: `6118`
- // Minimum execution time: 24_179_000 picoseconds.
- Weight::from_parts(24_647_000, 6118)
+ // Minimum execution time: 36_490_000 picoseconds.
+ Weight::from_parts(37_160_000, 6118)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
- /// Storage: Refungible Allowance (r:1 w:1)
- /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
- /// Storage: Refungible Balance (r:2 w:2)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:2 w:2)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:0)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:2)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Allowance` (r:1 w:1)
+ /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Balance` (r:2 w:2)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:2 w:2)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:0)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:2)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
fn transfer_from_creating_removing() -> Weight {
// Proof Size summary in bytes:
// Measured: `471`
// Estimated: `6118`
- // Minimum execution time: 24_008_000 picoseconds.
- Weight::from_parts(24_545_000, 6118)
+ // Minimum execution time: 40_080_000 picoseconds.
+ Weight::from_parts(48_310_000, 6118)
.saturating_add(T::DbWeight::get().reads(6_u64))
.saturating_add(T::DbWeight::get().writes(7_u64))
}
- /// Storage: Refungible Allowance (r:1 w:1)
- /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
- /// Storage: Refungible Balance (r:1 w:1)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:1)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:1 w:1)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TokensBurnt (r:1 w:1)
- /// Proof: Refungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:1)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
- /// Storage: Refungible TokenProperties (r:0 w:1)
- /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Allowance` (r:1 w:1)
+ /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Balance` (r:1 w:1)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:1)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TokensBurnt` (r:1 w:1)
+ /// Proof: `Refungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:1)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TokenProperties` (r:0 w:1)
+ /// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
fn burn_from() -> Weight {
// Proof Size summary in bytes:
// Measured: `471`
// Estimated: `3570`
- // Minimum execution time: 27_907_000 picoseconds.
- Weight::from_parts(28_489_000, 3570)
+ // Minimum execution time: 41_100_000 picoseconds.
+ Weight::from_parts(42_060_000, 3570)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(7_u64))
- }
- /// Storage: Common CollectionPropertyPermissions (r:1 w:1)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
- /// The range of component `b` is `[0, 64]`.
- fn set_token_property_permissions(b: u32, ) -> Weight {
- // Proof Size summary in bytes:
- // Measured: `314`
- // Estimated: `20191`
- // Minimum execution time: 1_460_000 picoseconds.
- Weight::from_parts(1_564_000, 20191)
- // Standard Error: 14_117
- .saturating_add(Weight::from_parts(8_196_214, 0).saturating_mul(b.into()))
- .saturating_add(T::DbWeight::get().reads(1_u64))
- .saturating_add(T::DbWeight::get().writes(1_u64))
}
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
- /// Storage: Refungible TokenProperties (r:1 w:1)
- /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:0)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// The range of component `b` is `[0, 64]`.
- fn set_token_properties(b: u32, ) -> Weight {
+ /// Storage: `Refungible::TokenProperties` (r:1 w:0)
+ /// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
+ fn load_token_properties() -> Weight {
// Proof Size summary in bytes:
- // Measured: `502 + b * (261 ±0)`
+ // Measured: `120`
// Estimated: `36269`
- // Minimum execution time: 1_012_000 picoseconds.
- Weight::from_parts(1_081_000, 36269)
- // Standard Error: 6_838
- .saturating_add(Weight::from_parts(5_801_181, 0).saturating_mul(b.into()))
- .saturating_add(T::DbWeight::get().reads(3_u64))
- .saturating_add(T::DbWeight::get().writes(1_u64))
+ // Minimum execution time: 2_520_000 picoseconds.
+ Weight::from_parts(2_670_000, 36269)
+ .saturating_add(T::DbWeight::get().reads(1_u64))
}
- /// Storage: Refungible TokenProperties (r:0 w:1)
- /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// Storage: `Refungible::TokenProperties` (r:0 w:1)
+ /// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
/// The range of component `b` is `[0, 64]`.
- fn init_token_properties(b: u32, ) -> Weight {
+ fn write_token_properties(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 229_000 picoseconds.
- Weight::from_parts(253_000, 0)
- // Standard Error: 100_218
- .saturating_add(Weight::from_parts(12_632_221, 0).saturating_mul(b.into()))
+ // Minimum execution time: 490_000 picoseconds.
+ Weight::from_parts(3_457_547, 0)
+ // Standard Error: 24_239
+ .saturating_add(Weight::from_parts(19_382_722, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:0)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible TokenProperties (r:1 w:1)
- /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// Storage: `Common::CollectionPropertyPermissions` (r:1 w:1)
+ /// Proof: `Common::CollectionPropertyPermissions` (`max_values`: None, `max_size`: Some(16726), added: 19201, mode: `MaxEncodedLen`)
/// The range of component `b` is `[0, 64]`.
- fn delete_token_properties(b: u32, ) -> Weight {
+ fn set_token_property_permissions(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `561 + b * (33291 ±0)`
- // Estimated: `36269`
- // Minimum execution time: 1_014_000 picoseconds.
- Weight::from_parts(1_065_000, 36269)
- // Standard Error: 39_536
- .saturating_add(Weight::from_parts(24_125_838, 0).saturating_mul(b.into()))
- .saturating_add(T::DbWeight::get().reads(3_u64))
+ // Measured: `314`
+ // Estimated: `20191`
+ // Minimum execution time: 1_500_000 picoseconds.
+ Weight::from_parts(1_590_000, 20191)
+ // Standard Error: 123_927
+ .saturating_add(Weight::from_parts(27_355_093, 0).saturating_mul(b.into()))
+ .saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
- /// Storage: Refungible TotalSupply (r:1 w:1)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible Balance (r:1 w:1)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:1)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Balance` (r:1 w:1)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
fn repartition_item() -> Weight {
// Proof Size summary in bytes:
// Measured: `288`
// Estimated: `3554`
- // Minimum execution time: 10_315_000 picoseconds.
- Weight::from_parts(10_601_000, 3554)
+ // Minimum execution time: 14_340_000 picoseconds.
+ Weight::from_parts(14_590_000, 3554)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
- }
- /// Storage: Refungible Balance (r:2 w:0)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- fn token_owner() -> Weight {
- // Proof Size summary in bytes:
- // Measured: `288`
- // Estimated: `6118`
- // Minimum execution time: 4_898_000 picoseconds.
- Weight::from_parts(5_136_000, 6118)
- .saturating_add(T::DbWeight::get().reads(2_u64))
}
- /// Storage: Refungible CollectionAllowance (r:0 w:1)
- /// Proof: Refungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)
+ /// Storage: `Refungible::CollectionAllowance` (r:0 w:1)
+ /// Proof: `Refungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)
fn set_allowance_for_all() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 4_146_000 picoseconds.
- Weight::from_parts(4_337_000, 0)
+ // Minimum execution time: 6_390_000 picoseconds.
+ Weight::from_parts(6_650_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
- /// Storage: Refungible CollectionAllowance (r:1 w:0)
- /// Proof: Refungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)
+ /// Storage: `Refungible::CollectionAllowance` (r:1 w:0)
+ /// Proof: `Refungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)
fn allowance_for_all() -> Weight {
// Proof Size summary in bytes:
// Measured: `4`
// Estimated: `3576`
- // Minimum execution time: 2_170_000 picoseconds.
- Weight::from_parts(2_301_000, 3576)
+ // Minimum execution time: 3_060_000 picoseconds.
+ Weight::from_parts(3_210_000, 3576)
.saturating_add(T::DbWeight::get().reads(1_u64))
}
- /// Storage: Refungible TokenProperties (r:1 w:1)
- /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// Storage: `Refungible::TokenProperties` (r:1 w:1)
+ /// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
fn repair_item() -> Weight {
// Proof Size summary in bytes:
// Measured: `120`
// Estimated: `36269`
- // Minimum execution time: 2_098_000 picoseconds.
- Weight::from_parts(2_251_000, 36269)
+ // Minimum execution time: 2_480_000 picoseconds.
+ Weight::from_parts(2_620_000, 36269)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -500,435 +462,399 @@
// For backwards compatibility and tests
impl WeightInfo for () {
- /// Storage: Refungible TokensMinted (r:1 w:1)
- /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:1 w:1)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible Balance (r:0 w:1)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:0 w:1)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:1)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Refungible::TokensMinted` (r:1 w:1)
+ /// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Balance` (r:0 w:1)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:0 w:1)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:1)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
fn create_item() -> Weight {
// Proof Size summary in bytes:
// Measured: `4`
// Estimated: `3530`
- // Minimum execution time: 11_341_000 picoseconds.
- Weight::from_parts(11_741_000, 3530)
+ // Minimum execution time: 19_400_000 picoseconds.
+ Weight::from_parts(19_890_000, 3530)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(5_u64))
}
- /// Storage: Refungible TokensMinted (r:1 w:1)
- /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:1 w:1)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible Balance (r:0 w:200)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:0 w:200)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:200)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Refungible::TokensMinted` (r:1 w:1)
+ /// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Balance` (r:0 w:200)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:0 w:200)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:200)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
/// The range of component `b` is `[0, 200]`.
fn create_multiple_items(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `4`
// Estimated: `3530`
- // Minimum execution time: 2_665_000 picoseconds.
- Weight::from_parts(2_791_000, 3530)
- // Standard Error: 996
- .saturating_add(Weight::from_parts(4_343_736, 0).saturating_mul(b.into()))
+ // Minimum execution time: 3_120_000 picoseconds.
+ Weight::from_parts(3_310_000, 3530)
+ // Standard Error: 2_748
+ .saturating_add(Weight::from_parts(11_489_631, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
.saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(b.into())))
}
- /// Storage: Refungible TokensMinted (r:1 w:1)
- /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:200 w:200)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible Balance (r:0 w:200)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:0 w:200)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:200)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Refungible::TokensMinted` (r:1 w:1)
+ /// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:200 w:200)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Balance` (r:0 w:200)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:0 w:200)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:200)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
/// The range of component `b` is `[0, 200]`.
fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `4`
// Estimated: `3481 + b * (2540 ±0)`
- // Minimum execution time: 2_616_000 picoseconds.
- Weight::from_parts(2_726_000, 3481)
- // Standard Error: 665
- .saturating_add(Weight::from_parts(5_554_066, 0).saturating_mul(b.into()))
+ // Minimum execution time: 3_180_000 picoseconds.
+ Weight::from_parts(2_015_490, 3481)
+ // Standard Error: 6_052
+ .saturating_add(Weight::from_parts(14_837_077, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(b.into())))
.saturating_add(RocksDbWeight::get().writes(1_u64))
.saturating_add(RocksDbWeight::get().writes((4_u64).saturating_mul(b.into())))
.saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))
}
- /// Storage: Refungible TokensMinted (r:1 w:1)
- /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:200 w:200)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible Balance (r:0 w:200)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:0 w:1)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:200)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Refungible::TokensMinted` (r:1 w:1)
+ /// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:200 w:200)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Balance` (r:0 w:200)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:0 w:1)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:200)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
/// The range of component `b` is `[0, 200]`.
fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `4`
// Estimated: `3481 + b * (2540 ±0)`
- // Minimum execution time: 3_697_000 picoseconds.
- Weight::from_parts(2_136_481, 3481)
- // Standard Error: 567
- .saturating_add(Weight::from_parts(4_390_621, 0).saturating_mul(b.into()))
+ // Minimum execution time: 5_200_000 picoseconds.
+ Weight::from_parts(25_301_631, 3481)
+ // Standard Error: 6_177
+ .saturating_add(Weight::from_parts(11_197_931, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(b.into())))
.saturating_add(RocksDbWeight::get().writes(2_u64))
.saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(b.into())))
.saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))
}
- /// Storage: Refungible Balance (r:3 w:1)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:1)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:1 w:1)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:1)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Balance` (r:3 w:1)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:1)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:1)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
fn burn_item_partial() -> Weight {
// Proof Size summary in bytes:
// Measured: `456`
// Estimated: `8682`
- // Minimum execution time: 22_859_000 picoseconds.
- Weight::from_parts(23_295_000, 8682)
+ // Minimum execution time: 29_540_000 picoseconds.
+ Weight::from_parts(30_190_000, 8682)
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
- /// Storage: Refungible Balance (r:1 w:1)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:1)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:1 w:1)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TokensBurnt (r:1 w:1)
- /// Proof: Refungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:1)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
- /// Storage: Refungible TokenProperties (r:0 w:1)
- /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Balance` (r:1 w:1)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:1)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TokensBurnt` (r:1 w:1)
+ /// Proof: `Refungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:1)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TokenProperties` (r:0 w:1)
+ /// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
fn burn_item_fully() -> Weight {
// Proof Size summary in bytes:
// Measured: `341`
// Estimated: `3554`
- // Minimum execution time: 21_477_000 picoseconds.
- Weight::from_parts(22_037_000, 3554)
+ // Minimum execution time: 30_650_000 picoseconds.
+ Weight::from_parts(31_370_000, 3554)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(6_u64))
}
- /// Storage: Refungible Balance (r:2 w:2)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:0)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Balance` (r:2 w:2)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:0)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
fn transfer_normal() -> Weight {
// Proof Size summary in bytes:
// Measured: `365`
// Estimated: `6118`
- // Minimum execution time: 13_714_000 picoseconds.
- Weight::from_parts(14_050_000, 6118)
+ // Minimum execution time: 18_530_000 picoseconds.
+ Weight::from_parts(19_010_000, 6118)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
- /// Storage: Refungible Balance (r:2 w:2)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:1 w:1)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:0)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:1)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Balance` (r:2 w:2)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:0)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:1)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
fn transfer_creating() -> Weight {
// Proof Size summary in bytes:
// Measured: `341`
// Estimated: `6118`
- // Minimum execution time: 15_879_000 picoseconds.
- Weight::from_parts(16_266_000, 6118)
+ // Minimum execution time: 24_240_000 picoseconds.
+ Weight::from_parts(24_760_000, 6118)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
- /// Storage: Refungible Balance (r:2 w:2)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:1 w:1)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:0)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:1)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Balance` (r:2 w:2)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:0)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:1)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
fn transfer_removing() -> Weight {
// Proof Size summary in bytes:
// Measured: `456`
// Estimated: `6118`
- // Minimum execution time: 18_186_000 picoseconds.
- Weight::from_parts(18_682_000, 6118)
+ // Minimum execution time: 25_990_000 picoseconds.
+ Weight::from_parts(26_650_000, 6118)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
- /// Storage: Refungible Balance (r:2 w:2)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:2 w:2)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:0)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:2)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Balance` (r:2 w:2)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:2 w:2)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:0)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:2)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
fn transfer_creating_removing() -> Weight {
// Proof Size summary in bytes:
// Measured: `341`
// Estimated: `6118`
- // Minimum execution time: 17_943_000 picoseconds.
- Weight::from_parts(18_333_000, 6118)
+ // Minimum execution time: 29_550_000 picoseconds.
+ Weight::from_parts(30_530_000, 6118)
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(6_u64))
}
- /// Storage: Refungible Balance (r:1 w:0)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible Allowance (r:0 w:1)
- /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Balance` (r:1 w:0)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Allowance` (r:0 w:1)
+ /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
fn approve() -> Weight {
// Proof Size summary in bytes:
// Measured: `223`
// Estimated: `3554`
- // Minimum execution time: 8_391_000 picoseconds.
- Weight::from_parts(8_637_000, 3554)
+ // Minimum execution time: 11_420_000 picoseconds.
+ Weight::from_parts(11_810_000, 3554)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
- /// Storage: Refungible Balance (r:1 w:0)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible Allowance (r:0 w:1)
- /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Balance` (r:1 w:0)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Allowance` (r:0 w:1)
+ /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
fn approve_from() -> Weight {
// Proof Size summary in bytes:
// Measured: `211`
// Estimated: `3554`
- // Minimum execution time: 8_519_000 picoseconds.
- Weight::from_parts(8_760_000, 3554)
+ // Minimum execution time: 11_610_000 picoseconds.
+ Weight::from_parts(11_950_000, 3554)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
- /// Storage: Refungible Allowance (r:1 w:1)
- /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
- /// Storage: Refungible Balance (r:2 w:2)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:0)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Allowance` (r:1 w:1)
+ /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Balance` (r:2 w:2)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:0)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
fn transfer_from_normal() -> Weight {
// Proof Size summary in bytes:
// Measured: `495`
// Estimated: `6118`
- // Minimum execution time: 19_554_000 picoseconds.
- Weight::from_parts(20_031_000, 6118)
+ // Minimum execution time: 28_510_000 picoseconds.
+ Weight::from_parts(29_180_000, 6118)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
}
- /// Storage: Refungible Allowance (r:1 w:1)
- /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
- /// Storage: Refungible Balance (r:2 w:2)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:1 w:1)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:0)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:1)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Allowance` (r:1 w:1)
+ /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Balance` (r:2 w:2)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:0)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:1)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
fn transfer_from_creating() -> Weight {
// Proof Size summary in bytes:
// Measured: `471`
// Estimated: `6118`
- // Minimum execution time: 21_338_000 picoseconds.
- Weight::from_parts(21_803_000, 6118)
+ // Minimum execution time: 34_370_000 picoseconds.
+ Weight::from_parts(35_270_000, 6118)
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(5_u64))
}
- /// Storage: Refungible Allowance (r:1 w:1)
- /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
- /// Storage: Refungible Balance (r:2 w:2)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:1 w:1)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:0)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:1)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Allowance` (r:1 w:1)
+ /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Balance` (r:2 w:2)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:0)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:1)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
fn transfer_from_removing() -> Weight {
// Proof Size summary in bytes:
// Measured: `586`
// Estimated: `6118`
- // Minimum execution time: 24_179_000 picoseconds.
- Weight::from_parts(24_647_000, 6118)
+ // Minimum execution time: 36_490_000 picoseconds.
+ Weight::from_parts(37_160_000, 6118)
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(5_u64))
}
- /// Storage: Refungible Allowance (r:1 w:1)
- /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
- /// Storage: Refungible Balance (r:2 w:2)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:2 w:2)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:0)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:2)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Allowance` (r:1 w:1)
+ /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Balance` (r:2 w:2)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:2 w:2)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:0)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:2)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
fn transfer_from_creating_removing() -> Weight {
// Proof Size summary in bytes:
// Measured: `471`
// Estimated: `6118`
- // Minimum execution time: 24_008_000 picoseconds.
- Weight::from_parts(24_545_000, 6118)
+ // Minimum execution time: 40_080_000 picoseconds.
+ Weight::from_parts(48_310_000, 6118)
.saturating_add(RocksDbWeight::get().reads(6_u64))
.saturating_add(RocksDbWeight::get().writes(7_u64))
}
- /// Storage: Refungible Allowance (r:1 w:1)
- /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)
- /// Storage: Refungible Balance (r:1 w:1)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:1)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible AccountBalance (r:1 w:1)
- /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
- /// Storage: Refungible TokensBurnt (r:1 w:1)
- /// Proof: Refungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)
- /// Storage: Refungible Owned (r:0 w:1)
- /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)
- /// Storage: Refungible TokenProperties (r:0 w:1)
- /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// Storage: `Refungible::Allowance` (r:1 w:1)
+ /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Balance` (r:1 w:1)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:1)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::AccountBalance` (r:1 w:1)
+ /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TokensBurnt` (r:1 w:1)
+ /// Proof: `Refungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Owned` (r:0 w:1)
+ /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::TokenProperties` (r:0 w:1)
+ /// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
fn burn_from() -> Weight {
// Proof Size summary in bytes:
// Measured: `471`
// Estimated: `3570`
- // Minimum execution time: 27_907_000 picoseconds.
- Weight::from_parts(28_489_000, 3570)
+ // Minimum execution time: 41_100_000 picoseconds.
+ Weight::from_parts(42_060_000, 3570)
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(7_u64))
}
- /// Storage: Common CollectionPropertyPermissions (r:1 w:1)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
- /// The range of component `b` is `[0, 64]`.
- fn set_token_property_permissions(b: u32, ) -> Weight {
+ /// Storage: `Refungible::TokenProperties` (r:1 w:0)
+ /// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
+ fn load_token_properties() -> Weight {
// Proof Size summary in bytes:
- // Measured: `314`
- // Estimated: `20191`
- // Minimum execution time: 1_460_000 picoseconds.
- Weight::from_parts(1_564_000, 20191)
- // Standard Error: 14_117
- .saturating_add(Weight::from_parts(8_196_214, 0).saturating_mul(b.into()))
- .saturating_add(RocksDbWeight::get().reads(1_u64))
- .saturating_add(RocksDbWeight::get().writes(1_u64))
- }
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
- /// Storage: Refungible TokenProperties (r:1 w:1)
- /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:0)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// The range of component `b` is `[0, 64]`.
- fn set_token_properties(b: u32, ) -> Weight {
- // Proof Size summary in bytes:
- // Measured: `502 + b * (261 ±0)`
+ // Measured: `120`
// Estimated: `36269`
- // Minimum execution time: 1_012_000 picoseconds.
- Weight::from_parts(1_081_000, 36269)
- // Standard Error: 6_838
- .saturating_add(Weight::from_parts(5_801_181, 0).saturating_mul(b.into()))
- .saturating_add(RocksDbWeight::get().reads(3_u64))
- .saturating_add(RocksDbWeight::get().writes(1_u64))
+ // Minimum execution time: 2_520_000 picoseconds.
+ Weight::from_parts(2_670_000, 36269)
+ .saturating_add(RocksDbWeight::get().reads(1_u64))
}
- /// Storage: Refungible TokenProperties (r:0 w:1)
- /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// Storage: `Refungible::TokenProperties` (r:0 w:1)
+ /// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
/// The range of component `b` is `[0, 64]`.
- fn init_token_properties(b: u32, ) -> Weight {
+ fn write_token_properties(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 229_000 picoseconds.
- Weight::from_parts(253_000, 0)
- // Standard Error: 100_218
- .saturating_add(Weight::from_parts(12_632_221, 0).saturating_mul(b.into()))
+ // Minimum execution time: 490_000 picoseconds.
+ Weight::from_parts(3_457_547, 0)
+ // Standard Error: 24_239
+ .saturating_add(Weight::from_parts(19_382_722, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
- /// Storage: Common CollectionPropertyPermissions (r:1 w:0)
- /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)
- /// Storage: Refungible TotalSupply (r:1 w:0)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible TokenProperties (r:1 w:1)
- /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// Storage: `Common::CollectionPropertyPermissions` (r:1 w:1)
+ /// Proof: `Common::CollectionPropertyPermissions` (`max_values`: None, `max_size`: Some(16726), added: 19201, mode: `MaxEncodedLen`)
/// The range of component `b` is `[0, 64]`.
- fn delete_token_properties(b: u32, ) -> Weight {
+ fn set_token_property_permissions(b: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `561 + b * (33291 ±0)`
- // Estimated: `36269`
- // Minimum execution time: 1_014_000 picoseconds.
- Weight::from_parts(1_065_000, 36269)
- // Standard Error: 39_536
- .saturating_add(Weight::from_parts(24_125_838, 0).saturating_mul(b.into()))
- .saturating_add(RocksDbWeight::get().reads(3_u64))
+ // Measured: `314`
+ // Estimated: `20191`
+ // Minimum execution time: 1_500_000 picoseconds.
+ Weight::from_parts(1_590_000, 20191)
+ // Standard Error: 123_927
+ .saturating_add(Weight::from_parts(27_355_093, 0).saturating_mul(b.into()))
+ .saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
- /// Storage: Refungible TotalSupply (r:1 w:1)
- /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)
- /// Storage: Refungible Balance (r:1 w:1)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
+ /// Storage: `Refungible::TotalSupply` (r:1 w:1)
+ /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
+ /// Storage: `Refungible::Balance` (r:1 w:1)
+ /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
fn repartition_item() -> Weight {
// Proof Size summary in bytes:
// Measured: `288`
// Estimated: `3554`
- // Minimum execution time: 10_315_000 picoseconds.
- Weight::from_parts(10_601_000, 3554)
+ // Minimum execution time: 14_340_000 picoseconds.
+ Weight::from_parts(14_590_000, 3554)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
- /// Storage: Refungible Balance (r:2 w:0)
- /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)
- fn token_owner() -> Weight {
- // Proof Size summary in bytes:
- // Measured: `288`
- // Estimated: `6118`
- // Minimum execution time: 4_898_000 picoseconds.
- Weight::from_parts(5_136_000, 6118)
- .saturating_add(RocksDbWeight::get().reads(2_u64))
- }
- /// Storage: Refungible CollectionAllowance (r:0 w:1)
- /// Proof: Refungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)
+ /// Storage: `Refungible::CollectionAllowance` (r:0 w:1)
+ /// Proof: `Refungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)
fn set_allowance_for_all() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 4_146_000 picoseconds.
- Weight::from_parts(4_337_000, 0)
+ // Minimum execution time: 6_390_000 picoseconds.
+ Weight::from_parts(6_650_000, 0)
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
- /// Storage: Refungible CollectionAllowance (r:1 w:0)
- /// Proof: Refungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)
+ /// Storage: `Refungible::CollectionAllowance` (r:1 w:0)
+ /// Proof: `Refungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)
fn allowance_for_all() -> Weight {
// Proof Size summary in bytes:
// Measured: `4`
// Estimated: `3576`
- // Minimum execution time: 2_170_000 picoseconds.
- Weight::from_parts(2_301_000, 3576)
+ // Minimum execution time: 3_060_000 picoseconds.
+ Weight::from_parts(3_210_000, 3576)
.saturating_add(RocksDbWeight::get().reads(1_u64))
}
- /// Storage: Refungible TokenProperties (r:1 w:1)
- /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)
+ /// Storage: `Refungible::TokenProperties` (r:1 w:1)
+ /// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)
fn repair_item() -> Weight {
// Proof Size summary in bytes:
// Measured: `120`
// Estimated: `36269`
- // Minimum execution time: 2_098_000 picoseconds.
- Weight::from_parts(2_251_000, 36269)
+ // Minimum execution time: 2_480_000 picoseconds.
+ Weight::from_parts(2_620_000, 36269)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
pallets/structure/src/lib.rsdiffbeforeafterboth--- a/pallets/structure/src/lib.rs
+++ b/pallets/structure/src/lib.rs
@@ -53,11 +53,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
-use frame_support::{
- dispatch::{DispatchResult, DispatchResultWithPostInfo},
- fail,
- pallet_prelude::*,
-};
+use frame_support::{dispatch::DispatchResult, fail, pallet_prelude::*};
use pallet_common::{
dispatch::CollectionDispatch, erc::CrossAccountId, eth::is_collection,
CommonCollectionOperations,
@@ -267,22 +263,6 @@
}
Err(<Error<T>>::DepthLimit.into())
- }
-
- /// Burn token and all of it's nested tokens
- ///
- /// - `self_budget`: Limit for searching children in depth.
- /// - `breadth_budget`: Limit of breadth of searching children.
- pub fn burn_item_recursively(
- from: T::CrossAccountId,
- collection: CollectionId,
- token: TokenId,
- self_budget: &dyn Budget,
- breadth_budget: &dyn Budget,
- ) -> DispatchResultWithPostInfo {
- let dispatch = T::CollectionDispatch::dispatch(collection)?;
- let dispatch = dispatch.as_dyn();
- dispatch.burn_item_recursively(from, token, self_budget, breadth_budget)
}
/// Check if `token` indirectly owned by `user`
pallets/unique/Cargo.tomldiffbeforeafterboth--- a/pallets/unique/Cargo.toml
+++ b/pallets/unique/Cargo.toml
@@ -31,7 +31,9 @@
'parity-scale-codec/std',
'sp-runtime/std',
'sp-std/std',
+ 'up-common/std',
'up-data-structs/std',
+ 'pallet-structure/std',
]
stubgen = ["evm-coder/stubgen", "pallet-common/stubgen"]
try-runtime = ["frame-support/try-runtime"]
@@ -53,9 +55,11 @@
pallet-evm-coder-substrate = { workspace = true }
pallet-nonfungible = { workspace = true }
pallet-refungible = { workspace = true }
+pallet-structure = { workspace = true }
scale-info = { workspace = true }
sp-core = { workspace = true }
sp-io = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }
+up-common = { workspace = true }
up-data-structs = { workspace = true }
pallets/unique/src/lib.rsdiffbeforeafterboth--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -84,13 +84,19 @@
#[frame_support::pallet]
pub mod pallet {
- use frame_support::{dispatch::DispatchResult, ensure, fail, storage::Key, BoundedVec};
+ use frame_support::{
+ dispatch::{DispatchErrorWithPostInfo, DispatchResult, PostDispatchInfo},
+ ensure, fail,
+ storage::Key,
+ BoundedVec,
+ };
use frame_system::{ensure_root, ensure_signed};
use pallet_common::{
dispatch::{dispatch_tx, CollectionDispatch},
CollectionHandle, CommonWeightInfo, Pallet as PalletCommon, RefungibleExtensionsWeightInfo,
};
use pallet_evm::account::CrossAccountId;
+ use pallet_structure::weights::WeightInfo as StructureWeightInfo;
use scale_info::TypeInfo;
use sp_std::{vec, vec::Vec};
use up_data_structs::{
@@ -104,9 +110,6 @@
use weights::WeightInfo;
use super::*;
-
- /// A maximum number of levels of depth in the token nesting tree.
- pub const NESTING_BUDGET: u32 = 5;
/// Errors for the common Unique transactions.
#[pallet::error]
@@ -128,6 +131,8 @@
/// Weight information for common pallet operations.
type CommonWeightInfo: CommonWeightInfo<Self::CrossAccountId>;
+ type StructureWeightInfo: StructureWeightInfo;
+
/// Weight info information for extra refungible pallet operations.
type RefungibleExtensionsWeightInfo: RefungibleExtensionsWeightInfo;
}
@@ -264,7 +269,7 @@
impl<T: Config> Pallet<T> {
/// A maximum number of levels of depth in the token nesting tree.
fn nesting_budget() -> u32 {
- NESTING_BUDGET
+ 5
}
/// Maximal length of a collection name.
@@ -666,7 +671,7 @@
/// * `owner`: Address of the initial owner of the item.
/// * `data`: Token data describing the item to store on chain.
#[pallet::call_index(11)]
- #[pallet::weight(T::CommonWeightInfo::create_item(data))]
+ #[pallet::weight(T::CommonWeightInfo::create_item(data) + <Pallet<T>>::nesting_budget_predispatch_weight())]
pub fn create_item(
origin: OriginFor<T>,
collection_id: CollectionId,
@@ -674,11 +679,14 @@
data: CreateItemData,
) -> DispatchResultWithPostInfo {
let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
- let budget = budget::Value::new(NESTING_BUDGET);
+ let budget = Self::structure_nesting_budget();
- dispatch_tx::<T, _>(collection_id, |d| {
- d.create_item(sender, owner, data, &budget)
- })
+ Self::refund_nesting_budget(
+ dispatch_tx::<T, _>(collection_id, |d| {
+ d.create_item(sender, owner, data, &budget)
+ }),
+ budget,
+ )
}
/// Create multiple items within a collection.
@@ -700,7 +708,7 @@
/// * `owner`: Address of the initial owner of the tokens.
/// * `items_data`: Vector of data describing each item to be created.
#[pallet::call_index(12)]
- #[pallet::weight(T::CommonWeightInfo::create_multiple_items(items_data))]
+ #[pallet::weight(T::CommonWeightInfo::create_multiple_items(items_data) + <Pallet<T>>::nesting_budget_predispatch_weight())]
pub fn create_multiple_items(
origin: OriginFor<T>,
collection_id: CollectionId,
@@ -709,11 +717,14 @@
) -> DispatchResultWithPostInfo {
ensure!(!items_data.is_empty(), Error::<T>::EmptyArgument);
let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
- let budget = budget::Value::new(NESTING_BUDGET);
+ let budget = Self::structure_nesting_budget();
- dispatch_tx::<T, _>(collection_id, |d| {
- d.create_multiple_items(sender, owner, items_data, &budget)
- })
+ Self::refund_nesting_budget(
+ dispatch_tx::<T, _>(collection_id, |d| {
+ d.create_multiple_items(sender, owner, items_data, &budget)
+ }),
+ budget,
+ )
}
/// Add or change collection properties.
@@ -791,7 +802,7 @@
/// * `properties`: Vector of key-value pairs stored as the token's metadata.
/// Keys support Latin letters, `-`, `_`, and `.` as symbols.
#[pallet::call_index(15)]
- #[pallet::weight(T::CommonWeightInfo::set_token_properties(properties.len() as u32))]
+ #[pallet::weight(T::CommonWeightInfo::set_token_properties(properties.len() as u32) + <Pallet<T>>::nesting_budget_predispatch_weight())]
pub fn set_token_properties(
origin: OriginFor<T>,
collection_id: CollectionId,
@@ -801,11 +812,14 @@
ensure!(!properties.is_empty(), Error::<T>::EmptyArgument);
let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
- let budget = budget::Value::new(NESTING_BUDGET);
+ let budget = Self::structure_nesting_budget();
- dispatch_tx::<T, _>(collection_id, |d| {
- d.set_token_properties(sender, token_id, properties, &budget)
- })
+ Self::refund_nesting_budget(
+ dispatch_tx::<T, _>(collection_id, |d| {
+ d.set_token_properties(sender, token_id, properties, &budget)
+ }),
+ budget,
+ )
}
/// Delete specified token properties. Currently properties only work with NFTs.
@@ -824,7 +838,7 @@
/// * `property_keys`: Vector of keys of the properties to be deleted.
/// Keys support Latin letters, `-`, `_`, and `.` as symbols.
#[pallet::call_index(16)]
- #[pallet::weight(T::CommonWeightInfo::delete_token_properties(property_keys.len() as u32))]
+ #[pallet::weight(T::CommonWeightInfo::delete_token_properties(property_keys.len() as u32) + <Pallet<T>>::nesting_budget_predispatch_weight())]
pub fn delete_token_properties(
origin: OriginFor<T>,
collection_id: CollectionId,
@@ -834,11 +848,14 @@
ensure!(!property_keys.is_empty(), Error::<T>::EmptyArgument);
let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
- let budget = budget::Value::new(NESTING_BUDGET);
+ let budget = Self::structure_nesting_budget();
- dispatch_tx::<T, _>(collection_id, |d| {
- d.delete_token_properties(sender, token_id, property_keys, &budget)
- })
+ Self::refund_nesting_budget(
+ dispatch_tx::<T, _>(collection_id, |d| {
+ d.delete_token_properties(sender, token_id, property_keys, &budget)
+ }),
+ budget,
+ )
}
/// Add or change token property permissions of a collection.
@@ -888,18 +905,21 @@
/// * `collection_id`: ID of the collection to which the tokens would belong.
/// * `data`: Explicit item creation data.
#[pallet::call_index(18)]
- #[pallet::weight(T::CommonWeightInfo::create_multiple_items_ex(data))]
+ #[pallet::weight(T::CommonWeightInfo::create_multiple_items_ex(data) + <Pallet<T>>::nesting_budget_predispatch_weight())]
pub fn create_multiple_items_ex(
origin: OriginFor<T>,
collection_id: CollectionId,
data: CreateItemExData<T::CrossAccountId>,
) -> DispatchResultWithPostInfo {
let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
- let budget = budget::Value::new(NESTING_BUDGET);
+ let budget = Self::structure_nesting_budget();
- dispatch_tx::<T, _>(collection_id, |d| {
- d.create_multiple_items_ex(sender, data, &budget)
- })
+ Self::refund_nesting_budget(
+ dispatch_tx::<T, _>(collection_id, |d| {
+ d.create_multiple_items_ex(sender, data, &budget)
+ }),
+ budget,
+ )
}
/// Completely allow or disallow transfers for a particular collection.
@@ -995,7 +1015,7 @@
/// * Fungible Mode: The desired number of pieces to burn.
/// * Re-Fungible Mode: The desired number of pieces to burn.
#[pallet::call_index(21)]
- #[pallet::weight(T::CommonWeightInfo::burn_from())]
+ #[pallet::weight(T::CommonWeightInfo::burn_from() + <Pallet<T>>::nesting_budget_predispatch_weight())]
pub fn burn_from(
origin: OriginFor<T>,
collection_id: CollectionId,
@@ -1004,11 +1024,14 @@
value: u128,
) -> DispatchResultWithPostInfo {
let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
- let budget = budget::Value::new(NESTING_BUDGET);
+ let budget = Self::structure_nesting_budget();
- dispatch_tx::<T, _>(collection_id, |d| {
- d.burn_from(sender, from, item_id, value, &budget)
- })
+ Self::refund_nesting_budget(
+ dispatch_tx::<T, _>(collection_id, |d| {
+ d.burn_from(sender, from, item_id, value, &budget)
+ }),
+ budget,
+ )
}
/// Change ownership of the token.
@@ -1033,7 +1056,7 @@
/// * Fungible Mode: The desired number of pieces to transfer.
/// * Re-Fungible Mode: The desired number of pieces to transfer.
#[pallet::call_index(22)]
- #[pallet::weight(T::CommonWeightInfo::transfer())]
+ #[pallet::weight(T::CommonWeightInfo::transfer() + <Pallet<T>>::nesting_budget_predispatch_weight())]
pub fn transfer(
origin: OriginFor<T>,
recipient: T::CrossAccountId,
@@ -1042,11 +1065,14 @@
value: u128,
) -> DispatchResultWithPostInfo {
let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
- let budget = budget::Value::new(NESTING_BUDGET);
+ let budget = Self::structure_nesting_budget();
- dispatch_tx::<T, _>(collection_id, |d| {
- d.transfer(sender, recipient, item_id, value, &budget)
- })
+ Self::refund_nesting_budget(
+ dispatch_tx::<T, _>(collection_id, |d| {
+ d.transfer(sender, recipient, item_id, value, &budget)
+ }),
+ budget,
+ )
}
/// Allow a non-permissioned address to transfer or burn an item.
@@ -1138,7 +1164,7 @@
/// * Fungible Mode: The desired number of pieces to transfer.
/// * Re-Fungible Mode: The desired number of pieces to transfer.
#[pallet::call_index(25)]
- #[pallet::weight(T::CommonWeightInfo::transfer_from())]
+ #[pallet::weight(T::CommonWeightInfo::transfer_from() + <Pallet<T>>::nesting_budget_predispatch_weight())]
pub fn transfer_from(
origin: OriginFor<T>,
from: T::CrossAccountId,
@@ -1148,11 +1174,14 @@
value: u128,
) -> DispatchResultWithPostInfo {
let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
- let budget = budget::Value::new(NESTING_BUDGET);
+ let budget = Self::structure_nesting_budget();
- dispatch_tx::<T, _>(collection_id, |d| {
- d.transfer_from(sender, from, recipient, item_id, value, &budget)
- })
+ Self::refund_nesting_budget(
+ dispatch_tx::<T, _>(collection_id, |d| {
+ d.transfer_from(sender, from, recipient, item_id, value, &budget)
+ }),
+ budget,
+ )
}
/// Set specific limits of a collection. Empty, or None fields mean chain default.
@@ -1348,5 +1377,40 @@
Ok(())
}
+
+ fn structure_nesting_budget() -> budget::Value {
+ budget::Value::new(Self::nesting_budget())
+ }
+
+ fn nesting_budget_predispatch_weight() -> Weight {
+ T::StructureWeightInfo::find_parent().saturating_mul(Self::nesting_budget() as u64)
+ }
+
+ pub fn refund_nesting_budget(
+ mut result: DispatchResultWithPostInfo,
+ budget: budget::Value,
+ ) -> DispatchResultWithPostInfo {
+ let refund_amount = budget.refund_amount();
+ let consumed = Self::nesting_budget() - refund_amount;
+
+ match &mut result {
+ Ok(PostDispatchInfo {
+ actual_weight: Some(weight),
+ ..
+ })
+ | Err(DispatchErrorWithPostInfo {
+ post_info: PostDispatchInfo {
+ actual_weight: Some(weight),
+ ..
+ },
+ ..
+ }) => {
+ *weight += T::StructureWeightInfo::find_parent().saturating_mul(consumed as u64)
+ }
+ _ => {}
+ }
+
+ result
+ }
}
}
primitives/common/src/constants.rsdiffbeforeafterboth--- a/primitives/common/src/constants.rs
+++ b/primitives/common/src/constants.rs
@@ -45,6 +45,7 @@
/// Minimum balance required to create or keep an account open.
pub const EXISTENTIAL_DEPOSIT: u128 = 0;
+
/// Amount of Balance reserved for candidate registration.
pub const GENESIS_LICENSE_BOND: u128 = 1_000_000_000_000 * UNIQUE;
/// Amount of maximum collators for Collator Selection.
primitives/data-structs/src/budget.rsdiffbeforeafterboth--- a/primitives/data-structs/src/budget.rs
+++ b/primitives/data-structs/src/budget.rs
@@ -1,4 +1,4 @@
-use core::cell::Cell;
+use sp_std::cell::Cell;
pub trait Budget {
/// Returns true while not exceeded
@@ -22,7 +22,7 @@
pub fn new(v: u32) -> Self {
Self(Cell::new(v))
}
- pub fn refund(self) -> u32 {
+ pub fn refund_amount(self) -> u32 {
self.0.get()
}
}
runtime/common/config/pallets/mod.rsdiffbeforeafterboth--- a/runtime/common/config/pallets/mod.rs
+++ b/runtime/common/config/pallets/mod.rs
@@ -116,6 +116,7 @@
impl pallet_unique::Config for Runtime {
type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;
type CommonWeightInfo = CommonWeights<Self>;
+ type StructureWeightInfo = pallet_structure::weights::SubstrateWeight<Self>;
type RefungibleExtensionsWeightInfo = CommonWeights<Self>;
}
runtime/common/runtime_apis.rsdiffbeforeafterboth--- a/runtime/common/runtime_apis.rs
+++ b/runtime/common/runtime_apis.rs
@@ -84,7 +84,7 @@
}
fn topmost_token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {
- let budget = up_data_structs::budget::Value::new(10);
+ let budget = budget::Value::new(10);
<pallet_structure::Pallet<Runtime>>::find_topmost_owner(collection, token, &budget)
}
runtime/common/weights/mod.rsdiffbeforeafterboth--- a/runtime/common/weights/mod.rs
+++ b/runtime/common/weights/mod.rs
@@ -98,10 +98,6 @@
dispatch_weight::<T>() + max_weight_of!(set_token_properties(amount))
}
- fn delete_token_properties(amount: u32) -> Weight {
- dispatch_weight::<T>() + max_weight_of!(delete_token_properties(amount))
- }
-
fn set_token_property_permissions(amount: u32) -> Weight {
dispatch_weight::<T>() + max_weight_of!(set_token_property_permissions(amount))
}
@@ -124,26 +120,14 @@
fn burn_from() -> Weight {
dispatch_weight::<T>() + max_weight_of!(burn_from())
- }
-
- fn burn_recursively_self_raw() -> Weight {
- max_weight_of!(burn_recursively_self_raw())
- }
-
- fn burn_recursively_breadth_raw(amount: u32) -> Weight {
- max_weight_of!(burn_recursively_breadth_raw(amount))
- }
-
- fn token_owner() -> Weight {
- max_weight_of!(token_owner())
}
fn set_allowance_for_all() -> Weight {
- max_weight_of!(set_allowance_for_all())
+ dispatch_weight::<T>() + max_weight_of!(set_allowance_for_all())
}
fn force_repair_item() -> Weight {
- max_weight_of!(force_repair_item())
+ dispatch_weight::<T>() + max_weight_of!(force_repair_item())
}
}
runtime/tests/src/lib.rsdiffbeforeafterboth--- a/runtime/tests/src/lib.rs
+++ b/runtime/tests/src/lib.rs
@@ -292,6 +292,7 @@
type WeightInfo = ();
type CommonWeightInfo = CommonWeights<Self>;
type RefungibleExtensionsWeightInfo = CommonWeights<Self>;
+ type StructureWeightInfo = pallet_structure::weights::SubstrateWeight<Self>;
}
// Build genesis storage according to the mock runtime.
runtime/tests/src/tests.rsdiffbeforeafterboth--- a/runtime/tests/src/tests.rs
+++ b/runtime/tests/src/tests.rs
@@ -2624,10 +2624,10 @@
use super::*;
- fn test<FTE: FnOnce() -> bool>(
+ fn test(
i: usize,
test_case: &pallet_common::tests::TestCase,
- check_token_existence: &mut LazyValue<bool, FTE>,
+ check_token_existence: &mut LazyValue<bool>,
) {
let collection_admin = test_case.collection_admin;
let mut is_collection_admin = LazyValue::new(|| test_case.is_collection_admin);
@@ -2635,7 +2635,7 @@
let mut is_token_owner = LazyValue::new(|| Ok(test_case.is_token_owner));
let is_no_permission = test_case.no_permission;
- let result = pallet_common::tests::check_token_permissions::<Test, _, _, FTE>(
+ let result = pallet_common::tests::check_token_permissions::<Test>(
collection_admin,
token_owner,
&mut is_collection_admin,
tests/src/eth/nativeFungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/nativeFungible.test.ts
+++ b/tests/src/eth/nativeFungible.test.ts
@@ -33,7 +33,7 @@
const collectionAddress = helper.ethAddress.fromCollectionId(0);
const contract = await helper.ethNativeContract.collection(collectionAddress, 'ft', owner);
- await expect(contract.methods.approve(spender, 100).call({from: owner})).to.be.rejectedWith('Approve not supported');
+ await expect(contract.methods.approve(spender, 100).call({from: owner})).to.be.rejectedWith('approve not supported');
});
itEth('balanceOf()', async ({helper}) => {
@@ -170,4 +170,4 @@
await expect(contract.methods.transferFromCross(receiver, receiver, 50).call({from: owner.eth})).to.be.rejectedWith('no permission');
});
-});
\ No newline at end of file
+});
tests/src/util/playgrounds/unique.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -3119,9 +3119,9 @@
async getTokenPropertiesConsumedSpace(tokenId: number): Promise<number> {
const api = this.helper.getApi();
- const props = (await api.query.nonfungible.tokenProperties(this.collectionId, tokenId)).toJSON();
+ const props = (await api.query.nonfungible.tokenProperties(this.collectionId, tokenId)).toJSON() as any;
- return (props! as any).consumedSpace;
+ return props?.consumedSpace ?? 0;
}
async transferToken(signer: TSigner, tokenId: number, addressObj: ICrossAccountId) {
@@ -3224,9 +3224,9 @@
async getTokenPropertiesConsumedSpace(tokenId: number): Promise<number> {
const api = this.helper.getApi();
- const props = (await api.query.refungible.tokenProperties(this.collectionId, tokenId)).toJSON();
+ const props = (await api.query.refungible.tokenProperties(this.collectionId, tokenId)).toJSON() as any;
- return (props! as any).consumedSpace;
+ return props?.consumedSpace ?? 0;
}
async transferToken(signer: TSigner, tokenId: number, addressObj: ICrossAccountId, amount = 1n) {