mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 09:21:04 +00:00
Add XCM Benchmarks to Kusama (#4442)
* add xcm benchmarks to kusama * Create temp * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=pallet_xcm_benchmarks::generic --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --template=./xcm/pallet-xcm-benchmarks/template.hbs --output=./runtime/kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=kusama-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/kusama/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs * add weights to kusama runtime * Fixes * Fixes * Fixes * Fixes * cargo run --quiet --profile=production --features=runtime-benchmarks -- benchmark --chain=kusama-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/kusama/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs * cargo run --quiet --profile=production --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=pallet_xcm_benchmarks::generic --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --template=./xcm/pallet-xcm-benchmarks/template.hbs --output=./runtime/kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs * use new benchmark * Fix license year * update substrate deps * Add Configuration::ActiveConfig storage key to the whitelist * Update Cargo.lock Co-authored-by: Parity Bot <admin@parity.io> Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
Generated
+1
@@ -3504,6 +3504,7 @@ dependencies = [
|
|||||||
"pallet-utility",
|
"pallet-utility",
|
||||||
"pallet-vesting",
|
"pallet-vesting",
|
||||||
"pallet-xcm",
|
"pallet-xcm",
|
||||||
|
"pallet-xcm-benchmarks",
|
||||||
"parity-scale-codec",
|
"parity-scale-codec",
|
||||||
"polkadot-primitives",
|
"polkadot-primitives",
|
||||||
"polkadot-runtime-common",
|
"polkadot-runtime-common",
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "m
|
|||||||
pallet-utility = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
pallet-utility = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
pallet-vesting = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
pallet-vesting = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
pallet-xcm = { path = "../../xcm/pallet-xcm", default-features = false }
|
pallet-xcm = { path = "../../xcm/pallet-xcm", default-features = false }
|
||||||
|
pallet-xcm-benchmarks = { path = "../../xcm/pallet-xcm-benchmarks", default-features = false, optional = true }
|
||||||
frame-election-provider-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
frame-election-provider-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
|
|
||||||
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
|
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
|
||||||
@@ -223,6 +224,7 @@ runtime-benchmarks = [
|
|||||||
"frame-election-provider-support/runtime-benchmarks",
|
"frame-election-provider-support/runtime-benchmarks",
|
||||||
"pallet-bags-list/runtime-benchmarks",
|
"pallet-bags-list/runtime-benchmarks",
|
||||||
"runtime-parachains/runtime-benchmarks",
|
"runtime-parachains/runtime-benchmarks",
|
||||||
|
"pallet-xcm-benchmarks",
|
||||||
]
|
]
|
||||||
try-runtime = [
|
try-runtime = [
|
||||||
"frame-executive/try-runtime",
|
"frame-executive/try-runtime",
|
||||||
|
|||||||
@@ -1600,6 +1600,9 @@ mod benches {
|
|||||||
[pallet_treasury, Treasury]
|
[pallet_treasury, Treasury]
|
||||||
[pallet_utility, Utility]
|
[pallet_utility, Utility]
|
||||||
[pallet_vesting, Vesting]
|
[pallet_vesting, Vesting]
|
||||||
|
// XCM
|
||||||
|
[pallet_xcm_benchmarks::fungible, pallet_xcm_benchmarks::fungible::Pallet::<Runtime>]
|
||||||
|
[pallet_xcm_benchmarks::generic, pallet_xcm_benchmarks::generic::Pallet::<Runtime>]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1967,19 +1970,85 @@ sp_api::impl_runtime_apis! {
|
|||||||
Vec<frame_benchmarking::BenchmarkBatch>,
|
Vec<frame_benchmarking::BenchmarkBatch>,
|
||||||
sp_runtime::RuntimeString,
|
sp_runtime::RuntimeString,
|
||||||
> {
|
> {
|
||||||
use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey};
|
use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey, BenchmarkError};
|
||||||
// Trying to add benchmarks directly to some pallets caused cyclic dependency issues.
|
// Trying to add benchmarks directly to some pallets caused cyclic dependency issues.
|
||||||
// To get around that, we separated the benchmarks into its own crate.
|
// To get around that, we separated the benchmarks into its own crate.
|
||||||
use pallet_session_benchmarking::Pallet as SessionBench;
|
use pallet_session_benchmarking::Pallet as SessionBench;
|
||||||
use pallet_offences_benchmarking::Pallet as OffencesBench;
|
use pallet_offences_benchmarking::Pallet as OffencesBench;
|
||||||
use frame_system_benchmarking::Pallet as SystemBench;
|
use frame_system_benchmarking::Pallet as SystemBench;
|
||||||
use frame_benchmarking::baseline::Pallet as Baseline;
|
use frame_benchmarking::baseline::Pallet as Baseline;
|
||||||
|
use xcm::latest::prelude::*;
|
||||||
|
use xcm_config::{CheckAccount, KsmLocation, SovereignAccountOf, Statemine, XcmConfig};
|
||||||
|
|
||||||
impl pallet_session_benchmarking::Config for Runtime {}
|
impl pallet_session_benchmarking::Config for Runtime {}
|
||||||
impl pallet_offences_benchmarking::Config for Runtime {}
|
impl pallet_offences_benchmarking::Config for Runtime {}
|
||||||
impl frame_system_benchmarking::Config for Runtime {}
|
impl frame_system_benchmarking::Config for Runtime {}
|
||||||
impl frame_benchmarking::baseline::Config for Runtime {}
|
impl frame_benchmarking::baseline::Config for Runtime {}
|
||||||
|
|
||||||
|
impl pallet_xcm_benchmarks::Config for Runtime {
|
||||||
|
type XcmConfig = XcmConfig;
|
||||||
|
type AccountIdConverter = SovereignAccountOf;
|
||||||
|
fn valid_destination() -> Result<MultiLocation, BenchmarkError> {
|
||||||
|
Ok(Statemine::get())
|
||||||
|
}
|
||||||
|
fn worst_case_holding() -> MultiAssets {
|
||||||
|
// Kusama only knows about KSM.
|
||||||
|
vec![MultiAsset{
|
||||||
|
id: Concrete(KsmLocation::get()),
|
||||||
|
fun: Fungible(1_000_000 * UNITS),
|
||||||
|
}].into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
|
||||||
|
Statemine::get(),
|
||||||
|
MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(KsmLocation::get()) },
|
||||||
|
));
|
||||||
|
pub const TrustedReserve: Option<(MultiLocation, MultiAsset)> = Some((
|
||||||
|
Statemine::get(),
|
||||||
|
MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(KsmLocation::get()) },
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
impl pallet_xcm_benchmarks::fungible::Config for Runtime {
|
||||||
|
type TransactAsset = Balances;
|
||||||
|
|
||||||
|
type CheckedAccount = CheckAccount;
|
||||||
|
type TrustedTeleporter = TrustedTeleporter;
|
||||||
|
type TrustedReserve = TrustedReserve;
|
||||||
|
|
||||||
|
fn get_multi_asset() -> MultiAsset {
|
||||||
|
MultiAsset {
|
||||||
|
id: Concrete(KsmLocation::get()),
|
||||||
|
fun: Fungible(1 * UNITS),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl pallet_xcm_benchmarks::generic::Config for Runtime {
|
||||||
|
type Call = Call;
|
||||||
|
|
||||||
|
fn worst_case_response() -> (u64, Response) {
|
||||||
|
(0u64, Response::Version(Default::default()))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn transact_origin() -> Result<MultiLocation, BenchmarkError> {
|
||||||
|
Ok(Statemine::get())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn subscribe_origin() -> Result<MultiLocation, BenchmarkError> {
|
||||||
|
Ok(Statemine::get())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn claimable_asset() -> Result<(MultiLocation, MultiLocation, MultiAssets), BenchmarkError> {
|
||||||
|
let origin = Statemine::get();
|
||||||
|
let assets: MultiAssets = (Concrete(KsmLocation::get()), 1_000 * UNITS).into();
|
||||||
|
let ticket = MultiLocation { parents: 0, interior: Here };
|
||||||
|
Ok((origin, ticket, assets))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let whitelist: Vec<TrackedStorageKey> = vec![
|
let whitelist: Vec<TrackedStorageKey> = vec![
|
||||||
// Block Number
|
// Block Number
|
||||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),
|
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),
|
||||||
@@ -1993,6 +2062,8 @@ sp_api::impl_runtime_apis! {
|
|||||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),
|
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),
|
||||||
// Treasury Account
|
// Treasury Account
|
||||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da95ecffd7b6c0f78751baa9d281e0bfa3a6d6f646c70792f74727372790000000000000000000000000000000000000000").to_vec().into(),
|
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da95ecffd7b6c0f78751baa9d281e0bfa3a6d6f646c70792f74727372790000000000000000000000000000000000000000").to_vec().into(),
|
||||||
|
// Configuration ActiveConfig
|
||||||
|
hex_literal::hex!("06de3d8a54d27e44a9d5ce189618f22db4b49d95320d9021994c850f25b8e385").to_vec().into(),
|
||||||
];
|
];
|
||||||
|
|
||||||
let mut batches = Vec::<BenchmarkBatch>::new();
|
let mut batches = Vec::<BenchmarkBatch>::new();
|
||||||
@@ -2000,7 +2071,6 @@ sp_api::impl_runtime_apis! {
|
|||||||
|
|
||||||
add_benchmarks!(params, batches);
|
add_benchmarks!(params, batches);
|
||||||
|
|
||||||
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
|
||||||
Ok(batches)
|
Ok(batches)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,3 +53,4 @@ pub mod runtime_parachains_initializer;
|
|||||||
pub mod runtime_parachains_paras;
|
pub mod runtime_parachains_paras;
|
||||||
pub mod runtime_parachains_paras_inherent;
|
pub mod runtime_parachains_paras_inherent;
|
||||||
pub mod runtime_parachains_ump;
|
pub mod runtime_parachains_ump;
|
||||||
|
pub mod xcm;
|
||||||
|
|||||||
@@ -0,0 +1,195 @@
|
|||||||
|
mod pallet_xcm_benchmarks_fungible;
|
||||||
|
mod pallet_xcm_benchmarks_generic;
|
||||||
|
|
||||||
|
use crate::Runtime;
|
||||||
|
use frame_support::weights::Weight;
|
||||||
|
use sp_std::prelude::*;
|
||||||
|
use xcm::{latest::prelude::*, DoubleEncoded};
|
||||||
|
|
||||||
|
use pallet_xcm_benchmarks_fungible::WeightInfo as XcmBalancesWeight;
|
||||||
|
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
|
||||||
|
|
||||||
|
/// Types of asset supported by the Kusama runtime.
|
||||||
|
pub enum AssetTypes {
|
||||||
|
/// An asset backed by `pallet-balances`.
|
||||||
|
Balances,
|
||||||
|
/// Unknown asset.
|
||||||
|
Unknown,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<&MultiAsset> for AssetTypes {
|
||||||
|
fn from(asset: &MultiAsset) -> Self {
|
||||||
|
match asset {
|
||||||
|
MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: Here }), .. } =>
|
||||||
|
AssetTypes::Balances,
|
||||||
|
_ => AssetTypes::Unknown,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
trait WeighMultiAssets {
|
||||||
|
fn weigh_multi_assets(&self, balances_weight: Weight) -> Weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kusama only knows about one asset, the balances pallet.
|
||||||
|
const MAX_ASSETS: u32 = 1;
|
||||||
|
|
||||||
|
impl WeighMultiAssets for MultiAssetFilter {
|
||||||
|
fn weigh_multi_assets(&self, balances_weight: Weight) -> Weight {
|
||||||
|
match self {
|
||||||
|
Self::Definite(assets) => assets
|
||||||
|
.inner()
|
||||||
|
.into_iter()
|
||||||
|
.map(From::from)
|
||||||
|
.map(|t| match t {
|
||||||
|
AssetTypes::Balances => balances_weight,
|
||||||
|
AssetTypes::Unknown => Weight::MAX,
|
||||||
|
})
|
||||||
|
.fold(0, |acc, x| acc.saturating_add(x)),
|
||||||
|
Self::Wild(_) => (MAX_ASSETS as Weight).saturating_mul(balances_weight),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl WeighMultiAssets for MultiAssets {
|
||||||
|
fn weigh_multi_assets(&self, balances_weight: Weight) -> Weight {
|
||||||
|
self.inner()
|
||||||
|
.into_iter()
|
||||||
|
.map(|m| <AssetTypes as From<&MultiAsset>>::from(m))
|
||||||
|
.map(|t| match t {
|
||||||
|
AssetTypes::Balances => balances_weight,
|
||||||
|
AssetTypes::Unknown => Weight::MAX,
|
||||||
|
})
|
||||||
|
.fold(0, |acc, x| acc.saturating_add(x))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct KusamaXcmWeight<Call>(core::marker::PhantomData<Call>);
|
||||||
|
impl<Call> XcmWeightInfo<Call> for KusamaXcmWeight<Call> {
|
||||||
|
fn withdraw_asset(assets: &MultiAssets) -> Weight {
|
||||||
|
assets.weigh_multi_assets(XcmBalancesWeight::<Runtime>::withdraw_asset())
|
||||||
|
}
|
||||||
|
fn reserve_asset_deposited(assets: &MultiAssets) -> Weight {
|
||||||
|
assets.weigh_multi_assets(XcmBalancesWeight::<Runtime>::reserve_asset_deposited())
|
||||||
|
}
|
||||||
|
fn receive_teleported_asset(assets: &MultiAssets) -> Weight {
|
||||||
|
assets.weigh_multi_assets(XcmBalancesWeight::<Runtime>::receive_teleported_asset())
|
||||||
|
}
|
||||||
|
fn query_response(_query_id: &u64, _response: &Response, _max_weight: &u64) -> Weight {
|
||||||
|
XcmGeneric::<Runtime>::query_response()
|
||||||
|
}
|
||||||
|
fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> Weight {
|
||||||
|
assets.weigh_multi_assets(XcmBalancesWeight::<Runtime>::transfer_asset())
|
||||||
|
}
|
||||||
|
fn transfer_reserve_asset(
|
||||||
|
assets: &MultiAssets,
|
||||||
|
_dest: &MultiLocation,
|
||||||
|
_xcm: &Xcm<()>,
|
||||||
|
) -> Weight {
|
||||||
|
assets.weigh_multi_assets(XcmBalancesWeight::<Runtime>::transfer_reserve_asset())
|
||||||
|
}
|
||||||
|
fn transact(
|
||||||
|
_origin_type: &OriginKind,
|
||||||
|
_require_weight_at_most: &u64,
|
||||||
|
_call: &DoubleEncoded<Call>,
|
||||||
|
) -> Weight {
|
||||||
|
XcmGeneric::<Runtime>::transact()
|
||||||
|
}
|
||||||
|
fn hrmp_new_channel_open_request(
|
||||||
|
_sender: &u32,
|
||||||
|
_max_message_size: &u32,
|
||||||
|
_max_capacity: &u32,
|
||||||
|
) -> Weight {
|
||||||
|
// XCM Executor does not currently support HRMP channel operations
|
||||||
|
Weight::MAX
|
||||||
|
}
|
||||||
|
fn hrmp_channel_accepted(_recipient: &u32) -> Weight {
|
||||||
|
// XCM Executor does not currently support HRMP channel operations
|
||||||
|
Weight::MAX
|
||||||
|
}
|
||||||
|
fn hrmp_channel_closing(_initiator: &u32, _sender: &u32, _recipient: &u32) -> Weight {
|
||||||
|
// XCM Executor does not currently support HRMP channel operations
|
||||||
|
Weight::MAX
|
||||||
|
}
|
||||||
|
fn clear_origin() -> Weight {
|
||||||
|
XcmGeneric::<Runtime>::clear_origin()
|
||||||
|
}
|
||||||
|
fn descend_origin(_who: &InteriorMultiLocation) -> Weight {
|
||||||
|
XcmGeneric::<Runtime>::descend_origin()
|
||||||
|
}
|
||||||
|
fn report_error(
|
||||||
|
_query_id: &QueryId,
|
||||||
|
_dest: &MultiLocation,
|
||||||
|
_max_response_weight: &u64,
|
||||||
|
) -> Weight {
|
||||||
|
XcmGeneric::<Runtime>::report_error()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn deposit_asset(
|
||||||
|
assets: &MultiAssetFilter,
|
||||||
|
_max_assets: &u32, // TODO use max assets?
|
||||||
|
_dest: &MultiLocation,
|
||||||
|
) -> Weight {
|
||||||
|
assets.weigh_multi_assets(XcmBalancesWeight::<Runtime>::deposit_asset())
|
||||||
|
}
|
||||||
|
fn deposit_reserve_asset(
|
||||||
|
assets: &MultiAssetFilter,
|
||||||
|
_max_assets: &u32, // TODO use max assets?
|
||||||
|
_dest: &MultiLocation,
|
||||||
|
_xcm: &Xcm<()>,
|
||||||
|
) -> Weight {
|
||||||
|
assets.weigh_multi_assets(XcmBalancesWeight::<Runtime>::deposit_reserve_asset())
|
||||||
|
}
|
||||||
|
fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets) -> Weight {
|
||||||
|
Weight::MAX // todo fix
|
||||||
|
}
|
||||||
|
fn initiate_reserve_withdraw(
|
||||||
|
assets: &MultiAssetFilter,
|
||||||
|
_reserve: &MultiLocation,
|
||||||
|
_xcm: &Xcm<()>,
|
||||||
|
) -> Weight {
|
||||||
|
assets.weigh_multi_assets(XcmGeneric::<Runtime>::initiate_reserve_withdraw())
|
||||||
|
}
|
||||||
|
fn initiate_teleport(
|
||||||
|
assets: &MultiAssetFilter,
|
||||||
|
_dest: &MultiLocation,
|
||||||
|
_xcm: &Xcm<()>,
|
||||||
|
) -> Weight {
|
||||||
|
assets.weigh_multi_assets(XcmBalancesWeight::<Runtime>::initiate_teleport())
|
||||||
|
}
|
||||||
|
fn query_holding(
|
||||||
|
_query_id: &u64,
|
||||||
|
_dest: &MultiLocation,
|
||||||
|
_assets: &MultiAssetFilter,
|
||||||
|
_max_response_weight: &u64,
|
||||||
|
) -> Weight {
|
||||||
|
XcmGeneric::<Runtime>::query_holding()
|
||||||
|
}
|
||||||
|
fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> Weight {
|
||||||
|
XcmGeneric::<Runtime>::buy_execution()
|
||||||
|
}
|
||||||
|
fn refund_surplus() -> Weight {
|
||||||
|
XcmGeneric::<Runtime>::refund_surplus()
|
||||||
|
}
|
||||||
|
fn set_error_handler(_xcm: &Xcm<Call>) -> Weight {
|
||||||
|
XcmGeneric::<Runtime>::set_error_handler()
|
||||||
|
}
|
||||||
|
fn set_appendix(_xcm: &Xcm<Call>) -> Weight {
|
||||||
|
XcmGeneric::<Runtime>::set_appendix()
|
||||||
|
}
|
||||||
|
fn clear_error() -> Weight {
|
||||||
|
XcmGeneric::<Runtime>::clear_error()
|
||||||
|
}
|
||||||
|
fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> Weight {
|
||||||
|
XcmGeneric::<Runtime>::claim_asset()
|
||||||
|
}
|
||||||
|
fn trap(_code: &u64) -> Weight {
|
||||||
|
XcmGeneric::<Runtime>::trap()
|
||||||
|
}
|
||||||
|
fn subscribe_version(_query_id: &QueryId, _max_response_weight: &u64) -> Weight {
|
||||||
|
XcmGeneric::<Runtime>::subscribe_version()
|
||||||
|
}
|
||||||
|
fn unsubscribe_version() -> Weight {
|
||||||
|
XcmGeneric::<Runtime>::unsubscribe_version()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
// Copyright 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// This file is part of Polkadot.
|
||||||
|
|
||||||
|
// Polkadot is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// Polkadot is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Autogenerated weights for `pallet_xcm_benchmarks::fungible`
|
||||||
|
//!
|
||||||
|
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||||
|
//! DATE: 2022-03-08, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||||
|
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024
|
||||||
|
|
||||||
|
// Executed Command:
|
||||||
|
// target/production/polkadot
|
||||||
|
// benchmark
|
||||||
|
// --chain=kusama-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/kusama/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs
|
||||||
|
|
||||||
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
|
#![allow(unused_parens)]
|
||||||
|
#![allow(unused_imports)]
|
||||||
|
|
||||||
|
use frame_support::{traits::Get, weights::Weight};
|
||||||
|
use sp_std::marker::PhantomData;
|
||||||
|
|
||||||
|
/// Weights for `pallet_xcm_benchmarks::fungible`.
|
||||||
|
pub struct WeightInfo<T>(PhantomData<T>);
|
||||||
|
impl<T: frame_system::Config> WeightInfo<T> {
|
||||||
|
// Storage: System Account (r:1 w:1)
|
||||||
|
pub(crate) fn withdraw_asset() -> Weight {
|
||||||
|
(20_385_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:2 w:2)
|
||||||
|
pub(crate) fn transfer_asset() -> Weight {
|
||||||
|
(32_756_000 as Weight)
|
||||||
|
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||||
|
}
|
||||||
|
// 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: Configuration ActiveConfig (r:1 w:0)
|
||||||
|
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
||||||
|
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||||
|
pub(crate) fn transfer_reserve_asset() -> Weight {
|
||||||
|
(50_645_000 as Weight)
|
||||||
|
.saturating_add(T::DbWeight::get().reads(8 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(5 as Weight))
|
||||||
|
}
|
||||||
|
// Storage: Benchmark Override (r:0 w:0)
|
||||||
|
pub(crate) fn reserve_asset_deposited() -> Weight {
|
||||||
|
(2_000_000_000_000 as Weight)
|
||||||
|
}
|
||||||
|
// Storage: System Account (r:1 w:1)
|
||||||
|
pub(crate) fn receive_teleported_asset() -> Weight {
|
||||||
|
(19_595_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)
|
||||||
|
pub(crate) fn deposit_asset() -> Weight {
|
||||||
|
(21_763_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: Configuration ActiveConfig (r:1 w:0)
|
||||||
|
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
||||||
|
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||||
|
pub(crate) fn deposit_reserve_asset() -> Weight {
|
||||||
|
(40_930_000 as Weight)
|
||||||
|
.saturating_add(T::DbWeight::get().reads(7 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(4 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: Configuration ActiveConfig (r:1 w:0)
|
||||||
|
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
||||||
|
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||||
|
pub(crate) fn initiate_teleport() -> Weight {
|
||||||
|
(40_788_000 as Weight)
|
||||||
|
.saturating_add(T::DbWeight::get().reads(7 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
// Copyright 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// This file is part of Polkadot.
|
||||||
|
|
||||||
|
// Polkadot is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// Polkadot is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Autogenerated weights for `pallet_xcm_benchmarks::generic`
|
||||||
|
//!
|
||||||
|
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||||
|
//! DATE: 2022-03-08, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||||
|
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024
|
||||||
|
|
||||||
|
// Executed Command:
|
||||||
|
// target/production/polkadot
|
||||||
|
// benchmark
|
||||||
|
// --chain=kusama-dev
|
||||||
|
// --steps=50
|
||||||
|
// --repeat=20
|
||||||
|
// --pallet=pallet_xcm_benchmarks::generic
|
||||||
|
// --extrinsic=*
|
||||||
|
// --execution=wasm
|
||||||
|
// --wasm-execution=compiled
|
||||||
|
// --heap-pages=4096
|
||||||
|
// --header=./file_header.txt
|
||||||
|
// --template=./xcm/pallet-xcm-benchmarks/template.hbs
|
||||||
|
// --output=./runtime/kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs
|
||||||
|
|
||||||
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
|
#![allow(unused_parens)]
|
||||||
|
#![allow(unused_imports)]
|
||||||
|
|
||||||
|
use frame_support::{traits::Get, weights::Weight};
|
||||||
|
use sp_std::marker::PhantomData;
|
||||||
|
|
||||||
|
/// Weights for `pallet_xcm_benchmarks::generic`.
|
||||||
|
pub struct WeightInfo<T>(PhantomData<T>);
|
||||||
|
impl<T: frame_system::Config> WeightInfo<T> {
|
||||||
|
// Storage: XcmPallet SupportedVersion (r:1 w:0)
|
||||||
|
// Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1)
|
||||||
|
// Storage: XcmPallet SafeXcmVersion (r:1 w:0)
|
||||||
|
// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||||
|
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
||||||
|
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||||
|
pub(crate) fn query_holding() -> Weight {
|
||||||
|
(21_822_000 as Weight)
|
||||||
|
.saturating_add(T::DbWeight::get().reads(6 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||||
|
}
|
||||||
|
pub(crate) fn buy_execution() -> Weight {
|
||||||
|
(3_109_000 as Weight)
|
||||||
|
}
|
||||||
|
// Storage: XcmPallet Queries (r:1 w:0)
|
||||||
|
pub(crate) fn query_response() -> Weight {
|
||||||
|
(12_087_000 as Weight)
|
||||||
|
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||||
|
}
|
||||||
|
pub(crate) fn transact() -> Weight {
|
||||||
|
(12_398_000 as Weight)
|
||||||
|
}
|
||||||
|
pub(crate) fn refund_surplus() -> Weight {
|
||||||
|
(3_247_000 as Weight)
|
||||||
|
}
|
||||||
|
pub(crate) fn set_error_handler() -> Weight {
|
||||||
|
(3_086_000 as Weight)
|
||||||
|
}
|
||||||
|
pub(crate) fn set_appendix() -> Weight {
|
||||||
|
(3_112_000 as Weight)
|
||||||
|
}
|
||||||
|
pub(crate) fn clear_error() -> Weight {
|
||||||
|
(3_118_000 as Weight)
|
||||||
|
}
|
||||||
|
pub(crate) fn descend_origin() -> Weight {
|
||||||
|
(4_054_000 as Weight)
|
||||||
|
}
|
||||||
|
pub(crate) fn clear_origin() -> Weight {
|
||||||
|
(3_111_000 as Weight)
|
||||||
|
}
|
||||||
|
// Storage: XcmPallet SupportedVersion (r:1 w:0)
|
||||||
|
// Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1)
|
||||||
|
// Storage: XcmPallet SafeXcmVersion (r:1 w:0)
|
||||||
|
// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||||
|
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
||||||
|
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||||
|
pub(crate) fn report_error() -> Weight {
|
||||||
|
(18_425_000 as Weight)
|
||||||
|
.saturating_add(T::DbWeight::get().reads(6 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||||
|
}
|
||||||
|
// Storage: XcmPallet AssetTraps (r:1 w:1)
|
||||||
|
pub(crate) fn claim_asset() -> Weight {
|
||||||
|
(7_144_000 as Weight)
|
||||||
|
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||||
|
}
|
||||||
|
pub(crate) fn trap() -> Weight {
|
||||||
|
(3_060_000 as Weight)
|
||||||
|
}
|
||||||
|
// Storage: XcmPallet VersionNotifyTargets (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: Configuration ActiveConfig (r:1 w:0)
|
||||||
|
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
||||||
|
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||||
|
pub(crate) fn subscribe_version() -> Weight {
|
||||||
|
(21_642_000 as Weight)
|
||||||
|
.saturating_add(T::DbWeight::get().reads(7 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||||
|
}
|
||||||
|
// Storage: XcmPallet VersionNotifyTargets (r:0 w:1)
|
||||||
|
pub(crate) fn unsubscribe_version() -> Weight {
|
||||||
|
(4_873_000 as Weight)
|
||||||
|
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||||
|
}
|
||||||
|
// Storage: XcmPallet SupportedVersion (r:1 w:0)
|
||||||
|
// Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1)
|
||||||
|
// Storage: XcmPallet SafeXcmVersion (r:1 w:0)
|
||||||
|
// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||||
|
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
||||||
|
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||||
|
pub(crate) fn initiate_reserve_withdraw() -> Weight {
|
||||||
|
(22_809_000 as Weight)
|
||||||
|
.saturating_add(T::DbWeight::get().reads(6 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,7 +29,7 @@ use xcm_builder::{
|
|||||||
ChildParachainAsNative, ChildParachainConvertsVia, ChildSystemParachainAsSuperuser,
|
ChildParachainAsNative, ChildParachainConvertsVia, ChildSystemParachainAsSuperuser,
|
||||||
CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsChildSystemParachain, IsConcrete,
|
CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsChildSystemParachain, IsConcrete,
|
||||||
LocationInverter, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation,
|
LocationInverter, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation,
|
||||||
TakeWeightCredit, UsingComponents,
|
TakeWeightCredit, UsingComponents, WeightInfoBounds,
|
||||||
};
|
};
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
@@ -101,7 +101,8 @@ pub type XcmRouter = (
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const Kusama: MultiAssetFilter = Wild(AllOf { fun: WildFungible, id: Concrete(KsmLocation::get()) });
|
pub const Kusama: MultiAssetFilter = Wild(AllOf { fun: WildFungible, id: Concrete(KsmLocation::get()) });
|
||||||
pub const KusamaForStatemine: (MultiAssetFilter, MultiLocation) = (Kusama::get(), Parachain(1000).into());
|
pub const Statemine: MultiLocation = Parachain(1000).into();
|
||||||
|
pub const KusamaForStatemine: (MultiAssetFilter, MultiLocation) = (Kusama::get(), Statemine::get());
|
||||||
pub const KusamaForEncointer: (MultiAssetFilter, MultiLocation) = (Kusama::get(), Parachain(1001).into());
|
pub const KusamaForEncointer: (MultiAssetFilter, MultiLocation) = (Kusama::get(), Parachain(1001).into());
|
||||||
}
|
}
|
||||||
pub type TrustedTeleporters =
|
pub type TrustedTeleporters =
|
||||||
@@ -137,7 +138,8 @@ impl xcm_executor::Config for XcmConfig {
|
|||||||
type IsTeleporter = TrustedTeleporters;
|
type IsTeleporter = TrustedTeleporters;
|
||||||
type LocationInverter = LocationInverter<Ancestry>;
|
type LocationInverter = LocationInverter<Ancestry>;
|
||||||
type Barrier = Barrier;
|
type Barrier = Barrier;
|
||||||
type Weigher = FixedWeightBounds<BaseXcmWeight, Call, MaxInstructions>;
|
type Weigher =
|
||||||
|
WeightInfoBounds<crate::weights::xcm::KusamaXcmWeight<Call>, Call, MaxInstructions>;
|
||||||
// The weight trader piggybacks on the existing transaction-fee conversion logic.
|
// The weight trader piggybacks on the existing transaction-fee conversion logic.
|
||||||
type Trader = UsingComponents<WeightToFee, KsmLocation, AccountId, Balances, ToAuthor<Runtime>>;
|
type Trader = UsingComponents<WeightToFee, KsmLocation, AccountId, Balances, ToAuthor<Runtime>>;
|
||||||
type ResponseHandler = XcmPallet;
|
type ResponseHandler = XcmPallet;
|
||||||
|
|||||||
Reference in New Issue
Block a user