From 953e62ea1fc4cd9d131e2e2140677a9be85f8562 Mon Sep 17 00:00:00 2001 From: Dusan Morhac <55763425+dudo50@users.noreply.github.com> Date: Thu, 7 Nov 2024 01:11:05 +0100 Subject: [PATCH] Fix tests --- templates/parachain/pallets/xcnft/src/mock.rs | 2 +- .../pallets/xcnft/src/tests/testpara.rs | 2 +- .../parachain/pallets/xcnft/src/weights.rs | 20 ++++++++++++++++--- .../parachain_two/pallets/xcnft/src/lib.rs | 2 +- .../parachain_two/pallets/xcnft/src/mock.rs | 2 +- .../pallets/xcnft/src/tests/testpara.rs | 2 +- .../pallets/xcnft/src/weights.rs | 18 ++++++++++++++--- 7 files changed, 37 insertions(+), 11 deletions(-) diff --git a/templates/parachain/pallets/xcnft/src/mock.rs b/templates/parachain/pallets/xcnft/src/mock.rs index 3d0b1196bf38..c2b4227c0e64 100644 --- a/templates/parachain/pallets/xcnft/src/mock.rs +++ b/templates/parachain/pallets/xcnft/src/mock.rs @@ -83,7 +83,7 @@ impl parachain_info::Config for Test {} impl crate::Config for Test { type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = crate::weights::SubstrateWeight; type XcmSender = XcmRouter; type RuntimeCall = RuntimeCall; type ProposalTimeInBlocks = proposal_time_in_blocks_parameter; diff --git a/templates/parachain/pallets/xcnft/src/tests/testpara.rs b/templates/parachain/pallets/xcnft/src/tests/testpara.rs index 7ddaa43a2fea..96301ed16d18 100644 --- a/templates/parachain/pallets/xcnft/src/tests/testpara.rs +++ b/templates/parachain/pallets/xcnft/src/tests/testpara.rs @@ -193,7 +193,7 @@ impl pallet_xcm::Config for Runtime { impl crate::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = crate::weights::SubstrateWeight; type XcmSender = XcmRouter; type RuntimeCall = RuntimeCall; type ProposalTimeInBlocks = proposal_time_in_blocks_parameter; diff --git a/templates/parachain/pallets/xcnft/src/weights.rs b/templates/parachain/pallets/xcnft/src/weights.rs index 9570aeff5f0a..fa979b69f738 100644 --- a/templates/parachain/pallets/xcnft/src/weights.rs +++ b/templates/parachain/pallets/xcnft/src/weights.rs @@ -4,7 +4,7 @@ //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 //! DATE: 2024-11-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `MacBook-Pro-uzivatela-Dudo.local`, CPU: `` +//! HOSTNAME: `MacBook-Pro`, CPU: `ArmM1` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -31,10 +31,24 @@ use frame_support::{traits::Get, weights::Weight}; use core::marker::PhantomData; +use crate as pallet_parachain_xcnft; /// Weight functions for `pallet_parachain_xcnft`. -pub struct WeightInfo(PhantomData); -impl pallet_parachain_xcnft::WeightInfo for WeightInfo { +/// +/// +pub trait WeightInfo { + fn transfer_collection_empty() -> Weight; + fn transfer_collection_same_owner() -> Weight; + fn transfer_collection_other_owners() -> Weight; + fn transfer_nft() -> Weight; + fn parse_empty_col() -> Weight; + fn parse_same_owner_col() -> Weight; + fn parse_diff_owner_col() -> Weight; + fn parse_item() -> Weight; +} + +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { /// Storage: `NftModule::Collection` (r:1 w:0) /// Proof: `NftModule::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`) /// Storage: `NftModule::Item` (r:1 w:0) diff --git a/templates/parachain_two/pallets/xcnft/src/lib.rs b/templates/parachain_two/pallets/xcnft/src/lib.rs index 071b4c5328cb..c2a9f071b081 100644 --- a/templates/parachain_two/pallets/xcnft/src/lib.rs +++ b/templates/parachain_two/pallets/xcnft/src/lib.rs @@ -114,7 +114,7 @@ pub mod pallet { /// A type representing the weights required by the dispatchables of this pallet. type WeightInfo: crate::weights::WeightInfo; - + /// Specifies how long should cross-chain proposals last type ProposalTimeInBlocks: Get; diff --git a/templates/parachain_two/pallets/xcnft/src/mock.rs b/templates/parachain_two/pallets/xcnft/src/mock.rs index f38e740d8cc1..103dbab4bcda 100644 --- a/templates/parachain_two/pallets/xcnft/src/mock.rs +++ b/templates/parachain_two/pallets/xcnft/src/mock.rs @@ -83,7 +83,7 @@ impl parachain_info::Config for Test {} impl crate::Config for Test { type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = crate::weights::SubstrateWeight; type XcmSender = XcmRouter; type RuntimeCall = RuntimeCall; type ProposalTimeInBlocks = proposal_time_in_blocks_parameter; diff --git a/templates/parachain_two/pallets/xcnft/src/tests/testpara.rs b/templates/parachain_two/pallets/xcnft/src/tests/testpara.rs index 065a21fc544c..4a455c83a463 100644 --- a/templates/parachain_two/pallets/xcnft/src/tests/testpara.rs +++ b/templates/parachain_two/pallets/xcnft/src/tests/testpara.rs @@ -182,7 +182,7 @@ impl pallet_xcm::Config for Runtime { impl crate::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = crate::weights::SubstrateWeight; type XcmSender = XcmRouter; type RuntimeCall = RuntimeCall; type ProposalTimeInBlocks = proposal_time_in_blocks_parameter; diff --git a/templates/parachain_two/pallets/xcnft/src/weights.rs b/templates/parachain_two/pallets/xcnft/src/weights.rs index a389870039c8..a8b1b88353f8 100644 --- a/templates/parachain_two/pallets/xcnft/src/weights.rs +++ b/templates/parachain_two/pallets/xcnft/src/weights.rs @@ -4,7 +4,7 @@ //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 //! DATE: 2024-11-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `MacBook-Pro-uzivatela-Dudo.local`, CPU: `` +//! HOSTNAME: `MacBook-Pro`, CPU: `ArmM1` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: @@ -31,10 +31,22 @@ use frame_support::{traits::Get, weights::Weight}; use core::marker::PhantomData; +use crate as pallet_parachain_xcnft_two; /// Weight functions for `pallet_parachain_xcnft_two`. -pub struct WeightInfo(PhantomData); -impl pallet_parachain_xcnft_two::WeightInfo for WeightInfo { +pub trait WeightInfo { + fn transfer_collection_empty() -> Weight; + fn transfer_collection_same_owner() -> Weight; + fn transfer_collection_other_owners() -> Weight; + fn transfer_nft() -> Weight; + fn parse_empty_col() -> Weight; + fn parse_same_owner_col() -> Weight; + fn parse_diff_owner_col() -> Weight; + fn parse_item() -> Weight; +} + +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { /// Storage: `UniquesModule::Class` (r:1 w:0) /// Proof: `UniquesModule::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`) /// Storage: `UniquesModule::Asset` (r:1 w:0)