[Fix] Hardcode teleport weight until XCM pallet is fixed (#1641)

* [Fix] Hardcode teleport weight until XCM pallet is fixed

* fix build

* solve dead code

* fix lint

* more eloquent weights

* quick fix
This commit is contained in:
Roman Useinov
2022-09-20 12:17:54 +02:00
committed by GitHub
parent 5115d9529e
commit 05e561de89
3 changed files with 15 additions and 6 deletions
@@ -21,7 +21,7 @@ use crate::Runtime;
use frame_support::weights::Weight; use frame_support::weights::Weight;
use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight;
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
use sp_std::prelude::*; use sp_std::{cmp, prelude::*};
use xcm::{ use xcm::{
latest::{prelude::*, Weight as XCMWeight}, latest::{prelude::*, Weight as XCMWeight},
DoubleEncoded, DoubleEncoded,
@@ -142,7 +142,10 @@ impl<Call> XcmWeightInfo<Call> for StatemineXcmWeight<Call> {
_dest: &MultiLocation, _dest: &MultiLocation,
_xcm: &Xcm<()>, _xcm: &Xcm<()>,
) -> XCMWeight { ) -> XCMWeight {
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::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::<Runtime>::initiate_teleport());
cmp::min(hardcoded_weight, weight)
} }
fn query_holding( fn query_holding(
_query_id: &u64, _query_id: &u64,
@@ -21,7 +21,7 @@ use crate::Runtime;
use frame_support::weights::Weight; use frame_support::weights::Weight;
use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight;
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
use sp_std::prelude::*; use sp_std::{cmp, prelude::*};
use xcm::{ use xcm::{
latest::{prelude::*, Weight as XCMWeight}, latest::{prelude::*, Weight as XCMWeight},
DoubleEncoded, DoubleEncoded,
@@ -142,7 +142,10 @@ impl<Call> XcmWeightInfo<Call> for StatemintXcmWeight<Call> {
_dest: &MultiLocation, _dest: &MultiLocation,
_xcm: &Xcm<()>, _xcm: &Xcm<()>,
) -> XCMWeight { ) -> XCMWeight {
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::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::<Runtime>::initiate_teleport());
cmp::min(hardcoded_weight, weight)
} }
fn query_holding( fn query_holding(
_query_id: &u64, _query_id: &u64,
@@ -21,7 +21,7 @@ use crate::Runtime;
use frame_support::weights::Weight; use frame_support::weights::Weight;
use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight;
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
use sp_std::prelude::*; use sp_std::{cmp, prelude::*};
use xcm::{ use xcm::{
latest::{prelude::*, Weight as XCMWeight}, latest::{prelude::*, Weight as XCMWeight},
DoubleEncoded, DoubleEncoded,
@@ -142,7 +142,10 @@ impl<Call> XcmWeightInfo<Call> for WestmintXcmWeight<Call> {
_dest: &MultiLocation, _dest: &MultiLocation,
_xcm: &Xcm<()>, _xcm: &Xcm<()>,
) -> XCMWeight { ) -> XCMWeight {
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::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::<Runtime>::initiate_teleport());
cmp::min(hardcoded_weight, weight)
} }
fn query_holding( fn query_holding(
_query_id: &u64, _query_id: &u64,