mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 04:28:01 +00:00
Bridge hub kusama fine-tuning before release (#1999)
* Fix benchmarks-ci.sh - missing pallet_utility/pallet_multisig * Missing ParentAsSuperuser for bridge-hubs * Fixed missing stuff in benchmarks.yml * Added MigrateToTrackInactive + CheckingAccount (for completness as other runtimes) * Measured xcm weights for bridge-hubs * Fix for fungible benchmarks * ".git/.scripts/bench-bot.sh" xcm bridge-hub-kusama bridge-hubs pallet_xcm_benchmarks::fungible * ".git/.scripts/bench-bot.sh" xcm bridge-hub-rococo bridge-hubs pallet_xcm_benchmarks::generic * ".git/.scripts/bench-bot.sh" xcm bridge-hub-rococo bridge-hubs pallet_xcm_benchmarks::fungible * ".git/.scripts/bench-bot.sh" xcm bridge-hub-kusama bridge-hubs pallet_xcm_benchmarks::generic * Reverting migrations - no need for them * script for generate genesis spec/head/wasm * Adding invulnerables and session.keys to the script (https://github.com/paritytech/devops/issues/2196) * update chainspec with cmd: ./scripts/create_bridge_hub_kusama_spec.sh ./target/release/wbuild/bridge-hub-kusama-runtime/bridge_hub_kusama_runtime.compact.compressed.wasm 1003 * para_id 1003 -> 1002, cmd: ./scripts/create_bridge_hub_kusama_spec.sh ./target/release/wbuild/bridge-hub-kusama-runtime/bridge_hub_kusama_runtime.compact.compressed.wasm 1002 Co-authored-by: command-bot <>
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -20,6 +20,7 @@ pub mod currency {
|
||||
/// The existential deposit. Set to 1/10 of its parent Relay Chain.
|
||||
pub const EXISTENTIAL_DEPOSIT: Balance = constants::currency::EXISTENTIAL_DEPOSIT / 10;
|
||||
|
||||
pub const UNITS: Balance = constants::currency::UNITS;
|
||||
pub const CENTS: Balance = constants::currency::CENTS;
|
||||
pub const MILLICENTS: Balance = constants::currency::MILLICENTS;
|
||||
|
||||
|
||||
@@ -439,6 +439,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]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -579,6 +583,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);
|
||||
|
||||
@@ -589,7 +599,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, BenchmarkError, TrackedStorageKey};
|
||||
|
||||
use frame_system_benchmarking::Pallet as SystemBench;
|
||||
impl frame_system_benchmarking::Config for Runtime {}
|
||||
@@ -597,6 +607,77 @@ 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::KsmRelayLocation;
|
||||
|
||||
impl pallet_xcm_benchmarks::Config for Runtime {
|
||||
type XcmConfig = xcm_config::XcmConfig;
|
||||
type AccountIdConverter = xcm_config::LocationToAccountId;
|
||||
fn valid_destination() -> Result<MultiLocation, BenchmarkError> {
|
||||
Ok(KsmRelayLocation::get())
|
||||
}
|
||||
fn worst_case_holding() -> MultiAssets {
|
||||
// just concrete assets according to relay chain.
|
||||
let assets: Vec<MultiAsset> = vec![
|
||||
MultiAsset {
|
||||
id: Concrete(KsmRelayLocation::get()),
|
||||
fun: Fungible(1_000_000 * UNITS),
|
||||
}
|
||||
];
|
||||
assets.into()
|
||||
}
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
|
||||
KsmRelayLocation::get(),
|
||||
MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(KsmRelayLocation::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(KsmRelayLocation::get()),
|
||||
fun: Fungible(1 * UNITS),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_xcm_benchmarks::generic::Config for Runtime {
|
||||
type RuntimeCall = RuntimeCall;
|
||||
|
||||
fn worst_case_response() -> (u64, Response) {
|
||||
(0u64, Response::Version(Default::default()))
|
||||
}
|
||||
|
||||
fn transact_origin() -> Result<MultiLocation, BenchmarkError> {
|
||||
Ok(KsmRelayLocation::get())
|
||||
}
|
||||
|
||||
fn subscribe_origin() -> Result<MultiLocation, BenchmarkError> {
|
||||
Ok(KsmRelayLocation::get())
|
||||
}
|
||||
|
||||
fn claimable_asset() -> Result<(MultiLocation, MultiLocation, MultiAssets), BenchmarkError> {
|
||||
let origin = KsmRelayLocation::get();
|
||||
let assets: MultiAssets = (Concrete(KsmRelayLocation::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(),
|
||||
@@ -614,7 +695,6 @@ impl_runtime_apis! {
|
||||
let params = (&config, &whitelist);
|
||||
add_benchmarks!(params, batches);
|
||||
|
||||
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
||||
Ok(batches)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ pub mod pallet_timestamp;
|
||||
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,188 @@
|
||||
// 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::{cmp, 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.saturating_mul(assets.inner().into_iter().count() as u64),
|
||||
Self::Wild(_) => weight.saturating_mul(MAX_ASSETS as u64),
|
||||
};
|
||||
weight.ref_time()
|
||||
}
|
||||
}
|
||||
|
||||
impl WeighMultiAssets for MultiAssets {
|
||||
fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight {
|
||||
weight.saturating_mul(self.inner().into_iter().count() as u64).ref_time()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct BridgeHubKusamaXcmWeight<Call>(core::marker::PhantomData<Call>);
|
||||
impl<Call> XcmWeightInfo<Call> for BridgeHubKusamaXcmWeight<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 {
|
||||
u64::MAX
|
||||
}
|
||||
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 {
|
||||
// Hardcoded till the XCM pallet is fixed
|
||||
let hardcoded_weight = Weight::from_ref_time(1_000_000_000 as u64).ref_time();
|
||||
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset());
|
||||
cmp::min(hardcoded_weight, weight)
|
||||
}
|
||||
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 {
|
||||
// Hardcoded till the XCM pallet is fixed
|
||||
let hardcoded_weight = Weight::from_ref_time(200_000_000 as u64).ref_time();
|
||||
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::initiate_teleport());
|
||||
cmp::min(hardcoded_weight, weight)
|
||||
}
|
||||
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-12-15, 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("bridge-hub-kusama-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
|
||||
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json
|
||||
// --pallet=pallet_xcm_benchmarks::fungible
|
||||
// --chain=bridge-hub-kusama-dev
|
||||
// --header=./file_header.txt
|
||||
// --template=./templates/xcm-bench-template.hbs
|
||||
// --output=./parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weights for `pallet_xcm_benchmarks::fungible`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> WeightInfo<T> {
|
||||
// Storage: System Account (r:1 w:1)
|
||||
pub(crate) fn withdraw_asset() -> Weight {
|
||||
Weight::from_ref_time(25_434_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as u64))
|
||||
}
|
||||
// Storage: System Account (r:2 w:2)
|
||||
pub(crate) fn transfer_asset() -> Weight {
|
||||
Weight::from_ref_time(36_180_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as u64))
|
||||
}
|
||||
// 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(83_476_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(8 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as u64))
|
||||
}
|
||||
pub(crate) fn receive_teleported_asset() -> Weight {
|
||||
Weight::from_ref_time(6_009_000 as u64)
|
||||
}
|
||||
// Storage: System Account (r:1 w:1)
|
||||
pub(crate) fn deposit_asset() -> Weight {
|
||||
Weight::from_ref_time(27_729_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as u64))
|
||||
}
|
||||
// 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(44_605_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(7 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as u64))
|
||||
}
|
||||
// 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(21_605_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as u64))
|
||||
}
|
||||
}
|
||||
+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-12-15, 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("bridge-hub-kusama-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
|
||||
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json
|
||||
// --pallet=pallet_xcm_benchmarks::generic
|
||||
// --chain=bridge-hub-kusama-dev
|
||||
// --header=./file_header.txt
|
||||
// --template=./templates/xcm-bench-template.hbs
|
||||
// --output=./parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weights for `pallet_xcm_benchmarks::generic`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> WeightInfo<T> {
|
||||
// Storage: 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(21_039_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as u64))
|
||||
}
|
||||
pub(crate) fn buy_execution() -> Weight {
|
||||
Weight::from_ref_time(5_375_000 as u64)
|
||||
}
|
||||
// Storage: PolkadotXcm Queries (r:1 w:0)
|
||||
pub(crate) fn query_response() -> Weight {
|
||||
Weight::from_ref_time(16_091_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as u64))
|
||||
}
|
||||
pub(crate) fn transact() -> Weight {
|
||||
Weight::from_ref_time(19_057_000 as u64)
|
||||
}
|
||||
pub(crate) fn refund_surplus() -> Weight {
|
||||
Weight::from_ref_time(5_397_000 as u64)
|
||||
}
|
||||
pub(crate) fn set_error_handler() -> Weight {
|
||||
Weight::from_ref_time(5_347_000 as u64)
|
||||
}
|
||||
pub(crate) fn set_appendix() -> Weight {
|
||||
Weight::from_ref_time(5_346_000 as u64)
|
||||
}
|
||||
pub(crate) fn clear_error() -> Weight {
|
||||
Weight::from_ref_time(5_310_000 as u64)
|
||||
}
|
||||
pub(crate) fn descend_origin() -> Weight {
|
||||
Weight::from_ref_time(6_273_000 as u64)
|
||||
}
|
||||
pub(crate) fn clear_origin() -> Weight {
|
||||
Weight::from_ref_time(5_279_000 as u64)
|
||||
}
|
||||
// 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(14_974_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(5 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as u64))
|
||||
}
|
||||
// Storage: PolkadotXcm AssetTraps (r:1 w:1)
|
||||
pub(crate) fn claim_asset() -> Weight {
|
||||
Weight::from_ref_time(20_711_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as u64))
|
||||
}
|
||||
pub(crate) fn trap() -> Weight {
|
||||
Weight::from_ref_time(5_154_000 as u64)
|
||||
}
|
||||
// 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(17_872_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as u64))
|
||||
}
|
||||
// Storage: PolkadotXcm VersionNotifyTargets (r:0 w:1)
|
||||
pub(crate) fn unsubscribe_version() -> Weight {
|
||||
Weight::from_ref_time(7_356_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().writes(1 as u64))
|
||||
}
|
||||
// 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(22_312_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as u64))
|
||||
}
|
||||
}
|
||||
@@ -32,9 +32,10 @@ use xcm::latest::prelude::*;
|
||||
use xcm_builder::{
|
||||
AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom,
|
||||
AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin,
|
||||
FixedWeightBounds, IsConcrete, LocationInverter, ParentIsPreset, RelayChainAsNative,
|
||||
IsConcrete, LocationInverter, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
|
||||
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
|
||||
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
|
||||
WeightInfoBounds,
|
||||
};
|
||||
use xcm_executor::XcmExecutor;
|
||||
|
||||
@@ -43,6 +44,7 @@ parameter_types! {
|
||||
pub const RelayNetwork: NetworkId = NetworkId::Kusama;
|
||||
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
|
||||
pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
|
||||
pub const MaxInstructions: u32 = 100;
|
||||
}
|
||||
|
||||
/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
|
||||
@@ -85,6 +87,9 @@ pub type XcmOriginToTransactDispatchOrigin = (
|
||||
// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when
|
||||
// recognized.
|
||||
SiblingParachainAsNative<cumulus_pallet_xcm::Origin, RuntimeOrigin>,
|
||||
// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a
|
||||
// transaction from the Root origin.
|
||||
ParentAsSuperuser<RuntimeOrigin>,
|
||||
// Native signed account converter; this just converts an `AccountId32` origin into a normal
|
||||
// `Origin::Signed` origin of the same 32-byte value.
|
||||
SignedAccountId32AsNative<RelayNetwork, RuntimeOrigin>,
|
||||
@@ -92,13 +97,6 @@ pub type XcmOriginToTransactDispatchOrigin = (
|
||||
XcmPassthrough<RuntimeOrigin>,
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
// TODO: change to meassured weights - https://github.com/paritytech/parity-bridges-common/issues/391
|
||||
// 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;
|
||||
}
|
||||
|
||||
match_types! {
|
||||
// TODO: map gov2 origins here - after merge https://github.com/paritytech/cumulus/pull/1895
|
||||
pub type ParentOrParentsExecutivePlurality: impl Contains<MultiLocation> = {
|
||||
@@ -140,8 +138,11 @@ impl xcm_executor::Config for XcmConfig {
|
||||
type IsTeleporter = ConcreteNativeAssetFrom<KsmRelayLocation>;
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
type Barrier = Barrier;
|
||||
// TODO: change to meassured weights - https://github.com/paritytech/parity-bridges-common/issues/391
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
|
||||
type Weigher = WeightInfoBounds<
|
||||
crate::weights::xcm::BridgeHubKusamaXcmWeight<RuntimeCall>,
|
||||
RuntimeCall,
|
||||
MaxInstructions,
|
||||
>;
|
||||
type Trader =
|
||||
UsingComponents<WeightToFee, KsmRelayLocation, AccountId, Balances, ToAuthor<Runtime>>;
|
||||
type ResponseHandler = PolkadotXcm;
|
||||
@@ -175,9 +176,11 @@ impl pallet_xcm::Config for Runtime {
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type XcmTeleportFilter = Everything;
|
||||
type XcmReserveTransferFilter = Nothing; // This parachain is not meant as a reserve location.
|
||||
|
||||
// TODO: change to meassured weights - https://github.com/paritytech/parity-bridges-common/issues/391
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
|
||||
type Weigher = WeightInfoBounds<
|
||||
crate::weights::xcm::BridgeHubKusamaXcmWeight<RuntimeCall>,
|
||||
RuntimeCall,
|
||||
MaxInstructions,
|
||||
>;
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
|
||||
@@ -20,6 +20,7 @@ pub mod currency {
|
||||
/// The existential deposit. Set to 1/10 of its parent Relay Chain (v9010).
|
||||
pub const EXISTENTIAL_DEPOSIT: Balance = constants::currency::EXISTENTIAL_DEPOSIT / 10;
|
||||
|
||||
pub const UNITS: Balance = constants::currency::UNITS;
|
||||
pub const CENTS: Balance = constants::currency::CENTS;
|
||||
|
||||
pub const fn deposit(items: u32, bytes: u32) -> Balance {
|
||||
|
||||
@@ -164,7 +164,6 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
};
|
||||
|
||||
// Unit = the base number of indivisible units for balances
|
||||
pub const UNIT: Balance = 1_000_000_000_000;
|
||||
pub const MILLIUNIT: Balance = 1_000_000_000;
|
||||
pub const MICROUNIT: Balance = 1_000_000;
|
||||
|
||||
@@ -468,6 +467,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]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -608,6 +611,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);
|
||||
|
||||
@@ -618,7 +627,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, BenchmarkError, TrackedStorageKey};
|
||||
|
||||
use frame_system_benchmarking::Pallet as SystemBench;
|
||||
impl frame_system_benchmarking::Config for Runtime {}
|
||||
@@ -626,6 +635,77 @@ 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::RelayLocation;
|
||||
|
||||
impl pallet_xcm_benchmarks::Config for Runtime {
|
||||
type XcmConfig = xcm_config::XcmConfig;
|
||||
type AccountIdConverter = xcm_config::LocationToAccountId;
|
||||
fn valid_destination() -> Result<MultiLocation, BenchmarkError> {
|
||||
Ok(RelayLocation::get())
|
||||
}
|
||||
fn worst_case_holding() -> MultiAssets {
|
||||
// just concrete assets according to relay chain.
|
||||
let assets: Vec<MultiAsset> = vec![
|
||||
MultiAsset {
|
||||
id: Concrete(RelayLocation::get()),
|
||||
fun: Fungible(1_000_000 * UNITS),
|
||||
}
|
||||
];
|
||||
assets.into()
|
||||
}
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
|
||||
RelayLocation::get(),
|
||||
MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(RelayLocation::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(RelayLocation::get()),
|
||||
fun: Fungible(1 * UNITS),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_xcm_benchmarks::generic::Config for Runtime {
|
||||
type RuntimeCall = RuntimeCall;
|
||||
|
||||
fn worst_case_response() -> (u64, Response) {
|
||||
(0u64, Response::Version(Default::default()))
|
||||
}
|
||||
|
||||
fn transact_origin() -> Result<MultiLocation, BenchmarkError> {
|
||||
Ok(RelayLocation::get())
|
||||
}
|
||||
|
||||
fn subscribe_origin() -> Result<MultiLocation, BenchmarkError> {
|
||||
Ok(RelayLocation::get())
|
||||
}
|
||||
|
||||
fn claimable_asset() -> Result<(MultiLocation, MultiLocation, MultiAssets), BenchmarkError> {
|
||||
let origin = RelayLocation::get();
|
||||
let assets: MultiAssets = (Concrete(RelayLocation::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(),
|
||||
@@ -643,7 +723,6 @@ impl_runtime_apis! {
|
||||
let params = (&config, &whitelist);
|
||||
add_benchmarks!(params, batches);
|
||||
|
||||
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
||||
Ok(batches)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ pub mod pallet_timestamp;
|
||||
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,188 @@
|
||||
// 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::{cmp, 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.saturating_mul(assets.inner().into_iter().count() as u64),
|
||||
Self::Wild(_) => weight.saturating_mul(MAX_ASSETS as u64),
|
||||
};
|
||||
weight.ref_time()
|
||||
}
|
||||
}
|
||||
|
||||
impl WeighMultiAssets for MultiAssets {
|
||||
fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight {
|
||||
weight.saturating_mul(self.inner().into_iter().count() as u64).ref_time()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct BridgeHubRococoXcmWeight<Call>(core::marker::PhantomData<Call>);
|
||||
impl<Call> XcmWeightInfo<Call> for BridgeHubRococoXcmWeight<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 {
|
||||
u64::MAX
|
||||
}
|
||||
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 {
|
||||
// Hardcoded till the XCM pallet is fixed
|
||||
let hardcoded_weight = Weight::from_ref_time(1_000_000_000 as u64).ref_time();
|
||||
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset());
|
||||
cmp::min(hardcoded_weight, weight)
|
||||
}
|
||||
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 {
|
||||
// Hardcoded till the XCM pallet is fixed
|
||||
let hardcoded_weight = Weight::from_ref_time(200_000_000 as u64).ref_time();
|
||||
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::initiate_teleport());
|
||||
cmp::min(hardcoded_weight, weight)
|
||||
}
|
||||
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-12-15, 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("bridge-hub-rococo-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
|
||||
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json
|
||||
// --pallet=pallet_xcm_benchmarks::fungible
|
||||
// --chain=bridge-hub-rococo-dev
|
||||
// --header=./file_header.txt
|
||||
// --template=./templates/xcm-bench-template.hbs
|
||||
// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weights for `pallet_xcm_benchmarks::fungible`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> WeightInfo<T> {
|
||||
// Storage: System Account (r:1 w:1)
|
||||
pub(crate) fn withdraw_asset() -> Weight {
|
||||
Weight::from_ref_time(26_254_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as u64))
|
||||
}
|
||||
// Storage: System Account (r:2 w:2)
|
||||
pub(crate) fn transfer_asset() -> Weight {
|
||||
Weight::from_ref_time(36_415_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as u64))
|
||||
}
|
||||
// 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(52_145_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(8 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as u64))
|
||||
}
|
||||
pub(crate) fn receive_teleported_asset() -> Weight {
|
||||
Weight::from_ref_time(5_889_000 as u64)
|
||||
}
|
||||
// Storage: System Account (r:1 w:1)
|
||||
pub(crate) fn deposit_asset() -> Weight {
|
||||
Weight::from_ref_time(27_689_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as u64))
|
||||
}
|
||||
// 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(44_857_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(7 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as u64))
|
||||
}
|
||||
// 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(21_586_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as u64))
|
||||
}
|
||||
}
|
||||
+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-12-15, 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("bridge-hub-rococo-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
|
||||
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json
|
||||
// --pallet=pallet_xcm_benchmarks::generic
|
||||
// --chain=bridge-hub-rococo-dev
|
||||
// --header=./file_header.txt
|
||||
// --template=./templates/xcm-bench-template.hbs
|
||||
// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weights for `pallet_xcm_benchmarks::generic`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> WeightInfo<T> {
|
||||
// Storage: 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(21_192_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as u64))
|
||||
}
|
||||
pub(crate) fn buy_execution() -> Weight {
|
||||
Weight::from_ref_time(5_394_000 as u64)
|
||||
}
|
||||
// Storage: PolkadotXcm Queries (r:1 w:0)
|
||||
pub(crate) fn query_response() -> Weight {
|
||||
Weight::from_ref_time(16_081_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as u64))
|
||||
}
|
||||
pub(crate) fn transact() -> Weight {
|
||||
Weight::from_ref_time(19_230_000 as u64)
|
||||
}
|
||||
pub(crate) fn refund_surplus() -> Weight {
|
||||
Weight::from_ref_time(5_286_000 as u64)
|
||||
}
|
||||
pub(crate) fn set_error_handler() -> Weight {
|
||||
Weight::from_ref_time(5_275_000 as u64)
|
||||
}
|
||||
pub(crate) fn set_appendix() -> Weight {
|
||||
Weight::from_ref_time(5_190_000 as u64)
|
||||
}
|
||||
pub(crate) fn clear_error() -> Weight {
|
||||
Weight::from_ref_time(5_113_000 as u64)
|
||||
}
|
||||
pub(crate) fn descend_origin() -> Weight {
|
||||
Weight::from_ref_time(6_169_000 as u64)
|
||||
}
|
||||
pub(crate) fn clear_origin() -> Weight {
|
||||
Weight::from_ref_time(5_158_000 as u64)
|
||||
}
|
||||
// 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(14_826_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(5 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as u64))
|
||||
}
|
||||
// Storage: PolkadotXcm AssetTraps (r:1 w:1)
|
||||
pub(crate) fn claim_asset() -> Weight {
|
||||
Weight::from_ref_time(20_278_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as u64))
|
||||
}
|
||||
pub(crate) fn trap() -> Weight {
|
||||
Weight::from_ref_time(5_100_000 as u64)
|
||||
}
|
||||
// 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(17_701_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as u64))
|
||||
}
|
||||
// Storage: PolkadotXcm VersionNotifyTargets (r:0 w:1)
|
||||
pub(crate) fn unsubscribe_version() -> Weight {
|
||||
Weight::from_ref_time(7_143_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().writes(1 as u64))
|
||||
}
|
||||
// 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(21_895_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as u64))
|
||||
}
|
||||
}
|
||||
@@ -32,9 +32,10 @@ use xcm::latest::prelude::*;
|
||||
use xcm_builder::{
|
||||
AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom,
|
||||
AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin,
|
||||
FixedWeightBounds, IsConcrete, LocationInverter, ParentIsPreset, RelayChainAsNative,
|
||||
IsConcrete, LocationInverter, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
|
||||
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
|
||||
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
|
||||
WeightInfoBounds,
|
||||
};
|
||||
use xcm_executor::XcmExecutor;
|
||||
|
||||
@@ -43,6 +44,7 @@ parameter_types! {
|
||||
pub const RelayNetwork: NetworkId = NetworkId::Any;
|
||||
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
|
||||
pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
|
||||
pub const MaxInstructions: u32 = 100;
|
||||
}
|
||||
|
||||
/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
|
||||
@@ -85,6 +87,9 @@ pub type XcmOriginToTransactDispatchOrigin = (
|
||||
// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when
|
||||
// recognized.
|
||||
SiblingParachainAsNative<cumulus_pallet_xcm::Origin, RuntimeOrigin>,
|
||||
// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a
|
||||
// transaction from the Root origin.
|
||||
ParentAsSuperuser<RuntimeOrigin>,
|
||||
// Native signed account converter; this just converts an `AccountId32` origin into a normal
|
||||
// `Origin::Signed` origin of the same 32-byte value.
|
||||
SignedAccountId32AsNative<RelayNetwork, RuntimeOrigin>,
|
||||
@@ -92,12 +97,6 @@ pub type XcmOriginToTransactDispatchOrigin = (
|
||||
XcmPassthrough<RuntimeOrigin>,
|
||||
);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
match_types! {
|
||||
pub type ParentOrParentsExecutivePlurality: impl Contains<MultiLocation> = {
|
||||
MultiLocation { parents: 1, interior: Here } |
|
||||
@@ -138,7 +137,11 @@ impl xcm_executor::Config for XcmConfig {
|
||||
type IsTeleporter = ConcreteNativeAssetFrom<RelayLocation>;
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
type Barrier = Barrier;
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
|
||||
type Weigher = WeightInfoBounds<
|
||||
crate::weights::xcm::BridgeHubRococoXcmWeight<RuntimeCall>,
|
||||
RuntimeCall,
|
||||
MaxInstructions,
|
||||
>;
|
||||
type Trader =
|
||||
UsingComponents<WeightToFee, RelayLocation, AccountId, Balances, ToAuthor<Runtime>>;
|
||||
type ResponseHandler = PolkadotXcm;
|
||||
@@ -172,7 +175,11 @@ impl pallet_xcm::Config for Runtime {
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type XcmTeleportFilter = Everything;
|
||||
type XcmReserveTransferFilter = Nothing; // This parachain is not meant as a reserve location.
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
|
||||
type Weigher = WeightInfoBounds<
|
||||
crate::weights::xcm::BridgeHubRococoXcmWeight<RuntimeCall>,
|
||||
RuntimeCall,
|
||||
MaxInstructions,
|
||||
>;
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
|
||||
@@ -43,10 +43,14 @@ elif [[ $runtimeName == "bridge-hub-rococo" ]] || [[ $runtimeName == "bridge-hub
|
||||
pallets=(
|
||||
frame_system
|
||||
pallet_balances
|
||||
pallet_collator_selection
|
||||
pallet_multisig
|
||||
pallet_session
|
||||
pallet_timestamp
|
||||
pallet_collator_selection
|
||||
pallet_utility
|
||||
cumulus_pallet_xcmp_queue
|
||||
pallet_xcm_benchmarks::generic
|
||||
pallet_xcm_benchmarks::fungible
|
||||
)
|
||||
else
|
||||
echo "$runtimeName pallet list not found in benchmarks-ci.sh"
|
||||
|
||||
@@ -57,3 +57,24 @@ benchmarks-collectives:
|
||||
tags:
|
||||
- weights
|
||||
|
||||
benchmarks-bridge-hubs:
|
||||
stage: benchmarks-run
|
||||
extends:
|
||||
- .collect-artifacts
|
||||
- .benchmarks-refs
|
||||
before_script:
|
||||
- !reference [.docker-env, before_script]
|
||||
timeout: 1d
|
||||
script:
|
||||
- ./scripts/benchmarks-ci.sh bridge-hubs bridge-hub-kusama ./artifacts
|
||||
- ./scripts/benchmarks-ci.sh bridge-hubs bridge-hub-rococo ./artifacts
|
||||
- export CURRENT_TIME=$(date '+%s')
|
||||
- export BRANCHNAME="weights-bridge-hubs-${CI_COMMIT_BRANCH}-${CURRENT_TIME}"
|
||||
- !reference [.git-commit-push, script]
|
||||
- ./scripts/ci/create-benchmark-pr.sh "[benchmarks] Update weights for bridge-hubs" "$BRANCHNAME"
|
||||
- rm -f ./artifacts/polkadot-parachain
|
||||
- rm -f ./artifacts/test-parachain
|
||||
after_script:
|
||||
- rm -rf .git/config
|
||||
tags:
|
||||
- weights
|
||||
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
usage() {
|
||||
echo Usage:
|
||||
echo "$1 <srtool compressed runtime path>"
|
||||
echo "$2 <para_id>"
|
||||
echo "e.g.: ./scripts/create_bridge_hub_kusama_spec.sh ./target/release/wbuild/bridge-hub-kusama-runtime/bridge_hub_kusama_runtime.compact.compressed.wasm 1003"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
rt_path=$1
|
||||
para_id=$2
|
||||
|
||||
echo "Generating chain spec for runtime: $rt_path and para_id: $para_id"
|
||||
|
||||
binary="./target/release/polkadot-parachain"
|
||||
|
||||
# build the chain spec we'll manipulate
|
||||
$binary build-spec --chain bridge-hub-kusama-dev > chain-spec-plain.json
|
||||
|
||||
# convert runtime to hex
|
||||
cat $rt_path | od -A n -v -t x1 | tr -d ' \n' > rt-hex.txt
|
||||
|
||||
# replace the runtime in the spec with the given runtime and set some values to production
|
||||
cat chain-spec-plain.json | jq --rawfile code rt-hex.txt '.genesis.runtime.system.code = ("0x" + $code)' \
|
||||
| jq '.name = "Kusama BridgeHub"' \
|
||||
| jq '.id = "bridge-hub-kusama"' \
|
||||
| jq '.chainType = "Live"' \
|
||||
| jq '.bootNodes = [
|
||||
"/dns/kusama-bridge-hub-collator-ew1-0.polkadot.io/tcp/30334/p2p/12D3KooWP2Gngt4tt2sz5BgDaAbMTxasPWk3V2Z99bQTmFcAorqa",
|
||||
"/dns/kusama-bridge-hub-collator-ew1-1.polkadot.io/tcp/30334/p2p/12D3KooWMmL3FQuYmruBui1sbY4MwNmvicinrePi1Yq4QMRSYHoR",
|
||||
"/dns/kusama-bridge-hub-collator-ue4-0.polkadot.io/tcp/30334/p2p/12D3KooWQpTocTck1tNBzMNTHJ3kSv4vzv8Yf9FpVkfGnungbez4",
|
||||
"/dns/kusama-bridge-hub-collator-ue4-1.polkadot.io/tcp/30334/p2p/12D3KooWRgtJqKEaMi7hkU4VMiGhpHTJeL8N7JgL7d9gwooPv4eW",
|
||||
|
||||
"/dns/kusama-bridge-hub-connect-ew1-0.polkadot.io/tcp/30334/p2p/12D3KooWPQQPivrqQ51kRTDc2R1mtqwKT4GGtk2rapkY4FrwHrEp",
|
||||
"/dns/kusama-bridge-hub-connect-ew1-1.polkadot.io/tcp/30334/p2p/12D3KooWPcF9Yk4gYrMju9CyWCV69hAFXbYsnxCLogwLGu9QFTRn",
|
||||
"/dns/kusama-bridge-hub-connect-ue4-0.polkadot.io/tcp/30334/p2p/12D3KooWMf1sVnJDTkKWtaThqvrgcSPLbfGXttSqbwhM2DJp9BUG",
|
||||
"/dns/kusama-bridge-hub-connect-ue4-1.polkadot.io/tcp/30334/p2p/12D3KooWQaV7wMfNVKy2aMz4Lds3TTxgSDyZAUEnbAZMfD8rW3ow",
|
||||
|
||||
"/dns/kusama-bridge-hub-connect-ew1-0.polkadot.io/tcp/443/wss/p2p/12D3KooWPQQPivrqQ51kRTDc2R1mtqwKT4GGtk2rapkY4FrwHrEp",
|
||||
"/dns/kusama-bridge-hub-connect-ew1-1.polkadot.io/tcp/443/wss/p2p/12D3KooWPcF9Yk4gYrMju9CyWCV69hAFXbYsnxCLogwLGu9QFTRn",
|
||||
"/dns/kusama-bridge-hub-connect-ue4-0.polkadot.io/tcp/443/wss/p2p/12D3KooWMf1sVnJDTkKWtaThqvrgcSPLbfGXttSqbwhM2DJp9BUG",
|
||||
"/dns/kusama-bridge-hub-connect-ue4-1.polkadot.io/tcp/443/wss/p2p/12D3KooWQaV7wMfNVKy2aMz4Lds3TTxgSDyZAUEnbAZMfD8rW3ow"
|
||||
|
||||
]' \
|
||||
| jq '.relay_chain = "kusama"' \
|
||||
| jq --argjson para_id $para_id '.para_id = $para_id' \
|
||||
| jq --argjson para_id $para_id '.genesis.runtime.parachainInfo.parachainId = $para_id' \
|
||||
| jq '.genesis.runtime.balances.balances = []' \
|
||||
| jq '.genesis.runtime.collatorSelection.invulnerables = [
|
||||
"DQkekNBt8g6D7bPUEqhgfujADxzzfivr1qQZJkeGzAqnEzF",
|
||||
"HbUc5qrLtKAZvasioiTSf1CunaN2SyEwvfsgMuYQjXA5sfk",
|
||||
"JEe4NcVyuWFEwZe4WLfRtynDswyKgvLS8H8r4Wo9d3t61g1",
|
||||
"FAe4DGhQHKTm35n5MgBFNBZvyEJcm7QAwgnVNQU8KXP2ixn"
|
||||
]' \
|
||||
| jq '.genesis.runtime.session.keys = [
|
||||
[
|
||||
"DQkekNBt8g6D7bPUEqhgfujADxzzfivr1qQZJkeGzAqnEzF",
|
||||
"DQkekNBt8g6D7bPUEqhgfujADxzzfivr1qQZJkeGzAqnEzF",
|
||||
{
|
||||
"aura": "5E7AiV9ygGUcfdK3XVoJsew7fsu18uvKQHYhksE5PXDNfRL9"
|
||||
}
|
||||
],
|
||||
[
|
||||
"HbUc5qrLtKAZvasioiTSf1CunaN2SyEwvfsgMuYQjXA5sfk",
|
||||
"HbUc5qrLtKAZvasioiTSf1CunaN2SyEwvfsgMuYQjXA5sfk",
|
||||
{
|
||||
"aura": "5CyXoMh8cA2MSk55JASpCfhCg44iSG5fBwmhvSfXUUS3uhPR"
|
||||
}
|
||||
],
|
||||
[
|
||||
"JEe4NcVyuWFEwZe4WLfRtynDswyKgvLS8H8r4Wo9d3t61g1",
|
||||
"JEe4NcVyuWFEwZe4WLfRtynDswyKgvLS8H8r4Wo9d3t61g1",
|
||||
{
|
||||
"aura": "5Grj5pN52kKU61qK9qP5cf9ADuyowe2WVvYWxMNK1QqAM8qf"
|
||||
}
|
||||
],
|
||||
[
|
||||
"FAe4DGhQHKTm35n5MgBFNBZvyEJcm7QAwgnVNQU8KXP2ixn",
|
||||
"FAe4DGhQHKTm35n5MgBFNBZvyEJcm7QAwgnVNQU8KXP2ixn",
|
||||
{
|
||||
"aura": "5EHTyftGjcHfe71VVuZqCeLbHNf4ptYzgdAMMyqpTNbs5Rrp"
|
||||
}
|
||||
]
|
||||
]' \
|
||||
> edited-chain-spec-plain.json
|
||||
|
||||
# build a raw spec
|
||||
$binary build-spec --chain edited-chain-spec-plain.json --raw > chain-spec-raw.json
|
||||
cp chain-spec-raw.json ./parachains/chain-specs/bridge-hub-kusama.json
|
||||
|
||||
# build genesis data
|
||||
$binary export-genesis-state --chain chain-spec-raw.json > bridge-hub-kusama-genesis-head-data
|
||||
|
||||
# build genesis wasm
|
||||
$binary export-genesis-wasm --chain chain-spec-raw.json > bridge-hub-kusama-wasm
|
||||
Reference in New Issue
Block a user