difftreelog
fix benchmarks
in: master
5 files changed
pallets/fungible/src/benchmarking.rsdiffbeforeafterboth1// 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| <Pallet<T>>::init_collection(owner.clone(), owner, data),35 FungibleHandle::cast,36 )37}3839benchmarks! {40 create_item {41 bench_init!{42 owner: sub; collection: collection(owner);43 sender: cross_from_sub(owner); to: cross_sub;44 };45 }: {<Pallet<T>>::create_item(&collection, &sender, (to, 200), &Unlimited)?}4647 create_multiple_items_ex {48 let b in 0..MAX_ITEMS_PER_BATCH;49 bench_init!{50 owner: sub; collection: collection(owner);51 sender: cross_from_sub(owner);52 };53 let data = (0..b).map(|i| {54 bench_init!(to: cross_sub(i););55 (to, 200)56 }).collect::<BTreeMap<_, _>>().try_into().unwrap();57 }: {<Pallet<T>>::create_multiple_items(&collection, &sender, data, &Unlimited)?}5859 burn_item {60 bench_init!{61 owner: sub; collection: collection(owner);62 owner: cross_from_sub; burner: cross_sub;63 };64 <Pallet<T>>::create_item(&collection, &owner, (burner.clone(), 200), &Unlimited)?;65 }: {<Pallet<T>>::burn(&collection, &burner, 100)?}6667 transfer {68 bench_init!{69 owner: sub; collection: collection(owner);70 owner: cross_from_sub; sender: cross_sub; to: cross_sub;71 };72 <Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;73 }: {<Pallet<T>>::transfer(&collection, &sender, &to, 200, &Unlimited)?}7475 approve {76 bench_init!{77 owner: sub; collection: collection(owner);78 owner: cross_from_sub; sender: cross_sub; spender: cross_sub;79 };80 <Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;81 }: {<Pallet<T>>::set_allowance(&collection, &sender, &spender, 100)?}8283 transfer_from {84 bench_init!{85 owner: sub; collection: collection(owner);86 owner: cross_from_sub; sender: cross_sub; spender: cross_sub; receiver: cross_sub;87 };88 <Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;89 <Pallet<T>>::set_allowance(&collection, &sender, &spender, 200)?;90 }: {<Pallet<T>>::transfer_from(&collection, &spender, &sender, &receiver, 100, &Unlimited)?}9192 burn_from {93 bench_init!{94 owner: sub; collection: collection(owner);95 owner: cross_from_sub; sender: cross_sub; burner: cross_sub;96 };97 <Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;98 <Pallet<T>>::set_allowance(&collection, &sender, &burner, 200)?;99 }: {<Pallet<T>>::burn_from(&collection, &burner, &sender, 100, &Unlimited)?}100}pallets/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,
)
}
pallets/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)
}
pallets/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();
runtime/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);