git.delta.rocks / unique-network / refs/commits / 460ecccc2904

difftreelog

fix benchmarks

Daniel Shiposha2022-10-21parent: #f2a945f.patch.diff
in: master

5 files changed

modifiedpallets/fungible/src/benchmarking.rsdiffbeforeafterboth
after · pallets/fungible/src/benchmarking.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use super::*;18use crate::{Pallet, Config, FungibleHandle};1920use sp_std::prelude::*;21use pallet_common::benchmarking::create_collection_raw;22use frame_benchmarking::{benchmarks, account};23use up_data_structs::{CollectionMode, MAX_ITEMS_PER_BATCH, budget::Unlimited};24use pallet_common::bench_init;2526const SEED: u32 = 1;2728fn create_collection<T: Config>(29	owner: T::CrossAccountId,30) -> Result<FungibleHandle<T>, DispatchError> {31	create_collection_raw(32		owner,33		CollectionMode::Fungible(0),34		|owner: T::CrossAccountId, data| {35			<Pallet<T>>::init_collection(owner.clone(), owner, data, Default::default())36		},37		FungibleHandle::cast,38	)39}4041benchmarks! {42	create_item {43		bench_init!{44			owner: sub; collection: collection(owner);45			sender: cross_from_sub(owner); to: cross_sub;46		};47	}: {<Pallet<T>>::create_item(&collection, &sender, (to, 200), &Unlimited)?}4849	create_multiple_items_ex {50		let b in 0..MAX_ITEMS_PER_BATCH;51		bench_init!{52			owner: sub; collection: collection(owner);53			sender: cross_from_sub(owner);54		};55		let data = (0..b).map(|i| {56			bench_init!(to: cross_sub(i););57			(to, 200)58		}).collect::<BTreeMap<_, _>>().try_into().unwrap();59	}: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}6061	burn_item {62		bench_init!{63			owner: sub; collection: collection(owner);64			owner: cross_from_sub; burner: cross_sub;65		};66		<Pallet<T>>::create_item(&collection, &owner, (burner.clone(), 200), &Unlimited)?;67	}: {<Pallet<T>>::burn(&collection, &burner, 100)?}6869	transfer {70		bench_init!{71			owner: sub; collection: collection(owner);72			owner: cross_from_sub; sender: cross_sub; to: cross_sub;73		};74		<Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;75	}: {<Pallet<T>>::transfer(&collection, &sender, &to, 200, &Unlimited)?}7677	approve {78		bench_init!{79			owner: sub; collection: collection(owner);80			owner: cross_from_sub; sender: cross_sub; spender: cross_sub;81		};82		<Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;83	}: {<Pallet<T>>::set_allowance(&collection, &sender, &spender, 100)?}8485	transfer_from {86		bench_init!{87			owner: sub; collection: collection(owner);88			owner: cross_from_sub; sender: cross_sub; spender: cross_sub; receiver: cross_sub;89		};90		<Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;91		<Pallet<T>>::set_allowance(&collection, &sender, &spender, 200)?;92	}: {<Pallet<T>>::transfer_from(&collection, &spender, &sender, &receiver, 100, &Unlimited)?}9394	burn_from {95		bench_init!{96			owner: sub; collection: collection(owner);97			owner: cross_from_sub; sender: cross_sub; burner: cross_sub;98		};99		<Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;100		<Pallet<T>>::set_allowance(&collection, &sender, &burner, 200)?;101	}: {<Pallet<T>>::burn_from(&collection, &burner, &sender, 100, &Unlimited)?}102}
modifiedpallets/refungible/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/refungible/src/benchmarking.rs
+++ b/pallets/refungible/src/benchmarking.rs
@@ -62,7 +62,9 @@
 	create_collection_raw(
 		owner,
 		CollectionMode::ReFungible,
-		|owner: T::CrossAccountId, data| <Pallet<T>>::init_collection(owner.clone(), owner, data),
+		|owner: T::CrossAccountId, data| {
+			<Pallet<T>>::init_collection(owner.clone(), owner, data, Default::default())
+		},
 		RefungibleHandle::cast,
 	)
 }
modifiedpallets/scheduler/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/scheduler/src/benchmarking.rs
+++ b/pallets/scheduler/src/benchmarking.rs
@@ -93,9 +93,9 @@
 	Ok(())
 }
 
-fn call_and_hash<T: Config>(i: u32) -> (<T as Config>::Call, T::Hash) {
+fn call_and_hash<T: Config>(i: u32) -> (<T as Config>::RuntimeCall, T::Hash) {
 	// Essentially a no-op call.
-	let call: <T as Config>::Call = frame_system::Call::remark { remark: i.encode() }.into();
+	let call: <T as Config>::RuntimeCall = frame_system::Call::remark { remark: i.encode() }.into();
 	let hash = T::Hashing::hash_of(&call);
 	(call, hash)
 }
modifiedpallets/structure/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/structure/src/benchmarking.rs
+++ b/pallets/structure/src/benchmarking.rs
@@ -19,7 +19,8 @@
 use frame_benchmarking::{benchmarks, account};
 use frame_support::traits::{Currency, Get};
 use up_data_structs::{
-	CreateCollectionData, CollectionMode, CreateItemData, CreateNftData, budget::Unlimited,
+	CreateCollectionData, CollectionMode, CreateItemData, CollectionFlags, CreateNftData,
+	budget::Unlimited,
 };
 use pallet_common::Config as CommonConfig;
 use pallet_evm::account::CrossAccountId;
@@ -32,10 +33,15 @@
 		let caller_cross = T::CrossAccountId::from_sub(caller.clone());
 
 		<T as CommonConfig>::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get());
-		T::CollectionDispatch::create(caller_cross.clone(), caller_cross.clone(), CreateCollectionData {
-			mode: CollectionMode::NFT,
-			..Default::default()
-		})?;
+		T::CollectionDispatch::create(
+			caller_cross.clone(),
+			caller_cross.clone(),
+			CreateCollectionData {
+				mode: CollectionMode::NFT,
+				..Default::default()
+			},
+			CollectionFlags::default(),
+		)?;
 		let dispatch = T::CollectionDispatch::dispatch(CollectionHandle::try_get(CollectionId(1))?);
 		let dispatch = dispatch.as_dyn();
 
modifiedruntime/common/runtime_apis.rsdiffbeforeafterboth
--- a/runtime/common/runtime_apis.rs
+++ b/runtime/common/runtime_apis.rs
@@ -683,8 +683,8 @@
                     #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]
                     list_benchmark!(list, extra, pallet_refungible, Refungible);
 
-                    #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]
-                    list_benchmark!(list, extra, pallet_unique_scheduler, Scheduler);
+                    // #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]
+                    // list_benchmark!(list, extra, pallet_unique_scheduler, Scheduler);
 
                     #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]
                     list_benchmark!(list, extra, pallet_proxy_rmrk_core, RmrkCore);
@@ -743,8 +743,8 @@
                     #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]
                     add_benchmark!(params, batches, pallet_refungible, Refungible);
 
-                    #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]
-                    add_benchmark!(params, batches, pallet_unique_scheduler, Scheduler);
+                    // #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]
+                    // add_benchmark!(params, batches, pallet_unique_scheduler, Scheduler);
 
                     #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]
                     add_benchmark!(params, batches, pallet_proxy_rmrk_core, RmrkCore);