mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 21:01:02 +00:00
Fix XCM Teleport Benchmark (#4146)
* fix xcm benchmark * fix overflow * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=pallet_xcm_benchmarks::fungible --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --template=./xcm/pallet-xcm-benchmarks/template.hbs --output=./runtime/westend/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs * fix spelling * fmt * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=pallet_xcm_benchmarks::fungible --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --template=./xcm/pallet-xcm-benchmarks/template.hbs --output=./runtime/westend/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs Co-authored-by: Parity Bot <admin@parity.io>
This commit is contained in:
@@ -17,8 +17,11 @@
|
||||
use super::*;
|
||||
use crate::{account_and_location, new_executor, worst_case_holding, AssetTransactorOf, XcmCallOf};
|
||||
use frame_benchmarking::{benchmarks_instance_pallet, BenchmarkError, BenchmarkResult};
|
||||
use frame_support::{pallet_prelude::Get, traits::fungible::Inspect};
|
||||
use sp_runtime::traits::Zero;
|
||||
use frame_support::{
|
||||
pallet_prelude::Get,
|
||||
traits::fungible::{Inspect, Mutate},
|
||||
};
|
||||
use sp_runtime::traits::{Bounded, Zero};
|
||||
use sp_std::{convert::TryInto, prelude::*, vec};
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_executor::traits::{Convert, TransactAsset};
|
||||
@@ -106,11 +109,19 @@ benchmarks_instance_pallet! {
|
||||
|
||||
receive_teleported_asset {
|
||||
// If there is no trusted teleporter, then we skip this benchmark.
|
||||
let (trusted_teleporter, teleportable_asset) = T::TrustedTeleporter::get().ok_or(
|
||||
BenchmarkError::Override(
|
||||
BenchmarkResult::from_weight(T::BlockWeights::get().max_block)
|
||||
)
|
||||
)?;
|
||||
let (trusted_teleporter, teleportable_asset) = T::TrustedTeleporter::get()
|
||||
.ok_or(BenchmarkError::Skip)?;
|
||||
|
||||
if let Some(checked_account) = T::CheckedAccount::get() {
|
||||
T::TransactAsset::mint_into(
|
||||
&checked_account,
|
||||
<
|
||||
T::TransactAsset
|
||||
as
|
||||
Inspect<T::AccountId>
|
||||
>::Balance::max_value() / 2u32.into(),
|
||||
)?;
|
||||
}
|
||||
|
||||
let assets: MultiAssets = vec![ teleportable_asset ].into();
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ impl xcm_executor::Config for XcmConfig {
|
||||
type AssetTransactor = AssetTransactor;
|
||||
type OriginConverter = ();
|
||||
type IsReserve = ();
|
||||
type IsTeleporter = ();
|
||||
type IsTeleporter = TrustedTeleporters;
|
||||
type LocationInverter = xcm_builder::LocationInverter<Ancestry>;
|
||||
type Barrier = AllowUnpaidExecutionFrom<Everything>;
|
||||
type Weigher = xcm_builder::FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
||||
@@ -153,12 +153,17 @@ impl crate::Config for Test {
|
||||
}
|
||||
}
|
||||
|
||||
pub type TrustedTeleporters = (xcm_builder::Case<TeleConcreteFung>,);
|
||||
|
||||
parameter_types! {
|
||||
pub const CheckedAccount: Option<u64> = Some(100);
|
||||
pub const ChildTeleporter: MultiLocation = Parachain(1000).into();
|
||||
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
|
||||
X1(OnlyChild).into(),
|
||||
ChildTeleporter::get(),
|
||||
MultiAsset { id: Concrete(Here.into()), fun: Fungible(100) },
|
||||
));
|
||||
pub const TeleConcreteFung: (MultiAssetFilter, MultiLocation) =
|
||||
(Wild(AllOf { fun: WildFungible, id: Concrete(Here.into()) }), ChildTeleporter::get());
|
||||
}
|
||||
|
||||
impl xcm_balances_benchmark::Config for Test {
|
||||
|
||||
Reference in New Issue
Block a user