Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 8cd0b80

Browse files
ruseinovgilescope
authored andcommitted
[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
1 parent 35dd14f commit 8cd0b80

File tree

3 files changed

+15
-6
lines changed
  • parachains/runtimes/assets
    • statemine/src/weights/xcm
    • statemint/src/weights/xcm
    • westmint/src/weights/xcm

3 files changed

+15
-6
lines changed

parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::Runtime;
2121
use frame_support::weights::Weight;
2222
use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight;
2323
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
24-
use sp_std::prelude::*;
24+
use sp_std::{cmp, prelude::*};
2525
use xcm::{
2626
latest::{prelude::*, Weight as XCMWeight},
2727
DoubleEncoded,
@@ -142,7 +142,10 @@ impl<Call> XcmWeightInfo<Call> for StatemineXcmWeight<Call> {
142142
_dest: &MultiLocation,
143143
_xcm: &Xcm<()>,
144144
) -> XCMWeight {
145-
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::initiate_teleport())
145+
// Hardcoded till the XCM pallet is fixed
146+
let hardcoded_weight = Weight::from_ref_time(200_000_000 as u64).ref_time();
147+
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::initiate_teleport());
148+
cmp::min(hardcoded_weight, weight)
146149
}
147150
fn query_holding(
148151
_query_id: &u64,

parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::Runtime;
2121
use frame_support::weights::Weight;
2222
use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight;
2323
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
24-
use sp_std::prelude::*;
24+
use sp_std::{cmp, prelude::*};
2525
use xcm::{
2626
latest::{prelude::*, Weight as XCMWeight},
2727
DoubleEncoded,
@@ -142,7 +142,10 @@ impl<Call> XcmWeightInfo<Call> for StatemintXcmWeight<Call> {
142142
_dest: &MultiLocation,
143143
_xcm: &Xcm<()>,
144144
) -> XCMWeight {
145-
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::initiate_teleport())
145+
// Hardcoded till the XCM pallet is fixed
146+
let hardcoded_weight = Weight::from_ref_time(200_000_000 as u64).ref_time();
147+
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::initiate_teleport());
148+
cmp::min(hardcoded_weight, weight)
146149
}
147150
fn query_holding(
148151
_query_id: &u64,

parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::Runtime;
2121
use frame_support::weights::Weight;
2222
use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight;
2323
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
24-
use sp_std::prelude::*;
24+
use sp_std::{cmp, prelude::*};
2525
use xcm::{
2626
latest::{prelude::*, Weight as XCMWeight},
2727
DoubleEncoded,
@@ -142,7 +142,10 @@ impl<Call> XcmWeightInfo<Call> for WestmintXcmWeight<Call> {
142142
_dest: &MultiLocation,
143143
_xcm: &Xcm<()>,
144144
) -> XCMWeight {
145-
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::initiate_teleport())
145+
// Hardcoded till the XCM pallet is fixed
146+
let hardcoded_weight = Weight::from_ref_time(200_000_000 as u64).ref_time();
147+
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::initiate_teleport());
148+
cmp::min(hardcoded_weight, weight)
146149
}
147150
fn query_holding(
148151
_query_id: &u64,

0 commit comments

Comments
 (0)