Fix XCM Weights on Westend (#4066)

* found issue

* fix up

* remove printlns
This commit is contained in:
Shawn Tabrizi
2021-10-12 11:18:32 -04:00
committed by GitHub
parent 533cdb6e7c
commit 622ffbd808
2 changed files with 22 additions and 2 deletions
+18
View File
@@ -49,3 +49,21 @@ fn call_size() {
If the limit is too strong, maybe consider increase the limit to 300.",
);
}
#[test]
fn sanity_check_teleport_assets_weight() {
// This test sanity checks that at least 50 teleports can exist in a block.
// Usually when XCM runs into an issue, it will return a weight of `Weight::MAX`,
// so this test will certainly ensure that this problem does not occur.
use frame_support::dispatch::GetDispatchInfo;
let weight = pallet_xcm::Call::<Runtime>::teleport_assets {
dest: Box::new(xcm::VersionedMultiLocation::V1(MultiLocation::here())),
beneficiary: Box::new(xcm::VersionedMultiLocation::V1(MultiLocation::here())),
assets: Box::new((Concrete(MultiLocation::here()), Fungible(200_000)).into()),
fee_asset_item: 0,
}
.get_dispatch_info()
.weight;
assert!(weight * 50 < BlockWeights::get().max_block);
}