diff --git a/pallets/balances-adapter/src/common.rs b/pallets/balances-adapter/src/common.rs index 6b5b2bd81e..b03a95124b 100644 --- a/pallets/balances-adapter/src/common.rs +++ b/pallets/balances-adapter/src/common.rs @@ -58,18 +58,6 @@ impl CommonWeightInfo for CommonWeights { 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() - } - fn set_allowance_for_all() -> Weight { Weight::default() } @@ -120,16 +108,6 @@ impl CommonCollectionOperations for NativeFungibleHandle { fail!(>::UnsupportedOperation); } - fn burn_item_recursively( - &self, - _sender: ::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!(>::UnsupportedOperation); - } - fn set_collection_properties( &self, _sender: ::CrossAccountId, diff --git a/pallets/common/src/lib.rs b/pallets/common/src/lib.rs index 20a97c9767..8248a84329 100644 --- a/pallets/common/src/lib.rs +++ b/pallets/common/src/lib.rs @@ -1938,30 +1938,6 @@ pub trait CommonWeightInfo { /// 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; @@ -2033,20 +2009,6 @@ pub trait CommonCollectionOperations { 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. diff --git a/pallets/fungible/src/common.rs b/pallets/fungible/src/common.rs index a4455c8b02..c998d697d2 100644 --- 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::{ @@ -93,20 +90,6 @@ impl CommonWeightInfo for CommonWeights { >::burn_from() } - fn burn_recursively_self_raw() -> Weight { - // Read to get total balance - Self::burn_item().saturating_add(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() } @@ -195,26 +178,6 @@ impl CommonCollectionOperations for FungibleHandle { ) } - 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(), - >::FungibleItemsHaveNoId - ); - ensure!(self_budget.consume(), >::DepthLimit,); - - with_weight( - >::burn(self, &sender, >::get((self.id, &sender))), - >::burn_recursively_self_raw(), - ) - } - fn transfer( &self, from: T::CrossAccountId, diff --git a/pallets/nonfungible/src/common.rs b/pallets/nonfungible/src/common.rs index 83dd3273e6..7fe032d30e 100644 --- a/pallets/nonfungible/src/common.rs +++ b/pallets/nonfungible/src/common.rs @@ -104,19 +104,6 @@ impl CommonWeightInfo for CommonWeights { >::burn_from() } - fn burn_recursively_self_raw() -> Weight { - >::burn_recursively_self_raw() - } - - fn burn_recursively_breadth_raw(amount: u32) -> Weight { - >::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 { - >::token_owner() - } - fn set_allowance_for_all() -> Weight { >::set_allowance_for_all() } @@ -309,16 +296,6 @@ impl CommonCollectionOperations for NonfungibleHandle { } } - fn burn_item_recursively( - &self, - sender: T::CrossAccountId, - token: TokenId, - self_budget: &dyn Budget, - breadth_budget: &dyn Budget, - ) -> DispatchResultWithPostInfo { - >::burn_recursively(self, &sender, token, self_budget, breadth_budget) - } - fn transfer( &self, from: T::CrossAccountId, diff --git a/pallets/nonfungible/src/lib.rs b/pallets/nonfungible/src/lib.rs index 22fbbf7b20..c309f294ac 100644 --- a/pallets/nonfungible/src/lib.rs +++ b/pallets/nonfungible/src/lib.rs @@ -109,7 +109,7 @@ use pallet_common::{ }; 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}; @@ -503,51 +503,6 @@ impl Pallet { 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, - sender: &T::CrossAccountId, - token: TokenId, - self_budget: &dyn Budget, - breadth_budget: &dyn Budget, - ) -> DispatchResultWithPostInfo { - ensure!(self_budget.consume(), >::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 >::iter_prefix((collection.id, token)) { - ensure!(breadth_budget.consume(), >::BreadthLimit,); - let PostDispatchInfo { actual_weight, .. } = - >::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 + >::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. diff --git a/pallets/refungible/src/common.rs b/pallets/refungible/src/common.rs index ce1c5a817a..bae6dc94a8 100644 --- 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::{ 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::{ @@ -131,19 +129,6 @@ impl CommonWeightInfo for CommonWeights { >::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 { - >::token_owner() - } - fn set_allowance_for_all() -> Weight { >::set_allowance_for_all() } @@ -260,25 +245,6 @@ impl CommonCollectionOperations for RefungibleHandle { ) } - fn burn_item_recursively( - &self, - sender: T::CrossAccountId, - token: TokenId, - self_budget: &dyn Budget, - _breadth_budget: &dyn Budget, - ) -> DispatchResultWithPostInfo { - ensure!(self_budget.consume(), >::DepthLimit,); - with_weight( - >::burn( - self, - &sender, - token, - >::get((self.id, token, &sender)), - ), - >::burn_recursively_self_raw(), - ) - } - fn transfer( &self, from: T::CrossAccountId, diff --git a/pallets/structure/src/lib.rs b/pallets/structure/src/lib.rs index 2014cc44b7..127983607d 100644 --- 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, @@ -269,22 +265,6 @@ impl Pallet { Err(>::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` /// /// Returns `true` if `user` is `token`'s owner. Or If token is provided as `user` then diff --git a/pallets/unique/Cargo.toml b/pallets/unique/Cargo.toml index 4b81b66ae0..d6e9265f85 100644 --- a/pallets/unique/Cargo.toml +++ b/pallets/unique/Cargo.toml @@ -33,6 +33,7 @@ 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"] @@ -54,6 +55,7 @@ pallet-evm = { workspace = true } 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 } diff --git a/pallets/unique/src/lib.rs b/pallets/unique/src/lib.rs index 98bd6a788f..00f3fea64e 100644 --- a/pallets/unique/src/lib.rs +++ b/pallets/unique/src/lib.rs @@ -84,13 +84,20 @@ pub mod weights; #[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::{ @@ -125,6 +132,8 @@ pub mod pallet { /// Weight information for common pallet operations. type CommonWeightInfo: CommonWeightInfo; + type StructureWeightInfo: StructureWeightInfo; + /// Weight info information for extra refungible pallet operations. type RefungibleExtensionsWeightInfo: RefungibleExtensionsWeightInfo; } @@ -663,7 +672,7 @@ pub mod pallet { /// * `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) + >::nesting_budget_predispatch_weight())] pub fn create_item( origin: OriginFor, collection_id: CollectionId, @@ -671,9 +680,10 @@ pub mod pallet { data: CreateItemData, ) -> DispatchResultWithPostInfo { let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?); + let budget = Self::structure_nesting_budget(); - dispatch_tx::(collection_id, |d| { - d.create_item(sender, owner, data, &Self::structure_nesting_budget()) + Self::dispatch_tx_with_nesting_budget(collection_id, &budget, |d| { + d.create_item(sender, owner, data, &budget) }) } @@ -696,7 +706,7 @@ pub mod pallet { /// * `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) + >::nesting_budget_predispatch_weight())] pub fn create_multiple_items( origin: OriginFor, collection_id: CollectionId, @@ -705,14 +715,10 @@ pub mod pallet { ) -> DispatchResultWithPostInfo { ensure!(!items_data.is_empty(), Error::::EmptyArgument); let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?); + let budget = Self::structure_nesting_budget(); - dispatch_tx::(collection_id, |d| { - d.create_multiple_items( - sender, - owner, - items_data, - &Self::structure_nesting_budget(), - ) + Self::dispatch_tx_with_nesting_budget(collection_id, &budget, |d| { + d.create_multiple_items(sender, owner, items_data, &budget) }) } @@ -791,7 +797,7 @@ pub mod pallet { /// * `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) + >::nesting_budget_predispatch_weight())] pub fn set_token_properties( origin: OriginFor, collection_id: CollectionId, @@ -801,14 +807,10 @@ pub mod pallet { ensure!(!properties.is_empty(), Error::::EmptyArgument); let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?); + let budget = Self::structure_nesting_budget(); - dispatch_tx::(collection_id, |d| { - d.set_token_properties( - sender, - token_id, - properties, - &Self::structure_nesting_budget(), - ) + Self::dispatch_tx_with_nesting_budget(collection_id, &budget, |d| { + d.set_token_properties(sender, token_id, properties, &budget) }) } @@ -828,7 +830,7 @@ pub mod pallet { /// * `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) + >::nesting_budget_predispatch_weight())] pub fn delete_token_properties( origin: OriginFor, collection_id: CollectionId, @@ -838,14 +840,10 @@ pub mod pallet { ensure!(!property_keys.is_empty(), Error::::EmptyArgument); let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?); + let budget = Self::structure_nesting_budget(); - dispatch_tx::(collection_id, |d| { - d.delete_token_properties( - sender, - token_id, - property_keys, - &Self::structure_nesting_budget(), - ) + Self::dispatch_tx_with_nesting_budget(collection_id, &budget, |d| { + d.delete_token_properties(sender, token_id, property_keys, &budget) }) } @@ -896,16 +894,17 @@ pub mod pallet { /// * `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) + >::nesting_budget_predispatch_weight())] pub fn create_multiple_items_ex( origin: OriginFor, collection_id: CollectionId, data: CreateItemExData, ) -> DispatchResultWithPostInfo { let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?); + let budget = Self::structure_nesting_budget(); - dispatch_tx::(collection_id, |d| { - d.create_multiple_items_ex(sender, data, &Self::structure_nesting_budget()) + Self::dispatch_tx_with_nesting_budget(collection_id, &budget, |d| { + d.create_multiple_items_ex(sender, data, &budget) }) } @@ -1002,7 +1001,7 @@ pub mod pallet { /// * 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() + >::nesting_budget_predispatch_weight())] pub fn burn_from( origin: OriginFor, collection_id: CollectionId, @@ -1011,15 +1010,10 @@ pub mod pallet { value: u128, ) -> DispatchResultWithPostInfo { let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?); + let budget = Self::structure_nesting_budget(); - dispatch_tx::(collection_id, |d| { - d.burn_from( - sender, - from, - item_id, - value, - &Self::structure_nesting_budget(), - ) + Self::dispatch_tx_with_nesting_budget(collection_id, &budget, |d| { + d.burn_from(sender, from, item_id, value, &budget) }) } @@ -1045,7 +1039,7 @@ pub mod pallet { /// * 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() + >::nesting_budget_predispatch_weight())] pub fn transfer( origin: OriginFor, recipient: T::CrossAccountId, @@ -1054,15 +1048,10 @@ pub mod pallet { value: u128, ) -> DispatchResultWithPostInfo { let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?); + let budget = Self::structure_nesting_budget(); - dispatch_tx::(collection_id, |d| { - d.transfer( - sender, - recipient, - item_id, - value, - &Self::structure_nesting_budget(), - ) + Self::dispatch_tx_with_nesting_budget(collection_id, &budget, |d| { + d.transfer(sender, recipient, item_id, value, &budget) }) } @@ -1155,7 +1144,7 @@ pub mod pallet { /// * 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() + >::nesting_budget_predispatch_weight())] pub fn transfer_from( origin: OriginFor, from: T::CrossAccountId, @@ -1165,16 +1154,10 @@ pub mod pallet { value: u128, ) -> DispatchResultWithPostInfo { let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?); + let budget = Self::structure_nesting_budget(); - dispatch_tx::(collection_id, |d| { - d.transfer_from( - sender, - from, - recipient, - item_id, - value, - &Self::structure_nesting_budget(), - ) + Self::dispatch_tx_with_nesting_budget(collection_id, &budget, |d| { + d.transfer_from(sender, from, recipient, item_id, value, &budget) }) } @@ -1375,5 +1358,40 @@ pub mod pallet { 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) -> DispatchResultWithPostInfo, + >( + collection: CollectionId, + budget: &budget::Value, + call: C, + ) -> DispatchResultWithPostInfo { + let mut result = dispatch_tx::(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 + } } } diff --git a/primitives/data-structs/src/budget.rs b/primitives/data-structs/src/budget.rs index 37a7353214..c71c79808f 100644 --- a/primitives/data-structs/src/budget.rs +++ b/primitives/data-structs/src/budget.rs @@ -22,7 +22,7 @@ impl Value { pub fn new(v: u32) -> Self { Self(Cell::new(v)) } - pub fn refund(self) -> u32 { + pub fn remaining(&self) -> u32 { self.0.get() } } diff --git a/runtime/common/config/pallets/mod.rs b/runtime/common/config/pallets/mod.rs index 1d7abdc768..ee0694582c 100644 --- a/runtime/common/config/pallets/mod.rs +++ b/runtime/common/config/pallets/mod.rs @@ -116,6 +116,7 @@ impl pallet_inflation::Config for Runtime { impl pallet_unique::Config for Runtime { type WeightInfo = pallet_unique::weights::SubstrateWeight; type CommonWeightInfo = CommonWeights; + type StructureWeightInfo = pallet_structure::weights::SubstrateWeight; type RefungibleExtensionsWeightInfo = CommonWeights; } diff --git a/runtime/common/weights/mod.rs b/runtime/common/weights/mod.rs index d805c7ec69..03b35ce510 100644 --- a/runtime/common/weights/mod.rs +++ b/runtime/common/weights/mod.rs @@ -122,24 +122,12 @@ where dispatch_weight::() + 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::() + max_weight_of!(set_allowance_for_all()) } fn force_repair_item() -> Weight { - max_weight_of!(force_repair_item()) + dispatch_weight::() + max_weight_of!(force_repair_item()) } }