difftreelog
refactor property writer / fix set_token_props weight
in: master
27 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
@@ -34,7 +34,7 @@
MAX_TOKEN_PREFIX_LENGTH,
};
-use crate::{CollectionHandle, Config, Pallet};
+use crate::{BenchmarkPropertyWriter, CollectionHandle, Config, Pallet};
const SEED: u32 = 1;
@@ -123,16 +123,6 @@
CollectionMode::NFT,
|owner: T::CrossAccountId, data| <Pallet<T>>::init_collection(owner.clone(), owner, data),
|h| h,
- )
-}
-
-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),
)
}
@@ -272,7 +262,7 @@
#[block]
{
- load_is_admin_and_property_permissions(&collection, &sender);
+ <BenchmarkPropertyWriter<T>>::load_collection_info(&&collection, &sender);
}
Ok(())
pallets/common/src/lib.rsdiffbeforeafterboth--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -872,7 +872,7 @@
}
/// Value representation with delayed initialization time.
-pub struct LazyValue<T, F: FnOnce() -> T> {
+pub struct LazyValue<T, F> {
value: Option<T>,
f: Option<F>,
}
@@ -1902,7 +1902,9 @@
/// Collection property deletion weight.
///
/// * `amount`- The number of properties to set.
- fn delete_collection_properties(amount: u32) -> Weight;
+ fn delete_collection_properties(amount: u32) -> Weight {
+ Self::set_collection_properties(amount)
+ }
/// Token property setting weight.
///
@@ -1912,7 +1914,9 @@
/// Token property deletion weight.
///
/// * `amount`- The number of properties to delete.
- fn delete_token_properties(amount: u32) -> Weight;
+ fn delete_token_properties(amount: u32) -> Weight {
+ Self::set_token_properties(amount)
+ }
/// Token property permissions set weight.
///
@@ -1934,30 +1938,6 @@
/// The price of burning a token from another user.
fn burn_from() -> Weight;
- /// Differs from burn_item in case of Fungible and Refungible, as it should burn
- /// whole users's balance.
- ///
- /// This method shouldn't be used directly, as it doesn't count breadth price, use [burn_recursively](CommonWeightInfo::burn_recursively) instead
- fn burn_recursively_self_raw() -> Weight;
-
- /// Cost of iterating over `amount` children while burning, without counting child burning itself.
- ///
- /// This method shouldn't be used directly, as it doesn't count depth price, use [burn_recursively](CommonWeightInfo::burn_recursively) instead
- fn burn_recursively_breadth_raw(amount: u32) -> Weight;
-
- /// The price of recursive burning a token.
- ///
- /// `max_selfs` - The maximum burning weight of the token itself.
- /// `max_breadth` - The maximum number of nested tokens to burn.
- fn burn_recursively(max_selfs: u32, max_breadth: u32) -> Weight {
- Self::burn_recursively_self_raw()
- .saturating_mul(max_selfs.max(1) as u64)
- .saturating_add(Self::burn_recursively_breadth_raw(max_breadth))
- }
-
- /// The price of retrieving token owner
- fn token_owner() -> Weight;
-
/// The price of setting approval for all
fn set_allowance_for_all() -> Weight;
@@ -2029,20 +2009,6 @@
amount: u128,
) -> DispatchResultWithPostInfo;
- /// Burn token and all nested tokens recursievly.
- ///
- /// * `sender` - The user who owns the token.
- /// * `token` - Token id that will burned.
- /// * `self_budget` - The budget that can be spent on burning tokens.
- /// * `breadth_budget` - The budget that can be spent on burning nested tokens.
- fn burn_item_recursively(
- &self,
- sender: T::CrossAccountId,
- token: TokenId,
- self_budget: &dyn Budget,
- breadth_budget: &dyn Budget,
- ) -> DispatchResultWithPostInfo;
-
/// Set collection properties.
///
/// * `sender` - Must be either the owner of the collection or its admin.
@@ -2373,14 +2339,6 @@
}
}
}
-
-/// A marker structure that enables the writer implementation
-/// to provide the interface to write properties to **newly created** tokens.
-pub struct NewTokenPropertyWriter;
-
-/// A marker structure that enables the writer implementation
-/// to provide the interface to write properties to **already existing** tokens.
-pub struct ExistingTokenPropertyWriter;
/// The type-safe interface for writing properties (setting or deleting) to tokens.
/// It has two distinct implementations for newly created tokens and existing ones.
@@ -2388,146 +2346,39 @@
/// This type utilizes the lazy evaluation to avoid repeating the computation
/// of several performance-heavy or PoV-heavy tasks,
/// such as checking the indirect ownership or reading the token property permissions.
-pub struct PropertyWriter<
- 'a,
- T,
- Handle,
- WriterVariant,
- FIsAdmin,
- FPropertyPermissions,
- FCheckTokenExist,
- FGetProperties,
-> where
- T: Config,
- FIsAdmin: FnOnce() -> bool,
- FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,
-{
+pub struct PropertyWriter<'a, WriterVariant, T, Handle, FIsAdmin, FPropertyPermissions> {
collection: &'a Handle,
- is_collection_admin: LazyValue<bool, FIsAdmin>,
- property_permissions: LazyValue<PropertiesPermissionMap, FPropertyPermissions>,
- check_token_exist: FCheckTokenExist,
- get_properties: FGetProperties,
+ collection_lazy_info: PropertyWriterLazyCollectionInfo<FIsAdmin, FPropertyPermissions>,
_phantom: PhantomData<(T, WriterVariant)>,
}
-impl<'a, T, Handle, FIsAdmin, FPropertyPermissions, FCheckTokenExist, FGetProperties>
- PropertyWriter<
- 'a,
- T,
- Handle,
- NewTokenPropertyWriter,
- FIsAdmin,
- FPropertyPermissions,
- FCheckTokenExist,
- FGetProperties,
- > where
+impl<'a, T, Handle, WriterVariant, FIsAdmin, FPropertyPermissions>
+ PropertyWriter<'a, WriterVariant, T, Handle, FIsAdmin, FPropertyPermissions>
+where
T: Config,
Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,
FIsAdmin: FnOnce() -> bool,
FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,
- FCheckTokenExist: Copy + FnOnce(TokenId) -> bool,
- FGetProperties: Copy + FnOnce(TokenId) -> TokenProperties,
{
- /// A function to write properties to a **newly created** token.
- pub fn write_token_properties(
+ fn internal_write_token_properties<FCheckTokenExist, FCheckTokenOwner, FGetProperties>(
&mut self,
- mint_target_is_sender: bool,
token_id: TokenId,
- properties_updates: impl Iterator<Item = Property>,
- log: evm_coder::ethereum::Log,
- ) -> DispatchResult {
- self.internal_write_token_properties(
- token_id,
- properties_updates.map(|p| (p.key, Some(p.value))),
- |_| Ok(mint_target_is_sender),
- log,
- )
- }
-}
-
-impl<'a, T, Handle, FIsAdmin, FPropertyPermissions, FCheckTokenExist, FGetProperties>
- PropertyWriter<
- 'a,
- T,
- Handle,
- ExistingTokenPropertyWriter,
- FIsAdmin,
- FPropertyPermissions,
- FCheckTokenExist,
- FGetProperties,
- > where
- T: Config,
- Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,
- FIsAdmin: FnOnce() -> bool,
- FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,
- FCheckTokenExist: Copy + FnOnce(TokenId) -> bool,
- FGetProperties: Copy + FnOnce(TokenId) -> TokenProperties,
-{
- /// A function to write properties to an **already existing** token.
- pub fn write_token_properties(
- &mut self,
- sender: &T::CrossAccountId,
- token_id: TokenId,
- properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,
- nesting_budget: &dyn Budget,
- log: evm_coder::ethereum::Log,
- ) -> DispatchResult {
- self.internal_write_token_properties(
- token_id,
- properties_updates,
- |collection| collection.check_token_indirect_owner(token_id, sender, nesting_budget),
- log,
- )
- }
-}
-
-impl<
- 'a,
- T,
- Handle,
- WriterVariant,
- FIsAdmin,
- FPropertyPermissions,
- FCheckTokenExist,
- FGetProperties,
- >
- PropertyWriter<
- 'a,
- T,
- Handle,
- WriterVariant,
- FIsAdmin,
- FPropertyPermissions,
- FCheckTokenExist,
- FGetProperties,
- > where
- T: Config,
- Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,
- FIsAdmin: FnOnce() -> bool,
- FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,
- FCheckTokenExist: Copy + FnOnce(TokenId) -> bool,
- FGetProperties: Copy + FnOnce(TokenId) -> TokenProperties,
-{
- fn internal_write_token_properties<FCheckTokenOwner>(
- &mut self,
- token_id: TokenId,
+ mut token_lazy_info: PropertyWriterLazyTokenInfo<
+ FCheckTokenExist,
+ FCheckTokenOwner,
+ FGetProperties,
+ >,
properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,
- check_token_owner: FCheckTokenOwner,
log: evm_coder::ethereum::Log,
) -> DispatchResult
where
- FCheckTokenOwner: FnOnce(&Handle) -> Result<bool, DispatchError>,
+ FCheckTokenExist: FnOnce() -> bool,
+ FCheckTokenOwner: FnOnce() -> Result<bool, DispatchError>,
+ FGetProperties: FnOnce() -> TokenProperties,
{
- let get_properties = self.get_properties;
- let mut stored_properties = LazyValue::new(move || get_properties(token_id));
-
- let mut is_token_owner = LazyValue::new(|| check_token_owner(self.collection));
-
- let check_token_exist = self.check_token_exist;
- let mut is_token_exist = LazyValue::new(move || check_token_exist(token_id));
-
for (key, value) in properties_updates {
let permission = self
+ .collection_lazy_info
.property_permissions
.value()
.get(&key)
@@ -2536,7 +2387,11 @@
match permission {
PropertyPermission { mutable: false, .. }
- if stored_properties.value().get(&key).is_some() =>
+ if token_lazy_info
+ .stored_properties
+ .value()
+ .get(&key)
+ .is_some() =>
{
return Err(<Error<T>>::NoPermission.into());
}
@@ -2548,15 +2403,16 @@
} => check_token_permissions::<T, _, _, _>(
collection_admin,
token_owner,
- &mut self.is_collection_admin,
- &mut is_token_owner,
- &mut is_token_exist,
+ &mut self.collection_lazy_info.is_collection_admin,
+ &mut token_lazy_info.is_token_owner,
+ &mut token_lazy_info.is_token_exist,
)?,
}
match value {
Some(value) => {
- stored_properties
+ token_lazy_info
+ .stored_properties
.value_mut()
.try_set(key.clone(), value)
.map_err(<Error<T>>::from)?;
@@ -2568,7 +2424,8 @@
));
}
None => {
- stored_properties
+ token_lazy_info
+ .stored_properties
.value_mut()
.remove(&key)
.map_err(<Error<T>>::from)?;
@@ -2582,142 +2439,330 @@
}
}
- let properties_changed = stored_properties.has_value();
+ let properties_changed = token_lazy_info.stored_properties.has_value();
if properties_changed {
<PalletEvm<T>>::deposit_log(log);
self.collection
- .set_token_properties_raw(token_id, stored_properties.into_inner());
+ .set_token_properties_raw(token_id, token_lazy_info.stored_properties.into_inner());
}
Ok(())
}
}
-/// Create a [`PropertyWriter`] for newly created tokens.
-pub fn property_writer_for_new_token<'a, T, Handle>(
- collection: &'a Handle,
- sender: &'a T::CrossAccountId,
-) -> PropertyWriter<
- 'a,
- T,
- Handle,
- NewTokenPropertyWriter,
- impl FnOnce() -> bool + 'a,
- impl FnOnce() -> PropertiesPermissionMap + 'a,
- impl Copy + FnOnce(TokenId) -> bool + 'a,
- impl Copy + FnOnce(TokenId) -> TokenProperties + 'a,
->
+/// A helper structure for the [`PropertyWriter`] that holds
+/// the collection-related info. The info is loaded using lazy evaluation.
+/// This info is common for any token for which we write properties.
+pub struct PropertyWriterLazyCollectionInfo<FIsAdmin, FPropertyPermissions> {
+ is_collection_admin: LazyValue<bool, FIsAdmin>,
+ property_permissions: LazyValue<PropertiesPermissionMap, FPropertyPermissions>,
+}
+
+/// A helper structure for the [`PropertyWriter`] that holds
+/// the token-related info. The info is loaded using lazy evaluation.
+pub struct PropertyWriterLazyTokenInfo<FCheckTokenExist, FCheckTokenOwner, FGetProperties> {
+ is_token_exist: LazyValue<bool, FCheckTokenExist>,
+ is_token_owner: LazyValue<Result<bool, DispatchError>, FCheckTokenOwner>,
+ stored_properties: LazyValue<TokenProperties, FGetProperties>,
+}
+
+impl<FCheckTokenExist, FCheckTokenOwner, FGetProperties>
+ PropertyWriterLazyTokenInfo<FCheckTokenExist, FCheckTokenOwner, FGetProperties>
where
+ FCheckTokenExist: FnOnce() -> bool,
+ FCheckTokenOwner: FnOnce() -> Result<bool, DispatchError>,
+ FGetProperties: FnOnce() -> TokenProperties,
+{
+ /// Create a lazy token info.
+ pub fn new(
+ check_token_exist: FCheckTokenExist,
+ check_token_owner: FCheckTokenOwner,
+ get_token_properties: FGetProperties,
+ ) -> Self {
+ Self {
+ is_token_exist: LazyValue::new(check_token_exist),
+ is_token_owner: LazyValue::new(check_token_owner),
+ stored_properties: LazyValue::new(get_token_properties),
+ }
+ }
+}
+
+/// A marker structure that enables the writer implementation
+/// to provide the interface to write properties to **newly created** tokens.
+pub struct NewTokenPropertyWriter<T>(PhantomData<T>);
+impl<T: Config> NewTokenPropertyWriter<T> {
+ /// Creates a [`PropertyWriter`] for **newly created** tokens.
+ pub fn new<'a, Handle>(
+ collection: &'a Handle,
+ sender: &'a T::CrossAccountId,
+ ) -> PropertyWriter<
+ 'a,
+ Self,
+ T,
+ Handle,
+ impl FnOnce() -> bool + 'a,
+ impl FnOnce() -> PropertiesPermissionMap + 'a,
+ >
+ where
+ T: Config,
+ Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,
+ {
+ PropertyWriter {
+ collection,
+ collection_lazy_info: PropertyWriterLazyCollectionInfo {
+ is_collection_admin: LazyValue::new(|| collection.is_owner_or_admin(sender)),
+ property_permissions: LazyValue::new(|| {
+ <Pallet<T>>::property_permissions(collection.id)
+ }),
+ },
+ _phantom: PhantomData,
+ }
+ }
+}
+
+impl<'a, T, Handle, FIsAdmin, FPropertyPermissions>
+ PropertyWriter<'a, NewTokenPropertyWriter<T>, T, Handle, FIsAdmin, FPropertyPermissions>
+where
T: Config,
Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,
+ FIsAdmin: FnOnce() -> bool,
+ FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,
{
- PropertyWriter {
- collection,
- is_collection_admin: LazyValue::new(|| collection.is_owner_or_admin(sender)),
- property_permissions: LazyValue::new(|| <Pallet<T>>::property_permissions(collection.id)),
- check_token_exist: |token_id| {
- debug_assert!(collection.token_exists(token_id));
+ /// A function to write properties to a **newly created** token.
+ pub fn write_token_properties(
+ &mut self,
+ mint_target_is_sender: bool,
+ token_id: TokenId,
+ properties_updates: impl Iterator<Item = Property>,
+ log: evm_coder::ethereum::Log,
+ ) -> DispatchResult {
+ let check_token_exist = || {
+ debug_assert!(self.collection.token_exists(token_id));
true
- },
- get_properties: |token_id| {
- debug_assert!(collection.get_token_properties_raw(token_id).is_none());
+ };
+
+ let check_token_owner = || Ok(mint_target_is_sender);
+
+ let get_token_properties = || {
+ debug_assert!(self.collection.get_token_properties_raw(token_id).is_none());
TokenProperties::new()
- },
- _phantom: PhantomData,
+ };
+
+ self.internal_write_token_properties(
+ token_id,
+ PropertyWriterLazyTokenInfo::new(
+ check_token_exist,
+ check_token_owner,
+ get_token_properties,
+ ),
+ properties_updates.map(|p| (p.key, Some(p.value))),
+ log,
+ )
}
}
-#[cfg(feature = "runtime-benchmarks")]
-/// Create a `PropertyWriter` with preloaded `is_collection_admin` and `property_permissions.
-/// Also:
-/// * it will return `true` for the token ownership check.
-/// * it will return empty stored properties without reading them from the storage.
-pub fn collection_info_loaded_property_writer<T, Handle>(
- collection: &Handle,
- is_collection_admin: bool,
- property_permissions: PropertiesPermissionMap,
-) -> PropertyWriter<
- T,
- Handle,
- NewTokenPropertyWriter,
- impl FnOnce() -> bool,
- impl FnOnce() -> PropertiesPermissionMap,
- impl Copy + FnOnce(TokenId) -> bool,
- impl Copy + FnOnce(TokenId) -> TokenProperties,
->
+/// A marker structure that enables the writer implementation
+/// to provide the interface to write properties to **already existing** tokens.
+pub struct ExistingTokenPropertyWriter<T>(PhantomData<T>);
+impl<T: Config> ExistingTokenPropertyWriter<T> {
+ /// Creates a [`PropertyWriter`] for **already existing** tokens.
+ pub fn new<'a, Handle>(
+ collection: &'a Handle,
+ sender: &'a T::CrossAccountId,
+ ) -> PropertyWriter<
+ 'a,
+ Self,
+ T,
+ Handle,
+ impl FnOnce() -> bool + 'a,
+ impl FnOnce() -> PropertiesPermissionMap + 'a,
+ >
+ where
+ Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,
+ {
+ PropertyWriter {
+ collection,
+ collection_lazy_info: PropertyWriterLazyCollectionInfo {
+ is_collection_admin: LazyValue::new(|| collection.is_owner_or_admin(sender)),
+ property_permissions: LazyValue::new(|| {
+ <Pallet<T>>::property_permissions(collection.id)
+ }),
+ },
+ _phantom: PhantomData,
+ }
+ }
+}
+
+impl<'a, T, Handle, FIsAdmin, FPropertyPermissions>
+ PropertyWriter<'a, ExistingTokenPropertyWriter<T>, T, Handle, FIsAdmin, FPropertyPermissions>
where
T: Config,
Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,
+ FIsAdmin: FnOnce() -> bool,
+ FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,
{
- PropertyWriter {
- collection,
- is_collection_admin: LazyValue::new(move || is_collection_admin),
- property_permissions: LazyValue::new(move || property_permissions),
- check_token_exist: |_token_id| true,
- get_properties: |_token_id| TokenProperties::new(),
- _phantom: PhantomData,
+ /// A function to write properties to an **already existing** token.
+ pub fn write_token_properties(
+ &mut self,
+ sender: &T::CrossAccountId,
+ token_id: TokenId,
+ properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,
+ nesting_budget: &dyn Budget,
+ log: evm_coder::ethereum::Log,
+ ) -> DispatchResult {
+ let check_token_exist = || self.collection.token_exists(token_id);
+ let check_token_owner = || {
+ self.collection
+ .check_token_indirect_owner(token_id, sender, nesting_budget)
+ };
+ let get_token_properties = || {
+ self.collection
+ .get_token_properties_raw(token_id)
+ .unwrap_or_default()
+ };
+
+ self.internal_write_token_properties(
+ token_id,
+ PropertyWriterLazyTokenInfo::new(
+ check_token_exist,
+ check_token_owner,
+ get_token_properties,
+ ),
+ properties_updates,
+ log,
+ )
}
}
-/// Create a [`PropertyWriter`] for already existing tokens.
-pub fn property_writer_for_existing_token<'a, T, Handle>(
- collection: &'a Handle,
- sender: &'a T::CrossAccountId,
-) -> PropertyWriter<
- 'a,
- T,
- Handle,
- ExistingTokenPropertyWriter,
- impl FnOnce() -> bool + 'a,
- impl FnOnce() -> PropertiesPermissionMap + 'a,
- impl Copy + FnOnce(TokenId) -> bool + 'a,
- impl Copy + FnOnce(TokenId) -> TokenProperties + 'a,
->
+/// A marker structure that enables the writer implementation
+/// to benchmark the token properties writing.
+#[cfg(feature = "runtime-benchmarks")]
+pub struct BenchmarkPropertyWriter<T>(PhantomData<T>);
+
+#[cfg(feature = "runtime-benchmarks")]
+impl<T: Config> BenchmarkPropertyWriter<T> {
+ /// Creates a [`PropertyWriter`] for benchmarking tokens properties writing.
+ pub fn new<'a, Handle, FIsAdmin, FPropertyPermissions>(
+ collection: &Handle,
+ collection_lazy_info: PropertyWriterLazyCollectionInfo<FIsAdmin, FPropertyPermissions>,
+ ) -> PropertyWriter<Self, T, Handle, FIsAdmin, FPropertyPermissions>
+ where
+ Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,
+ FIsAdmin: FnOnce() -> bool,
+ FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,
+ {
+ PropertyWriter {
+ collection,
+ collection_lazy_info,
+ _phantom: PhantomData,
+ }
+ }
+
+ /// Load the [`PropertyWriterLazyCollectionInfo`] from the storage.
+ pub fn load_collection_info<Handle>(
+ collection_handle: &Handle,
+ sender: &T::CrossAccountId,
+ ) -> PropertyWriterLazyCollectionInfo<
+ impl FnOnce() -> bool,
+ impl FnOnce() -> PropertiesPermissionMap,
+ >
+ where
+ Handle: Deref<Target = CollectionHandle<T>>,
+ {
+ let is_collection_admin = collection_handle.is_owner_or_admin(sender);
+ let property_permissions = <Pallet<T>>::property_permissions(collection_handle.id);
+
+ PropertyWriterLazyCollectionInfo {
+ is_collection_admin: LazyValue::new(move || is_collection_admin),
+ property_permissions: LazyValue::new(move || property_permissions),
+ }
+ }
+
+ /// Load the [`PropertyWriterLazyTokenInfo`] with token properties from the storage.
+ pub fn load_token_properties<Handle>(
+ collection: &Handle,
+ token_id: TokenId,
+ ) -> PropertyWriterLazyTokenInfo<
+ impl FnOnce() -> bool,
+ impl FnOnce() -> Result<bool, DispatchError>,
+ impl FnOnce() -> TokenProperties,
+ >
+ where
+ Handle: CommonCollectionOperations<T>,
+ {
+ let stored_properties = collection
+ .get_token_properties_raw(token_id)
+ .unwrap_or_default();
+
+ PropertyWriterLazyTokenInfo {
+ is_token_exist: LazyValue::new(|| true),
+ is_token_owner: LazyValue::new(|| Ok(true)),
+ stored_properties: LazyValue::new(move || stored_properties),
+ }
+ }
+}
+
+#[cfg(feature = "runtime-benchmarks")]
+impl<'a, T, Handle, FIsAdmin, FPropertyPermissions>
+ PropertyWriter<'a, BenchmarkPropertyWriter<T>, T, Handle, FIsAdmin, FPropertyPermissions>
where
T: Config,
Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,
+ FIsAdmin: FnOnce() -> bool,
+ FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,
{
- PropertyWriter {
- collection,
- is_collection_admin: LazyValue::new(|| collection.is_owner_or_admin(sender)),
- property_permissions: LazyValue::new(|| <Pallet<T>>::property_permissions(collection.id)),
- check_token_exist: |token_id| collection.token_exists(token_id),
- get_properties: |token_id| {
- collection
- .get_token_properties_raw(token_id)
- .unwrap_or_default()
- },
- _phantom: PhantomData,
+ /// A function to benchmark the writing of token properties.
+ pub fn write_token_properties(
+ &mut self,
+ token_id: TokenId,
+ properties_updates: impl Iterator<Item = Property>,
+ log: evm_coder::ethereum::Log,
+ ) -> DispatchResult {
+ let check_token_exist = || true;
+ let check_token_owner = || Ok(true);
+ let get_token_properties = || TokenProperties::new();
+
+ self.internal_write_token_properties(
+ token_id,
+ PropertyWriterLazyTokenInfo::new(
+ check_token_exist,
+ check_token_owner,
+ get_token_properties,
+ ),
+ properties_updates.map(|p| (p.key, Some(p.value))),
+ log,
+ )
}
}
-/// Computes the weight delta for newly created tokens with properties.
+/// Computes the weight of writing properties to tokens.
/// * `properties_nums` - The properties num of each created token.
-/// * `init_token_properties` - The function to obtain the weight from a token's properties num.
-pub fn init_token_properties_delta<T: Config, I: Fn(u32) -> Weight>(
+/// * `per_token_weight_weight` - The function to obtain the weight
+/// of writing properties from a token's properties num.
+pub fn write_token_properties_total_weight<T: Config, I: Fn(u32) -> Weight>(
properties_nums: impl Iterator<Item = u32>,
- init_token_properties: I,
+ per_token_weight: I,
) -> Weight {
- let mut delta = properties_nums
+ let mut weight = properties_nums
.filter_map(|properties_num| {
if properties_num > 0 {
- Some(init_token_properties(properties_num))
+ Some(per_token_weight(properties_num))
} else {
None
}
})
.fold(Weight::zero(), |a, b| a.saturating_add(b));
- // If at least once the `init_token_properties` was called,
- // it means at least one newly created token has properties.
- // Becuase of that, some common collection data also was loaded and we need to add this weight.
- // However, these common data was loaded only once which is guaranteed by the `PropertyWriter`.
- if !delta.is_zero() {
- delta = delta.saturating_add(<SelfWeightOf<T>>::init_token_properties_common())
+ if !weight.is_zero() {
+ // If we are here, it means the token properties were written at least once.
+ // Because of that, some common collection data was also loaded; we must add this weight.
+ // However, this common data was loaded only once, which is guaranteed by the `PropertyWriter`.
+
+ weight = weight.saturating_add(<SelfWeightOf<T>>::property_writer_load_collection_info());
}
- delta
+ weight
}
#[cfg(any(feature = "tests", test))]
pallets/common/src/weights.rsdiffbeforeafterboth--- a/pallets/common/src/weights.rs
+++ b/pallets/common/src/weights.rs
@@ -3,9 +3,9 @@
//! 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-05, 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`
+//! HOSTNAME: `hearthstone`, CPU: `AMD Ryzen 9 7950X3D 16-Core Processor`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
@@ -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
@@ -36,7 +36,7 @@
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.
@@ -49,10 +49,10 @@
// 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: 2_840_000 picoseconds.
+ Weight::from_parts(1_988_405, 44457)
+ // Standard Error: 7_834
+ .saturating_add(Weight::from_parts(3_053_965, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -63,10 +63,10 @@
// 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: 2_770_000 picoseconds.
+ Weight::from_parts(2_940_000, 44457)
+ // Standard Error: 30_686
+ .saturating_add(Weight::from_parts(9_801_835, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -76,20 +76,20 @@
// 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: 2_830_000 picoseconds.
+ Weight::from_parts(2_950_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 {
+ 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: 3_970_000 picoseconds.
+ Weight::from_parts(4_140_000, 20191)
.saturating_add(T::DbWeight::get().reads(2_u64))
}
}
@@ -103,10 +103,10 @@
// 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: 2_840_000 picoseconds.
+ Weight::from_parts(1_988_405, 44457)
+ // Standard Error: 7_834
+ .saturating_add(Weight::from_parts(3_053_965, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -117,10 +117,10 @@
// 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: 2_770_000 picoseconds.
+ Weight::from_parts(2_940_000, 44457)
+ // Standard Error: 30_686
+ .saturating_add(Weight::from_parts(9_801_835, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -130,20 +130,20 @@
// 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: 2_830_000 picoseconds.
+ Weight::from_parts(2_950_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 {
+ 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: 3_970_000 picoseconds.
+ Weight::from_parts(4_140_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
@@ -262,9 +262,82 @@
{
<Pallet<T>>::burn_from(&collection, &burner, &sender, item, &Unlimited)?;
}
+ }
- Ok(())
- }
+ // set_token_properties {
+ // let b in 0..MAX_PROPERTIES_PER_ITEM;
+ // 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)?;
+ // 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)?}
+
+ // load_token_properties {
+ // bench_init!{
+ // owner: sub; collection: collection(owner);
+ // owner: cross_from_sub;
+ // };
+
+ // let item = create_max_item(&collection, &owner, owner.clone())?;
+ // }: {
+ // pallet_common::BenchmarkPropertyWriter::<T>::load_token_properties(
+ // &collection,
+ // item,
+ // )
+ // }
+
+ // write_token_properties {
+ // let b in 0..MAX_PROPERTIES_PER_ITEM;
+ // 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)?;
+ // 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 lazy_collection_info = pallet_common::BenchmarkPropertyWriter::<T>::load_collection_info(
+ // &collection,
+ // &owner,
+ // );
+ // }: {
+ // 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()),
+ // )?
+ // }
#[benchmark]
fn set_token_property_permissions(
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;
@@ -39,9 +40,9 @@
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, _>(
+ .saturating_add(write_token_properties_total_weight::<T, _>(
t.iter().map(|t| t.properties.len() as u32),
- <SelfWeightOf<T>>::init_token_properties,
+ <SelfWeightOf<T>>::write_token_properties,
)),
_ => Weight::zero(),
}
@@ -49,12 +50,12 @@
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, _>(
+ write_token_properties_total_weight::<T, _>(
data.iter().map(|t| match t {
up_data_structs::CreateItemData::NFT(n) => n.properties.len() as u32,
_ => 0,
}),
- <SelfWeightOf<T>>::init_token_properties,
+ <SelfWeightOf<T>>::write_token_properties,
),
)
}
@@ -67,16 +68,15 @@
<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 +84,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 +97,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 {
@@ -306,16 +294,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,14 +38,14 @@
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::{
@@ -78,6 +78,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 +150,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 +165,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 +179,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 +189,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 +199,7 @@
&caller,
TokenId(token_id),
properties.into_iter(),
- &nesting_budget,
+ &nesting_budget(&self.recorder),
)
.map_err(dispatch_to_evm::<T>)
}
@@ -213,7 +209,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 +217,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 +245,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 +475,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 +592,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 +608,7 @@
properties: BoundedVec::default(),
owner: to,
},
- &budget,
+ &nesting_budget(&self.recorder),
)
.map_err(dispatch_to_evm::<T>)?;
@@ -664,9 +659,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 +686,7 @@
properties,
owner: to,
},
- &budget,
+ &nesting_budget(&self.recorder),
)
.map_err(dispatch_to_evm::<T>)?;
Ok(true)
@@ -840,11 +832,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 +853,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 +877,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 +902,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 +924,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 +951,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,7 +967,7 @@
})
.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)
}
@@ -995,9 +977,6 @@
#[weight(<SelfWeightOf<T>>::create_multiple_items(data.len() as u32) + <SelfWeightOf<T>>::set_token_properties(data.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 +992,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)
}
@@ -1037,9 +1021,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 +1047,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)
}
@@ -1096,10 +1077,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 +1085,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,9 +3,9 @@
//! 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-05, 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`
+//! HOSTNAME: `hearthstone`, CPU: `AMD Ryzen 9 7950X3D 16-Core Processor`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
@@ -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
@@ -46,7 +46,8 @@
fn burn_from() -> Weight;
fn set_token_property_permissions(b: u32, ) -> Weight;
fn set_token_properties(b: u32, ) -> Weight;
- fn init_token_properties(b: u32, ) -> Weight;
+ fn load_token_properties() -> Weight;
+ fn write_token_properties(b: u32, ) -> Weight;
fn delete_token_properties(b: u32, ) -> Weight;
fn token_owner() -> Weight;
fn set_allowance_for_all() -> Weight;
@@ -69,8 +70,8 @@
// 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: 4_990_000 picoseconds.
+ Weight::from_parts(5_170_000, 3530)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
@@ -87,10 +88,10 @@
// 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: 1_680_000 picoseconds.
+ Weight::from_parts(1_720_000, 3530)
+ // Standard Error: 674
+ .saturating_add(Weight::from_parts(2_406_591, 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())))
@@ -108,10 +109,10 @@
// 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: 1_680_000 picoseconds.
+ Weight::from_parts(1_720_000, 3481)
+ // Standard Error: 1_729
+ .saturating_add(Weight::from_parts(3_418_983, 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))
@@ -136,8 +137,8 @@
// Proof Size summary in bytes:
// Measured: `380`
// Estimated: `3530`
- // Minimum execution time: 18_062_000 picoseconds.
- Weight::from_parts(18_433_000, 3530)
+ // Minimum execution time: 10_700_000 picoseconds.
+ Weight::from_parts(11_180_000, 3530)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
@@ -159,8 +160,8 @@
// 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: 13_650_000 picoseconds.
+ Weight::from_parts(13_910_000, 3530)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
@@ -185,10 +186,10 @@
// 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()))
+ // Minimum execution time: 13_500_000 picoseconds.
+ Weight::from_parts(13_830_000, 5874)
+ // Standard Error: 136_447
+ .saturating_add(Weight::from_parts(43_149_279, 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))
@@ -207,8 +208,8 @@
// 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: 8_440_000 picoseconds.
+ Weight::from_parts(8_680_000, 6070)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
@@ -220,8 +221,8 @@
// 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: 4_580_000 picoseconds.
+ Weight::from_parts(4_850_000, 3522)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -233,8 +234,8 @@
// 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: 4_650_000 picoseconds.
+ Weight::from_parts(4_890_000, 3522)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -244,8 +245,8 @@
// 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: 2_630_000 picoseconds.
+ Weight::from_parts(2_760_000, 3522)
.saturating_add(T::DbWeight::get().reads(1_u64))
}
/// Storage: Nonfungible Allowance (r:1 w:1)
@@ -266,8 +267,8 @@
// 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: 13_300_000 picoseconds.
+ Weight::from_parts(13_650_000, 3530)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(6_u64))
}
@@ -278,10 +279,10 @@
// 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()))
+ // Minimum execution time: 550_000 picoseconds.
+ Weight::from_parts(600_000, 20191)
+ // Standard Error: 23_117
+ .saturating_add(Weight::from_parts(6_048_092, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -296,24 +297,34 @@
// Proof Size summary in bytes:
// Measured: `640 + b * (261 ±0)`
// 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()))
+ // Minimum execution time: 340_000 picoseconds.
+ Weight::from_parts(7_359_078, 36269)
+ // Standard Error: 9_052
+ .saturating_add(Weight::from_parts(2_763_267, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
+ /// 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: `279`
+ // Estimated: `36269`
+ // Minimum execution time: 1_610_000 picoseconds.
+ Weight::from_parts(1_690_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)
/// 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: 70_000 picoseconds.
+ Weight::from_parts(3_262_181, 0)
+ // Standard Error: 5_240
+ .saturating_add(Weight::from_parts(2_426_582, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: Common CollectionPropertyPermissions (r:1 w:0)
@@ -327,10 +338,10 @@
// 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()))
+ // Minimum execution time: 350_000 picoseconds.
+ Weight::from_parts(370_000, 36269)
+ // Standard Error: 29_081
+ .saturating_add(Weight::from_parts(9_667_268, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -340,8 +351,8 @@
// Proof Size summary in bytes:
// Measured: `326`
// Estimated: `3522`
- // Minimum execution time: 3_743_000 picoseconds.
- Weight::from_parts(3_908_000, 3522)
+ // Minimum execution time: 2_380_000 picoseconds.
+ Weight::from_parts(2_500_000, 3522)
.saturating_add(T::DbWeight::get().reads(1_u64))
}
/// Storage: Nonfungible CollectionAllowance (r:0 w:1)
@@ -350,8 +361,8 @@
// 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: 2_060_000 picoseconds.
+ Weight::from_parts(2_150_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: Nonfungible CollectionAllowance (r:1 w:0)
@@ -360,8 +371,8 @@
// 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: 1_630_000 picoseconds.
+ Weight::from_parts(1_730_000, 3576)
.saturating_add(T::DbWeight::get().reads(1_u64))
}
/// Storage: Nonfungible TokenProperties (r:1 w:1)
@@ -370,8 +381,8 @@
// 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: 1_700_000 picoseconds.
+ Weight::from_parts(1_780_000, 36269)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
@@ -391,8 +402,8 @@
// 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: 4_990_000 picoseconds.
+ Weight::from_parts(5_170_000, 3530)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
@@ -409,10 +420,10 @@
// 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: 1_680_000 picoseconds.
+ Weight::from_parts(1_720_000, 3530)
+ // Standard Error: 674
+ .saturating_add(Weight::from_parts(2_406_591, 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())))
@@ -430,10 +441,10 @@
// 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: 1_680_000 picoseconds.
+ Weight::from_parts(1_720_000, 3481)
+ // Standard Error: 1_729
+ .saturating_add(Weight::from_parts(3_418_983, 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))
@@ -458,8 +469,8 @@
// Proof Size summary in bytes:
// Measured: `380`
// Estimated: `3530`
- // Minimum execution time: 18_062_000 picoseconds.
- Weight::from_parts(18_433_000, 3530)
+ // Minimum execution time: 10_700_000 picoseconds.
+ Weight::from_parts(11_180_000, 3530)
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(5_u64))
}
@@ -481,8 +492,8 @@
// 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: 13_650_000 picoseconds.
+ Weight::from_parts(13_910_000, 3530)
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(5_u64))
}
@@ -507,10 +518,10 @@
// 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()))
+ // Minimum execution time: 13_500_000 picoseconds.
+ Weight::from_parts(13_830_000, 5874)
+ // Standard Error: 136_447
+ .saturating_add(Weight::from_parts(43_149_279, 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))
@@ -529,8 +540,8 @@
// 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: 8_440_000 picoseconds.
+ Weight::from_parts(8_680_000, 6070)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(5_u64))
}
@@ -542,8 +553,8 @@
// 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: 4_580_000 picoseconds.
+ Weight::from_parts(4_850_000, 3522)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -555,8 +566,8 @@
// 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: 4_650_000 picoseconds.
+ Weight::from_parts(4_890_000, 3522)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -566,8 +577,8 @@
// 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: 2_630_000 picoseconds.
+ Weight::from_parts(2_760_000, 3522)
.saturating_add(RocksDbWeight::get().reads(1_u64))
}
/// Storage: Nonfungible Allowance (r:1 w:1)
@@ -588,8 +599,8 @@
// 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: 13_300_000 picoseconds.
+ Weight::from_parts(13_650_000, 3530)
.saturating_add(RocksDbWeight::get().reads(5_u64))
.saturating_add(RocksDbWeight::get().writes(6_u64))
}
@@ -600,10 +611,10 @@
// 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()))
+ // Minimum execution time: 550_000 picoseconds.
+ Weight::from_parts(600_000, 20191)
+ // Standard Error: 23_117
+ .saturating_add(Weight::from_parts(6_048_092, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -618,24 +629,34 @@
// Proof Size summary in bytes:
// Measured: `640 + b * (261 ±0)`
// 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()))
+ // Minimum execution time: 340_000 picoseconds.
+ Weight::from_parts(7_359_078, 36269)
+ // Standard Error: 9_052
+ .saturating_add(Weight::from_parts(2_763_267, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
+ /// 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: `279`
+ // Estimated: `36269`
+ // Minimum execution time: 1_610_000 picoseconds.
+ Weight::from_parts(1_690_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)
/// 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: 70_000 picoseconds.
+ Weight::from_parts(3_262_181, 0)
+ // Standard Error: 5_240
+ .saturating_add(Weight::from_parts(2_426_582, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: Common CollectionPropertyPermissions (r:1 w:0)
@@ -649,10 +670,10 @@
// 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()))
+ // Minimum execution time: 350_000 picoseconds.
+ Weight::from_parts(370_000, 36269)
+ // Standard Error: 29_081
+ .saturating_add(Weight::from_parts(9_667_268, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
@@ -662,8 +683,8 @@
// Proof Size summary in bytes:
// Measured: `326`
// Estimated: `3522`
- // Minimum execution time: 3_743_000 picoseconds.
- Weight::from_parts(3_908_000, 3522)
+ // Minimum execution time: 2_380_000 picoseconds.
+ Weight::from_parts(2_500_000, 3522)
.saturating_add(RocksDbWeight::get().reads(1_u64))
}
/// Storage: Nonfungible CollectionAllowance (r:0 w:1)
@@ -672,8 +693,8 @@
// 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: 2_060_000 picoseconds.
+ Weight::from_parts(2_150_000, 0)
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: Nonfungible CollectionAllowance (r:1 w:0)
@@ -682,8 +703,8 @@
// 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: 1_630_000 picoseconds.
+ Weight::from_parts(1_730_000, 3576)
.saturating_add(RocksDbWeight::get().reads(1_u64))
}
/// Storage: Nonfungible TokenProperties (r:1 w:1)
@@ -692,8 +713,8 @@
// 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: 1_700_000 picoseconds.
+ Weight::from_parts(1_780_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::{
@@ -424,6 +421,81 @@
Ok(())
}
+ // set_token_properties {
+ // let b in 0..MAX_PROPERTIES_PER_ITEM;
+ // 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)?;
+ // 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)?}
+
+ // load_token_properties {
+ // bench_init!{
+ // owner: sub; collection: collection(owner);
+ // owner: cross_from_sub;
+ // };
+
+ // let item = create_max_item(&collection, &owner, [(owner.clone(), 200)])?;
+ // }: {
+ // pallet_common::BenchmarkPropertyWriter::<T>::load_token_properties(
+ // &collection,
+ // item,
+ // )
+ // }
+
+ // write_token_properties {
+ // let b in 0..MAX_PROPERTIES_PER_ITEM;
+ // 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)?;
+ // 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 lazy_collection_info = pallet_common::BenchmarkPropertyWriter::<T>::load_collection_info(
+ // &collection,
+ // &owner,
+ // );
+ // }: {
+ // 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()),
+ // )?
+ // }
+
#[benchmark]
fn set_token_property_permissions(
b: Linear<0, MAX_PROPERTIES_PER_ITEM>,
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::{
@@ -50,14 +48,14 @@
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, _>(
+ write_token_properties_total_weight::<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,
+ <SelfWeightOf<T>>::write_token_properties,
),
)
}
@@ -66,16 +64,16 @@
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, _>(
+ .saturating_add(write_token_properties_total_weight::<T, _>(
[i.properties.len() as u32].into_iter(),
- <SelfWeightOf<T>>::init_token_properties,
+ <SelfWeightOf<T>>::write_token_properties,
))
}
CreateItemExData::RefungibleMultipleItems(i) => {
<SelfWeightOf<T>>::create_multiple_items_ex_multiple_items(i.len() as u32)
- .saturating_add(init_token_properties_delta::<T, _>(
+ .saturating_add(write_token_properties_total_weight::<T, _>(
i.iter().map(|d| d.properties.len() as u32),
- <SelfWeightOf<T>>::init_token_properties,
+ <SelfWeightOf<T>>::write_token_properties,
))
}
_ => Weight::zero(),
@@ -88,18 +86,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()
+ + <SelfWeightOf<T>>::write_token_properties(amount)
+ })
}
fn set_token_property_permissions(amount: u32) -> Weight {
@@ -136,19 +129,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()
}
@@ -262,25 +242,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,26 @@
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::CommonWeights, weights::WeightInfo, AccountBalance, Balance, Config, CreateItemData,
+ Pallet, RefungibleHandle, SelfWeightOf, TokenProperties, TokensMinted, TotalSupply,
};
frontier_contract! {
@@ -90,6 +90,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 +162,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,
@@ -173,16 +177,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>)
}
@@ -191,7 +191,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 +201,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 +211,7 @@
&caller,
TokenId(token_id),
properties.into_iter(),
- &nesting_budget,
+ &nesting_budget(&self.recorder),
)
.map_err(dispatch_to_evm::<T>)
}
@@ -225,7 +221,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 +229,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,
@@ -258,17 +256,13 @@
.into_iter()
.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 +491,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 +628,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 +649,7 @@
users,
properties: CollectionPropertiesVec::default(),
},
- &budget,
+ &nesting_budget(&self.recorder),
)
.map_err(dispatch_to_evm::<T>)?;
@@ -704,9 +700,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 +729,7 @@
self,
&caller,
CreateItemData::<T> { users, properties },
- &budget,
+ &nesting_budget(&self.recorder),
)
.map_err(dispatch_to_evm::<T>)?;
Ok(true)
@@ -865,15 +858,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 +890,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 +924,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 +954,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 +987,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 +1024,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,7 +1046,7 @@
.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)
}
@@ -1053,9 +1064,6 @@
token_properties: 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 mut create_rft_data = Vec::with_capacity(token_properties.len());
@@ -1084,8 +1092,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)
}
@@ -1108,9 +1121,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 +1153,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)
}
@@ -1174,10 +1184,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 +1193,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.rsdiffbeforeafterboth1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_refungible4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2023-09-30, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! WORST CASE MAP SIZE: `1000000`8//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`9//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 10241011// Executed Command:12// target/production/unique-collator13// benchmark14// pallet15// --pallet16// pallet-refungible17// --wasm-execution18// compiled19// --extrinsic20// *21// --template=.maintain/frame-weight-template.hbs22// --steps=5023// --repeat=40024// --heap-pages=409625// --output=./pallets/refungible/src/weights.rs2627#![cfg_attr(rustfmt, rustfmt_skip)]28#![allow(unused_parens)]29#![allow(unused_imports)]3031use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};32use sp_std::marker::PhantomData;3334/// Weight functions needed for pallet_refungible.35pub trait WeightInfo {36 fn create_item() -> Weight;37 fn create_multiple_items(b: u32, ) -> Weight;38 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight;39 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight;40 fn burn_item_partial() -> Weight;41 fn burn_item_fully() -> Weight;42 fn transfer_normal() -> Weight;43 fn transfer_creating() -> Weight;44 fn transfer_removing() -> Weight;45 fn transfer_creating_removing() -> Weight;46 fn approve() -> Weight;47 fn approve_from() -> Weight;48 fn transfer_from_normal() -> Weight;49 fn transfer_from_creating() -> Weight;50 fn transfer_from_removing() -> Weight;51 fn transfer_from_creating_removing() -> Weight;52 fn burn_from() -> Weight;53 fn set_token_property_permissions(b: u32, ) -> Weight;54 fn set_token_properties(b: u32, ) -> Weight;55 fn init_token_properties(b: u32, ) -> Weight;56 fn delete_token_properties(b: u32, ) -> Weight;57 fn repartition_item() -> Weight;58 fn token_owner() -> Weight;59 fn set_allowance_for_all() -> Weight;60 fn allowance_for_all() -> Weight;61 fn repair_item() -> Weight;62}6364/// Weights for pallet_refungible using the Substrate node and recommended hardware.65pub struct SubstrateWeight<T>(PhantomData<T>);66impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {67 /// Storage: Refungible TokensMinted (r:1 w:1)68 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)69 /// Storage: Refungible AccountBalance (r:1 w:1)70 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)71 /// Storage: Refungible Balance (r:0 w:1)72 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)73 /// Storage: Refungible TotalSupply (r:0 w:1)74 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)75 /// Storage: Refungible Owned (r:0 w:1)76 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)77 fn create_item() -> Weight {78 // Proof Size summary in bytes:79 // Measured: `4`80 // Estimated: `3530`81 // Minimum execution time: 11_341_000 picoseconds.82 Weight::from_parts(11_741_000, 3530)83 .saturating_add(T::DbWeight::get().reads(2_u64))84 .saturating_add(T::DbWeight::get().writes(5_u64))85 }86 /// Storage: Refungible TokensMinted (r:1 w:1)87 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)88 /// Storage: Refungible AccountBalance (r:1 w:1)89 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)90 /// Storage: Refungible Balance (r:0 w:200)91 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)92 /// Storage: Refungible TotalSupply (r:0 w:200)93 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)94 /// Storage: Refungible Owned (r:0 w:200)95 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)96 /// The range of component `b` is `[0, 200]`.97 fn create_multiple_items(b: u32, ) -> Weight {98 // Proof Size summary in bytes:99 // Measured: `4`100 // Estimated: `3530`101 // Minimum execution time: 2_665_000 picoseconds.102 Weight::from_parts(2_791_000, 3530)103 // Standard Error: 996104 .saturating_add(Weight::from_parts(4_343_736, 0).saturating_mul(b.into()))105 .saturating_add(T::DbWeight::get().reads(2_u64))106 .saturating_add(T::DbWeight::get().writes(2_u64))107 .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into())))108 }109 /// Storage: Refungible TokensMinted (r:1 w:1)110 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)111 /// Storage: Refungible AccountBalance (r:200 w:200)112 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)113 /// Storage: Refungible Balance (r:0 w:200)114 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)115 /// Storage: Refungible TotalSupply (r:0 w:200)116 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)117 /// Storage: Refungible Owned (r:0 w:200)118 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)119 /// The range of component `b` is `[0, 200]`.120 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {121 // Proof Size summary in bytes:122 // Measured: `4`123 // Estimated: `3481 + b * (2540 ±0)`124 // Minimum execution time: 2_616_000 picoseconds.125 Weight::from_parts(2_726_000, 3481)126 // Standard Error: 665127 .saturating_add(Weight::from_parts(5_554_066, 0).saturating_mul(b.into()))128 .saturating_add(T::DbWeight::get().reads(1_u64))129 .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))130 .saturating_add(T::DbWeight::get().writes(1_u64))131 .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(b.into())))132 .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))133 }134 /// Storage: Refungible TokensMinted (r:1 w:1)135 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)136 /// Storage: Refungible AccountBalance (r:200 w:200)137 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)138 /// Storage: Refungible Balance (r:0 w:200)139 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)140 /// Storage: Refungible TotalSupply (r:0 w:1)141 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)142 /// Storage: Refungible Owned (r:0 w:200)143 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)144 /// The range of component `b` is `[0, 200]`.145 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {146 // Proof Size summary in bytes:147 // Measured: `4`148 // Estimated: `3481 + b * (2540 ±0)`149 // Minimum execution time: 3_697_000 picoseconds.150 Weight::from_parts(2_136_481, 3481)151 // Standard Error: 567152 .saturating_add(Weight::from_parts(4_390_621, 0).saturating_mul(b.into()))153 .saturating_add(T::DbWeight::get().reads(1_u64))154 .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))155 .saturating_add(T::DbWeight::get().writes(2_u64))156 .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into())))157 .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))158 }159 /// Storage: Refungible Balance (r:3 w:1)160 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)161 /// Storage: Refungible TotalSupply (r:1 w:1)162 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)163 /// Storage: Refungible AccountBalance (r:1 w:1)164 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)165 /// Storage: Refungible Owned (r:0 w:1)166 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)167 fn burn_item_partial() -> Weight {168 // Proof Size summary in bytes:169 // Measured: `456`170 // Estimated: `8682`171 // Minimum execution time: 22_859_000 picoseconds.172 Weight::from_parts(23_295_000, 8682)173 .saturating_add(T::DbWeight::get().reads(5_u64))174 .saturating_add(T::DbWeight::get().writes(4_u64))175 }176 /// Storage: Refungible Balance (r:1 w:1)177 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)178 /// Storage: Refungible TotalSupply (r:1 w:1)179 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)180 /// Storage: Refungible AccountBalance (r:1 w:1)181 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)182 /// Storage: Refungible TokensBurnt (r:1 w:1)183 /// Proof: Refungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)184 /// Storage: Refungible Owned (r:0 w:1)185 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)186 /// Storage: Refungible TokenProperties (r:0 w:1)187 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)188 fn burn_item_fully() -> Weight {189 // Proof Size summary in bytes:190 // Measured: `341`191 // Estimated: `3554`192 // Minimum execution time: 21_477_000 picoseconds.193 Weight::from_parts(22_037_000, 3554)194 .saturating_add(T::DbWeight::get().reads(4_u64))195 .saturating_add(T::DbWeight::get().writes(6_u64))196 }197 /// Storage: Refungible Balance (r:2 w:2)198 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)199 /// Storage: Refungible TotalSupply (r:1 w:0)200 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)201 fn transfer_normal() -> Weight {202 // Proof Size summary in bytes:203 // Measured: `365`204 // Estimated: `6118`205 // Minimum execution time: 13_714_000 picoseconds.206 Weight::from_parts(14_050_000, 6118)207 .saturating_add(T::DbWeight::get().reads(3_u64))208 .saturating_add(T::DbWeight::get().writes(2_u64))209 }210 /// Storage: Refungible Balance (r:2 w:2)211 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)212 /// Storage: Refungible AccountBalance (r:1 w:1)213 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)214 /// Storage: Refungible TotalSupply (r:1 w:0)215 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)216 /// Storage: Refungible Owned (r:0 w:1)217 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)218 fn transfer_creating() -> Weight {219 // Proof Size summary in bytes:220 // Measured: `341`221 // Estimated: `6118`222 // Minimum execution time: 15_879_000 picoseconds.223 Weight::from_parts(16_266_000, 6118)224 .saturating_add(T::DbWeight::get().reads(4_u64))225 .saturating_add(T::DbWeight::get().writes(4_u64))226 }227 /// Storage: Refungible Balance (r:2 w:2)228 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)229 /// Storage: Refungible AccountBalance (r:1 w:1)230 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)231 /// Storage: Refungible TotalSupply (r:1 w:0)232 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)233 /// Storage: Refungible Owned (r:0 w:1)234 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)235 fn transfer_removing() -> Weight {236 // Proof Size summary in bytes:237 // Measured: `456`238 // Estimated: `6118`239 // Minimum execution time: 18_186_000 picoseconds.240 Weight::from_parts(18_682_000, 6118)241 .saturating_add(T::DbWeight::get().reads(4_u64))242 .saturating_add(T::DbWeight::get().writes(4_u64))243 }244 /// Storage: Refungible Balance (r:2 w:2)245 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)246 /// Storage: Refungible AccountBalance (r:2 w:2)247 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)248 /// Storage: Refungible TotalSupply (r:1 w:0)249 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)250 /// Storage: Refungible Owned (r:0 w:2)251 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)252 fn transfer_creating_removing() -> Weight {253 // Proof Size summary in bytes:254 // Measured: `341`255 // Estimated: `6118`256 // Minimum execution time: 17_943_000 picoseconds.257 Weight::from_parts(18_333_000, 6118)258 .saturating_add(T::DbWeight::get().reads(5_u64))259 .saturating_add(T::DbWeight::get().writes(6_u64))260 }261 /// Storage: Refungible Balance (r:1 w:0)262 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)263 /// Storage: Refungible Allowance (r:0 w:1)264 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)265 fn approve() -> Weight {266 // Proof Size summary in bytes:267 // Measured: `223`268 // Estimated: `3554`269 // Minimum execution time: 8_391_000 picoseconds.270 Weight::from_parts(8_637_000, 3554)271 .saturating_add(T::DbWeight::get().reads(1_u64))272 .saturating_add(T::DbWeight::get().writes(1_u64))273 }274 /// Storage: Refungible Balance (r:1 w:0)275 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)276 /// Storage: Refungible Allowance (r:0 w:1)277 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)278 fn approve_from() -> Weight {279 // Proof Size summary in bytes:280 // Measured: `211`281 // Estimated: `3554`282 // Minimum execution time: 8_519_000 picoseconds.283 Weight::from_parts(8_760_000, 3554)284 .saturating_add(T::DbWeight::get().reads(1_u64))285 .saturating_add(T::DbWeight::get().writes(1_u64))286 }287 /// Storage: Refungible Allowance (r:1 w:1)288 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)289 /// Storage: Refungible Balance (r:2 w:2)290 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)291 /// Storage: Refungible TotalSupply (r:1 w:0)292 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)293 fn transfer_from_normal() -> Weight {294 // Proof Size summary in bytes:295 // Measured: `495`296 // Estimated: `6118`297 // Minimum execution time: 19_554_000 picoseconds.298 Weight::from_parts(20_031_000, 6118)299 .saturating_add(T::DbWeight::get().reads(4_u64))300 .saturating_add(T::DbWeight::get().writes(3_u64))301 }302 /// Storage: Refungible Allowance (r:1 w:1)303 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)304 /// Storage: Refungible Balance (r:2 w:2)305 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)306 /// Storage: Refungible AccountBalance (r:1 w:1)307 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)308 /// Storage: Refungible TotalSupply (r:1 w:0)309 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)310 /// Storage: Refungible Owned (r:0 w:1)311 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)312 fn transfer_from_creating() -> Weight {313 // Proof Size summary in bytes:314 // Measured: `471`315 // Estimated: `6118`316 // Minimum execution time: 21_338_000 picoseconds.317 Weight::from_parts(21_803_000, 6118)318 .saturating_add(T::DbWeight::get().reads(5_u64))319 .saturating_add(T::DbWeight::get().writes(5_u64))320 }321 /// Storage: Refungible Allowance (r:1 w:1)322 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)323 /// Storage: Refungible Balance (r:2 w:2)324 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)325 /// Storage: Refungible AccountBalance (r:1 w:1)326 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)327 /// Storage: Refungible TotalSupply (r:1 w:0)328 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)329 /// Storage: Refungible Owned (r:0 w:1)330 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)331 fn transfer_from_removing() -> Weight {332 // Proof Size summary in bytes:333 // Measured: `586`334 // Estimated: `6118`335 // Minimum execution time: 24_179_000 picoseconds.336 Weight::from_parts(24_647_000, 6118)337 .saturating_add(T::DbWeight::get().reads(5_u64))338 .saturating_add(T::DbWeight::get().writes(5_u64))339 }340 /// Storage: Refungible Allowance (r:1 w:1)341 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)342 /// Storage: Refungible Balance (r:2 w:2)343 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)344 /// Storage: Refungible AccountBalance (r:2 w:2)345 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)346 /// Storage: Refungible TotalSupply (r:1 w:0)347 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)348 /// Storage: Refungible Owned (r:0 w:2)349 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)350 fn transfer_from_creating_removing() -> Weight {351 // Proof Size summary in bytes:352 // Measured: `471`353 // Estimated: `6118`354 // Minimum execution time: 24_008_000 picoseconds.355 Weight::from_parts(24_545_000, 6118)356 .saturating_add(T::DbWeight::get().reads(6_u64))357 .saturating_add(T::DbWeight::get().writes(7_u64))358 }359 /// Storage: Refungible Allowance (r:1 w:1)360 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)361 /// Storage: Refungible Balance (r:1 w:1)362 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)363 /// Storage: Refungible TotalSupply (r:1 w:1)364 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)365 /// Storage: Refungible AccountBalance (r:1 w:1)366 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)367 /// Storage: Refungible TokensBurnt (r:1 w:1)368 /// Proof: Refungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)369 /// Storage: Refungible Owned (r:0 w:1)370 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)371 /// Storage: Refungible TokenProperties (r:0 w:1)372 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)373 fn burn_from() -> Weight {374 // Proof Size summary in bytes:375 // Measured: `471`376 // Estimated: `3570`377 // Minimum execution time: 27_907_000 picoseconds.378 Weight::from_parts(28_489_000, 3570)379 .saturating_add(T::DbWeight::get().reads(5_u64))380 .saturating_add(T::DbWeight::get().writes(7_u64))381 }382 /// Storage: Common CollectionPropertyPermissions (r:1 w:1)383 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)384 /// The range of component `b` is `[0, 64]`.385 fn set_token_property_permissions(b: u32, ) -> Weight {386 // Proof Size summary in bytes:387 // Measured: `314`388 // Estimated: `20191`389 // Minimum execution time: 1_460_000 picoseconds.390 Weight::from_parts(1_564_000, 20191)391 // Standard Error: 14_117392 .saturating_add(Weight::from_parts(8_196_214, 0).saturating_mul(b.into()))393 .saturating_add(T::DbWeight::get().reads(1_u64))394 .saturating_add(T::DbWeight::get().writes(1_u64))395 }396 /// Storage: Common CollectionPropertyPermissions (r:1 w:0)397 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)398 /// Storage: Refungible TokenProperties (r:1 w:1)399 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)400 /// Storage: Refungible TotalSupply (r:1 w:0)401 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)402 /// The range of component `b` is `[0, 64]`.403 fn set_token_properties(b: u32, ) -> Weight {404 // Proof Size summary in bytes:405 // Measured: `502 + b * (261 ±0)`406 // Estimated: `36269`407 // Minimum execution time: 1_012_000 picoseconds.408 Weight::from_parts(1_081_000, 36269)409 // Standard Error: 6_838410 .saturating_add(Weight::from_parts(5_801_181, 0).saturating_mul(b.into()))411 .saturating_add(T::DbWeight::get().reads(3_u64))412 .saturating_add(T::DbWeight::get().writes(1_u64))413 }414 /// Storage: Refungible TokenProperties (r:0 w:1)415 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)416 /// The range of component `b` is `[0, 64]`.417 fn init_token_properties(b: u32, ) -> Weight {418 // Proof Size summary in bytes:419 // Measured: `0`420 // Estimated: `0`421 // Minimum execution time: 229_000 picoseconds.422 Weight::from_parts(253_000, 0)423 // Standard Error: 100_218424 .saturating_add(Weight::from_parts(12_632_221, 0).saturating_mul(b.into()))425 .saturating_add(T::DbWeight::get().writes(1_u64))426 }427 /// Storage: Common CollectionPropertyPermissions (r:1 w:0)428 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)429 /// Storage: Refungible TotalSupply (r:1 w:0)430 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)431 /// Storage: Refungible TokenProperties (r:1 w:1)432 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)433 /// The range of component `b` is `[0, 64]`.434 fn delete_token_properties(b: u32, ) -> Weight {435 // Proof Size summary in bytes:436 // Measured: `561 + b * (33291 ±0)`437 // Estimated: `36269`438 // Minimum execution time: 1_014_000 picoseconds.439 Weight::from_parts(1_065_000, 36269)440 // Standard Error: 39_536441 .saturating_add(Weight::from_parts(24_125_838, 0).saturating_mul(b.into()))442 .saturating_add(T::DbWeight::get().reads(3_u64))443 .saturating_add(T::DbWeight::get().writes(1_u64))444 }445 /// Storage: Refungible TotalSupply (r:1 w:1)446 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)447 /// Storage: Refungible Balance (r:1 w:1)448 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)449 fn repartition_item() -> Weight {450 // Proof Size summary in bytes:451 // Measured: `288`452 // Estimated: `3554`453 // Minimum execution time: 10_315_000 picoseconds.454 Weight::from_parts(10_601_000, 3554)455 .saturating_add(T::DbWeight::get().reads(2_u64))456 .saturating_add(T::DbWeight::get().writes(2_u64))457 }458 /// Storage: Refungible Balance (r:2 w:0)459 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)460 fn token_owner() -> Weight {461 // Proof Size summary in bytes:462 // Measured: `288`463 // Estimated: `6118`464 // Minimum execution time: 4_898_000 picoseconds.465 Weight::from_parts(5_136_000, 6118)466 .saturating_add(T::DbWeight::get().reads(2_u64))467 }468 /// Storage: Refungible CollectionAllowance (r:0 w:1)469 /// Proof: Refungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)470 fn set_allowance_for_all() -> Weight {471 // Proof Size summary in bytes:472 // Measured: `0`473 // Estimated: `0`474 // Minimum execution time: 4_146_000 picoseconds.475 Weight::from_parts(4_337_000, 0)476 .saturating_add(T::DbWeight::get().writes(1_u64))477 }478 /// Storage: Refungible CollectionAllowance (r:1 w:0)479 /// Proof: Refungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)480 fn allowance_for_all() -> Weight {481 // Proof Size summary in bytes:482 // Measured: `4`483 // Estimated: `3576`484 // Minimum execution time: 2_170_000 picoseconds.485 Weight::from_parts(2_301_000, 3576)486 .saturating_add(T::DbWeight::get().reads(1_u64))487 }488 /// Storage: Refungible TokenProperties (r:1 w:1)489 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)490 fn repair_item() -> Weight {491 // Proof Size summary in bytes:492 // Measured: `120`493 // Estimated: `36269`494 // Minimum execution time: 2_098_000 picoseconds.495 Weight::from_parts(2_251_000, 36269)496 .saturating_add(T::DbWeight::get().reads(1_u64))497 .saturating_add(T::DbWeight::get().writes(1_u64))498 }499}500501// For backwards compatibility and tests502impl WeightInfo for () {503 /// Storage: Refungible TokensMinted (r:1 w:1)504 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)505 /// Storage: Refungible AccountBalance (r:1 w:1)506 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)507 /// Storage: Refungible Balance (r:0 w:1)508 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)509 /// Storage: Refungible TotalSupply (r:0 w:1)510 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)511 /// Storage: Refungible Owned (r:0 w:1)512 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)513 fn create_item() -> Weight {514 // Proof Size summary in bytes:515 // Measured: `4`516 // Estimated: `3530`517 // Minimum execution time: 11_341_000 picoseconds.518 Weight::from_parts(11_741_000, 3530)519 .saturating_add(RocksDbWeight::get().reads(2_u64))520 .saturating_add(RocksDbWeight::get().writes(5_u64))521 }522 /// Storage: Refungible TokensMinted (r:1 w:1)523 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)524 /// Storage: Refungible AccountBalance (r:1 w:1)525 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)526 /// Storage: Refungible Balance (r:0 w:200)527 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)528 /// Storage: Refungible TotalSupply (r:0 w:200)529 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)530 /// Storage: Refungible Owned (r:0 w:200)531 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)532 /// The range of component `b` is `[0, 200]`.533 fn create_multiple_items(b: u32, ) -> Weight {534 // Proof Size summary in bytes:535 // Measured: `4`536 // Estimated: `3530`537 // Minimum execution time: 2_665_000 picoseconds.538 Weight::from_parts(2_791_000, 3530)539 // Standard Error: 996540 .saturating_add(Weight::from_parts(4_343_736, 0).saturating_mul(b.into()))541 .saturating_add(RocksDbWeight::get().reads(2_u64))542 .saturating_add(RocksDbWeight::get().writes(2_u64))543 .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(b.into())))544 }545 /// Storage: Refungible TokensMinted (r:1 w:1)546 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)547 /// Storage: Refungible AccountBalance (r:200 w:200)548 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)549 /// Storage: Refungible Balance (r:0 w:200)550 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)551 /// Storage: Refungible TotalSupply (r:0 w:200)552 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)553 /// Storage: Refungible Owned (r:0 w:200)554 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)555 /// The range of component `b` is `[0, 200]`.556 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {557 // Proof Size summary in bytes:558 // Measured: `4`559 // Estimated: `3481 + b * (2540 ±0)`560 // Minimum execution time: 2_616_000 picoseconds.561 Weight::from_parts(2_726_000, 3481)562 // Standard Error: 665563 .saturating_add(Weight::from_parts(5_554_066, 0).saturating_mul(b.into()))564 .saturating_add(RocksDbWeight::get().reads(1_u64))565 .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(b.into())))566 .saturating_add(RocksDbWeight::get().writes(1_u64))567 .saturating_add(RocksDbWeight::get().writes((4_u64).saturating_mul(b.into())))568 .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))569 }570 /// Storage: Refungible TokensMinted (r:1 w:1)571 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)572 /// Storage: Refungible AccountBalance (r:200 w:200)573 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)574 /// Storage: Refungible Balance (r:0 w:200)575 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)576 /// Storage: Refungible TotalSupply (r:0 w:1)577 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)578 /// Storage: Refungible Owned (r:0 w:200)579 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)580 /// The range of component `b` is `[0, 200]`.581 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {582 // Proof Size summary in bytes:583 // Measured: `4`584 // Estimated: `3481 + b * (2540 ±0)`585 // Minimum execution time: 3_697_000 picoseconds.586 Weight::from_parts(2_136_481, 3481)587 // Standard Error: 567588 .saturating_add(Weight::from_parts(4_390_621, 0).saturating_mul(b.into()))589 .saturating_add(RocksDbWeight::get().reads(1_u64))590 .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(b.into())))591 .saturating_add(RocksDbWeight::get().writes(2_u64))592 .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(b.into())))593 .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))594 }595 /// Storage: Refungible Balance (r:3 w:1)596 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)597 /// Storage: Refungible TotalSupply (r:1 w:1)598 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)599 /// Storage: Refungible AccountBalance (r:1 w:1)600 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)601 /// Storage: Refungible Owned (r:0 w:1)602 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)603 fn burn_item_partial() -> Weight {604 // Proof Size summary in bytes:605 // Measured: `456`606 // Estimated: `8682`607 // Minimum execution time: 22_859_000 picoseconds.608 Weight::from_parts(23_295_000, 8682)609 .saturating_add(RocksDbWeight::get().reads(5_u64))610 .saturating_add(RocksDbWeight::get().writes(4_u64))611 }612 /// Storage: Refungible Balance (r:1 w:1)613 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)614 /// Storage: Refungible TotalSupply (r:1 w:1)615 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)616 /// Storage: Refungible AccountBalance (r:1 w:1)617 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)618 /// Storage: Refungible TokensBurnt (r:1 w:1)619 /// Proof: Refungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)620 /// Storage: Refungible Owned (r:0 w:1)621 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)622 /// Storage: Refungible TokenProperties (r:0 w:1)623 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)624 fn burn_item_fully() -> Weight {625 // Proof Size summary in bytes:626 // Measured: `341`627 // Estimated: `3554`628 // Minimum execution time: 21_477_000 picoseconds.629 Weight::from_parts(22_037_000, 3554)630 .saturating_add(RocksDbWeight::get().reads(4_u64))631 .saturating_add(RocksDbWeight::get().writes(6_u64))632 }633 /// Storage: Refungible Balance (r:2 w:2)634 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)635 /// Storage: Refungible TotalSupply (r:1 w:0)636 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)637 fn transfer_normal() -> Weight {638 // Proof Size summary in bytes:639 // Measured: `365`640 // Estimated: `6118`641 // Minimum execution time: 13_714_000 picoseconds.642 Weight::from_parts(14_050_000, 6118)643 .saturating_add(RocksDbWeight::get().reads(3_u64))644 .saturating_add(RocksDbWeight::get().writes(2_u64))645 }646 /// Storage: Refungible Balance (r:2 w:2)647 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)648 /// Storage: Refungible AccountBalance (r:1 w:1)649 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)650 /// Storage: Refungible TotalSupply (r:1 w:0)651 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)652 /// Storage: Refungible Owned (r:0 w:1)653 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)654 fn transfer_creating() -> Weight {655 // Proof Size summary in bytes:656 // Measured: `341`657 // Estimated: `6118`658 // Minimum execution time: 15_879_000 picoseconds.659 Weight::from_parts(16_266_000, 6118)660 .saturating_add(RocksDbWeight::get().reads(4_u64))661 .saturating_add(RocksDbWeight::get().writes(4_u64))662 }663 /// Storage: Refungible Balance (r:2 w:2)664 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)665 /// Storage: Refungible AccountBalance (r:1 w:1)666 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)667 /// Storage: Refungible TotalSupply (r:1 w:0)668 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)669 /// Storage: Refungible Owned (r:0 w:1)670 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)671 fn transfer_removing() -> Weight {672 // Proof Size summary in bytes:673 // Measured: `456`674 // Estimated: `6118`675 // Minimum execution time: 18_186_000 picoseconds.676 Weight::from_parts(18_682_000, 6118)677 .saturating_add(RocksDbWeight::get().reads(4_u64))678 .saturating_add(RocksDbWeight::get().writes(4_u64))679 }680 /// Storage: Refungible Balance (r:2 w:2)681 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)682 /// Storage: Refungible AccountBalance (r:2 w:2)683 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)684 /// Storage: Refungible TotalSupply (r:1 w:0)685 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)686 /// Storage: Refungible Owned (r:0 w:2)687 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)688 fn transfer_creating_removing() -> Weight {689 // Proof Size summary in bytes:690 // Measured: `341`691 // Estimated: `6118`692 // Minimum execution time: 17_943_000 picoseconds.693 Weight::from_parts(18_333_000, 6118)694 .saturating_add(RocksDbWeight::get().reads(5_u64))695 .saturating_add(RocksDbWeight::get().writes(6_u64))696 }697 /// Storage: Refungible Balance (r:1 w:0)698 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)699 /// Storage: Refungible Allowance (r:0 w:1)700 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)701 fn approve() -> Weight {702 // Proof Size summary in bytes:703 // Measured: `223`704 // Estimated: `3554`705 // Minimum execution time: 8_391_000 picoseconds.706 Weight::from_parts(8_637_000, 3554)707 .saturating_add(RocksDbWeight::get().reads(1_u64))708 .saturating_add(RocksDbWeight::get().writes(1_u64))709 }710 /// Storage: Refungible Balance (r:1 w:0)711 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)712 /// Storage: Refungible Allowance (r:0 w:1)713 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)714 fn approve_from() -> Weight {715 // Proof Size summary in bytes:716 // Measured: `211`717 // Estimated: `3554`718 // Minimum execution time: 8_519_000 picoseconds.719 Weight::from_parts(8_760_000, 3554)720 .saturating_add(RocksDbWeight::get().reads(1_u64))721 .saturating_add(RocksDbWeight::get().writes(1_u64))722 }723 /// Storage: Refungible Allowance (r:1 w:1)724 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)725 /// Storage: Refungible Balance (r:2 w:2)726 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)727 /// Storage: Refungible TotalSupply (r:1 w:0)728 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)729 fn transfer_from_normal() -> Weight {730 // Proof Size summary in bytes:731 // Measured: `495`732 // Estimated: `6118`733 // Minimum execution time: 19_554_000 picoseconds.734 Weight::from_parts(20_031_000, 6118)735 .saturating_add(RocksDbWeight::get().reads(4_u64))736 .saturating_add(RocksDbWeight::get().writes(3_u64))737 }738 /// Storage: Refungible Allowance (r:1 w:1)739 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)740 /// Storage: Refungible Balance (r:2 w:2)741 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)742 /// Storage: Refungible AccountBalance (r:1 w:1)743 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)744 /// Storage: Refungible TotalSupply (r:1 w:0)745 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)746 /// Storage: Refungible Owned (r:0 w:1)747 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)748 fn transfer_from_creating() -> Weight {749 // Proof Size summary in bytes:750 // Measured: `471`751 // Estimated: `6118`752 // Minimum execution time: 21_338_000 picoseconds.753 Weight::from_parts(21_803_000, 6118)754 .saturating_add(RocksDbWeight::get().reads(5_u64))755 .saturating_add(RocksDbWeight::get().writes(5_u64))756 }757 /// Storage: Refungible Allowance (r:1 w:1)758 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)759 /// Storage: Refungible Balance (r:2 w:2)760 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)761 /// Storage: Refungible AccountBalance (r:1 w:1)762 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)763 /// Storage: Refungible TotalSupply (r:1 w:0)764 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)765 /// Storage: Refungible Owned (r:0 w:1)766 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)767 fn transfer_from_removing() -> Weight {768 // Proof Size summary in bytes:769 // Measured: `586`770 // Estimated: `6118`771 // Minimum execution time: 24_179_000 picoseconds.772 Weight::from_parts(24_647_000, 6118)773 .saturating_add(RocksDbWeight::get().reads(5_u64))774 .saturating_add(RocksDbWeight::get().writes(5_u64))775 }776 /// Storage: Refungible Allowance (r:1 w:1)777 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)778 /// Storage: Refungible Balance (r:2 w:2)779 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)780 /// Storage: Refungible AccountBalance (r:2 w:2)781 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)782 /// Storage: Refungible TotalSupply (r:1 w:0)783 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)784 /// Storage: Refungible Owned (r:0 w:2)785 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)786 fn transfer_from_creating_removing() -> Weight {787 // Proof Size summary in bytes:788 // Measured: `471`789 // Estimated: `6118`790 // Minimum execution time: 24_008_000 picoseconds.791 Weight::from_parts(24_545_000, 6118)792 .saturating_add(RocksDbWeight::get().reads(6_u64))793 .saturating_add(RocksDbWeight::get().writes(7_u64))794 }795 /// Storage: Refungible Allowance (r:1 w:1)796 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)797 /// Storage: Refungible Balance (r:1 w:1)798 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)799 /// Storage: Refungible TotalSupply (r:1 w:1)800 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)801 /// Storage: Refungible AccountBalance (r:1 w:1)802 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)803 /// Storage: Refungible TokensBurnt (r:1 w:1)804 /// Proof: Refungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)805 /// Storage: Refungible Owned (r:0 w:1)806 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)807 /// Storage: Refungible TokenProperties (r:0 w:1)808 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)809 fn burn_from() -> Weight {810 // Proof Size summary in bytes:811 // Measured: `471`812 // Estimated: `3570`813 // Minimum execution time: 27_907_000 picoseconds.814 Weight::from_parts(28_489_000, 3570)815 .saturating_add(RocksDbWeight::get().reads(5_u64))816 .saturating_add(RocksDbWeight::get().writes(7_u64))817 }818 /// Storage: Common CollectionPropertyPermissions (r:1 w:1)819 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)820 /// The range of component `b` is `[0, 64]`.821 fn set_token_property_permissions(b: u32, ) -> Weight {822 // Proof Size summary in bytes:823 // Measured: `314`824 // Estimated: `20191`825 // Minimum execution time: 1_460_000 picoseconds.826 Weight::from_parts(1_564_000, 20191)827 // Standard Error: 14_117828 .saturating_add(Weight::from_parts(8_196_214, 0).saturating_mul(b.into()))829 .saturating_add(RocksDbWeight::get().reads(1_u64))830 .saturating_add(RocksDbWeight::get().writes(1_u64))831 }832 /// Storage: Common CollectionPropertyPermissions (r:1 w:0)833 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)834 /// Storage: Refungible TokenProperties (r:1 w:1)835 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)836 /// Storage: Refungible TotalSupply (r:1 w:0)837 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)838 /// The range of component `b` is `[0, 64]`.839 fn set_token_properties(b: u32, ) -> Weight {840 // Proof Size summary in bytes:841 // Measured: `502 + b * (261 ±0)`842 // Estimated: `36269`843 // Minimum execution time: 1_012_000 picoseconds.844 Weight::from_parts(1_081_000, 36269)845 // Standard Error: 6_838846 .saturating_add(Weight::from_parts(5_801_181, 0).saturating_mul(b.into()))847 .saturating_add(RocksDbWeight::get().reads(3_u64))848 .saturating_add(RocksDbWeight::get().writes(1_u64))849 }850 /// Storage: Refungible TokenProperties (r:0 w:1)851 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)852 /// The range of component `b` is `[0, 64]`.853 fn init_token_properties(b: u32, ) -> Weight {854 // Proof Size summary in bytes:855 // Measured: `0`856 // Estimated: `0`857 // Minimum execution time: 229_000 picoseconds.858 Weight::from_parts(253_000, 0)859 // Standard Error: 100_218860 .saturating_add(Weight::from_parts(12_632_221, 0).saturating_mul(b.into()))861 .saturating_add(RocksDbWeight::get().writes(1_u64))862 }863 /// Storage: Common CollectionPropertyPermissions (r:1 w:0)864 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)865 /// Storage: Refungible TotalSupply (r:1 w:0)866 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)867 /// Storage: Refungible TokenProperties (r:1 w:1)868 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)869 /// The range of component `b` is `[0, 64]`.870 fn delete_token_properties(b: u32, ) -> Weight {871 // Proof Size summary in bytes:872 // Measured: `561 + b * (33291 ±0)`873 // Estimated: `36269`874 // Minimum execution time: 1_014_000 picoseconds.875 Weight::from_parts(1_065_000, 36269)876 // Standard Error: 39_536877 .saturating_add(Weight::from_parts(24_125_838, 0).saturating_mul(b.into()))878 .saturating_add(RocksDbWeight::get().reads(3_u64))879 .saturating_add(RocksDbWeight::get().writes(1_u64))880 }881 /// Storage: Refungible TotalSupply (r:1 w:1)882 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)883 /// Storage: Refungible Balance (r:1 w:1)884 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)885 fn repartition_item() -> Weight {886 // Proof Size summary in bytes:887 // Measured: `288`888 // Estimated: `3554`889 // Minimum execution time: 10_315_000 picoseconds.890 Weight::from_parts(10_601_000, 3554)891 .saturating_add(RocksDbWeight::get().reads(2_u64))892 .saturating_add(RocksDbWeight::get().writes(2_u64))893 }894 /// Storage: Refungible Balance (r:2 w:0)895 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)896 fn token_owner() -> Weight {897 // Proof Size summary in bytes:898 // Measured: `288`899 // Estimated: `6118`900 // Minimum execution time: 4_898_000 picoseconds.901 Weight::from_parts(5_136_000, 6118)902 .saturating_add(RocksDbWeight::get().reads(2_u64))903 }904 /// Storage: Refungible CollectionAllowance (r:0 w:1)905 /// Proof: Refungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)906 fn set_allowance_for_all() -> Weight {907 // Proof Size summary in bytes:908 // Measured: `0`909 // Estimated: `0`910 // Minimum execution time: 4_146_000 picoseconds.911 Weight::from_parts(4_337_000, 0)912 .saturating_add(RocksDbWeight::get().writes(1_u64))913 }914 /// Storage: Refungible CollectionAllowance (r:1 w:0)915 /// Proof: Refungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)916 fn allowance_for_all() -> Weight {917 // Proof Size summary in bytes:918 // Measured: `4`919 // Estimated: `3576`920 // Minimum execution time: 2_170_000 picoseconds.921 Weight::from_parts(2_301_000, 3576)922 .saturating_add(RocksDbWeight::get().reads(1_u64))923 }924 /// Storage: Refungible TokenProperties (r:1 w:1)925 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)926 fn repair_item() -> Weight {927 // Proof Size summary in bytes:928 // Measured: `120`929 // Estimated: `36269`930 // Minimum execution time: 2_098_000 picoseconds.931 Weight::from_parts(2_251_000, 36269)932 .saturating_add(RocksDbWeight::get().reads(1_u64))933 .saturating_add(RocksDbWeight::get().writes(1_u64))934 }935}9361// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_refungible4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2023-10-05, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! WORST CASE MAP SIZE: `1000000`8//! HOSTNAME: `hearthstone`, CPU: `AMD Ryzen 9 7950X3D 16-Core Processor`9//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 10241011// Executed Command:12// target/production/unique-collator13// benchmark14// pallet15// --pallet16// pallet-refungible17// --wasm-execution18// compiled19// --extrinsic20// *21// --template=.maintain/frame-weight-template.hbs22// --steps=5023// --repeat=8024// --heap-pages=409625// --output=./pallets/refungible/src/weights.rs2627#![cfg_attr(rustfmt, rustfmt_skip)]28#![allow(unused_parens)]29#![allow(unused_imports)]3031use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};32use sp_std::marker::PhantomData;3334/// Weight functions needed for pallet_refungible.35pub trait WeightInfo {36 fn create_item() -> Weight;37 fn create_multiple_items(b: u32, ) -> Weight;38 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight;39 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight;40 fn burn_item_partial() -> Weight;41 fn burn_item_fully() -> Weight;42 fn transfer_normal() -> Weight;43 fn transfer_creating() -> Weight;44 fn transfer_removing() -> Weight;45 fn transfer_creating_removing() -> Weight;46 fn approve() -> Weight;47 fn approve_from() -> Weight;48 fn transfer_from_normal() -> Weight;49 fn transfer_from_creating() -> Weight;50 fn transfer_from_removing() -> Weight;51 fn transfer_from_creating_removing() -> Weight;52 fn burn_from() -> Weight;53 fn set_token_property_permissions(b: u32, ) -> Weight;54 fn set_token_properties(b: u32, ) -> Weight;55 fn load_token_properties() -> Weight;56 fn write_token_properties(b: u32, ) -> Weight;57 fn delete_token_properties(b: u32, ) -> Weight;58 fn repartition_item() -> Weight;59 fn token_owner() -> Weight;60 fn set_allowance_for_all() -> Weight;61 fn allowance_for_all() -> Weight;62 fn repair_item() -> Weight;63}6465/// Weights for pallet_refungible using the Substrate node and recommended hardware.66pub struct SubstrateWeight<T>(PhantomData<T>);67impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {68 /// Storage: Refungible TokensMinted (r:1 w:1)69 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)70 /// Storage: Refungible AccountBalance (r:1 w:1)71 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)72 /// Storage: Refungible Balance (r:0 w:1)73 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)74 /// Storage: Refungible TotalSupply (r:0 w:1)75 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)76 /// Storage: Refungible Owned (r:0 w:1)77 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)78 fn create_item() -> Weight {79 // Proof Size summary in bytes:80 // Measured: `4`81 // Estimated: `3530`82 // Minimum execution time: 5_710_000 picoseconds.83 Weight::from_parts(5_980_000, 3530)84 .saturating_add(T::DbWeight::get().reads(2_u64))85 .saturating_add(T::DbWeight::get().writes(5_u64))86 }87 /// Storage: Refungible TokensMinted (r:1 w:1)88 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)89 /// Storage: Refungible AccountBalance (r:1 w:1)90 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)91 /// Storage: Refungible Balance (r:0 w:200)92 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)93 /// Storage: Refungible TotalSupply (r:0 w:200)94 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)95 /// Storage: Refungible Owned (r:0 w:200)96 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)97 /// The range of component `b` is `[0, 200]`.98 fn create_multiple_items(b: u32, ) -> Weight {99 // Proof Size summary in bytes:100 // Measured: `4`101 // Estimated: `3530`102 // Minimum execution time: 1_300_000 picoseconds.103 Weight::from_parts(1_360_000, 3530)104 // Standard Error: 2_783105 .saturating_add(Weight::from_parts(3_456_531, 0).saturating_mul(b.into()))106 .saturating_add(T::DbWeight::get().reads(2_u64))107 .saturating_add(T::DbWeight::get().writes(2_u64))108 .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into())))109 }110 /// Storage: Refungible TokensMinted (r:1 w:1)111 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)112 /// Storage: Refungible AccountBalance (r:200 w:200)113 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)114 /// Storage: Refungible Balance (r:0 w:200)115 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)116 /// Storage: Refungible TotalSupply (r:0 w:200)117 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)118 /// Storage: Refungible Owned (r:0 w:200)119 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)120 /// The range of component `b` is `[0, 200]`.121 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {122 // Proof Size summary in bytes:123 // Measured: `4`124 // Estimated: `3481 + b * (2540 ±0)`125 // Minimum execution time: 1_290_000 picoseconds.126 Weight::from_parts(1_370_000, 3481)127 // Standard Error: 3_198128 .saturating_add(Weight::from_parts(4_435_305, 0).saturating_mul(b.into()))129 .saturating_add(T::DbWeight::get().reads(1_u64))130 .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))131 .saturating_add(T::DbWeight::get().writes(1_u64))132 .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(b.into())))133 .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))134 }135 /// Storage: Refungible TokensMinted (r:1 w:1)136 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)137 /// Storage: Refungible AccountBalance (r:200 w:200)138 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)139 /// Storage: Refungible Balance (r:0 w:200)140 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)141 /// Storage: Refungible TotalSupply (r:0 w:1)142 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)143 /// Storage: Refungible Owned (r:0 w:200)144 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)145 /// The range of component `b` is `[0, 200]`.146 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {147 // Proof Size summary in bytes:148 // Measured: `4`149 // Estimated: `3481 + b * (2540 ±0)`150 // Minimum execution time: 1_730_000 picoseconds.151 Weight::from_parts(1_810_000, 3481)152 // Standard Error: 1_923153 .saturating_add(Weight::from_parts(3_500_817, 0).saturating_mul(b.into()))154 .saturating_add(T::DbWeight::get().reads(1_u64))155 .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))156 .saturating_add(T::DbWeight::get().writes(2_u64))157 .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into())))158 .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))159 }160 /// Storage: Refungible Balance (r:3 w:1)161 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)162 /// Storage: Refungible TotalSupply (r:1 w:1)163 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)164 /// Storage: Refungible AccountBalance (r:1 w:1)165 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)166 /// Storage: Refungible Owned (r:0 w:1)167 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)168 fn burn_item_partial() -> Weight {169 // Proof Size summary in bytes:170 // Measured: `456`171 // Estimated: `8682`172 // Minimum execution time: 14_010_000 picoseconds.173 Weight::from_parts(16_300_000, 8682)174 .saturating_add(T::DbWeight::get().reads(5_u64))175 .saturating_add(T::DbWeight::get().writes(4_u64))176 }177 /// Storage: Refungible Balance (r:1 w:1)178 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)179 /// Storage: Refungible TotalSupply (r:1 w:1)180 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)181 /// Storage: Refungible AccountBalance (r:1 w:1)182 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)183 /// Storage: Refungible TokensBurnt (r:1 w:1)184 /// Proof: Refungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)185 /// Storage: Refungible Owned (r:0 w:1)186 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)187 /// Storage: Refungible TokenProperties (r:0 w:1)188 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)189 fn burn_item_fully() -> Weight {190 // Proof Size summary in bytes:191 // Measured: `341`192 // Estimated: `3554`193 // Minimum execution time: 13_700_000 picoseconds.194 Weight::from_parts(14_180_000, 3554)195 .saturating_add(T::DbWeight::get().reads(4_u64))196 .saturating_add(T::DbWeight::get().writes(6_u64))197 }198 /// Storage: Refungible Balance (r:2 w:2)199 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)200 /// Storage: Refungible TotalSupply (r:1 w:0)201 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)202 fn transfer_normal() -> Weight {203 // Proof Size summary in bytes:204 // Measured: `365`205 // Estimated: `6118`206 // Minimum execution time: 8_990_000 picoseconds.207 Weight::from_parts(9_400_000, 6118)208 .saturating_add(T::DbWeight::get().reads(3_u64))209 .saturating_add(T::DbWeight::get().writes(2_u64))210 }211 /// Storage: Refungible Balance (r:2 w:2)212 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)213 /// Storage: Refungible AccountBalance (r:1 w:1)214 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)215 /// Storage: Refungible TotalSupply (r:1 w:0)216 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)217 /// Storage: Refungible Owned (r:0 w:1)218 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)219 fn transfer_creating() -> Weight {220 // Proof Size summary in bytes:221 // Measured: `341`222 // Estimated: `6118`223 // Minimum execution time: 10_240_000 picoseconds.224 Weight::from_parts(10_610_000, 6118)225 .saturating_add(T::DbWeight::get().reads(4_u64))226 .saturating_add(T::DbWeight::get().writes(4_u64))227 }228 /// Storage: Refungible Balance (r:2 w:2)229 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)230 /// Storage: Refungible AccountBalance (r:1 w:1)231 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)232 /// Storage: Refungible TotalSupply (r:1 w:0)233 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)234 /// Storage: Refungible Owned (r:0 w:1)235 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)236 fn transfer_removing() -> Weight {237 // Proof Size summary in bytes:238 // Measured: `456`239 // Estimated: `6118`240 // Minimum execution time: 12_040_000 picoseconds.241 Weight::from_parts(12_390_000, 6118)242 .saturating_add(T::DbWeight::get().reads(4_u64))243 .saturating_add(T::DbWeight::get().writes(4_u64))244 }245 /// Storage: Refungible Balance (r:2 w:2)246 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)247 /// Storage: Refungible AccountBalance (r:2 w:2)248 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)249 /// Storage: Refungible TotalSupply (r:1 w:0)250 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)251 /// Storage: Refungible Owned (r:0 w:2)252 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)253 fn transfer_creating_removing() -> Weight {254 // Proof Size summary in bytes:255 // Measured: `341`256 // Estimated: `6118`257 // Minimum execution time: 11_940_000 picoseconds.258 Weight::from_parts(12_240_000, 6118)259 .saturating_add(T::DbWeight::get().reads(5_u64))260 .saturating_add(T::DbWeight::get().writes(6_u64))261 }262 /// Storage: Refungible Balance (r:1 w:0)263 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)264 /// Storage: Refungible Allowance (r:0 w:1)265 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)266 fn approve() -> Weight {267 // Proof Size summary in bytes:268 // Measured: `223`269 // Estimated: `3554`270 // Minimum execution time: 5_150_000 picoseconds.271 Weight::from_parts(5_440_000, 3554)272 .saturating_add(T::DbWeight::get().reads(1_u64))273 .saturating_add(T::DbWeight::get().writes(1_u64))274 }275 /// Storage: Refungible Balance (r:1 w:0)276 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)277 /// Storage: Refungible Allowance (r:0 w:1)278 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)279 fn approve_from() -> Weight {280 // Proof Size summary in bytes:281 // Measured: `211`282 // Estimated: `3554`283 // Minimum execution time: 5_170_000 picoseconds.284 Weight::from_parts(5_400_000, 3554)285 .saturating_add(T::DbWeight::get().reads(1_u64))286 .saturating_add(T::DbWeight::get().writes(1_u64))287 }288 /// Storage: Refungible Allowance (r:1 w:1)289 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)290 /// Storage: Refungible Balance (r:2 w:2)291 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)292 /// Storage: Refungible TotalSupply (r:1 w:0)293 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)294 fn transfer_from_normal() -> Weight {295 // Proof Size summary in bytes:296 // Measured: `495`297 // Estimated: `6118`298 // Minimum execution time: 13_150_000 picoseconds.299 Weight::from_parts(13_600_000, 6118)300 .saturating_add(T::DbWeight::get().reads(4_u64))301 .saturating_add(T::DbWeight::get().writes(3_u64))302 }303 /// Storage: Refungible Allowance (r:1 w:1)304 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)305 /// Storage: Refungible Balance (r:2 w:2)306 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)307 /// Storage: Refungible AccountBalance (r:1 w:1)308 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)309 /// Storage: Refungible TotalSupply (r:1 w:0)310 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)311 /// Storage: Refungible Owned (r:0 w:1)312 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)313 fn transfer_from_creating() -> Weight {314 // Proof Size summary in bytes:315 // Measured: `471`316 // Estimated: `6118`317 // Minimum execution time: 14_280_000 picoseconds.318 Weight::from_parts(14_680_000, 6118)319 .saturating_add(T::DbWeight::get().reads(5_u64))320 .saturating_add(T::DbWeight::get().writes(5_u64))321 }322 /// Storage: Refungible Allowance (r:1 w:1)323 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)324 /// Storage: Refungible Balance (r:2 w:2)325 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)326 /// Storage: Refungible AccountBalance (r:1 w:1)327 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)328 /// Storage: Refungible TotalSupply (r:1 w:0)329 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)330 /// Storage: Refungible Owned (r:0 w:1)331 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)332 fn transfer_from_removing() -> Weight {333 // Proof Size summary in bytes:334 // Measured: `586`335 // Estimated: `6118`336 // Minimum execution time: 16_110_000 picoseconds.337 Weight::from_parts(16_710_000, 6118)338 .saturating_add(T::DbWeight::get().reads(5_u64))339 .saturating_add(T::DbWeight::get().writes(5_u64))340 }341 /// Storage: Refungible Allowance (r:1 w:1)342 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)343 /// Storage: Refungible Balance (r:2 w:2)344 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)345 /// Storage: Refungible AccountBalance (r:2 w:2)346 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)347 /// Storage: Refungible TotalSupply (r:1 w:0)348 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)349 /// Storage: Refungible Owned (r:0 w:2)350 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)351 fn transfer_from_creating_removing() -> Weight {352 // Proof Size summary in bytes:353 // Measured: `471`354 // Estimated: `6118`355 // Minimum execution time: 16_130_000 picoseconds.356 Weight::from_parts(16_680_000, 6118)357 .saturating_add(T::DbWeight::get().reads(6_u64))358 .saturating_add(T::DbWeight::get().writes(7_u64))359 }360 /// Storage: Refungible Allowance (r:1 w:1)361 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)362 /// Storage: Refungible Balance (r:1 w:1)363 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)364 /// Storage: Refungible TotalSupply (r:1 w:1)365 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)366 /// Storage: Refungible AccountBalance (r:1 w:1)367 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)368 /// Storage: Refungible TokensBurnt (r:1 w:1)369 /// Proof: Refungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)370 /// Storage: Refungible Owned (r:0 w:1)371 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)372 /// Storage: Refungible TokenProperties (r:0 w:1)373 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)374 fn burn_from() -> Weight {375 // Proof Size summary in bytes:376 // Measured: `471`377 // Estimated: `3570`378 // Minimum execution time: 18_380_000 picoseconds.379 Weight::from_parts(18_870_000, 3570)380 .saturating_add(T::DbWeight::get().reads(5_u64))381 .saturating_add(T::DbWeight::get().writes(7_u64))382 }383 /// Storage: Common CollectionPropertyPermissions (r:1 w:1)384 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)385 /// The range of component `b` is `[0, 64]`.386 fn set_token_property_permissions(b: u32, ) -> Weight {387 // Proof Size summary in bytes:388 // Measured: `314`389 // Estimated: `20191`390 // Minimum execution time: 580_000 picoseconds.391 Weight::from_parts(660_000, 20191)392 // Standard Error: 29_964393 .saturating_add(Weight::from_parts(6_251_766, 0).saturating_mul(b.into()))394 .saturating_add(T::DbWeight::get().reads(1_u64))395 .saturating_add(T::DbWeight::get().writes(1_u64))396 }397 /// Storage: Common CollectionPropertyPermissions (r:1 w:0)398 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)399 /// Storage: Refungible TokenProperties (r:1 w:1)400 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)401 /// Storage: Refungible TotalSupply (r:1 w:0)402 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)403 /// The range of component `b` is `[0, 64]`.404 fn set_token_properties(b: u32, ) -> Weight {405 // Proof Size summary in bytes:406 // Measured: `502 + b * (261 ±0)`407 // Estimated: `36269`408 // Minimum execution time: 350_000 picoseconds.409 Weight::from_parts(2_269_806, 36269)410 // Standard Error: 7_751411 .saturating_add(Weight::from_parts(3_068_126, 0).saturating_mul(b.into()))412 .saturating_add(T::DbWeight::get().reads(3_u64))413 .saturating_add(T::DbWeight::get().writes(1_u64))414 }415 /// Storage: Refungible TokenProperties (r:1 w:0)416 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)417 fn load_token_properties() -> Weight {418 // Proof Size summary in bytes:419 // Measured: `120`420 // Estimated: `36269`421 // Minimum execution time: 1_010_000 picoseconds.422 Weight::from_parts(1_080_000, 36269)423 .saturating_add(T::DbWeight::get().reads(1_u64))424 }425 /// Storage: Refungible TokenProperties (r:0 w:1)426 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)427 /// The range of component `b` is `[0, 64]`.428 fn write_token_properties(b: u32, ) -> Weight {429 // Proof Size summary in bytes:430 // Measured: `0`431 // Estimated: `0`432 // Minimum execution time: 70_000 picoseconds.433 Weight::from_parts(1_363_449, 0)434 // Standard Error: 8_964435 .saturating_add(Weight::from_parts(2_665_759, 0).saturating_mul(b.into()))436 .saturating_add(T::DbWeight::get().writes(1_u64))437 }438 /// Storage: Common CollectionPropertyPermissions (r:1 w:0)439 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)440 /// Storage: Refungible TotalSupply (r:1 w:0)441 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)442 /// Storage: Refungible TokenProperties (r:1 w:1)443 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)444 /// The range of component `b` is `[0, 64]`.445 fn delete_token_properties(b: u32, ) -> Weight {446 // Proof Size summary in bytes:447 // Measured: `561 + b * (33291 ±0)`448 // Estimated: `36269`449 // Minimum execution time: 320_000 picoseconds.450 Weight::from_parts(370_000, 36269)451 // Standard Error: 28_541452 .saturating_add(Weight::from_parts(9_863_065, 0).saturating_mul(b.into()))453 .saturating_add(T::DbWeight::get().reads(3_u64))454 .saturating_add(T::DbWeight::get().writes(1_u64))455 }456 /// Storage: Refungible TotalSupply (r:1 w:1)457 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)458 /// Storage: Refungible Balance (r:1 w:1)459 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)460 fn repartition_item() -> Weight {461 // Proof Size summary in bytes:462 // Measured: `288`463 // Estimated: `3554`464 // Minimum execution time: 6_320_000 picoseconds.465 Weight::from_parts(6_640_000, 3554)466 .saturating_add(T::DbWeight::get().reads(2_u64))467 .saturating_add(T::DbWeight::get().writes(2_u64))468 }469 /// Storage: Refungible Balance (r:2 w:0)470 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)471 fn token_owner() -> Weight {472 // Proof Size summary in bytes:473 // Measured: `288`474 // Estimated: `6118`475 // Minimum execution time: 2_520_000 picoseconds.476 Weight::from_parts(2_680_000, 6118)477 .saturating_add(T::DbWeight::get().reads(2_u64))478 }479 /// Storage: Refungible CollectionAllowance (r:0 w:1)480 /// Proof: Refungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)481 fn set_allowance_for_all() -> Weight {482 // Proof Size summary in bytes:483 // Measured: `0`484 // Estimated: `0`485 // Minimum execution time: 2_070_000 picoseconds.486 Weight::from_parts(2_230_000, 0)487 .saturating_add(T::DbWeight::get().writes(1_u64))488 }489 /// Storage: Refungible CollectionAllowance (r:1 w:0)490 /// Proof: Refungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)491 fn allowance_for_all() -> Weight {492 // Proof Size summary in bytes:493 // Measured: `4`494 // Estimated: `3576`495 // Minimum execution time: 1_270_000 picoseconds.496 Weight::from_parts(1_420_000, 3576)497 .saturating_add(T::DbWeight::get().reads(1_u64))498 }499 /// Storage: Refungible TokenProperties (r:1 w:1)500 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)501 fn repair_item() -> Weight {502 // Proof Size summary in bytes:503 // Measured: `120`504 // Estimated: `36269`505 // Minimum execution time: 1_010_000 picoseconds.506 Weight::from_parts(1_160_000, 36269)507 .saturating_add(T::DbWeight::get().reads(1_u64))508 .saturating_add(T::DbWeight::get().writes(1_u64))509 }510}511512// For backwards compatibility and tests513impl WeightInfo for () {514 /// Storage: Refungible TokensMinted (r:1 w:1)515 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)516 /// Storage: Refungible AccountBalance (r:1 w:1)517 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)518 /// Storage: Refungible Balance (r:0 w:1)519 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)520 /// Storage: Refungible TotalSupply (r:0 w:1)521 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)522 /// Storage: Refungible Owned (r:0 w:1)523 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)524 fn create_item() -> Weight {525 // Proof Size summary in bytes:526 // Measured: `4`527 // Estimated: `3530`528 // Minimum execution time: 5_710_000 picoseconds.529 Weight::from_parts(5_980_000, 3530)530 .saturating_add(RocksDbWeight::get().reads(2_u64))531 .saturating_add(RocksDbWeight::get().writes(5_u64))532 }533 /// Storage: Refungible TokensMinted (r:1 w:1)534 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)535 /// Storage: Refungible AccountBalance (r:1 w:1)536 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)537 /// Storage: Refungible Balance (r:0 w:200)538 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)539 /// Storage: Refungible TotalSupply (r:0 w:200)540 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)541 /// Storage: Refungible Owned (r:0 w:200)542 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)543 /// The range of component `b` is `[0, 200]`.544 fn create_multiple_items(b: u32, ) -> Weight {545 // Proof Size summary in bytes:546 // Measured: `4`547 // Estimated: `3530`548 // Minimum execution time: 1_300_000 picoseconds.549 Weight::from_parts(1_360_000, 3530)550 // Standard Error: 2_783551 .saturating_add(Weight::from_parts(3_456_531, 0).saturating_mul(b.into()))552 .saturating_add(RocksDbWeight::get().reads(2_u64))553 .saturating_add(RocksDbWeight::get().writes(2_u64))554 .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(b.into())))555 }556 /// Storage: Refungible TokensMinted (r:1 w:1)557 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)558 /// Storage: Refungible AccountBalance (r:200 w:200)559 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)560 /// Storage: Refungible Balance (r:0 w:200)561 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)562 /// Storage: Refungible TotalSupply (r:0 w:200)563 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)564 /// Storage: Refungible Owned (r:0 w:200)565 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)566 /// The range of component `b` is `[0, 200]`.567 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {568 // Proof Size summary in bytes:569 // Measured: `4`570 // Estimated: `3481 + b * (2540 ±0)`571 // Minimum execution time: 1_290_000 picoseconds.572 Weight::from_parts(1_370_000, 3481)573 // Standard Error: 3_198574 .saturating_add(Weight::from_parts(4_435_305, 0).saturating_mul(b.into()))575 .saturating_add(RocksDbWeight::get().reads(1_u64))576 .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(b.into())))577 .saturating_add(RocksDbWeight::get().writes(1_u64))578 .saturating_add(RocksDbWeight::get().writes((4_u64).saturating_mul(b.into())))579 .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))580 }581 /// Storage: Refungible TokensMinted (r:1 w:1)582 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)583 /// Storage: Refungible AccountBalance (r:200 w:200)584 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)585 /// Storage: Refungible Balance (r:0 w:200)586 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)587 /// Storage: Refungible TotalSupply (r:0 w:1)588 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)589 /// Storage: Refungible Owned (r:0 w:200)590 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)591 /// The range of component `b` is `[0, 200]`.592 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {593 // Proof Size summary in bytes:594 // Measured: `4`595 // Estimated: `3481 + b * (2540 ±0)`596 // Minimum execution time: 1_730_000 picoseconds.597 Weight::from_parts(1_810_000, 3481)598 // Standard Error: 1_923599 .saturating_add(Weight::from_parts(3_500_817, 0).saturating_mul(b.into()))600 .saturating_add(RocksDbWeight::get().reads(1_u64))601 .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(b.into())))602 .saturating_add(RocksDbWeight::get().writes(2_u64))603 .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(b.into())))604 .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))605 }606 /// Storage: Refungible Balance (r:3 w:1)607 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)608 /// Storage: Refungible TotalSupply (r:1 w:1)609 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)610 /// Storage: Refungible AccountBalance (r:1 w:1)611 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)612 /// Storage: Refungible Owned (r:0 w:1)613 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)614 fn burn_item_partial() -> Weight {615 // Proof Size summary in bytes:616 // Measured: `456`617 // Estimated: `8682`618 // Minimum execution time: 14_010_000 picoseconds.619 Weight::from_parts(16_300_000, 8682)620 .saturating_add(RocksDbWeight::get().reads(5_u64))621 .saturating_add(RocksDbWeight::get().writes(4_u64))622 }623 /// Storage: Refungible Balance (r:1 w:1)624 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)625 /// Storage: Refungible TotalSupply (r:1 w:1)626 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)627 /// Storage: Refungible AccountBalance (r:1 w:1)628 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)629 /// Storage: Refungible TokensBurnt (r:1 w:1)630 /// Proof: Refungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)631 /// Storage: Refungible Owned (r:0 w:1)632 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)633 /// Storage: Refungible TokenProperties (r:0 w:1)634 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)635 fn burn_item_fully() -> Weight {636 // Proof Size summary in bytes:637 // Measured: `341`638 // Estimated: `3554`639 // Minimum execution time: 13_700_000 picoseconds.640 Weight::from_parts(14_180_000, 3554)641 .saturating_add(RocksDbWeight::get().reads(4_u64))642 .saturating_add(RocksDbWeight::get().writes(6_u64))643 }644 /// Storage: Refungible Balance (r:2 w:2)645 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)646 /// Storage: Refungible TotalSupply (r:1 w:0)647 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)648 fn transfer_normal() -> Weight {649 // Proof Size summary in bytes:650 // Measured: `365`651 // Estimated: `6118`652 // Minimum execution time: 8_990_000 picoseconds.653 Weight::from_parts(9_400_000, 6118)654 .saturating_add(RocksDbWeight::get().reads(3_u64))655 .saturating_add(RocksDbWeight::get().writes(2_u64))656 }657 /// Storage: Refungible Balance (r:2 w:2)658 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)659 /// Storage: Refungible AccountBalance (r:1 w:1)660 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)661 /// Storage: Refungible TotalSupply (r:1 w:0)662 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)663 /// Storage: Refungible Owned (r:0 w:1)664 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)665 fn transfer_creating() -> Weight {666 // Proof Size summary in bytes:667 // Measured: `341`668 // Estimated: `6118`669 // Minimum execution time: 10_240_000 picoseconds.670 Weight::from_parts(10_610_000, 6118)671 .saturating_add(RocksDbWeight::get().reads(4_u64))672 .saturating_add(RocksDbWeight::get().writes(4_u64))673 }674 /// Storage: Refungible Balance (r:2 w:2)675 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)676 /// Storage: Refungible AccountBalance (r:1 w:1)677 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)678 /// Storage: Refungible TotalSupply (r:1 w:0)679 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)680 /// Storage: Refungible Owned (r:0 w:1)681 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)682 fn transfer_removing() -> Weight {683 // Proof Size summary in bytes:684 // Measured: `456`685 // Estimated: `6118`686 // Minimum execution time: 12_040_000 picoseconds.687 Weight::from_parts(12_390_000, 6118)688 .saturating_add(RocksDbWeight::get().reads(4_u64))689 .saturating_add(RocksDbWeight::get().writes(4_u64))690 }691 /// Storage: Refungible Balance (r:2 w:2)692 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)693 /// Storage: Refungible AccountBalance (r:2 w:2)694 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)695 /// Storage: Refungible TotalSupply (r:1 w:0)696 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)697 /// Storage: Refungible Owned (r:0 w:2)698 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)699 fn transfer_creating_removing() -> Weight {700 // Proof Size summary in bytes:701 // Measured: `341`702 // Estimated: `6118`703 // Minimum execution time: 11_940_000 picoseconds.704 Weight::from_parts(12_240_000, 6118)705 .saturating_add(RocksDbWeight::get().reads(5_u64))706 .saturating_add(RocksDbWeight::get().writes(6_u64))707 }708 /// Storage: Refungible Balance (r:1 w:0)709 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)710 /// Storage: Refungible Allowance (r:0 w:1)711 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)712 fn approve() -> Weight {713 // Proof Size summary in bytes:714 // Measured: `223`715 // Estimated: `3554`716 // Minimum execution time: 5_150_000 picoseconds.717 Weight::from_parts(5_440_000, 3554)718 .saturating_add(RocksDbWeight::get().reads(1_u64))719 .saturating_add(RocksDbWeight::get().writes(1_u64))720 }721 /// Storage: Refungible Balance (r:1 w:0)722 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)723 /// Storage: Refungible Allowance (r:0 w:1)724 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)725 fn approve_from() -> Weight {726 // Proof Size summary in bytes:727 // Measured: `211`728 // Estimated: `3554`729 // Minimum execution time: 5_170_000 picoseconds.730 Weight::from_parts(5_400_000, 3554)731 .saturating_add(RocksDbWeight::get().reads(1_u64))732 .saturating_add(RocksDbWeight::get().writes(1_u64))733 }734 /// Storage: Refungible Allowance (r:1 w:1)735 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)736 /// Storage: Refungible Balance (r:2 w:2)737 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)738 /// Storage: Refungible TotalSupply (r:1 w:0)739 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)740 fn transfer_from_normal() -> Weight {741 // Proof Size summary in bytes:742 // Measured: `495`743 // Estimated: `6118`744 // Minimum execution time: 13_150_000 picoseconds.745 Weight::from_parts(13_600_000, 6118)746 .saturating_add(RocksDbWeight::get().reads(4_u64))747 .saturating_add(RocksDbWeight::get().writes(3_u64))748 }749 /// Storage: Refungible Allowance (r:1 w:1)750 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)751 /// Storage: Refungible Balance (r:2 w:2)752 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)753 /// Storage: Refungible AccountBalance (r:1 w:1)754 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)755 /// Storage: Refungible TotalSupply (r:1 w:0)756 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)757 /// Storage: Refungible Owned (r:0 w:1)758 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)759 fn transfer_from_creating() -> Weight {760 // Proof Size summary in bytes:761 // Measured: `471`762 // Estimated: `6118`763 // Minimum execution time: 14_280_000 picoseconds.764 Weight::from_parts(14_680_000, 6118)765 .saturating_add(RocksDbWeight::get().reads(5_u64))766 .saturating_add(RocksDbWeight::get().writes(5_u64))767 }768 /// Storage: Refungible Allowance (r:1 w:1)769 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)770 /// Storage: Refungible Balance (r:2 w:2)771 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)772 /// Storage: Refungible AccountBalance (r:1 w:1)773 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)774 /// Storage: Refungible TotalSupply (r:1 w:0)775 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)776 /// Storage: Refungible Owned (r:0 w:1)777 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)778 fn transfer_from_removing() -> Weight {779 // Proof Size summary in bytes:780 // Measured: `586`781 // Estimated: `6118`782 // Minimum execution time: 16_110_000 picoseconds.783 Weight::from_parts(16_710_000, 6118)784 .saturating_add(RocksDbWeight::get().reads(5_u64))785 .saturating_add(RocksDbWeight::get().writes(5_u64))786 }787 /// Storage: Refungible Allowance (r:1 w:1)788 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)789 /// Storage: Refungible Balance (r:2 w:2)790 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)791 /// Storage: Refungible AccountBalance (r:2 w:2)792 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)793 /// Storage: Refungible TotalSupply (r:1 w:0)794 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)795 /// Storage: Refungible Owned (r:0 w:2)796 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)797 fn transfer_from_creating_removing() -> Weight {798 // Proof Size summary in bytes:799 // Measured: `471`800 // Estimated: `6118`801 // Minimum execution time: 16_130_000 picoseconds.802 Weight::from_parts(16_680_000, 6118)803 .saturating_add(RocksDbWeight::get().reads(6_u64))804 .saturating_add(RocksDbWeight::get().writes(7_u64))805 }806 /// Storage: Refungible Allowance (r:1 w:1)807 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)808 /// Storage: Refungible Balance (r:1 w:1)809 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)810 /// Storage: Refungible TotalSupply (r:1 w:1)811 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)812 /// Storage: Refungible AccountBalance (r:1 w:1)813 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)814 /// Storage: Refungible TokensBurnt (r:1 w:1)815 /// Proof: Refungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)816 /// Storage: Refungible Owned (r:0 w:1)817 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)818 /// Storage: Refungible TokenProperties (r:0 w:1)819 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)820 fn burn_from() -> Weight {821 // Proof Size summary in bytes:822 // Measured: `471`823 // Estimated: `3570`824 // Minimum execution time: 18_380_000 picoseconds.825 Weight::from_parts(18_870_000, 3570)826 .saturating_add(RocksDbWeight::get().reads(5_u64))827 .saturating_add(RocksDbWeight::get().writes(7_u64))828 }829 /// Storage: Common CollectionPropertyPermissions (r:1 w:1)830 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)831 /// The range of component `b` is `[0, 64]`.832 fn set_token_property_permissions(b: u32, ) -> Weight {833 // Proof Size summary in bytes:834 // Measured: `314`835 // Estimated: `20191`836 // Minimum execution time: 580_000 picoseconds.837 Weight::from_parts(660_000, 20191)838 // Standard Error: 29_964839 .saturating_add(Weight::from_parts(6_251_766, 0).saturating_mul(b.into()))840 .saturating_add(RocksDbWeight::get().reads(1_u64))841 .saturating_add(RocksDbWeight::get().writes(1_u64))842 }843 /// Storage: Common CollectionPropertyPermissions (r:1 w:0)844 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)845 /// Storage: Refungible TokenProperties (r:1 w:1)846 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)847 /// Storage: Refungible TotalSupply (r:1 w:0)848 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)849 /// The range of component `b` is `[0, 64]`.850 fn set_token_properties(b: u32, ) -> Weight {851 // Proof Size summary in bytes:852 // Measured: `502 + b * (261 ±0)`853 // Estimated: `36269`854 // Minimum execution time: 350_000 picoseconds.855 Weight::from_parts(2_269_806, 36269)856 // Standard Error: 7_751857 .saturating_add(Weight::from_parts(3_068_126, 0).saturating_mul(b.into()))858 .saturating_add(RocksDbWeight::get().reads(3_u64))859 .saturating_add(RocksDbWeight::get().writes(1_u64))860 }861 /// Storage: Refungible TokenProperties (r:1 w:0)862 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)863 fn load_token_properties() -> Weight {864 // Proof Size summary in bytes:865 // Measured: `120`866 // Estimated: `36269`867 // Minimum execution time: 1_010_000 picoseconds.868 Weight::from_parts(1_080_000, 36269)869 .saturating_add(RocksDbWeight::get().reads(1_u64))870 }871 /// Storage: Refungible TokenProperties (r:0 w:1)872 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)873 /// The range of component `b` is `[0, 64]`.874 fn write_token_properties(b: u32, ) -> Weight {875 // Proof Size summary in bytes:876 // Measured: `0`877 // Estimated: `0`878 // Minimum execution time: 70_000 picoseconds.879 Weight::from_parts(1_363_449, 0)880 // Standard Error: 8_964881 .saturating_add(Weight::from_parts(2_665_759, 0).saturating_mul(b.into()))882 .saturating_add(RocksDbWeight::get().writes(1_u64))883 }884 /// Storage: Common CollectionPropertyPermissions (r:1 w:0)885 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)886 /// Storage: Refungible TotalSupply (r:1 w:0)887 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)888 /// Storage: Refungible TokenProperties (r:1 w:1)889 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)890 /// The range of component `b` is `[0, 64]`.891 fn delete_token_properties(b: u32, ) -> Weight {892 // Proof Size summary in bytes:893 // Measured: `561 + b * (33291 ±0)`894 // Estimated: `36269`895 // Minimum execution time: 320_000 picoseconds.896 Weight::from_parts(370_000, 36269)897 // Standard Error: 28_541898 .saturating_add(Weight::from_parts(9_863_065, 0).saturating_mul(b.into()))899 .saturating_add(RocksDbWeight::get().reads(3_u64))900 .saturating_add(RocksDbWeight::get().writes(1_u64))901 }902 /// Storage: Refungible TotalSupply (r:1 w:1)903 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)904 /// Storage: Refungible Balance (r:1 w:1)905 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)906 fn repartition_item() -> Weight {907 // Proof Size summary in bytes:908 // Measured: `288`909 // Estimated: `3554`910 // Minimum execution time: 6_320_000 picoseconds.911 Weight::from_parts(6_640_000, 3554)912 .saturating_add(RocksDbWeight::get().reads(2_u64))913 .saturating_add(RocksDbWeight::get().writes(2_u64))914 }915 /// Storage: Refungible Balance (r:2 w:0)916 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)917 fn token_owner() -> Weight {918 // Proof Size summary in bytes:919 // Measured: `288`920 // Estimated: `6118`921 // Minimum execution time: 2_520_000 picoseconds.922 Weight::from_parts(2_680_000, 6118)923 .saturating_add(RocksDbWeight::get().reads(2_u64))924 }925 /// Storage: Refungible CollectionAllowance (r:0 w:1)926 /// Proof: Refungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)927 fn set_allowance_for_all() -> Weight {928 // Proof Size summary in bytes:929 // Measured: `0`930 // Estimated: `0`931 // Minimum execution time: 2_070_000 picoseconds.932 Weight::from_parts(2_230_000, 0)933 .saturating_add(RocksDbWeight::get().writes(1_u64))934 }935 /// Storage: Refungible CollectionAllowance (r:1 w:0)936 /// Proof: Refungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)937 fn allowance_for_all() -> Weight {938 // Proof Size summary in bytes:939 // Measured: `4`940 // Estimated: `3576`941 // Minimum execution time: 1_270_000 picoseconds.942 Weight::from_parts(1_420_000, 3576)943 .saturating_add(RocksDbWeight::get().reads(1_u64))944 }945 /// Storage: Refungible TokenProperties (r:1 w:1)946 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)947 fn repair_item() -> Weight {948 // Proof Size summary in bytes:949 // Measured: `120`950 // Estimated: `36269`951 // Minimum execution time: 1_010_000 picoseconds.952 Weight::from_parts(1_160_000, 36269)953 .saturating_add(RocksDbWeight::get().reads(1_u64))954 .saturating_add(RocksDbWeight::get().writes(1_u64))955 }956}957pallets/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,20 @@
#[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,
+ CollectionHandle, CommonCollectionOperations, 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 +111,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 +132,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 +270,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 +672,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,9 +680,9 @@
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| {
+ Self::dispatch_tx_with_nesting_budget(collection_id, &budget, |d| {
d.create_item(sender, owner, data, &budget)
})
}
@@ -700,7 +706,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,9 +715,9 @@
) -> 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| {
+ Self::dispatch_tx_with_nesting_budget(collection_id, &budget, |d| {
d.create_multiple_items(sender, owner, items_data, &budget)
})
}
@@ -791,7 +797,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,9 +807,9 @@
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| {
+ Self::dispatch_tx_with_nesting_budget(collection_id, &budget, |d| {
d.set_token_properties(sender, token_id, properties, &budget)
})
}
@@ -824,7 +830,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,9 +840,9 @@
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| {
+ Self::dispatch_tx_with_nesting_budget(collection_id, &budget, |d| {
d.delete_token_properties(sender, token_id, property_keys, &budget)
})
}
@@ -888,16 +894,16 @@
/// * `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| {
+ Self::dispatch_tx_with_nesting_budget(collection_id, &budget, |d| {
d.create_multiple_items_ex(sender, data, &budget)
})
}
@@ -995,7 +1001,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,9 +1010,9 @@
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| {
+ Self::dispatch_tx_with_nesting_budget(collection_id, &budget, |d| {
d.burn_from(sender, from, item_id, value, &budget)
})
}
@@ -1033,7 +1039,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,9 +1048,9 @@
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| {
+ Self::dispatch_tx_with_nesting_budget(collection_id, &budget, |d| {
d.transfer(sender, recipient, item_id, value, &budget)
})
}
@@ -1138,7 +1144,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,9 +1154,9 @@
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| {
+ Self::dispatch_tx_with_nesting_budget(collection_id, &budget, |d| {
d.transfer_from(sender, from, recipient, item_id, value, &budget)
})
}
@@ -1348,5 +1354,44 @@
Ok(())
}
+
+ fn structure_nesting_budget() -> budget::Value {
+ budget::Value::new(Self::nesting_budget())
+ }
+
+ fn nesting_budget_weight(value: &budget::Value) -> Weight {
+ T::StructureWeightInfo::find_parent().saturating_mul(value.remaining() as u64)
+ }
+
+ fn nesting_budget_predispatch_weight() -> Weight {
+ Self::nesting_budget_weight(&Self::structure_nesting_budget())
+ }
+
+ pub fn dispatch_tx_with_nesting_budget<
+ C: FnOnce(&dyn CommonCollectionOperations<T>) -> DispatchResultWithPostInfo,
+ >(
+ collection: CollectionId,
+ budget: &budget::Value,
+ call: C,
+ ) -> DispatchResultWithPostInfo {
+ let mut result = dispatch_tx::<T, _>(collection, call);
+
+ match &mut result {
+ Ok(PostDispatchInfo {
+ actual_weight: Some(weight),
+ ..
+ })
+ | Err(DispatchErrorWithPostInfo {
+ post_info: PostDispatchInfo {
+ actual_weight: Some(weight),
+ ..
+ },
+ ..
+ }) => *weight += Self::nesting_budget_weight(budget),
+ _ => {}
+ }
+
+ 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 remaining(&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())
}
}