[Feature] Make XCM benchmarks more reusable and remove a redundant bench (#5936)

* [Feature] Make XCM benchmarks more reusable and remove a redunant bench

* implement track balances flag

* little comment fix

* Revert "little comment fix"

This reverts commit 6d0d1bb4d74752aa518c4d71718c1b71673bcca8.

* Revert "implement track balances flag"

This reverts commit e7884cbc57d053c5d57a80aab4caa42e78cfdc17.

* fix unused
This commit is contained in:
Roman Useinov
2022-09-01 18:33:04 +02:00
committed by GitHub
parent f2020208c0
commit 75d49dfeb4
@@ -20,10 +20,7 @@ use codec::Encode;
use frame_benchmarking::{benchmarks, BenchmarkError};
use frame_support::dispatch::GetDispatchInfo;
use sp_std::vec;
use xcm::{
latest::{prelude::*, MultiAssets},
DoubleEncoded,
};
use xcm::{latest::prelude::*, DoubleEncoded};
benchmarks! {
query_holding {
@@ -70,26 +67,6 @@ benchmarks! {
}
// Worst case scenario for this benchmark is a large number of assets to
// filter through the reserve.
reserve_asset_deposited {
const MAX_ASSETS: u32 = 100; // TODO when executor has a built in limit, use it here. #4426
let mut executor = new_executor::<T>(Default::default());
let assets = (0..MAX_ASSETS).map(|i| MultiAsset {
id: Abstract(i.encode()),
fun: Fungible(i as u128),
}).collect::<vec::Vec<_>>();
let multiassets: MultiAssets = assets.into();
let instruction = Instruction::ReserveAssetDeposited(multiassets.clone());
let xcm = Xcm(vec![instruction]);
}: {
executor.execute(xcm).map_err(|_| BenchmarkError::Skip)?;
} verify {
assert_eq!(executor.holding, multiassets.into());
}
query_response {
let mut executor = new_executor::<T>(Default::default());
let (query_id, response) = T::worst_case_response();