mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-19 12:15:42 +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:
@@ -18,7 +18,7 @@
|
|||||||
//! futures will still get polled, but will not count towards length. So length will only count
|
//! futures will still get polled, but will not count towards length. So length will only count
|
||||||
//! futures, which are still considered live.
|
//! futures, which are still considered live.
|
||||||
//!
|
//!
|
||||||
//! Usecase: If futures take longer than we would like them too, we may be able to request the data
|
//! Use case: If futures take longer than we would like them too, we may be able to request the data
|
||||||
//! from somewhere else as well. We don't really want to cancel the old future, because maybe it
|
//! from somewhere else as well. We don't really want to cancel the old future, because maybe it
|
||||||
//! was almost done, thus we would have wasted time with our impatience. By simply making them
|
//! was almost done, thus we would have wasted time with our impatience. By simply making them
|
||||||
//! not count towards length, we can make sure to have enough "live" requests ongoing, while at the
|
//! not count towards length, we can make sure to have enough "live" requests ongoing, while at the
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ pub type GenesisElectionOf<T> =
|
|||||||
/// pallet-election-provider-multi-phase.
|
/// pallet-election-provider-multi-phase.
|
||||||
pub const MINER_MAX_ITERATIONS: u32 = 10;
|
pub const MINER_MAX_ITERATIONS: u32 = 10;
|
||||||
|
|
||||||
/// A source of random balance for the NPoS Solver, which is meant to be run by the offchain worker
|
/// A source of random balance for the NPoS Solver, which is meant to be run by the off-chain worker
|
||||||
/// election miner.
|
/// election miner.
|
||||||
pub struct OffchainRandomBalancing;
|
pub struct OffchainRandomBalancing;
|
||||||
impl frame_support::pallet_prelude::Get<Option<(usize, sp_npos_elections::ExtendedBalance)>>
|
impl frame_support::pallet_prelude::Get<Option<(usize, sp_npos_elections::ExtendedBalance)>>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
//! Autogenerated weights for `pallet_xcm_benchmarks::fungible`
|
//! Autogenerated weights for `pallet_xcm_benchmarks::fungible`
|
||||||
//!
|
//!
|
||||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||||
//! DATE: 2021-09-17, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
//! DATE: 2021-10-25, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westend-dev"), DB CACHE: 128
|
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westend-dev"), DB CACHE: 128
|
||||||
|
|
||||||
// Executed Command:
|
// Executed Command:
|
||||||
@@ -48,48 +48,59 @@ pub struct WeightInfo<T>(PhantomData<T>);
|
|||||||
impl<T: frame_system::Config> WeightInfo<T> {
|
impl<T: frame_system::Config> WeightInfo<T> {
|
||||||
// Storage: System Account (r:1 w:1)
|
// Storage: System Account (r:1 w:1)
|
||||||
pub(crate) fn withdraw_asset() -> Weight {
|
pub(crate) fn withdraw_asset() -> Weight {
|
||||||
(39_691_000 as Weight)
|
(43_806_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
// Storage: System Account (r:2 w:2)
|
// Storage: System Account (r:2 w:2)
|
||||||
pub(crate) fn transfer_asset() -> Weight {
|
pub(crate) fn transfer_asset() -> Weight {
|
||||||
(62_616_000 as Weight)
|
(68_076_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||||
}
|
}
|
||||||
// Storage: System Account (r:2 w:2)
|
// Storage: System Account (r:2 w:2)
|
||||||
|
// Storage: XcmPallet SupportedVersion (r:1 w:0)
|
||||||
|
// Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1)
|
||||||
|
// Storage: XcmPallet SafeXcmVersion (r:1 w:0)
|
||||||
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
||||||
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||||
pub(crate) fn transfer_reserve_asset() -> Weight {
|
pub(crate) fn transfer_reserve_asset() -> Weight {
|
||||||
(86_642_000 as Weight)
|
(99_639_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
.saturating_add(T::DbWeight::get().reads(7 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
.saturating_add(T::DbWeight::get().writes(5 as Weight))
|
||||||
}
|
|
||||||
// Storage: Benchmark Override (r:0 w:0)
|
|
||||||
pub(crate) fn receive_teleported_asset() -> Weight {
|
|
||||||
(2_000_000_000_000 as Weight)
|
|
||||||
}
|
}
|
||||||
// Storage: System Account (r:1 w:1)
|
// Storage: System Account (r:1 w:1)
|
||||||
pub(crate) fn deposit_asset() -> Weight {
|
pub(crate) fn receive_teleported_asset() -> Weight {
|
||||||
(49_745_000 as Weight)
|
(38_670_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||||
}
|
}
|
||||||
// Storage: System Account (r:1 w:1)
|
// Storage: System Account (r:1 w:1)
|
||||||
|
pub(crate) fn deposit_asset() -> Weight {
|
||||||
|
(51_793_000 as Weight)
|
||||||
|
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||||
|
}
|
||||||
|
// Storage: System Account (r:1 w:1)
|
||||||
|
// Storage: XcmPallet SupportedVersion (r:1 w:0)
|
||||||
|
// Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1)
|
||||||
|
// Storage: XcmPallet SafeXcmVersion (r:1 w:0)
|
||||||
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
||||||
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||||
pub(crate) fn deposit_reserve_asset() -> Weight {
|
pub(crate) fn deposit_reserve_asset() -> Weight {
|
||||||
(75_318_000 as Weight)
|
(85_782_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
.saturating_add(T::DbWeight::get().reads(6 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||||
}
|
}
|
||||||
// Storage: System Account (r:1 w:1)
|
// Storage: System Account (r:1 w:1)
|
||||||
|
// Storage: XcmPallet SupportedVersion (r:1 w:0)
|
||||||
|
// Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1)
|
||||||
|
// Storage: XcmPallet SafeXcmVersion (r:1 w:0)
|
||||||
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
||||||
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||||
pub(crate) fn initiate_teleport() -> Weight {
|
pub(crate) fn initiate_teleport() -> Weight {
|
||||||
(75_467_000 as Weight)
|
(84_873_000 as Weight)
|
||||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
.saturating_add(T::DbWeight::get().reads(6 as Weight))
|
||||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,11 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
use crate::{account_and_location, new_executor, worst_case_holding, AssetTransactorOf, XcmCallOf};
|
use crate::{account_and_location, new_executor, worst_case_holding, AssetTransactorOf, XcmCallOf};
|
||||||
use frame_benchmarking::{benchmarks_instance_pallet, BenchmarkError, BenchmarkResult};
|
use frame_benchmarking::{benchmarks_instance_pallet, BenchmarkError, BenchmarkResult};
|
||||||
use frame_support::{pallet_prelude::Get, traits::fungible::Inspect};
|
use frame_support::{
|
||||||
use sp_runtime::traits::Zero;
|
pallet_prelude::Get,
|
||||||
|
traits::fungible::{Inspect, Mutate},
|
||||||
|
};
|
||||||
|
use sp_runtime::traits::{Bounded, Zero};
|
||||||
use sp_std::{convert::TryInto, prelude::*, vec};
|
use sp_std::{convert::TryInto, prelude::*, vec};
|
||||||
use xcm::latest::prelude::*;
|
use xcm::latest::prelude::*;
|
||||||
use xcm_executor::traits::{Convert, TransactAsset};
|
use xcm_executor::traits::{Convert, TransactAsset};
|
||||||
@@ -106,11 +109,19 @@ benchmarks_instance_pallet! {
|
|||||||
|
|
||||||
receive_teleported_asset {
|
receive_teleported_asset {
|
||||||
// If there is no trusted teleporter, then we skip this benchmark.
|
// If there is no trusted teleporter, then we skip this benchmark.
|
||||||
let (trusted_teleporter, teleportable_asset) = T::TrustedTeleporter::get().ok_or(
|
let (trusted_teleporter, teleportable_asset) = T::TrustedTeleporter::get()
|
||||||
BenchmarkError::Override(
|
.ok_or(BenchmarkError::Skip)?;
|
||||||
BenchmarkResult::from_weight(T::BlockWeights::get().max_block)
|
|
||||||
)
|
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();
|
let assets: MultiAssets = vec![ teleportable_asset ].into();
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ impl xcm_executor::Config for XcmConfig {
|
|||||||
type AssetTransactor = AssetTransactor;
|
type AssetTransactor = AssetTransactor;
|
||||||
type OriginConverter = ();
|
type OriginConverter = ();
|
||||||
type IsReserve = ();
|
type IsReserve = ();
|
||||||
type IsTeleporter = ();
|
type IsTeleporter = TrustedTeleporters;
|
||||||
type LocationInverter = xcm_builder::LocationInverter<Ancestry>;
|
type LocationInverter = xcm_builder::LocationInverter<Ancestry>;
|
||||||
type Barrier = AllowUnpaidExecutionFrom<Everything>;
|
type Barrier = AllowUnpaidExecutionFrom<Everything>;
|
||||||
type Weigher = xcm_builder::FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
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! {
|
parameter_types! {
|
||||||
pub const CheckedAccount: Option<u64> = Some(100);
|
pub const CheckedAccount: Option<u64> = Some(100);
|
||||||
|
pub const ChildTeleporter: MultiLocation = Parachain(1000).into();
|
||||||
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
|
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
|
||||||
X1(OnlyChild).into(),
|
ChildTeleporter::get(),
|
||||||
MultiAsset { id: Concrete(Here.into()), fun: Fungible(100) },
|
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 {
|
impl xcm_balances_benchmark::Config for Test {
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ pub mod pallet {
|
|||||||
/// \[ origin location, id, expected location \]
|
/// \[ origin location, id, expected location \]
|
||||||
InvalidResponder(MultiLocation, QueryId, Option<MultiLocation>),
|
InvalidResponder(MultiLocation, QueryId, Option<MultiLocation>),
|
||||||
/// Expected query response has been received but the expected origin location placed in
|
/// Expected query response has been received but the expected origin location placed in
|
||||||
/// storate by this runtime previously cannot be decoded. The query remains registered.
|
/// storage by this runtime previously cannot be decoded. The query remains registered.
|
||||||
///
|
///
|
||||||
/// This is unexpected (since a location placed in storage in a previously executing
|
/// This is unexpected (since a location placed in storage in a previously executing
|
||||||
/// runtime should be readable prior to query timeout) and dangerous since the possibly
|
/// runtime should be readable prior to query timeout) and dangerous since the possibly
|
||||||
|
|||||||
@@ -861,7 +861,7 @@ fn subscriber_side_subscription_works() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// We should autosubscribe when we don't know the remote's version.
|
/// We should auto-subscribe when we don't know the remote's version.
|
||||||
#[test]
|
#[test]
|
||||||
fn auto_subscription_works() {
|
fn auto_subscription_works() {
|
||||||
new_test_ext_with_balances(vec![]).execute_with(|| {
|
new_test_ext_with_balances(vec![]).execute_with(|| {
|
||||||
|
|||||||
Reference in New Issue
Block a user