From 16cd7736756aeb53f627e05ebd9a09a522e51ad7 Mon Sep 17 00:00:00 2001 From: Roman Useinov Date: Tue, 17 Jan 2023 12:40:27 +0100 Subject: [PATCH 1/8] [Enhancement] Use XCM V3 for initiate_teleport weight calc --- .../assets/statemint/src/weights/xcm/mod.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs b/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs index ed48d433170..34e711ad564 100644 --- a/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs @@ -35,7 +35,13 @@ impl WeighMultiAssets for MultiAssetFilter { match self { Self::Definite(assets) => weight.saturating_mul(assets.inner().into_iter().count() as u64), - Self::Wild(_) => weight.saturating_mul(MAX_ASSETS as u64), + Self::Wild(asset) => match asset { + // TODO: Investigate if this is the right solution + All => weight.saturating_mul(MAX_ASSETS as u64), + AllOf { .. } => weight, + AllCounted(count) => weight.saturating_mul(count as u64), + AllOfCounted { count, .. } => weight.saturating_mul(count as u64), + }, } } } @@ -138,10 +144,7 @@ impl XcmWeightInfo for StatemintXcmWeight { _dest: &MultiLocation, _xcm: &Xcm<()>, ) -> Weight { - // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_ref_time(200_000_000 as u64); - let weight = assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()); - hardcoded_weight.min(weight) + assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()) } fn report_holding(_response_info: &QueryResponseInfo, _assets: &MultiAssetFilter) -> Weight { XcmGeneric::::report_holding() From 202b0672f3524dba8974c197a4dc38cf2ba02d32 Mon Sep 17 00:00:00 2001 From: Roman Useinov Date: Tue, 17 Jan 2023 17:21:05 +0100 Subject: [PATCH 2/8] deref --- parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs b/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs index 34e711ad564..3713e325483 100644 --- a/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs @@ -39,8 +39,8 @@ impl WeighMultiAssets for MultiAssetFilter { // TODO: Investigate if this is the right solution All => weight.saturating_mul(MAX_ASSETS as u64), AllOf { .. } => weight, - AllCounted(count) => weight.saturating_mul(count as u64), - AllOfCounted { count, .. } => weight.saturating_mul(count as u64), + AllCounted(count) => weight.saturating_mul(*count as u64), + AllOfCounted { count, .. } => weight.saturating_mul(*count as u64), }, } } From 3fe90aed4e6309be4db6df4525be2f4416e7ab5a Mon Sep 17 00:00:00 2001 From: Roman Useinov Date: Sun, 5 Feb 2023 15:11:26 +0100 Subject: [PATCH 3/8] replicate in all the runtimes --- .../runtimes/assets/statemine/src/weights/xcm/mod.rs | 12 +++++++----- .../runtimes/assets/statemint/src/weights/xcm/mod.rs | 1 - .../runtimes/assets/westmint/src/weights/xcm/mod.rs | 12 +++++++----- .../bridge-hub-kusama/src/weights/xcm/mod.rs | 12 +++++++----- .../bridge-hub-rococo/src/weights/xcm/mod.rs | 12 +++++++----- 5 files changed, 28 insertions(+), 21 deletions(-) diff --git a/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs b/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs index d38e1c62e51..ced0380f2a1 100644 --- a/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs @@ -35,7 +35,12 @@ impl WeighMultiAssets for MultiAssetFilter { match self { Self::Definite(assets) => weight.saturating_mul(assets.inner().into_iter().count() as u64), - Self::Wild(_) => weight.saturating_mul(MAX_ASSETS as u64), + Self::Wild(asset) => match asset { + All => weight.saturating_mul(MAX_ASSETS as u64), + AllOf { .. } => weight, + AllCounted(count) => weight.saturating_mul(*count as u64), + AllOfCounted { count, .. } => weight.saturating_mul(*count as u64), + } } } } @@ -138,10 +143,7 @@ impl XcmWeightInfo for StatemineXcmWeight { _dest: &MultiLocation, _xcm: &Xcm<()>, ) -> Weight { - // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_ref_time(200_000_000 as u64); - let weight = assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()); - hardcoded_weight.min(weight) + assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()) } fn report_holding(_response_info: &QueryResponseInfo, _assets: &MultiAssetFilter) -> Weight { XcmGeneric::::report_holding() diff --git a/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs b/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs index 3713e325483..28b73ff9c37 100644 --- a/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs @@ -36,7 +36,6 @@ impl WeighMultiAssets for MultiAssetFilter { Self::Definite(assets) => weight.saturating_mul(assets.inner().into_iter().count() as u64), Self::Wild(asset) => match asset { - // TODO: Investigate if this is the right solution All => weight.saturating_mul(MAX_ASSETS as u64), AllOf { .. } => weight, AllCounted(count) => weight.saturating_mul(*count as u64), diff --git a/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs b/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs index ee63ee3f2ad..bf06ccfb0bd 100644 --- a/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs @@ -35,7 +35,12 @@ impl WeighMultiAssets for MultiAssetFilter { match self { Self::Definite(assets) => weight.saturating_mul(assets.inner().into_iter().count() as u64), - Self::Wild(_) => weight.saturating_mul(MAX_ASSETS as u64), + Self::Wild(asset) => match asset { + All => weight.saturating_mul(MAX_ASSETS as u64), + AllOf { .. } => weight, + AllCounted(count) => weight.saturating_mul(*count as u64), + AllOfCounted { count, .. } => weight.saturating_mul(*count as u64), + }, } } } @@ -138,10 +143,7 @@ impl XcmWeightInfo for WestmintXcmWeight { _dest: &MultiLocation, _xcm: &Xcm<()>, ) -> Weight { - // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_ref_time(200_000_000 as u64); - let weight = assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()); - hardcoded_weight.min(weight) + assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()) } fn report_holding(_response_info: &QueryResponseInfo, _assets: &MultiAssetFilter) -> Weight { XcmGeneric::::report_holding() diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs index 82b29187960..23202eb7663 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs @@ -35,7 +35,12 @@ impl WeighMultiAssets for MultiAssetFilter { match self { Self::Definite(assets) => weight.saturating_mul(assets.inner().into_iter().count() as u64), - Self::Wild(_) => weight.saturating_mul(MAX_ASSETS as u64), + Self::Wild(asset) => match asset { + All => weight.saturating_mul(MAX_ASSETS as u64), + AllOf { .. } => weight, + AllCounted(count) => weight.saturating_mul(*count as u64), + AllOfCounted { count, .. } => weight.saturating_mul(*count as u64), + }, } } } @@ -138,10 +143,7 @@ impl XcmWeightInfo for BridgeHubKusamaXcmWeight { _dest: &MultiLocation, _xcm: &Xcm<()>, ) -> Weight { - // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_ref_time(200_000_000 as u64); - let weight = assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()); - hardcoded_weight.min(weight) + assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()) } fn report_holding(_response_info: &QueryResponseInfo, _assets: &MultiAssetFilter) -> Weight { XcmGeneric::::report_holding() diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs index 0b911aec2d5..f9208791c65 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs @@ -35,7 +35,12 @@ impl WeighMultiAssets for MultiAssetFilter { match self { Self::Definite(assets) => weight.saturating_mul(assets.inner().into_iter().count() as u64), - Self::Wild(_) => weight.saturating_mul(MAX_ASSETS as u64), + Self::Wild(asset) => match asset { + All => weight.saturating_mul(MAX_ASSETS as u64), + AllOf { .. } => weight, + AllCounted(count) => weight.saturating_mul(*count as u64), + AllOfCounted { count, .. } => weight.saturating_mul(*count as u64), + }, } } } @@ -138,10 +143,7 @@ impl XcmWeightInfo for BridgeHubRococoXcmWeight { _dest: &MultiLocation, _xcm: &Xcm<()>, ) -> Weight { - // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_ref_time(200_000_000 as u64); - let weight = assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()); - hardcoded_weight.min(weight) + assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()) } fn report_holding(_response_info: &QueryResponseInfo, _assets: &MultiAssetFilter) -> Weight { XcmGeneric::::report_holding() From 1f884d1285de1d8c25fc36acc1d85c048822950e Mon Sep 17 00:00:00 2001 From: Roman Useinov Date: Sun, 5 Feb 2023 15:14:11 +0100 Subject: [PATCH 4/8] fmt --- parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs b/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs index ced0380f2a1..28dd52de171 100644 --- a/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs @@ -40,7 +40,7 @@ impl WeighMultiAssets for MultiAssetFilter { AllOf { .. } => weight, AllCounted(count) => weight.saturating_mul(*count as u64), AllOfCounted { count, .. } => weight.saturating_mul(*count as u64), - } + }, } } } From 92019058fc647f0c02d61b5f9f2d850f07ca1633 Mon Sep 17 00:00:00 2001 From: Roman Useinov Date: Thu, 9 Feb 2023 13:00:50 +0100 Subject: [PATCH 5/8] better handling for AllOf --- .../bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs index 23202eb7663..4190e988b5e 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs @@ -17,7 +17,7 @@ mod pallet_xcm_benchmarks_fungible; mod pallet_xcm_benchmarks_generic; -use crate::Runtime; +use crate::{xcm_config::MaxAssetsIntoHolding, Runtime}; use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; @@ -37,7 +37,12 @@ impl WeighMultiAssets for MultiAssetFilter { weight.saturating_mul(assets.inner().into_iter().count() as u64), Self::Wild(asset) => match asset { All => weight.saturating_mul(MAX_ASSETS as u64), - AllOf { .. } => weight, + AllOf { fun, .. } => match fun { + WildFungibility::Fungible => weight, + // Magic number 2 has to do with the fact that we could have up to 2 times + // MaxAssetsIntoHolding in the worst-case scenario. + WildFungibility::NonFungible => weight.saturating_mul(MaxAssetsIntoHolding::get() * 2 as u64), + }, AllCounted(count) => weight.saturating_mul(*count as u64), AllOfCounted { count, .. } => weight.saturating_mul(*count as u64), }, From e59c5524458678513a64c4b4faf856a465a5a66d Mon Sep 17 00:00:00 2001 From: Roman Useinov Date: Thu, 9 Feb 2023 13:07:30 +0100 Subject: [PATCH 6/8] fmt --- .../bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs index 898c0f09565..d505a07d356 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs @@ -41,7 +41,8 @@ impl WeighMultiAssets for MultiAssetFilter { WildFungibility::Fungible => weight, // Magic number 2 has to do with the fact that we could have up to 2 times // MaxAssetsIntoHolding in the worst-case scenario. - WildFungibility::NonFungible => weight.saturating_mul(MaxAssetsIntoHolding::get() * 2 as u64), + WildFungibility::NonFungible => + weight.saturating_mul(MaxAssetsIntoHolding::get() * 2 as u64), }, AllCounted(count) => weight.saturating_mul(*count as u64), AllOfCounted { count, .. } => weight.saturating_mul(*count as u64), From 0cf2bac3ba4af043db057cba43e0522dae3c2757 Mon Sep 17 00:00:00 2001 From: Roman Useinov Date: Thu, 9 Feb 2023 14:08:39 +0100 Subject: [PATCH 7/8] small type fix --- .../bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs index d505a07d356..53ceaa231d9 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs @@ -42,7 +42,7 @@ impl WeighMultiAssets for MultiAssetFilter { // Magic number 2 has to do with the fact that we could have up to 2 times // MaxAssetsIntoHolding in the worst-case scenario. WildFungibility::NonFungible => - weight.saturating_mul(MaxAssetsIntoHolding::get() * 2 as u64), + weight.saturating_mul((MaxAssetsIntoHolding::get() * 2) as u64), }, AllCounted(count) => weight.saturating_mul(*count as u64), AllOfCounted { count, .. } => weight.saturating_mul(*count as u64), From bdd401e27f14b88bfabd4214e155ca90d6ca03a1 Mon Sep 17 00:00:00 2001 From: Roman Useinov Date: Thu, 9 Feb 2023 15:22:40 +0100 Subject: [PATCH 8/8] replicate the fix for all runtimes --- .../assets/statemine/src/weights/xcm/mod.rs | 10 ++++++++-- .../assets/statemint/src/weights/xcm/mod.rs | 10 ++++++++-- .../assets/westmint/src/weights/xcm/mod.rs | 10 ++++++++-- .../bridge-hub-polkadot/src/weights/xcm/mod.rs | 15 +++++++++++++-- .../bridge-hub-rococo/src/weights/xcm/mod.rs | 10 ++++++++-- 5 files changed, 45 insertions(+), 10 deletions(-) diff --git a/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs b/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs index 4d91a3fda50..ba2370bf055 100644 --- a/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs @@ -17,7 +17,7 @@ mod pallet_xcm_benchmarks_fungible; mod pallet_xcm_benchmarks_generic; -use crate::Runtime; +use crate::{xcm_config::MaxAssetsIntoHolding, Runtime}; use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; @@ -37,7 +37,13 @@ impl WeighMultiAssets for MultiAssetFilter { weight.saturating_mul(assets.inner().into_iter().count() as u64), Self::Wild(asset) => match asset { All => weight.saturating_mul(MAX_ASSETS as u64), - AllOf { .. } => weight, + AllOf { fun, .. } => match fun { + WildFungibility::Fungible => weight, + // Magic number 2 has to do with the fact that we could have up to 2 times + // MaxAssetsIntoHolding in the worst-case scenario. + WildFungibility::NonFungible => + weight.saturating_mul((MaxAssetsIntoHolding::get() * 2) as u64), + }, AllCounted(count) => weight.saturating_mul(*count as u64), AllOfCounted { count, .. } => weight.saturating_mul(*count as u64), }, diff --git a/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs b/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs index 0cd9b4cba26..cf9423bc28e 100644 --- a/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs @@ -17,7 +17,7 @@ mod pallet_xcm_benchmarks_fungible; mod pallet_xcm_benchmarks_generic; -use crate::Runtime; +use crate::{xcm_config::MaxAssetsIntoHolding, Runtime}; use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; @@ -37,7 +37,13 @@ impl WeighMultiAssets for MultiAssetFilter { weight.saturating_mul(assets.inner().into_iter().count() as u64), Self::Wild(asset) => match asset { All => weight.saturating_mul(MAX_ASSETS as u64), - AllOf { .. } => weight, + AllOf { fun, .. } => match fun { + WildFungibility::Fungible => weight, + // Magic number 2 has to do with the fact that we could have up to 2 times + // MaxAssetsIntoHolding in the worst-case scenario. + WildFungibility::NonFungible => + weight.saturating_mul((MaxAssetsIntoHolding::get() * 2) as u64), + }, AllCounted(count) => weight.saturating_mul(*count as u64), AllOfCounted { count, .. } => weight.saturating_mul(*count as u64), }, diff --git a/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs b/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs index 16e9ccf2330..7c2454b6443 100644 --- a/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs @@ -17,7 +17,7 @@ mod pallet_xcm_benchmarks_fungible; mod pallet_xcm_benchmarks_generic; -use crate::Runtime; +use crate::{xcm_config::MaxAssetsIntoHolding, Runtime}; use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; @@ -37,7 +37,13 @@ impl WeighMultiAssets for MultiAssetFilter { weight.saturating_mul(assets.inner().into_iter().count() as u64), Self::Wild(asset) => match asset { All => weight.saturating_mul(MAX_ASSETS as u64), - AllOf { .. } => weight, + AllOf { fun, .. } => match fun { + WildFungibility::Fungible => weight, + // Magic number 2 has to do with the fact that we could have up to 2 times + // MaxAssetsIntoHolding in the worst-case scenario. + WildFungibility::NonFungible => + weight.saturating_mul((MaxAssetsIntoHolding::get() * 2) as u64), + }, AllCounted(count) => weight.saturating_mul(*count as u64), AllOfCounted { count, .. } => weight.saturating_mul(*count as u64), }, diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/mod.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/mod.rs index 9ebd31d5066..133339e1119 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/mod.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/mod.rs @@ -17,7 +17,7 @@ mod pallet_xcm_benchmarks_fungible; mod pallet_xcm_benchmarks_generic; -use crate::Runtime; +use crate::{xcm_config::MaxAssetsIntoHolding, Runtime}; use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; @@ -35,7 +35,18 @@ impl WeighMultiAssets for MultiAssetFilter { match self { Self::Definite(assets) => weight.saturating_mul(assets.inner().into_iter().count() as u64), - Self::Wild(_) => weight.saturating_mul(MAX_ASSETS as u64), + Self::Wild(asset) => match asset { + All => weight.saturating_mul(MAX_ASSETS as u64), + AllOf { fun, .. } => match fun { + WildFungibility::Fungible => weight, + // Magic number 2 has to do with the fact that we could have up to 2 times + // MaxAssetsIntoHolding in the worst-case scenario. + WildFungibility::NonFungible => + weight.saturating_mul((MaxAssetsIntoHolding::get() * 2) as u64), + }, + AllCounted(count) => weight.saturating_mul(*count as u64), + AllOfCounted { count, .. } => weight.saturating_mul(*count as u64), + }, } } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs index 20bbbb7668a..e1aa203fbf2 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs @@ -17,7 +17,7 @@ mod pallet_xcm_benchmarks_fungible; mod pallet_xcm_benchmarks_generic; -use crate::Runtime; +use crate::{xcm_config::MaxAssetsIntoHolding, Runtime}; use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; @@ -37,7 +37,13 @@ impl WeighMultiAssets for MultiAssetFilter { weight.saturating_mul(assets.inner().into_iter().count() as u64), Self::Wild(asset) => match asset { All => weight.saturating_mul(MAX_ASSETS as u64), - AllOf { .. } => weight, + AllOf { fun, .. } => match fun { + WildFungibility::Fungible => weight, + // Magic number 2 has to do with the fact that we could have up to 2 times + // MaxAssetsIntoHolding in the worst-case scenario. + WildFungibility::NonFungible => + weight.saturating_mul((MaxAssetsIntoHolding::get() * 2) as u64), + }, AllCounted(count) => weight.saturating_mul(*count as u64), AllOfCounted { count, .. } => weight.saturating_mul(*count as u64), },