Tests + backport fix for teleport_assets (ReceiveTeleportedAsset) (#2235) (#2238)

* Wwstmint test for ReceiveTeleportedAsset

* Missing fix for `weigh_multi_assets`

* Added tests for statemine/statemint

* [Enhancement] Use XCM V3 for initiate_teleport weight calc (#2102)

* [Enhancement] Use XCM V3 for initiate_teleport weight calc

* deref

* replicate in all the runtimes

* fmt

* better handling for AllOf

* fmt

* small type fix

* replicate the fix for all runtimes

---------

Co-authored-by: parity-processbot <>

* removed `frame_support::sp_tracing::try_init_simple();`

* Review fixes

* Removed `as u64`

---------

Co-authored-by: Branislav Kontur <bkontur@gmail.com>
Co-authored-by: Roman Useinov <roman.useinov@gmail.com>
This commit is contained in:
Egor_P
2023-02-27 12:28:40 +01:00
committed by GitHub
parent 672b53ead6
commit 9fa8786e29
9 changed files with 210 additions and 35 deletions
@@ -28,7 +28,7 @@ trait WeighMultiAssets {
fn weigh_multi_assets(&self, weight: Weight) -> Weight;
}
const MAX_ASSETS: u32 = 100;
const MAX_ASSETS: u64 = 100;
impl WeighMultiAssets for MultiAssetFilter {
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
@@ -36,7 +36,7 @@ impl WeighMultiAssets for MultiAssetFilter {
Self::Definite(assets) =>
weight.saturating_mul(assets.inner().into_iter().count() as u64),
Self::Wild(asset) => match asset {
All => weight.saturating_mul(MAX_ASSETS as u64),
All => weight.saturating_mul(MAX_ASSETS),
AllOf { fun, .. } => match fun {
WildFungibility::Fungible => weight,
// Magic number 2 has to do with the fact that we could have up to 2 times
@@ -44,8 +44,8 @@ impl WeighMultiAssets for MultiAssetFilter {
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),
AllCounted(count) => weight.saturating_mul(MAX_ASSETS.min(*count as u64)),
AllOfCounted { count, .. } => weight.saturating_mul(MAX_ASSETS.min(*count as u64)),
},
}
}