-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api/nonfungibles): destroy collection witness data & weights (#383)
chore: rename nfts instance feat(api/nonfungibles): destroy collection witness data & weights (#383) chore: rename nfts instance fix(api/nonfungibles): pallet weight testing
- Loading branch information
1 parent
0c26474
commit 2b6ed27
Showing
18 changed files
with
1,461 additions
and
491 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
//! Benchmarking setup for pallet_api::nonfungibles | ||
|
||
use frame_benchmarking::{account, v2::*}; | ||
use frame_support::{traits::nonfungibles_v2::Inspect, BoundedVec}; | ||
use sp_runtime::traits::Zero; | ||
|
||
use super::{AttributeNamespace, CollectionIdOf, Config, ItemIdOf, NftsInstanceOf, Pallet, Read}; | ||
use crate::Read as _; | ||
|
||
const SEED: u32 = 1; | ||
|
||
#[benchmarks( | ||
where | ||
<pallet_nfts::Pallet<T, NftsInstanceOf<T>> as Inspect<<T as frame_system::Config>::AccountId>>::ItemId: Zero, | ||
<pallet_nfts::Pallet<T, NftsInstanceOf<T>> as Inspect<<T as frame_system::Config>::AccountId>>::CollectionId: Zero, | ||
)] | ||
mod benchmarks { | ||
use super::*; | ||
|
||
#[benchmark] | ||
// Storage: `Collection` | ||
fn total_supply() { | ||
#[block] | ||
{ | ||
Pallet::<T>::read(Read::TotalSupply(CollectionIdOf::<T>::zero())); | ||
} | ||
} | ||
|
||
#[benchmark] | ||
// Storage: `AccountBalance` | ||
fn balance_of() { | ||
#[block] | ||
{ | ||
Pallet::<T>::read(Read::BalanceOf { | ||
collection: CollectionIdOf::<T>::zero(), | ||
owner: account("Alice", 0, SEED), | ||
}); | ||
} | ||
} | ||
|
||
#[benchmark] | ||
// Storage: `Allowances`, `Item` | ||
fn allowance() { | ||
#[block] | ||
{ | ||
Pallet::<T>::read(Read::Allowance { | ||
collection: CollectionIdOf::<T>::zero(), | ||
owner: account("Alice", 0, SEED), | ||
operator: account("Bob", 0, SEED), | ||
item: Some(ItemIdOf::<T>::zero()), | ||
}); | ||
} | ||
} | ||
|
||
#[benchmark] | ||
// Storage: `Item` | ||
fn owner_of() { | ||
#[block] | ||
{ | ||
Pallet::<T>::read(Read::OwnerOf { | ||
collection: CollectionIdOf::<T>::zero(), | ||
item: ItemIdOf::<T>::zero(), | ||
}); | ||
} | ||
} | ||
|
||
#[benchmark] | ||
// Storage: `Attribute` | ||
fn get_attribute() { | ||
#[block] | ||
{ | ||
Pallet::<T>::read(Read::GetAttribute { | ||
key: BoundedVec::default(), | ||
collection: CollectionIdOf::<T>::zero(), | ||
item: ItemIdOf::<T>::zero(), | ||
namespace: AttributeNamespace::CollectionOwner, | ||
}); | ||
} | ||
} | ||
|
||
#[benchmark] | ||
// Storage: `Collection` | ||
fn collection() { | ||
#[block] | ||
{ | ||
Pallet::<T>::read(Read::Collection(CollectionIdOf::<T>::zero())); | ||
} | ||
} | ||
|
||
#[benchmark] | ||
// Storage: `NextCollectionId` | ||
fn next_collection_id() { | ||
#[block] | ||
{ | ||
Pallet::<T>::read(Read::NextCollectionId); | ||
} | ||
} | ||
|
||
#[benchmark] | ||
// Storage: `ItemMetadata` | ||
fn item_metadata() { | ||
#[block] | ||
{ | ||
Pallet::<T>::read(Read::ItemMetadata { | ||
collection: CollectionIdOf::<T>::zero(), | ||
item: ItemIdOf::<T>::zero(), | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.