Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,13 @@ impl<Call> XcmWeightInfo<Call> for StatemineXcmWeight<Call> {
_dest: &MultiLocation,
_xcm: &Xcm<()>,
) -> 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());
if (weight > hardcoded_weight) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ruseinov
could be min function used here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bkontur This is std and it's not re-exported by sp_std. So preferably not

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joepetrowski @KiChjang what do you say? I haven't seen min/max used anywhere or being re-exported.

Copy link
Contributor

@bkontur bkontur Sep 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ruseinov
I see several usages of sp_std::cmp::min, but I dont have up-to-date code base now

could be it this: https://github.com/paritytech/substrate/blob/master/primitives/std/without_std.rs#L27 ?

also used here: https://github.com/paritytech/cumulus/blob/master/pallets/parachain-system/src/lib.rs#L55

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a strong opinion on it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we can use min/max - let's use it. I thought there was a reason not to.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bkontur fixed. I was having the same dilemma, but since I could not find many usages I assumed it might have something to do with no_std environments.

return hardcoded_weight
}
weight
}
fn query_holding(
_query_id: &u64,
Expand Down
8 changes: 7 additions & 1 deletion parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,13 @@ impl<Call> XcmWeightInfo<Call> for StatemintXcmWeight<Call> {
_dest: &MultiLocation,
_xcm: &Xcm<()>,
) -> 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());
if (weight > hardcoded_weight) {
return hardcoded_weight
}
weight
}
fn query_holding(
_query_id: &u64,
Expand Down
8 changes: 7 additions & 1 deletion parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,13 @@ impl<Call> XcmWeightInfo<Call> for WestmintXcmWeight<Call> {
_dest: &MultiLocation,
_xcm: &Xcm<()>,
) -> 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());
if (weight > hardcoded_weight) {
return hardcoded_weight
}
weight
}
fn query_holding(
_query_id: &u64,
Expand Down