git.delta.rocks / unique-network / refs/commits / 21b23e7b1db8

difftreelog

feat benchmark rmrk proxy equip

Daniel Shiposha2022-06-16parent: #c214759.patch.diff
in: master

9 files changed

modifiedMakefilediffbeforeafterboth
101bench-rmrk-core:101bench-rmrk-core:
102 make _bench PALLET=proxy-rmrk-core102 make _bench PALLET=proxy-rmrk-core
103
104.PHONY: bench-rmrk-equip
105bench-rmrk-equip:
106 make _bench PALLET=proxy-rmrk-equip
103107
104.PHONY: bench108.PHONY: bench
105bench: bench-evm-migration bench-unique bench-structure bench-fungible bench-refungible bench-nonfungible bench-scheduler bench-rmrk-core109bench: bench-evm-migration bench-unique bench-structure bench-fungible bench-refungible bench-nonfungible bench-scheduler bench-rmrk-core bench-rmrk-equip
106110
addedpallets/proxy-rmrk-equip/src/benchmarking.rsdiffbeforeafterboth

no changes

modifiedpallets/proxy-rmrk-equip/src/lib.rsdiffbeforeafterboth
28};28};
29use pallet_nonfungible::{Pallet as PalletNft, NonfungibleHandle};29use pallet_nonfungible::{Pallet as PalletNft, NonfungibleHandle};
30use pallet_evm::account::CrossAccountId;30use pallet_evm::account::CrossAccountId;
31use weights::WeightInfo;
3132
32pub use pallet::*;33pub use pallet::*;
34
35#[cfg(feature = "runtime-benchmarks")]
36pub mod benchmarking;
37pub mod weights;
38
39pub type SelfWeightOf<T> = <T as Config>::WeightInfo;
3340
34#[frame_support::pallet]41#[frame_support::pallet]
35pub mod pallet {42pub mod pallet {
38 #[pallet::config]45 #[pallet::config]
39 pub trait Config: frame_system::Config + pallet_rmrk_core::Config {46 pub trait Config: frame_system::Config + pallet_rmrk_core::Config {
40 type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;47 type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
48 type WeightInfo: WeightInfo;
41 }49 }
4250
43 #[pallet::storage]51 #[pallet::storage]
83 /// - symbol: arbitrary client-chosen symbol91 /// - symbol: arbitrary client-chosen symbol
84 /// - parts: array of Fixed and Slot parts composing the base, confined in length by92 /// - parts: array of Fixed and Slot parts composing the base, confined in length by
85 /// RmrkPartsLimit93 /// RmrkPartsLimit
94 #[transactional]
86 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]95 #[pallet::weight(<SelfWeightOf<T>>::create_base(parts.len() as u32))]
87 #[transactional]
88 pub fn create_base(96 pub fn create_base(
89 origin: OriginFor<T>,97 origin: OriginFor<T>,
90 base_type: RmrkString,98 base_type: RmrkString,
91 symbol: RmrkString,99 symbol: RmrkBaseSymbol,
92 parts: BoundedVec<RmrkPartType, RmrkPartsLimit>,100 parts: BoundedVec<RmrkPartType, RmrkPartsLimit>,
93 ) -> DispatchResult {101 ) -> DispatchResult {
94 let sender = ensure_signed(origin)?;102 let sender = ensure_signed(origin)?;
159 /// - key: arbitrary BoundedString, defined by client167 /// - key: arbitrary BoundedString, defined by client
160 /// - value: arbitrary BoundedString, defined by client168 /// - value: arbitrary BoundedString, defined by client
161 /// - inherit: optional bool169 /// - inherit: optional bool
170 #[transactional]
162 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]171 #[pallet::weight(<SelfWeightOf<T>>::theme_add(theme.properties.len() as u32))]
163 #[transactional]
164 pub fn theme_add(172 pub fn theme_add(
165 origin: OriginFor<T>,173 origin: OriginFor<T>,
166 base_id: RmrkBaseId,174 base_id: RmrkBaseId,
167 theme: RmrkTheme,175 theme: RmrkBoundedTheme,
168 ) -> DispatchResult {176 ) -> DispatchResult {
169 let sender = ensure_signed(origin)?;177 let sender = ensure_signed(origin)?;
170178
addedpallets/proxy-rmrk-equip/src/weights.rsdiffbeforeafterboth

no changes

modifiedprimitives/data-structs/src/lib.rsdiffbeforeafterboth
950 #[derive(PartialEq)]950 #[derive(PartialEq)]
951 pub const RmrkCollectionSymbolLimit: u32 = MAX_TOKEN_PREFIX_LENGTH;951 pub const RmrkCollectionSymbolLimit: u32 = MAX_TOKEN_PREFIX_LENGTH;
952 #[derive(PartialEq)]952 #[derive(PartialEq)]
953 pub const RmrkResourceSymbolLimit: u32 = MAX_TOKEN_PREFIX_LENGTH;953 pub const RmrkResourceSymbolLimit: u32 = 10;
954 #[derive(PartialEq)]
955 pub const RmrkBaseSymbolLimit: u32 = MAX_TOKEN_PREFIX_LENGTH;
954 #[derive(PartialEq)]956 #[derive(PartialEq)]
955 pub const RmrkKeyLimit: u32 = 32;957 pub const RmrkKeyLimit: u32 = 32;
956 #[derive(PartialEq)]958 #[derive(PartialEq)]
957 pub const RmrkValueLimit: u32 = 256;959 pub const RmrkValueLimit: u32 = 256;
958 #[derive(PartialEq)]960 #[derive(PartialEq)]
959 pub const RmrkMaxCollectionsEquippablePerPart: u32 = 100;961 pub const RmrkMaxCollectionsEquippablePerPart: u32 = 100;
962 #[derive(PartialEq)]
963 pub const MaxPropertiesPerTheme: u32 = 5;
960 #[derive(PartialEq)]964 #[derive(PartialEq)]
961 pub const RmrkPartsLimit: u32 = 25;965 pub const RmrkPartsLimit: u32 = 25;
962 #[derive(PartialEq)]966 #[derive(PartialEq)]
987 PartType<RmrkString, BoundedVec<RmrkCollectionId, RmrkMaxCollectionsEquippablePerPart>>;991 PartType<RmrkString, BoundedVec<RmrkCollectionId, RmrkMaxCollectionsEquippablePerPart>>;
988pub type RmrkThemeProperty = ThemeProperty<RmrkString>;992pub type RmrkThemeProperty = ThemeProperty<RmrkString>;
989pub type RmrkTheme = Theme<RmrkString, Vec<RmrkThemeProperty>>;993pub type RmrkTheme = Theme<RmrkString, Vec<RmrkThemeProperty>>;
994pub type RmrkBoundedTheme = Theme<RmrkString, BoundedVec<RmrkThemeProperty, MaxPropertiesPerTheme>>;
990pub type RmrkResourceTypes = ResourceTypes<RmrkString, RmrkBoundedParts>;995pub type RmrkResourceTypes = ResourceTypes<RmrkString, RmrkBoundedParts>;
991996
992pub type RmrkBasicResource = BasicResource<RmrkString>;997pub type RmrkBasicResource = BasicResource<RmrkString>;
9951000
996pub type RmrkString = BoundedVec<u8, RmrkStringLimit>;1001pub type RmrkString = BoundedVec<u8, RmrkStringLimit>;
997pub type RmrkCollectionSymbol = BoundedVec<u8, RmrkCollectionSymbolLimit>;1002pub type RmrkCollectionSymbol = BoundedVec<u8, RmrkCollectionSymbolLimit>;
1003pub type RmrkBaseSymbol = BoundedVec<u8, RmrkBaseSymbolLimit>;
998pub type RmrkKeyString = BoundedVec<u8, RmrkKeyLimit>;1004pub type RmrkKeyString = BoundedVec<u8, RmrkKeyLimit>;
999pub type RmrkValueString = BoundedVec<u8, RmrkValueLimit>;1005pub type RmrkValueString = BoundedVec<u8, RmrkValueLimit>;
1000pub type RmrkBoundedResource = BoundedVec<u8, RmrkResourceSymbolLimit>;1006pub type RmrkBoundedResource = BoundedVec<u8, RmrkResourceSymbolLimit>;
modifiedruntime/common/src/runtime_apis.rsdiffbeforeafterboth
458 #[cfg(not(feature = "unique-runtime"))]458 #[cfg(not(feature = "unique-runtime"))]
459 list_benchmark!(list, extra, pallet_proxy_rmrk_core, RmrkCore);459 list_benchmark!(list, extra, pallet_proxy_rmrk_core, RmrkCore);
460
461 #[cfg(not(feature = "unique-runtime"))]
462 list_benchmark!(list, extra, pallet_proxy_rmrk_equip, RmrkEquip);
460463
461 // list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);464 // list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);
462465
506 #[cfg(not(feature = "unique-runtime"))]509 #[cfg(not(feature = "unique-runtime"))]
507 add_benchmark!(params, batches, pallet_proxy_rmrk_core, RmrkCore);510 add_benchmark!(params, batches, pallet_proxy_rmrk_core, RmrkCore);
511
512 #[cfg(not(feature = "unique-runtime"))]
513 add_benchmark!(params, batches, pallet_proxy_rmrk_equip, RmrkEquip);
508514
509 // add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);515 // add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);
510516
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
34 'pallet-refungible/runtime-benchmarks',34 'pallet-refungible/runtime-benchmarks',
35 'pallet-nonfungible/runtime-benchmarks',35 'pallet-nonfungible/runtime-benchmarks',
36 'pallet-proxy-rmrk-core/runtime-benchmarks',36 'pallet-proxy-rmrk-core/runtime-benchmarks',
37 'pallet-proxy-rmrk-equip/runtime-benchmarks',
37 'pallet-unique/runtime-benchmarks',38 'pallet-unique/runtime-benchmarks',
38 'pallet-inflation/runtime-benchmarks',39 'pallet-inflation/runtime-benchmarks',
39 'pallet-unique-scheduler/runtime-benchmarks',40 'pallet-unique-scheduler/runtime-benchmarks',
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
923}923}
924924
925impl pallet_proxy_rmrk_equip::Config for Runtime {925impl pallet_proxy_rmrk_equip::Config for Runtime {
926 type WeightInfo = pallet_proxy_rmrk_equip::weights::SubstrateWeight<Self>;
926 type Event = Event;927 type Event = Event;
927}928}
928929
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
922}922}
923923
924impl pallet_proxy_rmrk_equip::Config for Runtime {924impl pallet_proxy_rmrk_equip::Config for Runtime {
925 type WeightInfo = pallet_proxy_rmrk_equip::weights::SubstrateWeight<Self>;
925 type Event = Event;926 type Event = Event;
926}927}
927928