From d0266892d0bdbec2163610930fb56745e5648b5b Mon Sep 17 00:00:00 2001 From: Squirrel Date: Tue, 20 Sep 2022 12:23:04 +0100 Subject: [PATCH] [Fix] Hardcode teleport weight until XCM pallet is fixed (#1641) (#1645) * [Fix] Hardcode teleport weight until XCM pallet is fixed * fix build * solve dead code * fix lint * more eloquent weights * quick fix Co-authored-by: Roman Useinov --- .../runtimes/assets/statemine/src/weights/xcm/mod.rs | 7 +++++-- .../runtimes/assets/statemint/src/weights/xcm/mod.rs | 7 +++++-- parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs | 7 +++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs b/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs index 79fbd0812bb..f1fe664953a 100644 --- a/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs @@ -21,7 +21,7 @@ use crate::Runtime; use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; -use sp_std::prelude::*; +use sp_std::{cmp, prelude::*}; use xcm::{ latest::{prelude::*, Weight as XCMWeight}, DoubleEncoded, @@ -142,7 +142,10 @@ impl XcmWeightInfo for StatemineXcmWeight { _dest: &MultiLocation, _xcm: &Xcm<()>, ) -> XCMWeight { - assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()) + // Hardcoded till the XCM pallet is fixed + let hardcoded_weight = Weight::from_ref_time(200_000_000 as u64).ref_time(); + let weight = assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()); + cmp::min(hardcoded_weight, weight) } fn query_holding( _query_id: &u64, diff --git a/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs b/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs index b51f8b207a5..04db4216efc 100644 --- a/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs @@ -21,7 +21,7 @@ use crate::Runtime; use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; -use sp_std::prelude::*; +use sp_std::{cmp, prelude::*}; use xcm::{ latest::{prelude::*, Weight as XCMWeight}, DoubleEncoded, @@ -142,7 +142,10 @@ impl XcmWeightInfo for StatemintXcmWeight { _dest: &MultiLocation, _xcm: &Xcm<()>, ) -> XCMWeight { - assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()) + // Hardcoded till the XCM pallet is fixed + let hardcoded_weight = Weight::from_ref_time(200_000_000 as u64).ref_time(); + let weight = assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()); + cmp::min(hardcoded_weight, weight) } fn query_holding( _query_id: &u64, diff --git a/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs b/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs index 52f643d8f5e..037e1d54459 100644 --- a/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs @@ -21,7 +21,7 @@ use crate::Runtime; use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; -use sp_std::prelude::*; +use sp_std::{cmp, prelude::*}; use xcm::{ latest::{prelude::*, Weight as XCMWeight}, DoubleEncoded, @@ -142,7 +142,10 @@ impl XcmWeightInfo for WestmintXcmWeight { _dest: &MultiLocation, _xcm: &Xcm<()>, ) -> XCMWeight { - assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()) + // Hardcoded till the XCM pallet is fixed + let hardcoded_weight = Weight::from_ref_time(200_000_000 as u64).ref_time(); + let weight = assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()); + cmp::min(hardcoded_weight, weight) } fn query_holding( _query_id: &u64,