mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 21:01:02 +00:00
XCM v3 (#4097)
* cargo fmt * Create benchmarks for XCM instructions introduced in v3 (#4564) * Create benchmarks for BurnAsset and ExpectAsset * Add benchmarks for ExpectOrigin and ExpectError * Add benchmarks for QueryPallet and ExpectPallet * Add benchmarks for ReportTransactStatus and ClearTransactStatus * cargo fmt * Use AllPalletsWithSystem in mocks * Update XCM generic benchmarks for westend * Remove default impls for some XCM weight functions * Fix compilation error * Add weight_args helper attribute * Remove manually written XcmWeightInfo * Parse trailing comma * Revert "Add weight_args helper attribute" This reverts commit 3b7c47a6182e1b9227036c38b406d494c3fcf6fd. * Fixes * Fixes * XCM v3: Introduce querier field into `QueryReponse` (#4732) * Introduce querier field into QueryReponse * Convert &Option<MultiLocation> to Option<&MultiLocation> &Option<T> is almost always never quite useful, most of the time it still gets converted to an Option<&T> via `as_ref`, so we should simply make functions that accept Option<&T> instead. * Fix tests * cargo fmt * Fix benchmarks * Appease spellchecker * Fix test * Fix tests * Fix test * Fix mock * Fixes * Fix tests * Add test for response queriers * Update xcm/pallet-xcm/src/lib.rs * Test for non-existence of querier Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> * Fixes * Fixes * Add `starts_with` function to `MultiLocation` and `Junctions` (#4835) * add matches_prefix function to MultiLocation and Junctions * rename matches_prefix to starts_with * remove unnecessary main in doc comment Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Make use of starts_with in match_and_split Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> * XCM v3: Bridge infrastructure (#4681) * XCM bridge infrastructure * Missing bit of cherry-pick * Revamped XCM proc macros; new NetworkIds * Fixes * Formatting * ExportMessage instruction and config type * Add MessageExporter definitions * Formatting * Missing files * Fixes * Initial bridging config API * Allow for two-stage XCM execution * Update xcm/src/v3/mod.rs Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> * XCM crate building again * Initial bridging primitive * Docs * Docs * More work * More work * Merge branch 'gav-xcm-v3' into gav-xcm-v3-bridging * Make build * WithComputedOrigin and SovereignPaidRemoteExporter * Remove TODOs * Slim bridge API and tests. * Fixes * More work * First bridge test passing * Formatting * Another test * Next round of bridging tests * Repot tests * Cleanups * Paid bridging * Formatting * Tests * Spelling * Formatting * Fees and refactoring * Fixes * Formatting * Refactor SendXcm to become two-phase * Fix tests * Refactoring of SendXcm and ExportXcm complete * Formatting * Rename CannotReachDestination -> NotApplicable * Remove XCM v0 * Minor grumbles * Formatting * Formatting * Fixes * Fixes * Cleanup XCM config * Fee handling * Fixes * Formatting * Fixes * Bump Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> * Bump Substrate * XCM v3: `ExchangeAsset` and Remote-locking (#4945) * Asset Exchange and Locks * Make sure XCM typers impl MaxEncodedLen * Basic implementation for locks * Bump Substrate * Missing files * Use new API * Introduce instruction * Big refactor * Docs * Remove deprecated struct * Remove deprecated struct * Repot XCM builder tests * ExchangeAsset test * Exchange tests * Locking tests * Locking tests * Fixes and tests * Fixes * Formatting * Spelling * Add simulator test for remote locking * Fix tests * Bump * XCM v3: Support for non-fungibles (#4950) * NFT support and a test * New files. * Integration tests for sending NFTs * Formatting * Broken Cargo features * Use 2021 edition * Fixes * Formatting * Formatting * Update xcm/xcm-builder/src/asset_conversion.rs Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> * Update xcm/xcm-builder/src/nonfungibles_adapter.rs Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> * Update xcm/xcm-executor/src/lib.rs Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> * Fixes * Fixes * Fixes * Formatting * Fixes Co-authored-by: Bastian Köcher <info@kchr.de> Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> * XCM v3: Context & ID hash (#4756) * send_xcm returns message hash * cargo fmt * Create topic register and instructions * Fix weights * Use tabs * Sketch out XcmContext * Fix doc test * Add the XCM context as a parameter to executor trait fns * Fixes * Add XcmContext parameter * Revert adding context as an arg to SendXcm trait methods * Revert adding context argument to ConvertOrigin trait methods * cargo fmt * Do not change the API of XcmExecutor::execute * Fixes * Fixes * Fixes * Fixes * Remove convenience method * Fixes * Fixes * cargo fmt * Fixes * Add benchmarks for XCM topic instructions * cargo run --quiet --profile=production --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=pallet_xcm_benchmarks::generic --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --template=./xcm/pallet-xcm-benchmarks/template.hbs --output=./runtime/westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs * Remove context argument on FilterAssetLocation * Fixes * Remove unused import * Fixes * Fixes * Fixes * Accept XCM hash parameter in ExecuteXcm trait methods * cargo fmt * Properly enable sp-io/std * Fixes * default-features = false * Fixes * Fixes * Fixes * Make XcmContext optional in withdraw_asset * Fixes * Fixes * Fixes * Modify tests to check for the correct XCM hash * Small refactor * cargo fmt * Check for expected hash in xcm-builder unit tests * Add doc comment for the optionality of the XCM context in withdraw_asset * Update xcm/src/v3/traits.rs * Update xcm/src/v3/traits.rs * Store XcmContext and avoid rebuilding * Use ref for XcmContext * Formatting * Fix incorrect hash CC @KiChjang * Refactor and make clear fake hashes * Fixes * Fixes * Fixes * Fix broken hashing * Docs * Fixes * Fixes * Fixes * Formatting * Fixes * Fixes * Fixes * Remove unknowable hash * Formatting * Use message hash for greater identifiability * Formatting * Fixes * Formatting Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> Co-authored-by: Parity Bot <admin@parity.io> * Fixes * Fixes * Fixes * Fixes * Formatting * Fixes * Formatting * Fixes * Fixes * Formatting * Formatting * Remove horrible names * Bump * Remove InvertLocation trait (#5092) * Remove InvertLocation trait * Remove unneeded functions * Formatting * Fixes * Remove XCMv1 (#5094) * Remove XCMv1 * Remove XCMv1 * Formatting * Fixes * Fixes * Formatting * derive serialize/deserialize for xcm primitives (#5036) * derive serialize/deserialize for xcm primitives * derive serialize/deserialize for xcm primitives * update v3 * update v2 Co-authored-by: Gav Wood <gavin@parity.io> * Update lock * Fixes * Add benchmarks for the ExchangeAsset instruction * `AliasOrigin` instruction stub (#5122) * AliasOrigin instruction stub * Fixes * Fixes * Update substrate * Fixes * Ensure same array length before using copy_from_slice * Fixes * Add benchmarks for the UniversalOrigin instruction * Remove unused import * Remove unused import * Add benchmarks for SetFeesMode instruction * Add benchmarks for asset (un)locking instructions * Leave AliasOrigin unbenchmarked * Fixes after merge * cargo fmt * Fixes * Fixes * Set TrustedReserves to None on both Kusama and Westend * Remove extraneous reserve_asset_deposited benchmark * Fix universal_origin benchmark * cargo run --quiet --profile=production --features=runtime-benchmarks -- benchmark pallet --chain=westend-dev --steps=50 --repeat=20 --pallet=pallet_xcm_benchmarks::generic --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --template=./xcm/pallet-xcm-benchmarks/template.hbs --output=./runtime/westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs * Don't rely on skipped benchmark functions * Fixes * cargo run --quiet --profile=production --features=runtime-benchmarks -- benchmark pallet --chain=kusama-dev --steps=50 --repeat=20 --pallet=pallet_xcm_benchmarks::generic --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --template=./xcm/pallet-xcm-benchmarks/template.hbs --output=./runtime/kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs * Fix unused variables * Fixes * Spelling * Fixes * Fix codec index of VersionedXcm * Allows to customize how calls are dispatched from XCM (#5657) * CallDispatcher trait * fmt * unused import * fix test-runtime * remove JustDispatch type * fix typo in test-runtime * missing CallDispatcher * more missing CallDispatcher * Update comment `NoteAssetLocked` -> `NoteUnlockable` * Fixes * Fixes * Adjust MultiAssets weights based on new wild card variants * Fixes * Fixes * Fixes * Fixes * Fixes * Some late fixes for XCMv3 (#5237) * Maximise chances that trapped assets can be reclaimed * Do origin check as part of ExportMessage for security * Formatting * Fixes * Cleanup export XCM APIs * Formatting * Update xcm/src/v3/junctions.rs * UnpaidExecution instruction and associated barrier. * Tighten barriers (ClearOrigin/QueryResponse) * Allow only 1 ClearOrigin instruction in AllowTopLevelPaidExecutionFrom * Bi-directional teleport accounting * Revert other fix * Build fixes] * Tests build * Benchmark fixes Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> * Update Substrate * Re-export `pub` stuff from universal_exports.rs + removed unecessary clone (#6145) * Re-export `pub` stuff from universal_exports.rs * Removed unnecessary clone * Use 2D weights in XCM v3 (#6134) * Depend upon sp-core instead of sp-runtime * Make sp-io a dev-dependency * Use 2D weights in XCM v3 * cargo fmt * Add XCM pallet migration to runtimes * Use from_parts * cargo fmt * Fixes * cargo fmt * Remove XCMWeight import * Fixes * Fixes * Fixes * Fixes * Use translate in migration * Increase max upward message size in tests * Fix doc test * Remove most uses of from_ref_time * cargo fmt * Fixes * Fixes * Add extrinsic benchmarking to XCM pallet * cargo fmt * Fixes * Use old syntax * cargo fmt * Fixes * Remove hardcoded weights * Add XCM pallet to benchmarks * Use successful origin * Fix weird type parameter compilation issue * Fixes * ".git/.scripts/bench-bot.sh" runtime westend-dev pallet_xcm * ".git/.scripts/bench-bot.sh" runtime rococo-dev pallet_xcm * ".git/.scripts/bench-bot.sh" runtime kusama-dev pallet_xcm * ".git/.scripts/bench-bot.sh" runtime polkadot-dev pallet_xcm * Use benchmarked XCM pallet weights * Fixes * Fixes * Use override instead of skip * Fixes * Fixes * Fixes * Fixes * ".git/.scripts/bench-bot.sh" runtime polkadot-dev pallet_xcm * Fixes * ".git/.scripts/bench-bot.sh" runtime polkadot-dev pallet_xcm * ".git/.scripts/bench-bot.sh" runtime westend-dev pallet_xcm Co-authored-by: command-bot <> * Replace Weight::MAX with 100b weight units * Add test to ensure all_gte in barriers is correct * Update xcm/src/v3/junction.rs Co-authored-by: asynchronous rob <rphmeier@gmail.com> * Add more weight tests * cargo fmt * Create thread_local in XCM executor to limit recursion depth (#6304) * Create thread_local in XCM executor to limit recursion depth * Add unit test for recursion limit * Fix statefulness in tests * Remove panic * Use defer and environmental macro * Fix the implementation * Use nicer interface * Change ThisNetwork to AnyNetwork * Move recursion check up to top level * cargo fmt * Update comment Co-authored-by: Bastian Köcher <info@kchr.de> * Add upper limit on the number of overweight messages in the queue (#6298) * Add upper limit on the number of ovwerweight messages in the queue * Add newline * Introduce whitelist for Transact and limit UMP processing to 10 messages per block (#6280) * Add SafeCallFilter to XcmConfig * Limit UMP to receive 10 messages every block * Place 10 message limit on processing instead of receiving * Always increment the message_processed count whenever a message is processed * Add as_derivative to the Transact whitelist * cargo fmt * Fixes * Update xcm/xcm-builder/src/universal_exports.rs Co-authored-by: Branislav Kontur <bkontur@gmail.com> * Fixes * Fixes * Remove topic register and instead use the topic field in XcmContext * Derive some common traits for DispatchBlobError * Fixes * cargo fmt * Fixes * Fixes * Fix comments * Fixes * Introduce WithOriginFilter and apply it as the CallDispatcher for runtimes * Fixes * Appease clippy and fixes * Fixes * Fix more clippy issues * Fixes * ".git/.scripts/bench-bot.sh" runtime polkadot-dev pallet_xcm * ".git/.scripts/bench-bot.sh" runtime westend-dev pallet_xcm * ".git/.scripts/bench-bot.sh" runtime westend-dev pallet_xcm * Add benchmark function for ExportMessage * Fix comment * Add upper limit to DownwardMessageQueues size * Add max size check for queue in can_queue_downward_message * Fixes * Make Transact runtime call configurable * Return Weight::MAX when there is no successful send XCM origin * Update substrate * Fixes * Fixes * Remove ExportMessage benchmark * Remove assertion on Transact instruction benchmark * Make reachable destination configurable in XCM pallet benchmarks * Fixes * Fixes * Remove cfg attribute in fuzzer * Fixes * Remove cfg attribute for XCM pallet in test runtime * Fixes * Use ReachableDest where possible * Fixes * Add benchmark for UnpaidExecution * Update substrate * Ensure benchmark functions pass filters * Add runtime-benchmarks feature to fuzzer * Ensure FixedRateOfFungible accounts for proof size weights * cargo fmt * Whitelist remark_with_event when runtime-benchmarks feature is enabled * Use remark_with_event for Transact benchmarks * Fix Cargo.lock * Allow up to 3 DescendOrigin instructions before UnpaidExecution * cargo fmt * Edit code comment * Check check_origin for unpaid execution privilege * Fixes * Small nits for xcm-v3 (#6408) * Add possibility to skip benchmark for export_message * ".git/.scripts/bench-bot.sh" xcm westend-dev pallet_xcm_benchmarks::generic * Revert * ".git/.scripts/bench-bot.sh" xcm westend-dev pallet_xcm_benchmarks::generic * Add HaulBlobError to `fn haul_blob` * ".git/.scripts/bench-bot.sh" xcm westend-dev pallet_xcm_benchmarks::generic Co-authored-by: command-bot <> * Revert changes to UnpaidExecution * Change AllowUnpaidExecutionFrom to be explicit * Fix log text * cargo fmt * Add benchmarks for XCM pallet version migration (#6448) * Add benchmarks for XCM pallet version migration * cargo fmt * Fixes * Fixes * Fixes * ".git/.scripts/bench-bot.sh" runtime westend-dev pallet_xcm * ".git/.scripts/bench-bot.sh" runtime kusama-dev pallet_xcm * ".git/.scripts/bench-bot.sh" runtime rococo-dev pallet_xcm * ".git/.scripts/bench-bot.sh" runtime polkadot-dev pallet_xcm * Fix benchmarks * Fix benchmarks * ".git/.scripts/bench-bot.sh" runtime westend-dev pallet_xcm * ".git/.scripts/bench-bot.sh" runtime kusama-dev pallet_xcm * ".git/.scripts/bench-bot.sh" runtime rococo-dev pallet_xcm * ".git/.scripts/bench-bot.sh" runtime polkadot-dev pallet_xcm Co-authored-by: command-bot <> * Merge remote-tracking branch 'origin/master' into gav-xcm-v3 * Fixes * Fix comments (#6470) * Specify Ethereum networks by their chain id (#6286) Co-authored-by: Squirrel <gilescope@gmail.com> * Use for Kusama * Use WithComputedOrigin for Polkadot, Rococo and Westend * Update lock * Fix warning * Update xcm/pallet-xcm/src/tests.rs Co-authored-by: Squirrel <gilescope@gmail.com> * Update runtime/parachains/src/ump/migration.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update xcm/pallet-xcm/src/migration.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fixes * cargo fmt * Typo * Update xcm/src/v3/mod.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Docs * Docs * Docs * Docs * Docs * Update xcm/src/v3/multiasset.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add tests for MultiAssets::from_sorted_and_deduplicated * Fail gracefully when same instance NFTs are detected during push * Update Substrate to fix benchmarks * Apply suggestions from code review * Update runtime/kusama/src/xcm_config.rs * Rename arguments * Attempt to fix benchmark * ".git/.scripts/commands/bench/bench.sh" runtime polkadot-dev runtime_parachains::ump * Use actual weights for UMP pallet in Polkadot * ".git/.scripts/commands/bench/bench.sh" runtime kusama-dev runtime_parachains::ump * ".git/.scripts/commands/bench/bench.sh" runtime westend-dev runtime_parachains::ump * ".git/.scripts/commands/bench/bench.sh" runtime rococo-dev runtime_parachains::ump Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Bastian Köcher <info@kchr.de> Co-authored-by: Parity Bot <admin@parity.io> Co-authored-by: stanly-johnson <stanlyjohnson@outlook.com> Co-authored-by: nanocryk <6422796+nanocryk@users.noreply.github.com> Co-authored-by: Branislav Kontur <bkontur@gmail.com> Co-authored-by: asynchronous rob <rphmeier@gmail.com> Co-authored-by: command-bot <> Co-authored-by: Vincent Geddes <vincent.geddes@hey.com> Co-authored-by: Squirrel <gilescope@gmail.com> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -1497,6 +1497,9 @@ pub type Migrations = (
|
||||
pallet_staking::migrations::v13::MigrateToV13<Runtime>,
|
||||
parachains_disputes::migration::v1::MigrateToV1<Runtime>,
|
||||
parachains_configuration::migration::v4::MigrateToV4<Runtime>,
|
||||
// "Use 2D weights in XCM v3" <https://github.com/paritytech/polkadot/pull/6134>
|
||||
pallet_xcm::migration::v1::MigrateToV1<Runtime>,
|
||||
parachains_ump::migration::v1::MigrateToV1<Runtime>,
|
||||
);
|
||||
|
||||
/// Unchecked extrinsic type as expected by this runtime.
|
||||
@@ -1576,6 +1579,7 @@ mod benches {
|
||||
[pallet_vesting, Vesting]
|
||||
[pallet_whitelist, Whitelist]
|
||||
// XCM
|
||||
[pallet_xcm, XcmPallet]
|
||||
[pallet_xcm_benchmarks::fungible, pallet_xcm_benchmarks::fungible::Pallet::<Runtime>]
|
||||
[pallet_xcm_benchmarks::generic, pallet_xcm_benchmarks::generic::Pallet::<Runtime>]
|
||||
);
|
||||
@@ -1978,7 +1982,9 @@ sp_api::impl_runtime_apis! {
|
||||
use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench;
|
||||
use frame_benchmarking::baseline::Pallet as Baseline;
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_config::{CheckAccount, KsmLocation, SovereignAccountOf, Statemine, XcmConfig};
|
||||
use xcm_config::{
|
||||
LocalCheckAccount, SovereignAccountOf, Statemine, TokenLocation, XcmConfig,
|
||||
};
|
||||
|
||||
impl pallet_session_benchmarking::Config for Runtime {}
|
||||
impl pallet_offences_benchmarking::Config for Runtime {}
|
||||
@@ -1993,10 +1999,10 @@ sp_api::impl_runtime_apis! {
|
||||
fn valid_destination() -> Result<MultiLocation, BenchmarkError> {
|
||||
Ok(Statemine::get())
|
||||
}
|
||||
fn worst_case_holding() -> MultiAssets {
|
||||
fn worst_case_holding(_depositable_count: u32) -> MultiAssets {
|
||||
// Kusama only knows about KSM.
|
||||
vec![MultiAsset{
|
||||
id: Concrete(KsmLocation::get()),
|
||||
id: Concrete(TokenLocation::get()),
|
||||
fun: Fungible(1_000_000 * UNITS),
|
||||
}].into()
|
||||
}
|
||||
@@ -2005,24 +2011,19 @@ sp_api::impl_runtime_apis! {
|
||||
parameter_types! {
|
||||
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
|
||||
Statemine::get(),
|
||||
MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(KsmLocation::get()) },
|
||||
));
|
||||
pub const TrustedReserve: Option<(MultiLocation, MultiAsset)> = Some((
|
||||
Statemine::get(),
|
||||
MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(KsmLocation::get()) },
|
||||
MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(TokenLocation::get()) },
|
||||
));
|
||||
}
|
||||
|
||||
impl pallet_xcm_benchmarks::fungible::Config for Runtime {
|
||||
type TransactAsset = Balances;
|
||||
|
||||
type CheckedAccount = CheckAccount;
|
||||
type CheckedAccount = LocalCheckAccount;
|
||||
type TrustedTeleporter = TrustedTeleporter;
|
||||
type TrustedReserve = TrustedReserve;
|
||||
|
||||
fn get_multi_asset() -> MultiAsset {
|
||||
MultiAsset {
|
||||
id: Concrete(KsmLocation::get()),
|
||||
id: Concrete(TokenLocation::get()),
|
||||
fun: Fungible(1 * UNITS),
|
||||
}
|
||||
}
|
||||
@@ -2035,8 +2036,18 @@ sp_api::impl_runtime_apis! {
|
||||
(0u64, Response::Version(Default::default()))
|
||||
}
|
||||
|
||||
fn transact_origin() -> Result<MultiLocation, BenchmarkError> {
|
||||
Ok(Statemine::get())
|
||||
fn worst_case_asset_exchange() -> Result<(MultiAssets, MultiAssets), BenchmarkError> {
|
||||
// Kusama doesn't support asset exchanges
|
||||
Err(BenchmarkError::Skip)
|
||||
}
|
||||
|
||||
fn universal_alias() -> Result<Junction, BenchmarkError> {
|
||||
// The XCM executor of Kusama doesn't have a configured `UniversalAliases`
|
||||
Err(BenchmarkError::Skip)
|
||||
}
|
||||
|
||||
fn transact_origin_and_runtime_call() -> Result<(MultiLocation, RuntimeCall), BenchmarkError> {
|
||||
Ok((Statemine::get(), frame_system::Call::remark_with_event { remark: vec![] }.into()))
|
||||
}
|
||||
|
||||
fn subscribe_origin() -> Result<MultiLocation, BenchmarkError> {
|
||||
@@ -2045,10 +2056,15 @@ sp_api::impl_runtime_apis! {
|
||||
|
||||
fn claimable_asset() -> Result<(MultiLocation, MultiLocation, MultiAssets), BenchmarkError> {
|
||||
let origin = Statemine::get();
|
||||
let assets: MultiAssets = (Concrete(KsmLocation::get()), 1_000 * UNITS).into();
|
||||
let assets: MultiAssets = (Concrete(TokenLocation::get()), 1_000 * UNITS).into();
|
||||
let ticket = MultiLocation { parents: 0, interior: Here };
|
||||
Ok((origin, ticket, assets))
|
||||
}
|
||||
|
||||
fn unlockable_asset() -> Result<(MultiLocation, MultiLocation, MultiAsset), BenchmarkError> {
|
||||
// Kusama doesn't support asset locking
|
||||
Err(BenchmarkError::Skip)
|
||||
}
|
||||
}
|
||||
|
||||
let whitelist: Vec<TrackedStorageKey> = vec![
|
||||
|
||||
@@ -50,6 +50,7 @@ pub mod pallet_treasury;
|
||||
pub mod pallet_utility;
|
||||
pub mod pallet_vesting;
|
||||
pub mod pallet_whitelist;
|
||||
pub mod pallet_xcm;
|
||||
pub mod runtime_common_auctions;
|
||||
pub mod runtime_common_claims;
|
||||
pub mod runtime_common_crowdloan;
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
// Copyright 2017-2022 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Polkadot.
|
||||
|
||||
// Polkadot is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Polkadot is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
//! Autogenerated weights for `pallet_xcm`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-12-16, 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("kusama-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// /home/benchbot/cargo_target_dir/production/polkadot
|
||||
// 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/polkadot/.git/.artifacts/bench.json
|
||||
// --pallet=pallet_xcm
|
||||
// --chain=kusama-dev
|
||||
// --header=./file_header.txt
|
||||
// --output=./runtime/kusama/src/weights/
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_xcm`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
|
||||
// Storage: XcmPallet SupportedVersion (r:1 w:0)
|
||||
// Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: XcmPallet SafeXcmVersion (r:1 w:0)
|
||||
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
||||
fn send() -> Weight {
|
||||
// Minimum execution time: 36_474 nanoseconds.
|
||||
Weight::from_ref_time(37_030_000)
|
||||
.saturating_add(T::DbWeight::get().reads(5))
|
||||
.saturating_add(T::DbWeight::get().writes(3))
|
||||
}
|
||||
fn teleport_assets() -> Weight {
|
||||
// Minimum execution time: 28_147 nanoseconds.
|
||||
Weight::from_ref_time(28_836_000)
|
||||
}
|
||||
fn reserve_transfer_assets() -> Weight {
|
||||
// Minimum execution time: 28_469 nanoseconds.
|
||||
Weight::from_ref_time(29_002_000)
|
||||
}
|
||||
fn execute() -> Weight {
|
||||
// Minimum execution time: 15_637 nanoseconds.
|
||||
Weight::from_ref_time(15_880_000)
|
||||
}
|
||||
// Storage: XcmPallet SupportedVersion (r:0 w:1)
|
||||
fn force_xcm_version() -> Weight {
|
||||
// Minimum execution time: 15_330 nanoseconds.
|
||||
Weight::from_ref_time(15_817_000)
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
// Storage: XcmPallet SafeXcmVersion (r:0 w:1)
|
||||
fn force_default_xcm_version() -> Weight {
|
||||
// Minimum execution time: 4_104 nanoseconds.
|
||||
Weight::from_ref_time(4_365_000)
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
// Storage: XcmPallet VersionNotifiers (r:1 w:1)
|
||||
// Storage: XcmPallet QueryCounter (r:1 w:1)
|
||||
// Storage: XcmPallet SupportedVersion (r:1 w:0)
|
||||
// Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: XcmPallet SafeXcmVersion (r:1 w:0)
|
||||
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
||||
// Storage: XcmPallet Queries (r:0 w:1)
|
||||
fn force_subscribe_version_notify() -> Weight {
|
||||
// Minimum execution time: 42_177 nanoseconds.
|
||||
Weight::from_ref_time(42_657_000)
|
||||
.saturating_add(T::DbWeight::get().reads(7))
|
||||
.saturating_add(T::DbWeight::get().writes(6))
|
||||
}
|
||||
// Storage: XcmPallet VersionNotifiers (r:1 w:1)
|
||||
// Storage: XcmPallet SupportedVersion (r:1 w:0)
|
||||
// Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: XcmPallet SafeXcmVersion (r:1 w:0)
|
||||
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
||||
// Storage: XcmPallet Queries (r:0 w:1)
|
||||
fn force_unsubscribe_version_notify() -> Weight {
|
||||
// Minimum execution time: 45_481 nanoseconds.
|
||||
Weight::from_ref_time(45_960_000)
|
||||
.saturating_add(T::DbWeight::get().reads(6))
|
||||
.saturating_add(T::DbWeight::get().writes(5))
|
||||
}
|
||||
// Storage: XcmPallet SupportedVersion (r:4 w:2)
|
||||
fn migrate_supported_version() -> Weight {
|
||||
// Minimum execution time: 14_899 nanoseconds.
|
||||
Weight::from_ref_time(15_452_000)
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
// Storage: XcmPallet VersionNotifiers (r:4 w:2)
|
||||
fn migrate_version_notifiers() -> Weight {
|
||||
// Minimum execution time: 14_759 nanoseconds.
|
||||
Weight::from_ref_time(15_176_000)
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
// Storage: XcmPallet VersionNotifyTargets (r:5 w:0)
|
||||
fn already_notified_target() -> Weight {
|
||||
// Minimum execution time: 17_022 nanoseconds.
|
||||
Weight::from_ref_time(17_468_000)
|
||||
.saturating_add(T::DbWeight::get().reads(5))
|
||||
}
|
||||
// Storage: XcmPallet VersionNotifyTargets (r:2 w:1)
|
||||
// Storage: XcmPallet SupportedVersion (r:1 w:0)
|
||||
// Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: XcmPallet SafeXcmVersion (r:1 w:0)
|
||||
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
||||
fn notify_current_targets() -> Weight {
|
||||
// Minimum execution time: 37_810 nanoseconds.
|
||||
Weight::from_ref_time(38_198_000)
|
||||
.saturating_add(T::DbWeight::get().reads(7))
|
||||
.saturating_add(T::DbWeight::get().writes(4))
|
||||
}
|
||||
// Storage: XcmPallet VersionNotifyTargets (r:3 w:0)
|
||||
fn notify_target_migration_fail() -> Weight {
|
||||
// Minimum execution time: 7_440 nanoseconds.
|
||||
Weight::from_ref_time(7_659_000)
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
}
|
||||
// Storage: XcmPallet VersionNotifyTargets (r:4 w:2)
|
||||
fn migrate_version_notify_targets() -> Weight {
|
||||
// Minimum execution time: 14_975 nanoseconds.
|
||||
Weight::from_ref_time(15_479_000)
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
// Storage: XcmPallet VersionNotifyTargets (r:4 w:2)
|
||||
// Storage: XcmPallet SupportedVersion (r:1 w:0)
|
||||
// Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: XcmPallet SafeXcmVersion (r:1 w:0)
|
||||
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
||||
fn migrate_and_notify_old_targets() -> Weight {
|
||||
// Minimum execution time: 43_328 nanoseconds.
|
||||
Weight::from_ref_time(44_054_000)
|
||||
.saturating_add(T::DbWeight::get().reads(9))
|
||||
.saturating_add(T::DbWeight::get().writes(5))
|
||||
}
|
||||
}
|
||||
@@ -16,23 +16,25 @@
|
||||
//! Autogenerated weights for `runtime_parachains::ump`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-11-16, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! DATE: 2023-01-16, 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("kusama-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./target/production/polkadot
|
||||
// /home/benchbot/cargo_target_dir/production/polkadot
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=kusama-dev
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --pallet=runtime_parachains::ump
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/polkadot/.git/.artifacts/bench.json
|
||||
// --pallet=runtime_parachains::ump
|
||||
// --chain=kusama-dev
|
||||
// --header=./file_header.txt
|
||||
// --output=./runtime/kusama/src/weights/runtime_parachains_ump.rs
|
||||
// --output=./runtime/kusama/src/weights/
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
@@ -46,26 +48,27 @@ pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> runtime_parachains::ump::WeightInfo for WeightInfo<T> {
|
||||
/// The range of component `s` is `[0, 51200]`.
|
||||
fn process_upward_message(s: u32, ) -> Weight {
|
||||
// Minimum execution time: 10_348 nanoseconds.
|
||||
Weight::from_ref_time(5_121_205 as u64)
|
||||
// Standard Error: 12
|
||||
.saturating_add(Weight::from_ref_time(1_934 as u64).saturating_mul(s as u64))
|
||||
// Minimum execution time: 10_393 nanoseconds.
|
||||
Weight::from_ref_time(2_845_995)
|
||||
// Standard Error: 21
|
||||
.saturating_add(Weight::from_ref_time(2_016).saturating_mul(s.into()))
|
||||
}
|
||||
// Storage: Ump NeedsDispatch (r:1 w:1)
|
||||
// Storage: Ump NextDispatchRoundStartWith (r:1 w:1)
|
||||
// Storage: Ump RelayDispatchQueues (r:0 w:1)
|
||||
// Storage: Ump RelayDispatchQueueSize (r:0 w:1)
|
||||
fn clean_ump_after_outgoing() -> Weight {
|
||||
// Minimum execution time: 9_800 nanoseconds.
|
||||
Weight::from_ref_time(10_025_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as u64))
|
||||
// Minimum execution time: 9_686 nanoseconds.
|
||||
Weight::from_ref_time(9_920_000)
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(4))
|
||||
}
|
||||
// Storage: Ump Overweight (r:1 w:1)
|
||||
// Storage: Ump CounterForOverweight (r:1 w:1)
|
||||
fn service_overweight() -> Weight {
|
||||
// Minimum execution time: 26_272 nanoseconds.
|
||||
Weight::from_ref_time(26_790_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as u64))
|
||||
// Minimum execution time: 28_502 nanoseconds.
|
||||
Weight::from_ref_time(28_900_000)
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,7 @@ mod pallet_xcm_benchmarks_generic;
|
||||
use crate::Runtime;
|
||||
use frame_support::weights::Weight;
|
||||
use sp_std::prelude::*;
|
||||
use xcm::{
|
||||
latest::{prelude::*, Weight as XCMWeight},
|
||||
DoubleEncoded,
|
||||
};
|
||||
use xcm::{latest::prelude::*, DoubleEncoded};
|
||||
|
||||
use pallet_xcm_benchmarks_fungible::WeightInfo as XcmBalancesWeight;
|
||||
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
|
||||
@@ -31,15 +28,15 @@ impl From<&MultiAsset> for AssetTypes {
|
||||
}
|
||||
|
||||
trait WeighMultiAssets {
|
||||
fn weigh_multi_assets(&self, balances_weight: Weight) -> XCMWeight;
|
||||
fn weigh_multi_assets(&self, balances_weight: Weight) -> Weight;
|
||||
}
|
||||
|
||||
// Kusama only knows about one asset, the balances pallet.
|
||||
const MAX_ASSETS: u32 = 1;
|
||||
|
||||
impl WeighMultiAssets for MultiAssetFilter {
|
||||
fn weigh_multi_assets(&self, balances_weight: Weight) -> XCMWeight {
|
||||
let weight = match self {
|
||||
fn weigh_multi_assets(&self, balances_weight: Weight) -> Weight {
|
||||
match self {
|
||||
Self::Definite(assets) => assets
|
||||
.inner()
|
||||
.into_iter()
|
||||
@@ -49,155 +46,213 @@ impl WeighMultiAssets for MultiAssetFilter {
|
||||
AssetTypes::Unknown => Weight::MAX,
|
||||
})
|
||||
.fold(Weight::zero(), |acc, x| acc.saturating_add(x)),
|
||||
Self::Wild(_) => balances_weight.saturating_mul(MAX_ASSETS as u64),
|
||||
};
|
||||
|
||||
weight.ref_time()
|
||||
Self::Wild(AllOf { .. } | AllOfCounted { .. }) => balances_weight,
|
||||
Self::Wild(AllCounted(count)) => balances_weight.saturating_mul(*count as u64),
|
||||
Self::Wild(All) => balances_weight.saturating_mul(MAX_ASSETS as u64),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl WeighMultiAssets for MultiAssets {
|
||||
fn weigh_multi_assets(&self, balances_weight: Weight) -> XCMWeight {
|
||||
let weight = self
|
||||
.inner()
|
||||
fn weigh_multi_assets(&self, balances_weight: Weight) -> Weight {
|
||||
self.inner()
|
||||
.into_iter()
|
||||
.map(|m| <AssetTypes as From<&MultiAsset>>::from(m))
|
||||
.map(|t| match t {
|
||||
AssetTypes::Balances => balances_weight,
|
||||
AssetTypes::Unknown => Weight::MAX,
|
||||
})
|
||||
.fold(Weight::zero(), |acc, x| acc.saturating_add(x));
|
||||
|
||||
weight.ref_time()
|
||||
.fold(Weight::zero(), |acc, x| acc.saturating_add(x))
|
||||
}
|
||||
}
|
||||
|
||||
pub struct KusamaXcmWeight<RuntimeCall>(core::marker::PhantomData<RuntimeCall>);
|
||||
impl<RuntimeCall> XcmWeightInfo<RuntimeCall> for KusamaXcmWeight<RuntimeCall> {
|
||||
fn withdraw_asset(assets: &MultiAssets) -> XCMWeight {
|
||||
fn withdraw_asset(assets: &MultiAssets) -> Weight {
|
||||
assets.weigh_multi_assets(XcmBalancesWeight::<Runtime>::withdraw_asset())
|
||||
}
|
||||
fn reserve_asset_deposited(assets: &MultiAssets) -> XCMWeight {
|
||||
fn reserve_asset_deposited(assets: &MultiAssets) -> Weight {
|
||||
assets.weigh_multi_assets(XcmBalancesWeight::<Runtime>::reserve_asset_deposited())
|
||||
}
|
||||
fn receive_teleported_asset(assets: &MultiAssets) -> XCMWeight {
|
||||
fn receive_teleported_asset(assets: &MultiAssets) -> Weight {
|
||||
assets.weigh_multi_assets(XcmBalancesWeight::<Runtime>::receive_teleported_asset())
|
||||
}
|
||||
fn query_response(_query_id: &u64, _response: &Response, _max_weight: &u64) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::query_response().ref_time()
|
||||
fn query_response(
|
||||
_query_id: &u64,
|
||||
_response: &Response,
|
||||
_max_weight: &Weight,
|
||||
_querier: &Option<MultiLocation>,
|
||||
) -> Weight {
|
||||
XcmGeneric::<Runtime>::query_response()
|
||||
}
|
||||
fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> XCMWeight {
|
||||
fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> Weight {
|
||||
assets.weigh_multi_assets(XcmBalancesWeight::<Runtime>::transfer_asset())
|
||||
}
|
||||
fn transfer_reserve_asset(
|
||||
assets: &MultiAssets,
|
||||
_dest: &MultiLocation,
|
||||
_xcm: &Xcm<()>,
|
||||
) -> XCMWeight {
|
||||
) -> Weight {
|
||||
assets.weigh_multi_assets(XcmBalancesWeight::<Runtime>::transfer_reserve_asset())
|
||||
}
|
||||
fn transact(
|
||||
_origin_type: &OriginKind,
|
||||
_require_weight_at_most: &u64,
|
||||
_origin_kind: &OriginKind,
|
||||
_require_weight_at_most: &Weight,
|
||||
_call: &DoubleEncoded<RuntimeCall>,
|
||||
) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::transact().ref_time()
|
||||
) -> Weight {
|
||||
XcmGeneric::<Runtime>::transact()
|
||||
}
|
||||
fn hrmp_new_channel_open_request(
|
||||
_sender: &u32,
|
||||
_max_message_size: &u32,
|
||||
_max_capacity: &u32,
|
||||
) -> XCMWeight {
|
||||
) -> Weight {
|
||||
// XCM Executor does not currently support HRMP channel operations
|
||||
Weight::MAX.ref_time()
|
||||
Weight::MAX
|
||||
}
|
||||
fn hrmp_channel_accepted(_recipient: &u32) -> XCMWeight {
|
||||
fn hrmp_channel_accepted(_recipient: &u32) -> Weight {
|
||||
// XCM Executor does not currently support HRMP channel operations
|
||||
Weight::MAX.ref_time()
|
||||
Weight::MAX
|
||||
}
|
||||
fn hrmp_channel_closing(_initiator: &u32, _sender: &u32, _recipient: &u32) -> XCMWeight {
|
||||
fn hrmp_channel_closing(_initiator: &u32, _sender: &u32, _recipient: &u32) -> Weight {
|
||||
// XCM Executor does not currently support HRMP channel operations
|
||||
Weight::MAX.ref_time()
|
||||
Weight::MAX
|
||||
}
|
||||
fn clear_origin() -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::clear_origin().ref_time()
|
||||
fn clear_origin() -> Weight {
|
||||
XcmGeneric::<Runtime>::clear_origin()
|
||||
}
|
||||
fn descend_origin(_who: &InteriorMultiLocation) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::descend_origin().ref_time()
|
||||
fn descend_origin(_who: &InteriorMultiLocation) -> Weight {
|
||||
XcmGeneric::<Runtime>::descend_origin()
|
||||
}
|
||||
fn report_error(
|
||||
_query_id: &QueryId,
|
||||
_dest: &MultiLocation,
|
||||
_max_response_weight: &u64,
|
||||
) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::report_error().ref_time()
|
||||
fn report_error(_query_response_info: &QueryResponseInfo) -> Weight {
|
||||
XcmGeneric::<Runtime>::report_error()
|
||||
}
|
||||
|
||||
fn deposit_asset(
|
||||
assets: &MultiAssetFilter,
|
||||
_max_assets: &u32, // TODO use max assets?
|
||||
_dest: &MultiLocation,
|
||||
) -> XCMWeight {
|
||||
fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight {
|
||||
assets.weigh_multi_assets(XcmBalancesWeight::<Runtime>::deposit_asset())
|
||||
}
|
||||
fn deposit_reserve_asset(
|
||||
assets: &MultiAssetFilter,
|
||||
_max_assets: &u32, // TODO use max assets?
|
||||
_dest: &MultiLocation,
|
||||
_xcm: &Xcm<()>,
|
||||
) -> XCMWeight {
|
||||
) -> Weight {
|
||||
assets.weigh_multi_assets(XcmBalancesWeight::<Runtime>::deposit_reserve_asset())
|
||||
}
|
||||
fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets) -> XCMWeight {
|
||||
Weight::MAX.ref_time() // todo fix
|
||||
fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets, _maximal: &bool) -> Weight {
|
||||
// Kusama does not currently support exchange asset operations
|
||||
Weight::MAX
|
||||
}
|
||||
fn initiate_reserve_withdraw(
|
||||
assets: &MultiAssetFilter,
|
||||
_reserve: &MultiLocation,
|
||||
_xcm: &Xcm<()>,
|
||||
) -> XCMWeight {
|
||||
) -> Weight {
|
||||
assets.weigh_multi_assets(XcmGeneric::<Runtime>::initiate_reserve_withdraw())
|
||||
}
|
||||
fn initiate_teleport(
|
||||
assets: &MultiAssetFilter,
|
||||
_dest: &MultiLocation,
|
||||
_xcm: &Xcm<()>,
|
||||
) -> XCMWeight {
|
||||
) -> Weight {
|
||||
assets.weigh_multi_assets(XcmBalancesWeight::<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 report_holding(_response_info: &QueryResponseInfo, _assets: &MultiAssetFilter) -> Weight {
|
||||
XcmGeneric::<Runtime>::report_holding()
|
||||
}
|
||||
fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::buy_execution().ref_time()
|
||||
fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> Weight {
|
||||
XcmGeneric::<Runtime>::buy_execution()
|
||||
}
|
||||
fn refund_surplus() -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::refund_surplus().ref_time()
|
||||
fn refund_surplus() -> Weight {
|
||||
XcmGeneric::<Runtime>::refund_surplus()
|
||||
}
|
||||
fn set_error_handler(_xcm: &Xcm<RuntimeCall>) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::set_error_handler().ref_time()
|
||||
fn set_error_handler(_xcm: &Xcm<RuntimeCall>) -> Weight {
|
||||
XcmGeneric::<Runtime>::set_error_handler()
|
||||
}
|
||||
fn set_appendix(_xcm: &Xcm<RuntimeCall>) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::set_appendix().ref_time()
|
||||
fn set_appendix(_xcm: &Xcm<RuntimeCall>) -> Weight {
|
||||
XcmGeneric::<Runtime>::set_appendix()
|
||||
}
|
||||
fn clear_error() -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::clear_error().ref_time()
|
||||
fn clear_error() -> Weight {
|
||||
XcmGeneric::<Runtime>::clear_error()
|
||||
}
|
||||
fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::claim_asset().ref_time()
|
||||
fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> Weight {
|
||||
XcmGeneric::<Runtime>::claim_asset()
|
||||
}
|
||||
fn trap(_code: &u64) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::trap().ref_time()
|
||||
fn trap(_code: &u64) -> Weight {
|
||||
XcmGeneric::<Runtime>::trap()
|
||||
}
|
||||
fn subscribe_version(_query_id: &QueryId, _max_response_weight: &u64) -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::subscribe_version().ref_time()
|
||||
fn subscribe_version(_query_id: &QueryId, _max_response_weight: &Weight) -> Weight {
|
||||
XcmGeneric::<Runtime>::subscribe_version()
|
||||
}
|
||||
fn unsubscribe_version() -> XCMWeight {
|
||||
XcmGeneric::<Runtime>::unsubscribe_version().ref_time()
|
||||
fn unsubscribe_version() -> Weight {
|
||||
XcmGeneric::<Runtime>::unsubscribe_version()
|
||||
}
|
||||
fn burn_asset(assets: &MultiAssets) -> Weight {
|
||||
assets.weigh_multi_assets(XcmGeneric::<Runtime>::burn_asset())
|
||||
}
|
||||
fn expect_asset(assets: &MultiAssets) -> Weight {
|
||||
assets.weigh_multi_assets(XcmGeneric::<Runtime>::expect_asset())
|
||||
}
|
||||
fn expect_origin(_origin: &Option<MultiLocation>) -> Weight {
|
||||
XcmGeneric::<Runtime>::expect_origin()
|
||||
}
|
||||
fn expect_error(_error: &Option<(u32, XcmError)>) -> Weight {
|
||||
XcmGeneric::<Runtime>::expect_error()
|
||||
}
|
||||
fn query_pallet(_module_name: &Vec<u8>, _response_info: &QueryResponseInfo) -> Weight {
|
||||
XcmGeneric::<Runtime>::query_pallet()
|
||||
}
|
||||
fn expect_pallet(
|
||||
_index: &u32,
|
||||
_name: &Vec<u8>,
|
||||
_module_name: &Vec<u8>,
|
||||
_crate_major: &u32,
|
||||
_min_crate_minor: &u32,
|
||||
) -> Weight {
|
||||
XcmGeneric::<Runtime>::expect_pallet()
|
||||
}
|
||||
fn report_transact_status(_response_info: &QueryResponseInfo) -> Weight {
|
||||
XcmGeneric::<Runtime>::report_transact_status()
|
||||
}
|
||||
fn clear_transact_status() -> Weight {
|
||||
XcmGeneric::<Runtime>::clear_transact_status()
|
||||
}
|
||||
fn universal_origin(_: &Junction) -> Weight {
|
||||
// Kusama does not currently support universal origin operations
|
||||
Weight::MAX
|
||||
}
|
||||
fn export_message(_: &NetworkId, _: &Junctions, _: &Xcm<()>) -> Weight {
|
||||
Weight::MAX // todo fix
|
||||
}
|
||||
fn lock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight {
|
||||
// Kusama does not currently support asset locking operations
|
||||
Weight::MAX
|
||||
}
|
||||
fn unlock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight {
|
||||
// Kusama does not currently support asset locking operations
|
||||
Weight::MAX
|
||||
}
|
||||
fn note_unlockable(_: &MultiAsset, _: &MultiLocation) -> Weight {
|
||||
// Kusama does not currently support asset locking operations
|
||||
Weight::MAX
|
||||
}
|
||||
fn request_unlock(_: &MultiAsset, _: &MultiLocation) -> Weight {
|
||||
// Kusama does not currently support asset locking operations
|
||||
Weight::MAX
|
||||
}
|
||||
fn set_fees_mode(_: &bool) -> Weight {
|
||||
XcmGeneric::<Runtime>::set_fees_mode()
|
||||
}
|
||||
fn set_topic(_topic: &[u8; 32]) -> Weight {
|
||||
XcmGeneric::<Runtime>::set_topic()
|
||||
}
|
||||
fn clear_topic() -> Weight {
|
||||
XcmGeneric::<Runtime>::clear_topic()
|
||||
}
|
||||
fn alias_origin(_: &MultiLocation) -> Weight {
|
||||
// XCM Executor does not currently support alias origin operations
|
||||
Weight::MAX
|
||||
}
|
||||
fn unpaid_execution(_: &WeightLimit, _: &Option<MultiLocation>) -> Weight {
|
||||
XcmGeneric::<Runtime>::unpaid_execution()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,12 +17,13 @@
|
||||
//! Autogenerated weights for `pallet_xcm_benchmarks::generic`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-03-08, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! DATE: 2022-04-18, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// target/production/polkadot
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=kusama-dev
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
@@ -48,89 +49,135 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
||||
// Storage: XcmPallet SupportedVersion (r:1 w:0)
|
||||
// Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: XcmPallet SafeXcmVersion (r:1 w:0)
|
||||
// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
||||
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||
pub(crate) fn query_holding() -> Weight {
|
||||
Weight::from_ref_time(21_822_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as u64))
|
||||
pub(crate) fn report_holding() -> Weight {
|
||||
Weight::from_ref_time(25_878_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(5 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as u64))
|
||||
}
|
||||
pub(crate) fn buy_execution() -> Weight {
|
||||
Weight::from_ref_time(3_109_000 as u64)
|
||||
Weight::from_ref_time(3_697_000 as u64)
|
||||
}
|
||||
// Storage: XcmPallet Queries (r:1 w:0)
|
||||
pub(crate) fn query_response() -> Weight {
|
||||
Weight::from_ref_time(12_087_000 as u64)
|
||||
Weight::from_ref_time(13_458_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as u64))
|
||||
}
|
||||
pub(crate) fn transact() -> Weight {
|
||||
Weight::from_ref_time(12_398_000 as u64)
|
||||
Weight::from_ref_time(13_597_000 as u64)
|
||||
}
|
||||
pub(crate) fn refund_surplus() -> Weight {
|
||||
Weight::from_ref_time(3_247_000 as u64)
|
||||
Weight::from_ref_time(3_839_000 as u64)
|
||||
}
|
||||
pub(crate) fn set_error_handler() -> Weight {
|
||||
Weight::from_ref_time(3_086_000 as u64)
|
||||
Weight::from_ref_time(3_657_000 as u64)
|
||||
}
|
||||
pub(crate) fn set_appendix() -> Weight {
|
||||
Weight::from_ref_time(3_112_000 as u64)
|
||||
Weight::from_ref_time(3_757_000 as u64)
|
||||
}
|
||||
pub(crate) fn clear_error() -> Weight {
|
||||
Weight::from_ref_time(3_118_000 as u64)
|
||||
Weight::from_ref_time(3_651_000 as u64)
|
||||
}
|
||||
pub(crate) fn descend_origin() -> Weight {
|
||||
Weight::from_ref_time(4_054_000 as u64)
|
||||
Weight::from_ref_time(4_589_000 as u64)
|
||||
}
|
||||
pub(crate) fn clear_origin() -> Weight {
|
||||
Weight::from_ref_time(3_111_000 as u64)
|
||||
Weight::from_ref_time(3_661_000 as u64)
|
||||
}
|
||||
// Storage: XcmPallet SupportedVersion (r:1 w:0)
|
||||
// Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: XcmPallet SafeXcmVersion (r:1 w:0)
|
||||
// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
||||
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||
pub(crate) fn report_error() -> Weight {
|
||||
Weight::from_ref_time(18_425_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as u64))
|
||||
Weight::from_ref_time(21_351_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(5 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as u64))
|
||||
}
|
||||
// Storage: XcmPallet AssetTraps (r:1 w:1)
|
||||
pub(crate) fn claim_asset() -> Weight {
|
||||
Weight::from_ref_time(7_144_000 as u64)
|
||||
Weight::from_ref_time(7_674_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(3_060_000 as u64)
|
||||
Weight::from_ref_time(3_606_000 as u64)
|
||||
}
|
||||
// Storage: XcmPallet VersionNotifyTargets (r:1 w:1)
|
||||
// Storage: XcmPallet SupportedVersion (r:1 w:0)
|
||||
// Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: XcmPallet SafeXcmVersion (r:1 w:0)
|
||||
// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
||||
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||
pub(crate) fn subscribe_version() -> Weight {
|
||||
Weight::from_ref_time(21_642_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(7 as u64))
|
||||
Weight::from_ref_time(30_453_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as u64))
|
||||
}
|
||||
// Storage: XcmPallet VersionNotifyTargets (r:0 w:1)
|
||||
pub(crate) fn unsubscribe_version() -> Weight {
|
||||
Weight::from_ref_time(4_873_000 as u64)
|
||||
Weight::from_ref_time(5_543_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().writes(1 as u64))
|
||||
}
|
||||
// Storage: XcmPallet SupportedVersion (r:1 w:0)
|
||||
// Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: XcmPallet SafeXcmVersion (r:1 w:0)
|
||||
// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
||||
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||
pub(crate) fn initiate_reserve_withdraw() -> Weight {
|
||||
Weight::from_ref_time(22_809_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(6 as u64))
|
||||
Weight::from_ref_time(25_464_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(5 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as u64))
|
||||
}
|
||||
pub(crate) fn burn_asset() -> Weight {
|
||||
Weight::from_ref_time(5_194_000 as u64)
|
||||
}
|
||||
pub(crate) fn expect_asset() -> Weight {
|
||||
Weight::from_ref_time(3_698_000 as u64)
|
||||
}
|
||||
pub(crate) fn expect_origin() -> Weight {
|
||||
Weight::from_ref_time(3_786_000 as u64)
|
||||
}
|
||||
pub(crate) fn expect_error() -> Weight {
|
||||
Weight::from_ref_time(3_645_000 as u64)
|
||||
}
|
||||
// Storage: XcmPallet SupportedVersion (r:1 w:0)
|
||||
// Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: XcmPallet SafeXcmVersion (r:1 w:0)
|
||||
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
||||
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||
pub(crate) fn query_pallet() -> Weight {
|
||||
Weight::from_ref_time(22_993_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(5 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as u64))
|
||||
}
|
||||
pub(crate) fn expect_pallet() -> Weight {
|
||||
Weight::from_ref_time(4_043_000 as u64)
|
||||
}
|
||||
// Storage: XcmPallet SupportedVersion (r:1 w:0)
|
||||
// Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1)
|
||||
// Storage: XcmPallet SafeXcmVersion (r:1 w:0)
|
||||
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
|
||||
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||
pub(crate) fn report_transact_status() -> Weight {
|
||||
Weight::from_ref_time(21_668_000 as u64)
|
||||
.saturating_add(T::DbWeight::get().reads(5 as u64))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as u64))
|
||||
}
|
||||
pub(crate) fn clear_transact_status() -> Weight {
|
||||
Weight::from_ref_time(3_673_000 as u64)
|
||||
}
|
||||
pub(crate) fn set_topic() -> Weight {
|
||||
Weight::from_ref_time(3_661_000 as u64)
|
||||
}
|
||||
pub(crate) fn clear_topic() -> Weight {
|
||||
Weight::from_ref_time(3_647_000 as u64)
|
||||
}
|
||||
pub(crate) fn set_fees_mode() -> Weight {
|
||||
Weight::from_ref_time(3_599_000 as u64)
|
||||
}
|
||||
pub(crate) fn unpaid_execution() -> Weight {
|
||||
Weight::from_ref_time(3_111_000 as u64)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,33 +17,44 @@
|
||||
//! XCM configurations for the Kusama runtime.
|
||||
|
||||
use super::{
|
||||
parachains_origin, AccountId, Balances, CouncilCollective, Fellows, ParaId, Runtime,
|
||||
RuntimeCall, RuntimeEvent, RuntimeOrigin, StakingAdmin, WeightToFee, XcmPallet,
|
||||
parachains_origin, AccountId, AllPalletsWithSystem, Balances, CouncilCollective, Fellows,
|
||||
ParaId, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, StakingAdmin, WeightToFee,
|
||||
XcmPallet,
|
||||
};
|
||||
use frame_support::{
|
||||
match_types, parameter_types,
|
||||
traits::{Contains, Everything, Nothing},
|
||||
weights::Weight,
|
||||
};
|
||||
use frame_support::{match_types, parameter_types, traits::Everything};
|
||||
use runtime_common::{xcm_sender, ToAuthor};
|
||||
use sp_core::ConstU32;
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_builder::{
|
||||
AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom,
|
||||
AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, BackingToPlurality,
|
||||
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
|
||||
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, BackingToPlurality,
|
||||
ChildParachainAsNative, ChildParachainConvertsVia, ChildSystemParachainAsSuperuser,
|
||||
CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsChildSystemParachain, IsConcrete,
|
||||
LocationInverter, OriginToPluralityVoice, SignedAccountId32AsNative, SignedToAccountId32,
|
||||
MintLocation, OriginToPluralityVoice, SignedAccountId32AsNative, SignedToAccountId32,
|
||||
SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WeightInfoBounds,
|
||||
WithComputedOrigin,
|
||||
};
|
||||
use xcm_executor::traits::WithOriginFilter;
|
||||
|
||||
parameter_types! {
|
||||
/// The location of the KSM token, from the context of this chain. Since this token is native to this
|
||||
/// chain, we make it synonymous with it and thus it is the `Here` location, which means "equivalent to
|
||||
/// the context".
|
||||
pub const KsmLocation: MultiLocation = Here.into();
|
||||
pub const TokenLocation: MultiLocation = Here.into_location();
|
||||
/// The Kusama network ID. This is named.
|
||||
pub const KusamaNetwork: NetworkId = NetworkId::Kusama;
|
||||
/// Our XCM location ancestry - i.e. what, if anything, `Parent` means evaluated in our context. Since
|
||||
/// Kusama is a top-level relay-chain, there is no ancestry.
|
||||
pub const Ancestry: MultiLocation = Here.into();
|
||||
pub const ThisNetwork: NetworkId = Kusama;
|
||||
/// Our XCM location ancestry - i.e. our location within the Consensus Universe.
|
||||
///
|
||||
/// Since Kusama is a top-level relay-chain with its own consensus, it's just our network ID.
|
||||
pub UniversalLocation: InteriorMultiLocation = ThisNetwork::get().into();
|
||||
/// The check account, which holds any native assets that have been teleported out and not back in (yet).
|
||||
pub CheckAccount: AccountId = XcmPallet::check_account();
|
||||
/// The check account that is allowed to mint assets locally.
|
||||
pub LocalCheckAccount: (AccountId, MintLocation) = (CheckAccount::get(), MintLocation::Local);
|
||||
}
|
||||
|
||||
/// The canonical means of converting a `MultiLocation` into an `AccountId`, used when we want to determine
|
||||
@@ -52,41 +63,41 @@ pub type SovereignAccountOf = (
|
||||
// We can convert a child parachain using the standard `AccountId` conversion.
|
||||
ChildParachainConvertsVia<ParaId, AccountId>,
|
||||
// We can directly alias an `AccountId32` into a local account.
|
||||
AccountId32Aliases<KusamaNetwork, AccountId>,
|
||||
AccountId32Aliases<ThisNetwork, AccountId>,
|
||||
);
|
||||
|
||||
/// Our asset transactor. This is what allows us to interest with the runtime facilities from the point of
|
||||
/// view of XCM-only concepts like `MultiLocation` and `MultiAsset`.
|
||||
///
|
||||
/// Ours is only aware of the Balances pallet, which is mapped to `KsmLocation`.
|
||||
/// Ours is only aware of the Balances pallet, which is mapped to `TokenLocation`.
|
||||
pub type LocalAssetTransactor = XcmCurrencyAdapter<
|
||||
// Use this currency:
|
||||
Balances,
|
||||
// Use this currency when it is a fungible asset matching the given location or name:
|
||||
IsConcrete<KsmLocation>,
|
||||
IsConcrete<TokenLocation>,
|
||||
// We can convert the MultiLocations with our converter above:
|
||||
SovereignAccountOf,
|
||||
// Our chain's account ID type (we can't get away without mentioning it explicitly):
|
||||
AccountId,
|
||||
// We track our teleports in/out to keep total issuance correct.
|
||||
CheckAccount,
|
||||
LocalCheckAccount,
|
||||
>;
|
||||
|
||||
/// The means that we convert an the XCM message origin location into a local dispatch origin.
|
||||
/// The means that we convert the XCM message origin location into a local dispatch origin.
|
||||
type LocalOriginConverter = (
|
||||
// A `Signed` origin of the sovereign account that the original location controls.
|
||||
SovereignSignedViaLocation<SovereignAccountOf, RuntimeOrigin>,
|
||||
// A child parachain, natively expressed, has the `Parachain` origin.
|
||||
ChildParachainAsNative<parachains_origin::Origin, RuntimeOrigin>,
|
||||
// The AccountId32 location type can be expressed natively as a `Signed` origin.
|
||||
SignedAccountId32AsNative<KusamaNetwork, RuntimeOrigin>,
|
||||
SignedAccountId32AsNative<ThisNetwork, RuntimeOrigin>,
|
||||
// A system child parachain, expressed as a Superuser, converts to the `Root` origin.
|
||||
ChildSystemParachainAsSuperuser<ParaId, RuntimeOrigin>,
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
/// The amount of weight an XCM operation takes. This is a safe overestimate.
|
||||
pub const BaseXcmWeight: u64 = 1_000_000_000;
|
||||
pub const BaseXcmWeight: Weight = Weight::from_parts(1_000_000_000, 64 * 1024);
|
||||
/// Maximum number of instructions in a single XCM fragment. A sanity check against weight
|
||||
/// calculations getting too crazy.
|
||||
pub const MaxInstructions: u32 = 100;
|
||||
@@ -96,18 +107,19 @@ parameter_types! {
|
||||
/// individual routers.
|
||||
pub type XcmRouter = (
|
||||
// Only one router so far - use DMP to communicate with child parachains.
|
||||
xcm_sender::ChildParachainRouter<Runtime, XcmPallet>,
|
||||
xcm_sender::ChildParachainRouter<Runtime, XcmPallet, ()>,
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
pub const Kusama: MultiAssetFilter = Wild(AllOf { fun: WildFungible, id: Concrete(KsmLocation::get()) });
|
||||
pub const Statemine: MultiLocation = Parachain(1000).into();
|
||||
pub const Encointer: MultiLocation = Parachain(1001).into();
|
||||
pub const KusamaForStatemine: (MultiAssetFilter, MultiLocation) = (Kusama::get(), Statemine::get());
|
||||
pub const KusamaForEncointer: (MultiAssetFilter, MultiLocation) = (Kusama::get(), Encointer::get());
|
||||
pub const Ksm: MultiAssetFilter = Wild(AllOf { fun: WildFungible, id: Concrete(TokenLocation::get()) });
|
||||
pub const Statemine: MultiLocation = Parachain(1000).into_location();
|
||||
pub const Encointer: MultiLocation = Parachain(1001).into_location();
|
||||
pub const KsmForStatemine: (MultiAssetFilter, MultiLocation) = (Ksm::get(), Statemine::get());
|
||||
pub const KsmForEncointer: (MultiAssetFilter, MultiLocation) = (Ksm::get(), Encointer::get());
|
||||
pub const MaxAssetsIntoHolding: u32 = 64;
|
||||
}
|
||||
pub type TrustedTeleporters =
|
||||
(xcm_builder::Case<KusamaForStatemine>, xcm_builder::Case<KusamaForEncointer>);
|
||||
(xcm_builder::Case<KsmForStatemine>, xcm_builder::Case<KsmForEncointer>);
|
||||
|
||||
match_types! {
|
||||
pub type OnlyParachains: impl Contains<MultiLocation> = {
|
||||
@@ -119,16 +131,209 @@ match_types! {
|
||||
pub type Barrier = (
|
||||
// Weight that is paid for may be consumed.
|
||||
TakeWeightCredit,
|
||||
// If the message is one that immediately attemps to pay for execution, then allow it.
|
||||
AllowTopLevelPaidExecutionFrom<Everything>,
|
||||
// Messages coming from system parachains need not pay for execution.
|
||||
AllowUnpaidExecutionFrom<IsChildSystemParachain<ParaId>>,
|
||||
// Expected responses are OK.
|
||||
AllowKnownQueryResponses<XcmPallet>,
|
||||
// Subscriptions for version tracking are OK.
|
||||
AllowSubscriptionsFrom<OnlyParachains>,
|
||||
WithComputedOrigin<
|
||||
(
|
||||
// If the message is one that immediately attempts to pay for execution, then allow it.
|
||||
AllowTopLevelPaidExecutionFrom<Everything>,
|
||||
// Messages coming from system parachains need not pay for execution.
|
||||
AllowExplicitUnpaidExecutionFrom<IsChildSystemParachain<ParaId>>,
|
||||
// Subscriptions for version tracking are OK.
|
||||
AllowSubscriptionsFrom<OnlyParachains>,
|
||||
),
|
||||
UniversalLocation,
|
||||
ConstU32<8>,
|
||||
>,
|
||||
);
|
||||
|
||||
/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly
|
||||
/// account for proof size weights.
|
||||
///
|
||||
/// Calls that are allowed through this filter must:
|
||||
/// 1. Have a fixed weight;
|
||||
/// 2. Cannot lead to another call being made;
|
||||
/// 3. Have a defined proof size weight, e.g. no unbounded vecs in call parameters.
|
||||
pub struct SafeCallFilter;
|
||||
impl Contains<RuntimeCall> for SafeCallFilter {
|
||||
fn contains(call: &RuntimeCall) -> bool {
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
{
|
||||
if matches!(call, RuntimeCall::System(frame_system::Call::remark_with_event { .. })) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
match call {
|
||||
RuntimeCall::System(
|
||||
frame_system::Call::kill_prefix { .. } | frame_system::Call::set_heap_pages { .. },
|
||||
) |
|
||||
RuntimeCall::Babe(..) |
|
||||
RuntimeCall::Timestamp(..) |
|
||||
RuntimeCall::Indices(..) |
|
||||
RuntimeCall::Balances(..) |
|
||||
RuntimeCall::Staking(
|
||||
pallet_staking::Call::bond { .. } |
|
||||
pallet_staking::Call::bond_extra { .. } |
|
||||
pallet_staking::Call::unbond { .. } |
|
||||
pallet_staking::Call::withdraw_unbonded { .. } |
|
||||
pallet_staking::Call::validate { .. } |
|
||||
pallet_staking::Call::nominate { .. } |
|
||||
pallet_staking::Call::chill { .. } |
|
||||
pallet_staking::Call::set_payee { .. } |
|
||||
pallet_staking::Call::set_controller { .. } |
|
||||
pallet_staking::Call::set_validator_count { .. } |
|
||||
pallet_staking::Call::increase_validator_count { .. } |
|
||||
pallet_staking::Call::scale_validator_count { .. } |
|
||||
pallet_staking::Call::force_no_eras { .. } |
|
||||
pallet_staking::Call::force_new_era { .. } |
|
||||
pallet_staking::Call::set_invulnerables { .. } |
|
||||
pallet_staking::Call::force_unstake { .. } |
|
||||
pallet_staking::Call::force_new_era_always { .. } |
|
||||
pallet_staking::Call::payout_stakers { .. } |
|
||||
pallet_staking::Call::rebond { .. } |
|
||||
pallet_staking::Call::reap_stash { .. } |
|
||||
pallet_staking::Call::set_staking_configs { .. } |
|
||||
pallet_staking::Call::chill_other { .. } |
|
||||
pallet_staking::Call::force_apply_min_commission { .. },
|
||||
) |
|
||||
RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
|
||||
RuntimeCall::Grandpa(..) |
|
||||
RuntimeCall::ImOnline(..) |
|
||||
RuntimeCall::Democracy(
|
||||
pallet_democracy::Call::second { .. } |
|
||||
pallet_democracy::Call::vote { .. } |
|
||||
pallet_democracy::Call::emergency_cancel { .. } |
|
||||
pallet_democracy::Call::fast_track { .. } |
|
||||
pallet_democracy::Call::veto_external { .. } |
|
||||
pallet_democracy::Call::cancel_referendum { .. } |
|
||||
pallet_democracy::Call::delegate { .. } |
|
||||
pallet_democracy::Call::undelegate { .. } |
|
||||
pallet_democracy::Call::clear_public_proposals { .. } |
|
||||
pallet_democracy::Call::unlock { .. } |
|
||||
pallet_democracy::Call::remove_vote { .. } |
|
||||
pallet_democracy::Call::remove_other_vote { .. } |
|
||||
pallet_democracy::Call::blacklist { .. } |
|
||||
pallet_democracy::Call::cancel_proposal { .. },
|
||||
) |
|
||||
RuntimeCall::Council(
|
||||
pallet_collective::Call::vote { .. } |
|
||||
pallet_collective::Call::close_old_weight { .. } |
|
||||
pallet_collective::Call::disapprove_proposal { .. } |
|
||||
pallet_collective::Call::close { .. },
|
||||
) |
|
||||
RuntimeCall::TechnicalCommittee(
|
||||
pallet_collective::Call::vote { .. } |
|
||||
pallet_collective::Call::close_old_weight { .. } |
|
||||
pallet_collective::Call::disapprove_proposal { .. } |
|
||||
pallet_collective::Call::close { .. },
|
||||
) |
|
||||
RuntimeCall::PhragmenElection(
|
||||
pallet_elections_phragmen::Call::remove_voter { .. } |
|
||||
pallet_elections_phragmen::Call::submit_candidacy { .. } |
|
||||
pallet_elections_phragmen::Call::renounce_candidacy { .. } |
|
||||
pallet_elections_phragmen::Call::remove_member { .. } |
|
||||
pallet_elections_phragmen::Call::clean_defunct_voters { .. },
|
||||
) |
|
||||
RuntimeCall::TechnicalMembership(
|
||||
pallet_membership::Call::add_member { .. } |
|
||||
pallet_membership::Call::remove_member { .. } |
|
||||
pallet_membership::Call::swap_member { .. } |
|
||||
pallet_membership::Call::change_key { .. } |
|
||||
pallet_membership::Call::set_prime { .. } |
|
||||
pallet_membership::Call::clear_prime { .. },
|
||||
) |
|
||||
RuntimeCall::Treasury(..) |
|
||||
RuntimeCall::ConvictionVoting(..) |
|
||||
RuntimeCall::Referenda(
|
||||
pallet_referenda::Call::place_decision_deposit { .. } |
|
||||
pallet_referenda::Call::refund_decision_deposit { .. } |
|
||||
pallet_referenda::Call::cancel { .. } |
|
||||
pallet_referenda::Call::kill { .. } |
|
||||
pallet_referenda::Call::nudge_referendum { .. } |
|
||||
pallet_referenda::Call::one_fewer_deciding { .. },
|
||||
) |
|
||||
RuntimeCall::FellowshipCollective(..) |
|
||||
RuntimeCall::FellowshipReferenda(
|
||||
pallet_referenda::Call::place_decision_deposit { .. } |
|
||||
pallet_referenda::Call::refund_decision_deposit { .. } |
|
||||
pallet_referenda::Call::cancel { .. } |
|
||||
pallet_referenda::Call::kill { .. } |
|
||||
pallet_referenda::Call::nudge_referendum { .. } |
|
||||
pallet_referenda::Call::one_fewer_deciding { .. },
|
||||
) |
|
||||
RuntimeCall::Claims(
|
||||
super::claims::Call::claim { .. } |
|
||||
super::claims::Call::mint_claim { .. } |
|
||||
super::claims::Call::move_claim { .. },
|
||||
) |
|
||||
RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) |
|
||||
RuntimeCall::Identity(
|
||||
pallet_identity::Call::add_registrar { .. } |
|
||||
pallet_identity::Call::set_identity { .. } |
|
||||
pallet_identity::Call::clear_identity { .. } |
|
||||
pallet_identity::Call::request_judgement { .. } |
|
||||
pallet_identity::Call::cancel_request { .. } |
|
||||
pallet_identity::Call::set_fee { .. } |
|
||||
pallet_identity::Call::set_account_id { .. } |
|
||||
pallet_identity::Call::set_fields { .. } |
|
||||
pallet_identity::Call::provide_judgement { .. } |
|
||||
pallet_identity::Call::kill_identity { .. } |
|
||||
pallet_identity::Call::add_sub { .. } |
|
||||
pallet_identity::Call::rename_sub { .. } |
|
||||
pallet_identity::Call::remove_sub { .. } |
|
||||
pallet_identity::Call::quit_sub { .. },
|
||||
) |
|
||||
RuntimeCall::Society(
|
||||
pallet_society::Call::bid { .. } |
|
||||
pallet_society::Call::unbid { .. } |
|
||||
pallet_society::Call::vouch { .. } |
|
||||
pallet_society::Call::unvouch { .. } |
|
||||
pallet_society::Call::vote { .. } |
|
||||
pallet_society::Call::defender_vote { .. } |
|
||||
pallet_society::Call::payout { .. } |
|
||||
pallet_society::Call::unfound { .. } |
|
||||
pallet_society::Call::judge_suspended_member { .. } |
|
||||
pallet_society::Call::judge_suspended_candidate { .. } |
|
||||
pallet_society::Call::set_max_members { .. },
|
||||
) |
|
||||
RuntimeCall::Recovery(..) |
|
||||
RuntimeCall::Vesting(..) |
|
||||
RuntimeCall::Bounties(
|
||||
pallet_bounties::Call::propose_bounty { .. } |
|
||||
pallet_bounties::Call::approve_bounty { .. } |
|
||||
pallet_bounties::Call::propose_curator { .. } |
|
||||
pallet_bounties::Call::unassign_curator { .. } |
|
||||
pallet_bounties::Call::accept_curator { .. } |
|
||||
pallet_bounties::Call::award_bounty { .. } |
|
||||
pallet_bounties::Call::claim_bounty { .. } |
|
||||
pallet_bounties::Call::close_bounty { .. },
|
||||
) |
|
||||
RuntimeCall::ChildBounties(..) |
|
||||
RuntimeCall::ElectionProviderMultiPhase(..) |
|
||||
RuntimeCall::VoterList(..) |
|
||||
RuntimeCall::NominationPools(
|
||||
pallet_nomination_pools::Call::join { .. } |
|
||||
pallet_nomination_pools::Call::bond_extra { .. } |
|
||||
pallet_nomination_pools::Call::claim_payout { .. } |
|
||||
pallet_nomination_pools::Call::unbond { .. } |
|
||||
pallet_nomination_pools::Call::pool_withdraw_unbonded { .. } |
|
||||
pallet_nomination_pools::Call::withdraw_unbonded { .. } |
|
||||
pallet_nomination_pools::Call::create { .. } |
|
||||
pallet_nomination_pools::Call::create_with_pool_id { .. } |
|
||||
pallet_nomination_pools::Call::set_state { .. } |
|
||||
pallet_nomination_pools::Call::set_configs { .. } |
|
||||
pallet_nomination_pools::Call::update_roles { .. } |
|
||||
pallet_nomination_pools::Call::chill { .. },
|
||||
) |
|
||||
RuntimeCall::XcmPallet(pallet_xcm::Call::limited_reserve_transfer_assets {
|
||||
..
|
||||
}) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct XcmConfig;
|
||||
impl xcm_executor::Config for XcmConfig {
|
||||
type RuntimeCall = RuntimeCall;
|
||||
@@ -137,7 +342,7 @@ impl xcm_executor::Config for XcmConfig {
|
||||
type OriginConverter = LocalOriginConverter;
|
||||
type IsReserve = ();
|
||||
type IsTeleporter = TrustedTeleporters;
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
type UniversalLocation = UniversalLocation;
|
||||
type Barrier = Barrier;
|
||||
type Weigher = WeightInfoBounds<
|
||||
crate::weights::xcm::KusamaXcmWeight<RuntimeCall>,
|
||||
@@ -145,11 +350,22 @@ impl xcm_executor::Config for XcmConfig {
|
||||
MaxInstructions,
|
||||
>;
|
||||
// The weight trader piggybacks on the existing transaction-fee conversion logic.
|
||||
type Trader = UsingComponents<WeightToFee, KsmLocation, AccountId, Balances, ToAuthor<Runtime>>;
|
||||
type Trader =
|
||||
UsingComponents<WeightToFee, TokenLocation, AccountId, Balances, ToAuthor<Runtime>>;
|
||||
type ResponseHandler = XcmPallet;
|
||||
type AssetTrap = XcmPallet;
|
||||
type AssetLocker = ();
|
||||
type AssetExchanger = ();
|
||||
type AssetClaims = XcmPallet;
|
||||
type SubscriptionService = XcmPallet;
|
||||
type PalletInstancesInfo = AllPalletsWithSystem;
|
||||
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
|
||||
type FeeManager = ();
|
||||
// No bridges yet...
|
||||
type MessageExporter = ();
|
||||
type UniversalAliases = Nothing;
|
||||
type CallDispatcher = WithOriginFilter<SafeCallFilter>;
|
||||
type SafeCallFilter = SafeCallFilter;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -160,6 +376,11 @@ parameter_types! {
|
||||
pub const FellowsBodyId: BodyId = BodyId::Technical;
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
parameter_types! {
|
||||
pub ReachableDest: Option<MultiLocation> = Some(Parachain(1000).into());
|
||||
}
|
||||
|
||||
/// Type to convert the council origin to a Plurality `MultiLocation` value.
|
||||
pub type CouncilToPlurality = BackingToPlurality<
|
||||
RuntimeOrigin,
|
||||
@@ -174,7 +395,7 @@ pub type LocalOriginToLocation = (
|
||||
// `Unit` body.
|
||||
CouncilToPlurality,
|
||||
// And a usual Signed origin to be used in XCM as a corresponding AccountId32
|
||||
SignedToAccountId32<RuntimeOrigin, AccountId, KusamaNetwork>,
|
||||
SignedToAccountId32<RuntimeOrigin, AccountId, ThisNetwork>,
|
||||
);
|
||||
|
||||
/// Type to convert the `StakingAdmin` origin to a Plurality `MultiLocation` value.
|
||||
@@ -214,9 +435,17 @@ impl pallet_xcm::Config for Runtime {
|
||||
// transfer.
|
||||
type XcmReserveTransferFilter = Everything;
|
||||
type Weigher = FixedWeightBounds<BaseXcmWeight, RuntimeCall, MaxInstructions>;
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
type UniversalLocation = UniversalLocation;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
|
||||
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
|
||||
type Currency = Balances;
|
||||
type CurrencyMatcher = ();
|
||||
type TrustedLockers = ();
|
||||
type SovereignAccountOf = SovereignAccountOf;
|
||||
type MaxLockers = ConstU32<8>;
|
||||
type WeightInfo = crate::weights::pallet_xcm::WeightInfo<Runtime>;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
type ReachableDest = ReachableDest;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user