mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-09 01:18:00 +00:00
[Feature] Add XCM benchmark weights to Statemint and Statemine (#1454)
* [Feature] Add XCM benchmarark weights to Statemint and Statemine * add xcm-bench-template * add polkadot xcm bench pallet to statemint * Sample benchmarking that compiles * add benches to the module * Remove batches assertion and whitelist ActiveConfig * ".git/.scripts/bench-bot.sh" xcm statemint assets pallet_xcm_benchmarks::generic * ".git/.scripts/bench-bot.sh" xcm statemint assets pallet_xcm_benchmarks::generic * fix benchmarks * fix get_multi_asset * fmt and more bench fixes * reformat * move Xcm type definitions * define types twice * remove commented out lines * define Xcm bench types globally * test use * fix semi * make sure the type definittion is properly documented * tweak TrustedTeleporter/Reserve * use dots as asset * copy benchmarks over, fix the ci script * remove extra asset * ".git/.scripts/bench-bot.sh" xcm statemint assets pallet_xcm_benchmarks::generic * benchmarks setup for statemint/e and westmint * ".git/.scripts/bench-bot.sh" xcm statemint assets pallet_xcm_benchmarks::fungible * ".git/.scripts/bench-bot.sh" xcm statemine assets pallet_xcm_benchmarks::generic * ".git/.scripts/bench-bot.sh" xcm statemine assets pallet_xcm_benchmarks::fungible * remove a check * ".git/.scripts/bench-bot.sh" xcm westmint assets pallet_xcm_benchmarks::fungible * ".git/.scripts/bench-bot.sh" xcm westmint assets pallet_xcm_benchmarks::generic * implement WeightInfoBounds for all the asset runtimes * update Cargo.lock * fix Muharem's comments * ".git/.scripts/bench-bot.sh" xcm statemint assets pallet_xcm_benchmarks::generic * Update parachains/runtimes/assets/statemint/src/lib.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * fix some review comments * fix file headers * more fixes to licenses and such * fix another inconsistency * Extend weights template Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * remove a placeholder * remove redundant overrides * ".git/.scripts/bench-bot.sh" xcm statemint assets pallet_xcm_benchmarks::fungible * Update benchmarking.rs * remove redundant bench * fix * ".git/.scripts/bench-bot.sh" xcm statemint assets pallet_xcm_benchmarks::generic * Update pallets/xcm-benchmarks/src/fungible/mock.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * remove TODO's * remove local xcm-benchmark-pallet impl * disable CheckedAccount in benches * update template * fix up imports * fix xcm * fix the template Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: command-bot <> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
Generated
+3
@@ -11597,6 +11597,7 @@ dependencies = [
|
||||
"pallet-uniques",
|
||||
"pallet-utility",
|
||||
"pallet-xcm",
|
||||
"pallet-xcm-benchmarks",
|
||||
"parachain-info",
|
||||
"parachains-common",
|
||||
"parity-scale-codec",
|
||||
@@ -11663,6 +11664,7 @@ dependencies = [
|
||||
"pallet-uniques",
|
||||
"pallet-utility",
|
||||
"pallet-xcm",
|
||||
"pallet-xcm-benchmarks",
|
||||
"parachain-info",
|
||||
"parachains-common",
|
||||
"parity-scale-codec",
|
||||
@@ -13139,6 +13141,7 @@ dependencies = [
|
||||
"pallet-uniques",
|
||||
"pallet-utility",
|
||||
"pallet-xcm",
|
||||
"pallet-xcm-benchmarks",
|
||||
"parachain-info",
|
||||
"parachains-common",
|
||||
"parity-scale-codec",
|
||||
|
||||
@@ -71,6 +71,7 @@ cumulus-primitives-utility = { path = "../../../../primitives/utility", default-
|
||||
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
|
||||
parachain-info = { path = "../../../pallets/parachain-info", default-features = false }
|
||||
parachains-common = { path = "../../../common", default-features = false }
|
||||
pallet-xcm-benchmarks = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false, optional = true }
|
||||
|
||||
|
||||
[dev-dependencies]
|
||||
@@ -101,6 +102,7 @@ runtime-benchmarks = [
|
||||
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
|
||||
"pallet-collator-selection/runtime-benchmarks",
|
||||
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
|
||||
"pallet-xcm-benchmarks",
|
||||
]
|
||||
try-runtime = [
|
||||
"frame-executive/try-runtime",
|
||||
|
||||
@@ -638,6 +638,10 @@ mod benches {
|
||||
[pallet_timestamp, Timestamp]
|
||||
[pallet_collator_selection, CollatorSelection]
|
||||
[cumulus_pallet_xcmp_queue, XcmpQueue]
|
||||
// XCM
|
||||
// NOTE: Make sure you point to the individual modules below.
|
||||
[pallet_xcm_benchmarks::fungible, XcmBalances]
|
||||
[pallet_xcm_benchmarks::generic, XcmGeneric]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -789,6 +793,12 @@ impl_runtime_apis! {
|
||||
use frame_system_benchmarking::Pallet as SystemBench;
|
||||
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
|
||||
|
||||
// This is defined once again in dispatch_benchmark, because list_benchmarks!
|
||||
// and add_benchmarks! are macros exported by define_benchmarks! macros and those types
|
||||
// are referenced in that call.
|
||||
type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
|
||||
type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;
|
||||
|
||||
let mut list = Vec::<BenchmarkList>::new();
|
||||
list_benchmarks!(list, extra);
|
||||
|
||||
@@ -799,7 +809,8 @@ impl_runtime_apis! {
|
||||
fn dispatch_benchmark(
|
||||
config: frame_benchmarking::BenchmarkConfig
|
||||
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey};
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkBatch, BenchmarkError,
|
||||
TrackedStorageKey};
|
||||
|
||||
use frame_system_benchmarking::Pallet as SystemBench;
|
||||
impl frame_system_benchmarking::Config for Runtime {}
|
||||
@@ -807,6 +818,95 @@ impl_runtime_apis! {
|
||||
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
|
||||
impl cumulus_pallet_session_benchmarking::Config for Runtime {}
|
||||
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_config::KsmLocation;
|
||||
use pallet_xcm_benchmarks::asset_instance_from;
|
||||
|
||||
impl pallet_xcm_benchmarks::Config for Runtime {
|
||||
type XcmConfig = xcm_config::XcmConfig;
|
||||
type AccountIdConverter = xcm_config::LocationToAccountId;
|
||||
fn valid_destination() -> Result<MultiLocation, BenchmarkError> {
|
||||
Ok(KsmLocation::get())
|
||||
}
|
||||
fn worst_case_holding() -> MultiAssets {
|
||||
// A mix of fungible, non-fungible, and concrete assets.
|
||||
const HOLDING_FUNGIBLES: u32 = 100;
|
||||
const HOLDING_NON_FUNGIBLES: u32 = 100;
|
||||
let fungibles_amount: u128 = 100;
|
||||
let mut assets = (0..HOLDING_FUNGIBLES)
|
||||
.map(|i| {
|
||||
MultiAsset {
|
||||
id: Concrete(GeneralIndex(i as u128).into()),
|
||||
fun: Fungible(fungibles_amount * i as u128),
|
||||
}
|
||||
.into()
|
||||
})
|
||||
.chain(core::iter::once(MultiAsset { id: Concrete(Here.into()), fun: Fungible(u128::MAX) }))
|
||||
.chain((0..HOLDING_NON_FUNGIBLES).map(|i| MultiAsset {
|
||||
id: Concrete(GeneralIndex(i as u128).into()),
|
||||
fun: NonFungible(asset_instance_from(i)),
|
||||
}))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
assets.push(MultiAsset{
|
||||
id: Concrete(KsmLocation::get()),
|
||||
fun: Fungible(1_000_000 * UNITS),
|
||||
});
|
||||
assets.into()
|
||||
}
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
|
||||
KsmLocation::get(),
|
||||
MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(KsmLocation::get()) },
|
||||
));
|
||||
pub const TrustedReserve: Option<(MultiLocation, MultiAsset)> = None;
|
||||
pub const CheckedAccount: Option<AccountId> = None;
|
||||
|
||||
}
|
||||
|
||||
impl pallet_xcm_benchmarks::fungible::Config for Runtime {
|
||||
type TransactAsset = Balances;
|
||||
|
||||
type CheckedAccount = CheckedAccount;
|
||||
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(KsmLocation::get())
|
||||
}
|
||||
|
||||
fn subscribe_origin() -> Result<MultiLocation, BenchmarkError> {
|
||||
Ok(KsmLocation::get())
|
||||
}
|
||||
|
||||
fn claimable_asset() -> Result<(MultiLocation, MultiLocation, MultiAssets), BenchmarkError> {
|
||||
let origin = KsmLocation::get();
|
||||
let assets: MultiAssets = (Concrete(KsmLocation::get()), 1_000 * UNITS).into();
|
||||
let ticket = MultiLocation { parents: 0, interior: Here };
|
||||
Ok((origin, ticket, assets))
|
||||
}
|
||||
}
|
||||
|
||||
type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
|
||||
type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;
|
||||
|
||||
let whitelist: Vec<TrackedStorageKey> = vec![
|
||||
// Block Number
|
||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),
|
||||
@@ -818,13 +918,14 @@ impl_runtime_apis! {
|
||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),
|
||||
// System Events
|
||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),
|
||||
//TODO: use from relay_well_known_keys::ACTIVE_CONFIG
|
||||
hex_literal::hex!("06de3d8a54d27e44a9d5ce189618f22db4b49d95320d9021994c850f25b8e385").to_vec().into(),
|
||||
];
|
||||
|
||||
let mut batches = Vec::<BenchmarkBatch>::new();
|
||||
let params = (&config, &whitelist);
|
||||
add_benchmarks!(params, batches);
|
||||
|
||||
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
||||
Ok(batches)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ pub mod pallet_uniques;
|
||||
pub mod pallet_utility;
|
||||
pub mod paritydb_weights;
|
||||
pub mod rocksdb_weights;
|
||||
pub mod xcm;
|
||||
|
||||
pub use block_weights::constants::BlockExecutionWeight;
|
||||
pub use extrinsic_weights::constants::ExtrinsicBaseWeight;
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
// Copyright 2022 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus 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.
|
||||
|
||||
// Cumulus 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 Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
mod pallet_xcm_benchmarks_fungible;
|
||||
mod pallet_xcm_benchmarks_generic;
|
||||
|
||||
use crate::Runtime;
|
||||
use frame_support::weights::Weight;
|
||||
use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight;
|
||||
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
|
||||
use sp_std::prelude::*;
|
||||
use xcm::{
|
||||
latest::{prelude::*, Weight as XCMWeight},
|
||||
DoubleEncoded,
|
||||
};
|
||||
|
||||
trait WeighMultiAssets {
|
||||
fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight;
|
||||
}
|
||||
|
||||
const MAX_ASSETS: u32 = 100;
|
||||
|
||||
impl WeighMultiAssets for MultiAssetFilter {
|
||||
fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight {
|
||||
let weight = match self {
|
||||
Self::Definite(assets) =>
|
||||
weight.scalar_saturating_mul(assets.inner().into_iter().count() as u64),
|
||||
Self::Wild(_) => weight.scalar_saturating_mul(MAX_ASSETS as u64),
|
||||
};
|
||||
weight.ref_time()
|
||||
}
|
||||
}
|
||||
|
||||
impl WeighMultiAssets for MultiAssets {
|
||||
fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight {
|
||||
weight.scalar_saturating_mul(self.inner().into_iter().count() as u64).ref_time()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct StatemineXcmWeight<Call>(core::marker::PhantomData<Call>);
|
||||
impl<Call> XcmWeightInfo<Call> for StatemineXcmWeight<Call> {
|
||||
fn withdraw_asset(assets: &MultiAssets) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::withdraw_asset())
|
||||
}
|
||||
// Currently there is no trusted reserve
|
||||
fn reserve_asset_deposited(_assets: &MultiAssets) -> XCMWeight {
|
||||
unimplemented!()
|
||||
}
|
||||
fn receive_teleported_asset(assets: &MultiAssets) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::receive_teleported_asset())
|
||||
}
|
||||
fn query_response(_query_id: &u64, _response: &Response, _max_weight: &u64) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::query_response().ref_time()
|
||||
}
|
||||
fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::transfer_asset())
|
||||
}
|
||||
fn transfer_reserve_asset(
|
||||
assets: &MultiAssets,
|
||||
_dest: &MultiLocation,
|
||||
_xcm: &Xcm<()>,
|
||||
) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::transfer_reserve_asset())
|
||||
}
|
||||
fn transact(
|
||||
_origin_type: &OriginKind,
|
||||
_require_weight_at_most: &u64,
|
||||
_call: &DoubleEncoded<Call>,
|
||||
) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::transact().ref_time()
|
||||
}
|
||||
fn hrmp_new_channel_open_request(
|
||||
_sender: &u32,
|
||||
_max_message_size: &u32,
|
||||
_max_capacity: &u32,
|
||||
) -> XCMWeight {
|
||||
// XCM Executor does not currently support HRMP channel operations
|
||||
Weight::MAX.ref_time()
|
||||
}
|
||||
fn hrmp_channel_accepted(_recipient: &u32) -> XCMWeight {
|
||||
// XCM Executor does not currently support HRMP channel operations
|
||||
Weight::MAX.ref_time()
|
||||
}
|
||||
fn hrmp_channel_closing(_initiator: &u32, _sender: &u32, _recipient: &u32) -> XCMWeight {
|
||||
// XCM Executor does not currently support HRMP channel operations
|
||||
Weight::MAX.ref_time()
|
||||
}
|
||||
fn clear_origin() -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::clear_origin().ref_time()
|
||||
}
|
||||
fn descend_origin(_who: &InteriorMultiLocation) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::descend_origin().ref_time()
|
||||
}
|
||||
fn report_error(
|
||||
_query_id: &QueryId,
|
||||
_dest: &MultiLocation,
|
||||
_max_response_weight: &u64,
|
||||
) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::report_error().ref_time()
|
||||
}
|
||||
|
||||
fn deposit_asset(
|
||||
assets: &MultiAssetFilter,
|
||||
_max_assets: &u32,
|
||||
_dest: &MultiLocation,
|
||||
) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset())
|
||||
}
|
||||
fn deposit_reserve_asset(
|
||||
assets: &MultiAssetFilter,
|
||||
_max_assets: &u32,
|
||||
_dest: &MultiLocation,
|
||||
_xcm: &Xcm<()>,
|
||||
) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_reserve_asset())
|
||||
}
|
||||
fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets) -> XCMWeight {
|
||||
Weight::MAX.ref_time()
|
||||
}
|
||||
fn initiate_reserve_withdraw(
|
||||
assets: &MultiAssetFilter,
|
||||
_reserve: &MultiLocation,
|
||||
_xcm: &Xcm<()>,
|
||||
) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmGeneric::<Runtime>::initiate_reserve_withdraw())
|
||||
}
|
||||
fn initiate_teleport(
|
||||
assets: &MultiAssetFilter,
|
||||
_dest: &MultiLocation,
|
||||
_xcm: &Xcm<()>,
|
||||
) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::initiate_teleport())
|
||||
}
|
||||
fn query_holding(
|
||||
_query_id: &u64,
|
||||
_dest: &MultiLocation,
|
||||
_assets: &MultiAssetFilter,
|
||||
_max_response_weight: &u64,
|
||||
) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::query_holding().ref_time()
|
||||
}
|
||||
fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::buy_execution().ref_time()
|
||||
}
|
||||
fn refund_surplus() -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::refund_surplus().ref_time()
|
||||
}
|
||||
fn set_error_handler(_xcm: &Xcm<Call>) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::set_error_handler().ref_time()
|
||||
}
|
||||
fn set_appendix(_xcm: &Xcm<Call>) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::set_appendix().ref_time()
|
||||
}
|
||||
fn clear_error() -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::clear_error().ref_time()
|
||||
}
|
||||
fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::claim_asset().ref_time()
|
||||
}
|
||||
fn trap(_code: &u64) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::trap().ref_time()
|
||||
}
|
||||
fn subscribe_version(_query_id: &QueryId, _max_response_weight: &u64) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::subscribe_version().ref_time()
|
||||
}
|
||||
fn unsubscribe_version() -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::unsubscribe_version().ref_time()
|
||||
}
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
// Copyright 2022 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus 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.
|
||||
|
||||
// Cumulus 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 Cumulus. 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-08-17, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// /home/benchbot/cargo_target_dir/production/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --pallet=pallet_xcm_benchmarks::fungible
|
||||
// --chain=statemine-dev
|
||||
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json
|
||||
// --header=./file_header.txt
|
||||
// --template=./templates/xcm-bench-template.hbs
|
||||
// --output=./parachains/runtimes/assets/statemine/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::{RefTimeWeight, 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 {
|
||||
Weight::from_ref_time(29_190_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
|
||||
}
|
||||
// Storage: System Account (r:2 w:2)
|
||||
pub(crate) fn transfer_asset() -> Weight {
|
||||
Weight::from_ref_time(34_102_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
|
||||
}
|
||||
// Storage: System Account (r:2 w:2)
|
||||
// Storage: ParachainInfo ParachainId (r:1 w:0)
|
||||
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
|
||||
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
|
||||
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
|
||||
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
|
||||
pub(crate) fn transfer_reserve_asset() -> Weight {
|
||||
Weight::from_ref_time(49_386_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(8 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
|
||||
}
|
||||
pub(crate) fn receive_teleported_asset() -> Weight {
|
||||
Weight::from_ref_time(4_937_000 as RefTimeWeight)
|
||||
}
|
||||
// Storage: System Account (r:1 w:1)
|
||||
pub(crate) fn deposit_asset() -> Weight {
|
||||
Weight::from_ref_time(30_853_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
|
||||
}
|
||||
// Storage: System Account (r:1 w:1)
|
||||
// Storage: ParachainInfo ParachainId (r:1 w:0)
|
||||
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
|
||||
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
|
||||
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
|
||||
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
|
||||
pub(crate) fn deposit_reserve_asset() -> Weight {
|
||||
Weight::from_ref_time(45_866_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(7 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
|
||||
}
|
||||
// Storage: ParachainInfo ParachainId (r:1 w:0)
|
||||
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
|
||||
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
|
||||
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
|
||||
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
|
||||
pub(crate) fn initiate_teleport() -> Weight {
|
||||
Weight::from_ref_time(23_964_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
|
||||
}
|
||||
}
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
// Copyright 2022 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus 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.
|
||||
|
||||
// Cumulus 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 Cumulus. 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-08-17, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// /home/benchbot/cargo_target_dir/production/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --pallet=pallet_xcm_benchmarks::generic
|
||||
// --chain=statemine-dev
|
||||
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json
|
||||
// --header=./file_header.txt
|
||||
// --template=./templates/xcm-bench-template.hbs
|
||||
// --output=./parachains/runtimes/assets/statemine/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::{RefTimeWeight, 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: ParachainInfo ParachainId (r:1 w:0)
|
||||
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
|
||||
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
|
||||
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
|
||||
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
|
||||
pub(crate) fn query_holding() -> Weight {
|
||||
Weight::from_ref_time(694_466_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
|
||||
}
|
||||
pub(crate) fn buy_execution() -> Weight {
|
||||
Weight::from_ref_time(7_095_000 as RefTimeWeight)
|
||||
}
|
||||
// Storage: PolkadotXcm Queries (r:1 w:0)
|
||||
pub(crate) fn query_response() -> Weight {
|
||||
Weight::from_ref_time(13_270_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
|
||||
}
|
||||
pub(crate) fn transact() -> Weight {
|
||||
Weight::from_ref_time(16_375_000 as RefTimeWeight)
|
||||
}
|
||||
pub(crate) fn refund_surplus() -> Weight {
|
||||
Weight::from_ref_time(7_319_000 as RefTimeWeight)
|
||||
}
|
||||
pub(crate) fn set_error_handler() -> Weight {
|
||||
Weight::from_ref_time(3_515_000 as RefTimeWeight)
|
||||
}
|
||||
pub(crate) fn set_appendix() -> Weight {
|
||||
Weight::from_ref_time(3_501_000 as RefTimeWeight)
|
||||
}
|
||||
pub(crate) fn clear_error() -> Weight {
|
||||
Weight::from_ref_time(3_459_000 as RefTimeWeight)
|
||||
}
|
||||
pub(crate) fn descend_origin() -> Weight {
|
||||
Weight::from_ref_time(4_319_000 as RefTimeWeight)
|
||||
}
|
||||
pub(crate) fn clear_origin() -> Weight {
|
||||
Weight::from_ref_time(3_511_000 as RefTimeWeight)
|
||||
}
|
||||
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
|
||||
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
|
||||
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
|
||||
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
|
||||
pub(crate) fn report_error() -> Weight {
|
||||
Weight::from_ref_time(13_284_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(5 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
|
||||
}
|
||||
// Storage: PolkadotXcm AssetTraps (r:1 w:1)
|
||||
pub(crate) fn claim_asset() -> Weight {
|
||||
Weight::from_ref_time(7_985_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
|
||||
}
|
||||
pub(crate) fn trap() -> Weight {
|
||||
Weight::from_ref_time(3_515_000 as RefTimeWeight)
|
||||
}
|
||||
// Storage: PolkadotXcm VersionNotifyTargets (r:1 w:1)
|
||||
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
|
||||
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
|
||||
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
|
||||
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
|
||||
pub(crate) fn subscribe_version() -> Weight {
|
||||
Weight::from_ref_time(16_657_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
|
||||
}
|
||||
// Storage: PolkadotXcm VersionNotifyTargets (r:0 w:1)
|
||||
pub(crate) fn unsubscribe_version() -> Weight {
|
||||
Weight::from_ref_time(5_622_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
|
||||
}
|
||||
// Storage: ParachainInfo ParachainId (r:1 w:0)
|
||||
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
|
||||
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
|
||||
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
|
||||
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
|
||||
pub(crate) fn initiate_reserve_withdraw() -> Weight {
|
||||
Weight::from_ref_time(878_786_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
|
||||
}
|
||||
}
|
||||
@@ -34,11 +34,11 @@ use xcm::latest::prelude::*;
|
||||
use xcm_builder::{
|
||||
AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom,
|
||||
AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, AsPrefixedGeneralIndex,
|
||||
ConvertedConcreteAssetId, CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds,
|
||||
FungiblesAdapter, IsConcrete, LocationInverter, NativeAsset, ParentAsSuperuser, ParentIsPreset,
|
||||
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
|
||||
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
|
||||
UsingComponents,
|
||||
ConvertedConcreteAssetId, CurrencyAdapter, EnsureXcmOrigin, FungiblesAdapter, IsConcrete,
|
||||
LocationInverter, NativeAsset, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
|
||||
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
|
||||
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
|
||||
WeightInfoBounds,
|
||||
};
|
||||
use xcm_executor::{traits::JustTry, XcmExecutor};
|
||||
|
||||
@@ -128,8 +128,6 @@ pub type XcmOriginToTransactDispatchOrigin = (
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
// One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate.
|
||||
pub UnitWeightCost: u64 = 1_000_000_000;
|
||||
pub const MaxInstructions: u32 = 100;
|
||||
pub XcmAssetFeesReceiver: Option<AccountId> = Authorship::author();
|
||||
}
|
||||
@@ -172,7 +170,8 @@ impl xcm_executor::Config for XcmConfig {
|
||||
type IsTeleporter = NativeAsset; // <- should be enough to allow teleportation of KSM
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
type Barrier = Barrier;
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
||||
type Weigher =
|
||||
WeightInfoBounds<crate::weights::xcm::StatemineXcmWeight<Call>, Call, MaxInstructions>;
|
||||
type Trader = (
|
||||
UsingComponents<WeightToFee, KsmLocation, AccountId, Balances, ToStakingPot<Runtime>>,
|
||||
cumulus_primitives_utility::TakeFirstAssetTrader<
|
||||
@@ -227,7 +226,9 @@ impl pallet_xcm::Config for Runtime {
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type XcmTeleportFilter = Everything;
|
||||
type XcmReserveTransferFilter = Everything;
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
||||
type Weigher =
|
||||
WeightInfoBounds<crate::weights::xcm::StatemineXcmWeight<Call>, Call, MaxInstructions>;
|
||||
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
type Origin = Origin;
|
||||
type Call = Call;
|
||||
|
||||
@@ -71,6 +71,7 @@ cumulus-primitives-utility = { path = "../../../../primitives/utility", default-
|
||||
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
|
||||
parachain-info = { path = "../../../pallets/parachain-info", default-features = false }
|
||||
parachains-common = { path = "../../../common", default-features = false }
|
||||
pallet-xcm-benchmarks = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
hex-literal = "0.3.4"
|
||||
@@ -100,6 +101,7 @@ runtime-benchmarks = [
|
||||
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
|
||||
"pallet-collator-selection/runtime-benchmarks",
|
||||
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
|
||||
"pallet-xcm-benchmarks",
|
||||
]
|
||||
try-runtime = [
|
||||
"frame-executive/try-runtime",
|
||||
|
||||
@@ -667,6 +667,10 @@ mod benches {
|
||||
[pallet_timestamp, Timestamp]
|
||||
[pallet_collator_selection, CollatorSelection]
|
||||
[cumulus_pallet_xcmp_queue, XcmpQueue]
|
||||
// XCM
|
||||
// NOTE: Make sure you point to the individual modules below.
|
||||
[pallet_xcm_benchmarks::fungible, XcmBalances]
|
||||
[pallet_xcm_benchmarks::generic, XcmGeneric]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -813,11 +817,18 @@ impl_runtime_apis! {
|
||||
Vec<frame_benchmarking::BenchmarkList>,
|
||||
Vec<frame_support::traits::StorageInfo>,
|
||||
) {
|
||||
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkList};
|
||||
use frame_support::traits::StorageInfoTrait;
|
||||
use frame_system_benchmarking::Pallet as SystemBench;
|
||||
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
|
||||
|
||||
// This is defined once again in dispatch_benchmark, because list_benchmarks!
|
||||
// and add_benchmarks! are macros exported by define_benchmarks! macros and those types
|
||||
// are referenced in that call.
|
||||
type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
|
||||
type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;
|
||||
|
||||
let mut list = Vec::<BenchmarkList>::new();
|
||||
list_benchmarks!(list, extra);
|
||||
|
||||
@@ -828,7 +839,7 @@ impl_runtime_apis! {
|
||||
fn dispatch_benchmark(
|
||||
config: frame_benchmarking::BenchmarkConfig
|
||||
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey};
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey, BenchmarkError};
|
||||
|
||||
use frame_system_benchmarking::Pallet as SystemBench;
|
||||
impl frame_system_benchmarking::Config for Runtime {}
|
||||
@@ -836,6 +847,94 @@ impl_runtime_apis! {
|
||||
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
|
||||
impl cumulus_pallet_session_benchmarking::Config for Runtime {}
|
||||
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_config::DotLocation;
|
||||
use pallet_xcm_benchmarks::asset_instance_from;
|
||||
|
||||
impl pallet_xcm_benchmarks::Config for Runtime {
|
||||
type XcmConfig = xcm_config::XcmConfig;
|
||||
type AccountIdConverter = xcm_config::LocationToAccountId;
|
||||
fn valid_destination() -> Result<MultiLocation, BenchmarkError> {
|
||||
Ok(DotLocation::get())
|
||||
}
|
||||
fn worst_case_holding() -> MultiAssets {
|
||||
// A mix of fungible, non-fungible, and concrete assets.
|
||||
const HOLDING_FUNGIBLES: u32 = 100;
|
||||
const HOLDING_NON_FUNGIBLES: u32 = 100;
|
||||
let fungibles_amount: u128 = 100;
|
||||
let mut assets = (0..HOLDING_FUNGIBLES)
|
||||
.map(|i| {
|
||||
MultiAsset {
|
||||
id: Concrete(GeneralIndex(i as u128).into()),
|
||||
fun: Fungible(fungibles_amount * i as u128),
|
||||
}
|
||||
.into()
|
||||
})
|
||||
.chain(core::iter::once(MultiAsset { id: Concrete(Here.into()), fun: Fungible(u128::MAX) }))
|
||||
.chain((0..HOLDING_NON_FUNGIBLES).map(|i| MultiAsset {
|
||||
id: Concrete(GeneralIndex(i as u128).into()),
|
||||
fun: NonFungible(asset_instance_from(i)),
|
||||
}))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
assets.push(MultiAsset{
|
||||
id: Concrete(DotLocation::get()),
|
||||
fun: Fungible(1_000_000 * UNITS),
|
||||
});
|
||||
assets.into()
|
||||
}
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
|
||||
DotLocation::get(),
|
||||
MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(DotLocation::get()) },
|
||||
));
|
||||
pub const TrustedReserve: Option<(MultiLocation, MultiAsset)> = None;
|
||||
pub const CheckedAccount: Option<AccountId> = None;
|
||||
}
|
||||
|
||||
impl pallet_xcm_benchmarks::fungible::Config for Runtime {
|
||||
type TransactAsset = Balances;
|
||||
|
||||
type CheckedAccount = CheckedAccount;
|
||||
type TrustedTeleporter = TrustedTeleporter;
|
||||
type TrustedReserve = TrustedReserve;
|
||||
|
||||
fn get_multi_asset() -> MultiAsset {
|
||||
MultiAsset {
|
||||
id: Concrete(DotLocation::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(DotLocation::get())
|
||||
}
|
||||
|
||||
fn subscribe_origin() -> Result<MultiLocation, BenchmarkError> {
|
||||
Ok(DotLocation::get())
|
||||
}
|
||||
|
||||
fn claimable_asset() -> Result<(MultiLocation, MultiLocation, MultiAssets), BenchmarkError> {
|
||||
let origin = DotLocation::get();
|
||||
let assets: MultiAssets = (Concrete(DotLocation::get()), 1_000 * UNITS).into();
|
||||
let ticket = MultiLocation { parents: 0, interior: Here };
|
||||
Ok((origin, ticket, assets))
|
||||
}
|
||||
}
|
||||
|
||||
type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
|
||||
type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;
|
||||
|
||||
let whitelist: Vec<TrackedStorageKey> = vec![
|
||||
// Block Number
|
||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),
|
||||
@@ -847,13 +946,14 @@ impl_runtime_apis! {
|
||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),
|
||||
// System Events
|
||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),
|
||||
//TODO: use from relay_well_known_keys::ACTIVE_CONFIG
|
||||
hex_literal::hex!("06de3d8a54d27e44a9d5ce189618f22db4b49d95320d9021994c850f25b8e385").to_vec().into(),
|
||||
];
|
||||
|
||||
let mut batches = Vec::<BenchmarkBatch>::new();
|
||||
let params = (&config, &whitelist);
|
||||
add_benchmarks!(params, batches);
|
||||
|
||||
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
||||
Ok(batches)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ pub mod pallet_uniques;
|
||||
pub mod pallet_utility;
|
||||
pub mod paritydb_weights;
|
||||
pub mod rocksdb_weights;
|
||||
pub mod xcm;
|
||||
|
||||
pub use block_weights::constants::BlockExecutionWeight;
|
||||
pub use extrinsic_weights::constants::ExtrinsicBaseWeight;
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
// Copyright 2022 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus 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.
|
||||
|
||||
// Cumulus 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 Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
mod pallet_xcm_benchmarks_fungible;
|
||||
mod pallet_xcm_benchmarks_generic;
|
||||
|
||||
use crate::Runtime;
|
||||
use frame_support::weights::Weight;
|
||||
use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight;
|
||||
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
|
||||
use sp_std::prelude::*;
|
||||
use xcm::{
|
||||
latest::{prelude::*, Weight as XCMWeight},
|
||||
DoubleEncoded,
|
||||
};
|
||||
|
||||
trait WeighMultiAssets {
|
||||
fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight;
|
||||
}
|
||||
|
||||
const MAX_ASSETS: u32 = 100;
|
||||
|
||||
impl WeighMultiAssets for MultiAssetFilter {
|
||||
fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight {
|
||||
let weight = match self {
|
||||
Self::Definite(assets) =>
|
||||
weight.scalar_saturating_mul(assets.inner().into_iter().count() as u64),
|
||||
Self::Wild(_) => weight.scalar_saturating_mul(MAX_ASSETS as u64),
|
||||
};
|
||||
weight.ref_time()
|
||||
}
|
||||
}
|
||||
|
||||
impl WeighMultiAssets for MultiAssets {
|
||||
fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight {
|
||||
weight.scalar_saturating_mul(self.inner().into_iter().count() as u64).ref_time()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct StatemintXcmWeight<Call>(core::marker::PhantomData<Call>);
|
||||
impl<Call> XcmWeightInfo<Call> for StatemintXcmWeight<Call> {
|
||||
fn withdraw_asset(assets: &MultiAssets) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::withdraw_asset())
|
||||
}
|
||||
// Currently there is no trusted reserve
|
||||
fn reserve_asset_deposited(_assets: &MultiAssets) -> XCMWeight {
|
||||
unimplemented!()
|
||||
}
|
||||
fn receive_teleported_asset(assets: &MultiAssets) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::receive_teleported_asset())
|
||||
}
|
||||
fn query_response(_query_id: &u64, _response: &Response, _max_weight: &u64) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::query_response().ref_time()
|
||||
}
|
||||
fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::transfer_asset())
|
||||
}
|
||||
fn transfer_reserve_asset(
|
||||
assets: &MultiAssets,
|
||||
_dest: &MultiLocation,
|
||||
_xcm: &Xcm<()>,
|
||||
) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::transfer_reserve_asset())
|
||||
}
|
||||
fn transact(
|
||||
_origin_type: &OriginKind,
|
||||
_require_weight_at_most: &u64,
|
||||
_call: &DoubleEncoded<Call>,
|
||||
) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::transact().ref_time()
|
||||
}
|
||||
fn hrmp_new_channel_open_request(
|
||||
_sender: &u32,
|
||||
_max_message_size: &u32,
|
||||
_max_capacity: &u32,
|
||||
) -> XCMWeight {
|
||||
// XCM Executor does not currently support HRMP channel operations
|
||||
Weight::MAX.ref_time()
|
||||
}
|
||||
fn hrmp_channel_accepted(_recipient: &u32) -> XCMWeight {
|
||||
// XCM Executor does not currently support HRMP channel operations
|
||||
Weight::MAX.ref_time()
|
||||
}
|
||||
fn hrmp_channel_closing(_initiator: &u32, _sender: &u32, _recipient: &u32) -> XCMWeight {
|
||||
// XCM Executor does not currently support HRMP channel operations
|
||||
Weight::MAX.ref_time()
|
||||
}
|
||||
fn clear_origin() -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::clear_origin().ref_time()
|
||||
}
|
||||
fn descend_origin(_who: &InteriorMultiLocation) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::descend_origin().ref_time()
|
||||
}
|
||||
fn report_error(
|
||||
_query_id: &QueryId,
|
||||
_dest: &MultiLocation,
|
||||
_max_response_weight: &u64,
|
||||
) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::report_error().ref_time()
|
||||
}
|
||||
|
||||
fn deposit_asset(
|
||||
assets: &MultiAssetFilter,
|
||||
_max_assets: &u32,
|
||||
_dest: &MultiLocation,
|
||||
) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset())
|
||||
}
|
||||
fn deposit_reserve_asset(
|
||||
assets: &MultiAssetFilter,
|
||||
_max_assets: &u32,
|
||||
_dest: &MultiLocation,
|
||||
_xcm: &Xcm<()>,
|
||||
) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_reserve_asset())
|
||||
}
|
||||
fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets) -> XCMWeight {
|
||||
Weight::MAX.ref_time()
|
||||
}
|
||||
fn initiate_reserve_withdraw(
|
||||
assets: &MultiAssetFilter,
|
||||
_reserve: &MultiLocation,
|
||||
_xcm: &Xcm<()>,
|
||||
) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmGeneric::<Runtime>::initiate_reserve_withdraw())
|
||||
}
|
||||
fn initiate_teleport(
|
||||
assets: &MultiAssetFilter,
|
||||
_dest: &MultiLocation,
|
||||
_xcm: &Xcm<()>,
|
||||
) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::initiate_teleport())
|
||||
}
|
||||
fn query_holding(
|
||||
_query_id: &u64,
|
||||
_dest: &MultiLocation,
|
||||
_assets: &MultiAssetFilter,
|
||||
_max_response_weight: &u64,
|
||||
) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::query_holding().ref_time()
|
||||
}
|
||||
fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::buy_execution().ref_time()
|
||||
}
|
||||
fn refund_surplus() -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::refund_surplus().ref_time()
|
||||
}
|
||||
fn set_error_handler(_xcm: &Xcm<Call>) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::set_error_handler().ref_time()
|
||||
}
|
||||
fn set_appendix(_xcm: &Xcm<Call>) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::set_appendix().ref_time()
|
||||
}
|
||||
fn clear_error() -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::clear_error().ref_time()
|
||||
}
|
||||
fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::claim_asset().ref_time()
|
||||
}
|
||||
fn trap(_code: &u64) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::trap().ref_time()
|
||||
}
|
||||
fn subscribe_version(_query_id: &QueryId, _max_response_weight: &u64) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::subscribe_version().ref_time()
|
||||
}
|
||||
fn unsubscribe_version() -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::unsubscribe_version().ref_time()
|
||||
}
|
||||
}
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
// Copyright 2022 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus 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.
|
||||
|
||||
// Cumulus 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 Cumulus. 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-08-25, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// /home/benchbot/cargo_target_dir/production/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --pallet=pallet_xcm_benchmarks::fungible
|
||||
// --chain=statemint-dev
|
||||
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json
|
||||
// --header=./file_header.txt
|
||||
// --template=./templates/xcm-bench-template.hbs
|
||||
// --output=./parachains/runtimes/assets/statemint/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::{RefTimeWeight, 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 {
|
||||
Weight::from_ref_time(34_002_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
|
||||
}
|
||||
// Storage: System Account (r:2 w:2)
|
||||
pub(crate) fn transfer_asset() -> Weight {
|
||||
Weight::from_ref_time(38_285_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
|
||||
}
|
||||
// Storage: System Account (r:2 w:2)
|
||||
// Storage: ParachainInfo ParachainId (r:1 w:0)
|
||||
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
|
||||
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
|
||||
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
|
||||
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
|
||||
pub(crate) fn transfer_reserve_asset() -> Weight {
|
||||
Weight::from_ref_time(55_068_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(8 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
|
||||
}
|
||||
pub(crate) fn receive_teleported_asset() -> Weight {
|
||||
Weight::from_ref_time(7_796_000 as RefTimeWeight)
|
||||
}
|
||||
// Storage: System Account (r:1 w:1)
|
||||
pub(crate) fn deposit_asset() -> Weight {
|
||||
Weight::from_ref_time(35_092_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
|
||||
}
|
||||
// Storage: System Account (r:1 w:1)
|
||||
// Storage: ParachainInfo ParachainId (r:1 w:0)
|
||||
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
|
||||
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
|
||||
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
|
||||
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
|
||||
pub(crate) fn deposit_reserve_asset() -> Weight {
|
||||
Weight::from_ref_time(50_590_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(7 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
|
||||
}
|
||||
// Storage: ParachainInfo ParachainId (r:1 w:0)
|
||||
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
|
||||
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
|
||||
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
|
||||
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
|
||||
pub(crate) fn initiate_teleport() -> Weight {
|
||||
Weight::from_ref_time(27_220_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
|
||||
}
|
||||
}
|
||||
+138
@@ -0,0 +1,138 @@
|
||||
// Copyright 2022 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus 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.
|
||||
|
||||
// Cumulus 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 Cumulus. 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-08-25, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// /home/benchbot/cargo_target_dir/production/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --pallet=pallet_xcm_benchmarks::generic
|
||||
// --chain=statemint-dev
|
||||
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json
|
||||
// --header=./file_header.txt
|
||||
// --template=./templates/xcm-bench-template.hbs
|
||||
// --output=./parachains/runtimes/assets/statemint/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::{RefTimeWeight, 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: ParachainInfo ParachainId (r:1 w:0)
|
||||
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
|
||||
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
|
||||
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
|
||||
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
|
||||
pub(crate) fn query_holding() -> Weight {
|
||||
Weight::from_ref_time(682_639_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
|
||||
}
|
||||
pub(crate) fn buy_execution() -> Weight {
|
||||
Weight::from_ref_time(9_272_000 as RefTimeWeight)
|
||||
}
|
||||
// Storage: PolkadotXcm Queries (r:1 w:0)
|
||||
pub(crate) fn query_response() -> Weight {
|
||||
Weight::from_ref_time(17_084_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
|
||||
}
|
||||
pub(crate) fn transact() -> Weight {
|
||||
Weight::from_ref_time(20_265_000 as RefTimeWeight)
|
||||
}
|
||||
pub(crate) fn refund_surplus() -> Weight {
|
||||
Weight::from_ref_time(9_422_000 as RefTimeWeight)
|
||||
}
|
||||
pub(crate) fn set_error_handler() -> Weight {
|
||||
Weight::from_ref_time(5_545_000 as RefTimeWeight)
|
||||
}
|
||||
pub(crate) fn set_appendix() -> Weight {
|
||||
Weight::from_ref_time(5_450_000 as RefTimeWeight)
|
||||
}
|
||||
pub(crate) fn clear_error() -> Weight {
|
||||
Weight::from_ref_time(5_519_000 as RefTimeWeight)
|
||||
}
|
||||
pub(crate) fn descend_origin() -> Weight {
|
||||
Weight::from_ref_time(6_398_000 as RefTimeWeight)
|
||||
}
|
||||
pub(crate) fn clear_origin() -> Weight {
|
||||
Weight::from_ref_time(5_498_000 as RefTimeWeight)
|
||||
}
|
||||
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
|
||||
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
|
||||
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
|
||||
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
|
||||
pub(crate) fn report_error() -> Weight {
|
||||
Weight::from_ref_time(15_784_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(5 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
|
||||
}
|
||||
// Storage: PolkadotXcm AssetTraps (r:1 w:1)
|
||||
pub(crate) fn claim_asset() -> Weight {
|
||||
Weight::from_ref_time(11_861_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
|
||||
}
|
||||
pub(crate) fn trap() -> Weight {
|
||||
Weight::from_ref_time(5_462_000 as RefTimeWeight)
|
||||
}
|
||||
// Storage: PolkadotXcm VersionNotifyTargets (r:1 w:1)
|
||||
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
|
||||
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
|
||||
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
|
||||
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
|
||||
pub(crate) fn subscribe_version() -> Weight {
|
||||
Weight::from_ref_time(18_997_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
|
||||
}
|
||||
// Storage: PolkadotXcm VersionNotifyTargets (r:0 w:1)
|
||||
pub(crate) fn unsubscribe_version() -> Weight {
|
||||
Weight::from_ref_time(8_684_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
|
||||
}
|
||||
// Storage: ParachainInfo ParachainId (r:1 w:0)
|
||||
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
|
||||
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
|
||||
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
|
||||
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
|
||||
pub(crate) fn initiate_reserve_withdraw() -> Weight {
|
||||
Weight::from_ref_time(883_121_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
|
||||
}
|
||||
}
|
||||
@@ -31,11 +31,11 @@ use xcm::latest::prelude::*;
|
||||
use xcm_builder::{
|
||||
AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom,
|
||||
AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, AsPrefixedGeneralIndex,
|
||||
ConvertedConcreteAssetId, CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds,
|
||||
FungiblesAdapter, IsConcrete, LocationInverter, NativeAsset, ParentAsSuperuser, ParentIsPreset,
|
||||
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
|
||||
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
|
||||
UsingComponents,
|
||||
ConvertedConcreteAssetId, CurrencyAdapter, EnsureXcmOrigin, FungiblesAdapter, IsConcrete,
|
||||
LocationInverter, NativeAsset, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
|
||||
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
|
||||
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
|
||||
WeightInfoBounds,
|
||||
};
|
||||
use xcm_executor::{traits::JustTry, XcmExecutor};
|
||||
|
||||
@@ -125,8 +125,6 @@ pub type XcmOriginToTransactDispatchOrigin = (
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
// One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate.
|
||||
pub UnitWeightCost: u64 = 1_000_000_000;
|
||||
pub const MaxInstructions: u32 = 100;
|
||||
pub XcmAssetFeesReceiver: Option<AccountId> = Authorship::author();
|
||||
}
|
||||
@@ -169,7 +167,8 @@ impl xcm_executor::Config for XcmConfig {
|
||||
type IsTeleporter = NativeAsset; // <- should be enough to allow teleportation of DOT
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
type Barrier = Barrier;
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
||||
type Weigher =
|
||||
WeightInfoBounds<crate::weights::xcm::StatemintXcmWeight<Call>, Call, MaxInstructions>;
|
||||
type Trader =
|
||||
UsingComponents<WeightToFee, DotLocation, AccountId, Balances, ToStakingPot<Runtime>>;
|
||||
type ResponseHandler = PolkadotXcm;
|
||||
@@ -203,7 +202,8 @@ impl pallet_xcm::Config for Runtime {
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type XcmTeleportFilter = Everything;
|
||||
type XcmReserveTransferFilter = Everything;
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
||||
type Weigher =
|
||||
WeightInfoBounds<crate::weights::xcm::StatemintXcmWeight<Call>, Call, MaxInstructions>;
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
type Origin = Origin;
|
||||
type Call = Call;
|
||||
|
||||
@@ -71,6 +71,7 @@ cumulus-primitives-utility = { path = "../../../../primitives/utility", default-
|
||||
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
|
||||
parachain-info = { path = "../../../pallets/parachain-info", default-features = false }
|
||||
parachains-common = { path = "../../../common", default-features = false }
|
||||
pallet-xcm-benchmarks = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
hex-literal = "0.3.4"
|
||||
@@ -100,6 +101,7 @@ runtime-benchmarks = [
|
||||
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
|
||||
"pallet-collator-selection/runtime-benchmarks",
|
||||
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
|
||||
"pallet-xcm-benchmarks",
|
||||
]
|
||||
try-runtime = [
|
||||
"frame-executive/try-runtime",
|
||||
|
||||
@@ -628,6 +628,10 @@ mod benches {
|
||||
[pallet_timestamp, Timestamp]
|
||||
[pallet_collator_selection, CollatorSelection]
|
||||
[cumulus_pallet_xcmp_queue, XcmpQueue]
|
||||
// XCM
|
||||
// NOTE: Make sure you point to the individual modules below.
|
||||
[pallet_xcm_benchmarks::fungible, XcmBalances]
|
||||
[pallet_xcm_benchmarks::generic, XcmGeneric]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -779,6 +783,12 @@ impl_runtime_apis! {
|
||||
use frame_system_benchmarking::Pallet as SystemBench;
|
||||
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
|
||||
|
||||
// This is defined once again in dispatch_benchmark, because list_benchmarks!
|
||||
// and add_benchmarks! are macros exported by define_benchmarks! macros and those types
|
||||
// are referenced in that call.
|
||||
type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
|
||||
type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;
|
||||
|
||||
let mut list = Vec::<BenchmarkList>::new();
|
||||
list_benchmarks!(list, extra);
|
||||
|
||||
@@ -789,7 +799,7 @@ impl_runtime_apis! {
|
||||
fn dispatch_benchmark(
|
||||
config: frame_benchmarking::BenchmarkConfig
|
||||
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey};
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey, BenchmarkError};
|
||||
|
||||
use frame_system_benchmarking::Pallet as SystemBench;
|
||||
impl frame_system_benchmarking::Config for Runtime {}
|
||||
@@ -797,6 +807,95 @@ impl_runtime_apis! {
|
||||
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
|
||||
impl cumulus_pallet_session_benchmarking::Config for Runtime {}
|
||||
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_config::WestendLocation;
|
||||
use pallet_xcm_benchmarks::asset_instance_from;
|
||||
|
||||
impl pallet_xcm_benchmarks::Config for Runtime {
|
||||
type XcmConfig = xcm_config::XcmConfig;
|
||||
type AccountIdConverter = xcm_config::LocationToAccountId;
|
||||
fn valid_destination() -> Result<MultiLocation, BenchmarkError> {
|
||||
Ok(WestendLocation::get())
|
||||
}
|
||||
fn worst_case_holding() -> MultiAssets {
|
||||
// A mix of fungible, non-fungible, and concrete assets.
|
||||
const HOLDING_FUNGIBLES: u32 = 100;
|
||||
const HOLDING_NON_FUNGIBLES: u32 = 100;
|
||||
let fungibles_amount: u128 = 100;
|
||||
let mut assets = (0..HOLDING_FUNGIBLES)
|
||||
.map(|i| {
|
||||
MultiAsset {
|
||||
id: Concrete(GeneralIndex(i as u128).into()),
|
||||
fun: Fungible(fungibles_amount * i as u128),
|
||||
}
|
||||
.into()
|
||||
})
|
||||
.chain(core::iter::once(MultiAsset { id: Concrete(Here.into()), fun: Fungible(u128::MAX) }))
|
||||
.chain((0..HOLDING_NON_FUNGIBLES).map(|i| MultiAsset {
|
||||
id: Concrete(GeneralIndex(i as u128).into()),
|
||||
fun: NonFungible(asset_instance_from(i)),
|
||||
}))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
assets.push(MultiAsset{
|
||||
id: Concrete(WestendLocation::get()),
|
||||
fun: Fungible(1_000_000 * UNITS),
|
||||
});
|
||||
assets.into()
|
||||
}
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
|
||||
WestendLocation::get(),
|
||||
MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(WestendLocation::get()) },
|
||||
));
|
||||
pub const TrustedReserve: Option<(MultiLocation, MultiAsset)> = None;
|
||||
pub const CheckedAccount: Option<AccountId> = None;
|
||||
|
||||
}
|
||||
|
||||
impl pallet_xcm_benchmarks::fungible::Config for Runtime {
|
||||
type TransactAsset = Balances;
|
||||
|
||||
type CheckedAccount = CheckedAccount;
|
||||
type TrustedTeleporter = TrustedTeleporter;
|
||||
type TrustedReserve = TrustedReserve;
|
||||
|
||||
fn get_multi_asset() -> MultiAsset {
|
||||
MultiAsset {
|
||||
id: Concrete(WestendLocation::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(WestendLocation::get())
|
||||
}
|
||||
|
||||
fn subscribe_origin() -> Result<MultiLocation, BenchmarkError> {
|
||||
Ok(WestendLocation::get())
|
||||
}
|
||||
|
||||
fn claimable_asset() -> Result<(MultiLocation, MultiLocation, MultiAssets), BenchmarkError> {
|
||||
let origin = WestendLocation::get();
|
||||
let assets: MultiAssets = (Concrete(WestendLocation::get()), 1_000 * UNITS).into();
|
||||
let ticket = MultiLocation { parents: 0, interior: Here };
|
||||
Ok((origin, ticket, assets))
|
||||
}
|
||||
}
|
||||
|
||||
type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
|
||||
type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;
|
||||
|
||||
let whitelist: Vec<TrackedStorageKey> = vec![
|
||||
// Block Number
|
||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),
|
||||
@@ -808,13 +907,14 @@ impl_runtime_apis! {
|
||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),
|
||||
// System Events
|
||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),
|
||||
//TODO: use from relay_well_known_keys::ACTIVE_CONFIG
|
||||
hex_literal::hex!("06de3d8a54d27e44a9d5ce189618f22db4b49d95320d9021994c850f25b8e385").to_vec().into(),
|
||||
];
|
||||
|
||||
let mut batches = Vec::<BenchmarkBatch>::new();
|
||||
let params = (&config, &whitelist);
|
||||
add_benchmarks!(params, batches);
|
||||
|
||||
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
||||
Ok(batches)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ pub mod pallet_uniques;
|
||||
pub mod pallet_utility;
|
||||
pub mod paritydb_weights;
|
||||
pub mod rocksdb_weights;
|
||||
pub mod xcm;
|
||||
|
||||
pub use block_weights::constants::BlockExecutionWeight;
|
||||
pub use extrinsic_weights::constants::ExtrinsicBaseWeight;
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
// Copyright 2022 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus 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.
|
||||
|
||||
// Cumulus 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 Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
mod pallet_xcm_benchmarks_fungible;
|
||||
mod pallet_xcm_benchmarks_generic;
|
||||
|
||||
use crate::Runtime;
|
||||
use frame_support::weights::Weight;
|
||||
use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight;
|
||||
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
|
||||
use sp_std::prelude::*;
|
||||
use xcm::{
|
||||
latest::{prelude::*, Weight as XCMWeight},
|
||||
DoubleEncoded,
|
||||
};
|
||||
|
||||
trait WeighMultiAssets {
|
||||
fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight;
|
||||
}
|
||||
|
||||
const MAX_ASSETS: u32 = 100;
|
||||
|
||||
impl WeighMultiAssets for MultiAssetFilter {
|
||||
fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight {
|
||||
let weight = match self {
|
||||
Self::Definite(assets) =>
|
||||
weight.scalar_saturating_mul(assets.inner().into_iter().count() as u64),
|
||||
Self::Wild(_) => weight.scalar_saturating_mul(MAX_ASSETS as u64),
|
||||
};
|
||||
weight.ref_time()
|
||||
}
|
||||
}
|
||||
|
||||
impl WeighMultiAssets for MultiAssets {
|
||||
fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight {
|
||||
weight.scalar_saturating_mul(self.inner().into_iter().count() as u64).ref_time()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct WestmintXcmWeight<Call>(core::marker::PhantomData<Call>);
|
||||
impl<Call> XcmWeightInfo<Call> for WestmintXcmWeight<Call> {
|
||||
fn withdraw_asset(assets: &MultiAssets) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::withdraw_asset())
|
||||
}
|
||||
// Currently there is no trusted reserve
|
||||
fn reserve_asset_deposited(_assets: &MultiAssets) -> XCMWeight {
|
||||
unimplemented!()
|
||||
}
|
||||
fn receive_teleported_asset(assets: &MultiAssets) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::receive_teleported_asset())
|
||||
}
|
||||
fn query_response(_query_id: &u64, _response: &Response, _max_weight: &u64) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::query_response().ref_time()
|
||||
}
|
||||
fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::transfer_asset())
|
||||
}
|
||||
fn transfer_reserve_asset(
|
||||
assets: &MultiAssets,
|
||||
_dest: &MultiLocation,
|
||||
_xcm: &Xcm<()>,
|
||||
) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::transfer_reserve_asset())
|
||||
}
|
||||
fn transact(
|
||||
_origin_type: &OriginKind,
|
||||
_require_weight_at_most: &u64,
|
||||
_call: &DoubleEncoded<Call>,
|
||||
) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::transact().ref_time()
|
||||
}
|
||||
fn hrmp_new_channel_open_request(
|
||||
_sender: &u32,
|
||||
_max_message_size: &u32,
|
||||
_max_capacity: &u32,
|
||||
) -> XCMWeight {
|
||||
// XCM Executor does not currently support HRMP channel operations
|
||||
Weight::MAX.ref_time()
|
||||
}
|
||||
fn hrmp_channel_accepted(_recipient: &u32) -> XCMWeight {
|
||||
// XCM Executor does not currently support HRMP channel operations
|
||||
Weight::MAX.ref_time()
|
||||
}
|
||||
fn hrmp_channel_closing(_initiator: &u32, _sender: &u32, _recipient: &u32) -> XCMWeight {
|
||||
// XCM Executor does not currently support HRMP channel operations
|
||||
Weight::MAX.ref_time()
|
||||
}
|
||||
fn clear_origin() -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::clear_origin().ref_time()
|
||||
}
|
||||
fn descend_origin(_who: &InteriorMultiLocation) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::descend_origin().ref_time()
|
||||
}
|
||||
fn report_error(
|
||||
_query_id: &QueryId,
|
||||
_dest: &MultiLocation,
|
||||
_max_response_weight: &u64,
|
||||
) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::report_error().ref_time()
|
||||
}
|
||||
|
||||
fn deposit_asset(
|
||||
assets: &MultiAssetFilter,
|
||||
_max_assets: &u32,
|
||||
_dest: &MultiLocation,
|
||||
) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset())
|
||||
}
|
||||
fn deposit_reserve_asset(
|
||||
assets: &MultiAssetFilter,
|
||||
_max_assets: &u32,
|
||||
_dest: &MultiLocation,
|
||||
_xcm: &Xcm<()>,
|
||||
) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_reserve_asset())
|
||||
}
|
||||
fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets) -> XCMWeight {
|
||||
Weight::MAX.ref_time()
|
||||
}
|
||||
fn initiate_reserve_withdraw(
|
||||
assets: &MultiAssetFilter,
|
||||
_reserve: &MultiLocation,
|
||||
_xcm: &Xcm<()>,
|
||||
) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmGeneric::<Runtime>::initiate_reserve_withdraw())
|
||||
}
|
||||
fn initiate_teleport(
|
||||
assets: &MultiAssetFilter,
|
||||
_dest: &MultiLocation,
|
||||
_xcm: &Xcm<()>,
|
||||
) -> XCMWeight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::initiate_teleport())
|
||||
}
|
||||
fn query_holding(
|
||||
_query_id: &u64,
|
||||
_dest: &MultiLocation,
|
||||
_assets: &MultiAssetFilter,
|
||||
_max_response_weight: &u64,
|
||||
) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::query_holding().ref_time()
|
||||
}
|
||||
fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::buy_execution().ref_time()
|
||||
}
|
||||
fn refund_surplus() -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::refund_surplus().ref_time()
|
||||
}
|
||||
fn set_error_handler(_xcm: &Xcm<Call>) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::set_error_handler().ref_time()
|
||||
}
|
||||
fn set_appendix(_xcm: &Xcm<Call>) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::set_appendix().ref_time()
|
||||
}
|
||||
fn clear_error() -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::clear_error().ref_time()
|
||||
}
|
||||
fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::claim_asset().ref_time()
|
||||
}
|
||||
fn trap(_code: &u64) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::trap().ref_time()
|
||||
}
|
||||
fn subscribe_version(_query_id: &QueryId, _max_response_weight: &u64) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::subscribe_version().ref_time()
|
||||
}
|
||||
fn unsubscribe_version() -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::unsubscribe_version().ref_time()
|
||||
}
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
// Copyright 2022 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus 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.
|
||||
|
||||
// Cumulus 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 Cumulus. 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-08-17, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// /home/benchbot/cargo_target_dir/production/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --pallet=pallet_xcm_benchmarks::fungible
|
||||
// --chain=westmint-dev
|
||||
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json
|
||||
// --header=./file_header.txt
|
||||
// --template=./templates/xcm-bench-template.hbs
|
||||
// --output=./parachains/runtimes/assets/westmint/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::{RefTimeWeight, 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 {
|
||||
Weight::from_ref_time(28_725_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
|
||||
}
|
||||
// Storage: System Account (r:2 w:2)
|
||||
pub(crate) fn transfer_asset() -> Weight {
|
||||
Weight::from_ref_time(33_865_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
|
||||
}
|
||||
// Storage: System Account (r:2 w:2)
|
||||
// Storage: ParachainInfo ParachainId (r:1 w:0)
|
||||
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
|
||||
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
|
||||
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
|
||||
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
|
||||
pub(crate) fn transfer_reserve_asset() -> Weight {
|
||||
Weight::from_ref_time(48_839_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(8 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
|
||||
}
|
||||
pub(crate) fn receive_teleported_asset() -> Weight {
|
||||
Weight::from_ref_time(4_849_000 as RefTimeWeight)
|
||||
}
|
||||
// Storage: System Account (r:1 w:1)
|
||||
pub(crate) fn deposit_asset() -> Weight {
|
||||
Weight::from_ref_time(29_778_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
|
||||
}
|
||||
// Storage: System Account (r:1 w:1)
|
||||
// Storage: ParachainInfo ParachainId (r:1 w:0)
|
||||
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
|
||||
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
|
||||
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
|
||||
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
|
||||
pub(crate) fn deposit_reserve_asset() -> Weight {
|
||||
Weight::from_ref_time(45_355_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(7 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
|
||||
}
|
||||
// Storage: ParachainInfo ParachainId (r:1 w:0)
|
||||
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
|
||||
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
|
||||
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
|
||||
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
|
||||
pub(crate) fn initiate_teleport() -> Weight {
|
||||
Weight::from_ref_time(23_451_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
|
||||
}
|
||||
}
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
// Copyright 2022 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus 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.
|
||||
|
||||
// Cumulus 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 Cumulus. 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-08-17, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// /home/benchbot/cargo_target_dir/production/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --pallet=pallet_xcm_benchmarks::generic
|
||||
// --chain=westmint-dev
|
||||
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json
|
||||
// --header=./file_header.txt
|
||||
// --template=./templates/xcm-bench-template.hbs
|
||||
// --output=./parachains/runtimes/assets/westmint/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::{RefTimeWeight, 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: ParachainInfo ParachainId (r:1 w:0)
|
||||
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
|
||||
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
|
||||
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
|
||||
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
|
||||
pub(crate) fn query_holding() -> Weight {
|
||||
Weight::from_ref_time(676_316_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
|
||||
}
|
||||
pub(crate) fn buy_execution() -> Weight {
|
||||
Weight::from_ref_time(7_030_000 as RefTimeWeight)
|
||||
}
|
||||
// Storage: PolkadotXcm Queries (r:1 w:0)
|
||||
pub(crate) fn query_response() -> Weight {
|
||||
Weight::from_ref_time(12_574_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
|
||||
}
|
||||
pub(crate) fn transact() -> Weight {
|
||||
Weight::from_ref_time(15_764_000 as RefTimeWeight)
|
||||
}
|
||||
pub(crate) fn refund_surplus() -> Weight {
|
||||
Weight::from_ref_time(7_200_000 as RefTimeWeight)
|
||||
}
|
||||
pub(crate) fn set_error_handler() -> Weight {
|
||||
Weight::from_ref_time(3_310_000 as RefTimeWeight)
|
||||
}
|
||||
pub(crate) fn set_appendix() -> Weight {
|
||||
Weight::from_ref_time(3_260_000 as RefTimeWeight)
|
||||
}
|
||||
pub(crate) fn clear_error() -> Weight {
|
||||
Weight::from_ref_time(3_277_000 as RefTimeWeight)
|
||||
}
|
||||
pub(crate) fn descend_origin() -> Weight {
|
||||
Weight::from_ref_time(3_913_000 as RefTimeWeight)
|
||||
}
|
||||
pub(crate) fn clear_origin() -> Weight {
|
||||
Weight::from_ref_time(3_354_000 as RefTimeWeight)
|
||||
}
|
||||
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
|
||||
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
|
||||
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
|
||||
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
|
||||
pub(crate) fn report_error() -> Weight {
|
||||
Weight::from_ref_time(13_028_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(5 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
|
||||
}
|
||||
// Storage: PolkadotXcm AssetTraps (r:1 w:1)
|
||||
pub(crate) fn claim_asset() -> Weight {
|
||||
Weight::from_ref_time(7_739_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
|
||||
}
|
||||
pub(crate) fn trap() -> Weight {
|
||||
Weight::from_ref_time(3_351_000 as RefTimeWeight)
|
||||
}
|
||||
// Storage: PolkadotXcm VersionNotifyTargets (r:1 w:1)
|
||||
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
|
||||
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
|
||||
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
|
||||
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
|
||||
pub(crate) fn subscribe_version() -> Weight {
|
||||
Weight::from_ref_time(16_051_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
|
||||
}
|
||||
// Storage: PolkadotXcm VersionNotifyTargets (r:0 w:1)
|
||||
pub(crate) fn unsubscribe_version() -> Weight {
|
||||
Weight::from_ref_time(5_477_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
|
||||
}
|
||||
// Storage: ParachainInfo ParachainId (r:1 w:0)
|
||||
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
|
||||
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
|
||||
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
|
||||
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
|
||||
pub(crate) fn initiate_reserve_withdraw() -> Weight {
|
||||
Weight::from_ref_time(874_435_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
|
||||
}
|
||||
}
|
||||
@@ -34,11 +34,11 @@ use xcm::latest::prelude::*;
|
||||
use xcm_builder::{
|
||||
AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom,
|
||||
AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, AsPrefixedGeneralIndex,
|
||||
ConvertedConcreteAssetId, CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds,
|
||||
FungiblesAdapter, IsConcrete, LocationInverter, NativeAsset, ParentAsSuperuser, ParentIsPreset,
|
||||
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
|
||||
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
|
||||
UsingComponents,
|
||||
ConvertedConcreteAssetId, CurrencyAdapter, EnsureXcmOrigin, FungiblesAdapter, IsConcrete,
|
||||
LocationInverter, NativeAsset, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
|
||||
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
|
||||
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
|
||||
WeightInfoBounds,
|
||||
};
|
||||
use xcm_executor::{traits::JustTry, XcmExecutor};
|
||||
|
||||
@@ -129,8 +129,6 @@ pub type XcmOriginToTransactDispatchOrigin = (
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
// One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate.
|
||||
pub UnitWeightCost: u64 = 1_000_000_000;
|
||||
pub const MaxInstructions: u32 = 100;
|
||||
pub XcmAssetFeesReceiver: Option<AccountId> = Authorship::author();
|
||||
}
|
||||
@@ -169,7 +167,8 @@ impl xcm_executor::Config for XcmConfig {
|
||||
type IsTeleporter = NativeAsset; // <- should be enough to allow teleportation of WND
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
type Barrier = Barrier;
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
||||
type Weigher =
|
||||
WeightInfoBounds<crate::weights::xcm::WestmintXcmWeight<Call>, Call, MaxInstructions>;
|
||||
type Trader = (
|
||||
UsingComponents<WeightToFee, WestendLocation, AccountId, Balances, ToStakingPot<Runtime>>,
|
||||
cumulus_primitives_utility::TakeFirstAssetTrader<
|
||||
@@ -220,7 +219,8 @@ impl pallet_xcm::Config for Runtime {
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type XcmTeleportFilter = Everything;
|
||||
type XcmReserveTransferFilter = Everything;
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
||||
type Weigher =
|
||||
WeightInfoBounds<crate::weights::xcm::WestmintXcmWeight<Call>, Call, MaxInstructions>;
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
type Origin = Origin;
|
||||
type Call = Call;
|
||||
|
||||
@@ -22,6 +22,8 @@ if [[ $runtimeName == "statemint" ]] || [[ $runtimeName == "statemine" ]] || [[
|
||||
pallet_uniques
|
||||
cumulus_pallet_xcmp_queue
|
||||
frame_system
|
||||
pallet_xcm_benchmarks::generic
|
||||
pallet_xcm_benchmarks::fungible
|
||||
)
|
||||
elif [[ $runtimeName == "collectives-polkadot" ]]; then
|
||||
pallets=(
|
||||
@@ -44,6 +46,11 @@ fi
|
||||
|
||||
for pallet in ${pallets[@]}
|
||||
do
|
||||
# a little hack for xcm benchmarks
|
||||
output_file="${pallet//::/_}"
|
||||
if [[ "$pallet" == *"xcm"* ]]; then
|
||||
output_file="xcm/$output_file"
|
||||
fi
|
||||
$artifactsDir/polkadot-parachain benchmark pallet \
|
||||
--chain=$benchmarkRuntimeName \
|
||||
--execution=wasm \
|
||||
@@ -53,7 +60,6 @@ do
|
||||
--steps=$steps \
|
||||
--repeat=$repeat \
|
||||
--json \
|
||||
--header=./file_header.txt \
|
||||
--output=$benchmarkOutput >> $artifactsDir/${pallet}_benchmark.json
|
||||
|
||||
--header=./file_header.txt \
|
||||
--output="${benchmarkOutput}/${output_file}.rs" >> $artifactsDir/${pallet}_benchmark.json
|
||||
done
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
// Copyright 2022 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus 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.
|
||||
|
||||
// Cumulus 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 Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
//! Autogenerated weights for `{{pallet}}`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION {{version}}
|
||||
//! DATE: {{date}}, STEPS: `{{cmd.steps}}`, REPEAT: {{cmd.repeat}}, LOW RANGE: `{{cmd.lowest_range_values}}`, HIGH RANGE: `{{cmd.highest_range_values}}`
|
||||
//! HOSTNAME: `{{hostname}}`, CPU: `{{cpuname}}`
|
||||
//! EXECUTION: {{cmd.execution}}, WASM-EXECUTION: {{cmd.wasm_execution}}, CHAIN: {{cmd.chain}}, DB CACHE: {{cmd.db_cache}}
|
||||
|
||||
// Executed Command:
|
||||
{{#each args as |arg|}}
|
||||
// {{arg}}
|
||||
{{/each}}
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight}};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weights for `{{pallet}}`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> WeightInfo<T> {
|
||||
{{#each benchmarks as |benchmark|}}
|
||||
{{#each benchmark.comments as |comment|}}
|
||||
// {{comment}}
|
||||
{{/each}}
|
||||
pub(crate) fn {{benchmark.name~}}
|
||||
(
|
||||
{{~#each benchmark.components as |c| ~}}
|
||||
{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
|
||||
) -> Weight {
|
||||
Weight::from_ref_time({{underscore benchmark.base_weight}} as RefTimeWeight)
|
||||
{{#each benchmark.component_weight as |cw|}}
|
||||
// Standard Error: {{underscore cw.error}}
|
||||
.saturating_add(Weight::from_ref_time({{underscore cw.slope}}).scalar_saturating_mul({{cw.name}} as RefTimeWeight))
|
||||
{{/each}}
|
||||
{{#if (ne benchmark.base_reads "0")}}
|
||||
.saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}} as RefTimeWeight))
|
||||
{{/if}}
|
||||
{{#each benchmark.component_reads as |cr|}}
|
||||
.saturating_add(T::DbWeight::get().reads(({{cr.slope}} as RefTimeWeight).scalar_saturating_mul({{cr.name}} as RefTimeWeight)))
|
||||
{{/each}}
|
||||
{{#if (ne benchmark.base_writes "0")}}
|
||||
.saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}} as RefTimeWeight))
|
||||
{{/if}}
|
||||
{{#each benchmark.component_writes as |cw|}}
|
||||
.saturating_add(T::DbWeight::get().writes(({{cw.slope}} as RefTimeWeight).scalar_saturating_mul({{cw.name}} as RefTimeWeight)))
|
||||
{{/each}}
|
||||
}
|
||||
{{/each}}
|
||||
}
|
||||
Reference in New Issue
Block a user