[testnet] Add AssetHubRococo <-> AssetHubWestend asset bridging support (#1967)

## Summary

Asset bridging support for AssetHub**Rococo** <-> AssetHub**Wococo** was
added [here](https://github.com/paritytech/polkadot-sdk/pull/1215), so
now we aim to bridge AssetHub**Rococo** and AssetHub**Westend**. (And
perhaps retire AssetHubWococo and the Wococo chains).

## Solution

**bridge-hub-westend-runtime**
- added new runtime as a copy of `bridge-hub-rococo-runtime`
- added support for bridging to `BridgeHubRococo`
- added tests and benchmarks

**bridge-hub-rococo-runtime**
- added support for bridging to `BridgeHubWestend`
- added tests and benchmarks
- internal refactoring by splitting bridge configuration per network,
e.g., `bridge_to_whatevernetwork_config.rs`.

**asset-hub-rococo-runtime**
- added support for asset bridging to `AssetHubWestend` (allows to
receive only WNDs)
- added new xcm router for `Westend`
- added tests and benchmarks

**asset-hub-westend-runtime**
- added support for asset bridging to `AssetHubRococo` (allows to
receive only ROCs)
- added new xcm router for `Rococo`
- added tests and benchmarks

## Deployment

All changes will be deployed as a part of
https://github.com/paritytech/polkadot-sdk/issues/1988.

## TODO

- [x] benchmarks for all pallet instances
- [x] integration tests
- [x] local run scripts


Relates to:
https://github.com/paritytech/parity-bridges-common/issues/2602
Relates to: https://github.com/paritytech/polkadot-sdk/issues/1988

---------

Co-authored-by: command-bot <>
Co-authored-by: Adrian Catangiu <adrian@parity.io>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
This commit is contained in:
Branislav Kontur
2023-11-02 00:39:49 +01:00
committed by GitHub
parent c66ae375e6
commit 1b1fab0da3
112 changed files with 10028 additions and 1638 deletions
@@ -83,6 +83,7 @@ assets-common = { path = "../common", default-features = false }
# Bridges
pallet-xcm-bridge-hub-router = { path = "../../../../../bridges/modules/xcm-bridge-hub-router", default-features = false }
bp-asset-hub-rococo = { path = "../../../../../bridges/primitives/chain-asset-hub-rococo", default-features = false }
bp-asset-hub-westend = { path = "../../../../../bridges/primitives/chain-asset-hub-westend", default-features = false }
bp-asset-hub-wococo = { path = "../../../../../bridges/primitives/chain-asset-hub-wococo", default-features = false }
bp-bridge-hub-rococo = { path = "../../../../../bridges/primitives/chain-bridge-hub-rococo", default-features = false }
bp-bridge-hub-wococo = { path = "../../../../../bridges/primitives/chain-bridge-hub-wococo", default-features = false }
@@ -171,6 +172,7 @@ try-runtime = [
std = [
"assets-common/std",
"bp-asset-hub-rococo/std",
"bp-asset-hub-westend/std",
"bp-asset-hub-wococo/std",
"bp-bridge-hub-rococo/std",
"bp-bridge-hub-wococo/std",
@@ -123,7 +123,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("statemine"),
impl_name: create_runtime_str!("statemine"),
authoring_version: 1,
spec_version: 10006,
spec_version: 1_003_000,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 13,
@@ -136,7 +136,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("statemine"),
impl_name: create_runtime_str!("statemine"),
authoring_version: 1,
spec_version: 10006,
spec_version: 1_003_000,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 13,
@@ -833,7 +833,7 @@ impl pallet_nfts::Config for Runtime {
/// XCM router instance to BridgeHub with bridging capabilities for `Wococo` global
/// consensus with dynamic fees and back-pressure.
pub type ToWococoXcmRouterInstance = pallet_assets::Instance1;
pub type ToWococoXcmRouterInstance = pallet_xcm_bridge_hub_router::Instance1;
impl pallet_xcm_bridge_hub_router::Config<ToWococoXcmRouterInstance> for Runtime {
type WeightInfo = weights::pallet_xcm_bridge_hub_router_to_wococo::WeightInfo<Runtime>;
@@ -864,7 +864,7 @@ impl pallet_xcm_bridge_hub_router::Config<ToWococoXcmRouterInstance> for Runtime
/// XCM router instance to BridgeHub with bridging capabilities for `Rococo` global
/// consensus with dynamic fees and back-pressure.
pub type ToRococoXcmRouterInstance = pallet_assets::Instance2;
pub type ToRococoXcmRouterInstance = pallet_xcm_bridge_hub_router::Instance2;
impl pallet_xcm_bridge_hub_router::Config<ToRococoXcmRouterInstance> for Runtime {
type WeightInfo = weights::pallet_xcm_bridge_hub_router_to_rococo::WeightInfo<Runtime>;
@@ -893,6 +893,37 @@ impl pallet_xcm_bridge_hub_router::Config<ToRococoXcmRouterInstance> for Runtime
type FeeAsset = xcm_config::bridging::XcmBridgeHubRouterFeeAssetId;
}
/// XCM router instance to BridgeHub with bridging capabilities for `Westend` global
/// consensus with dynamic fees and back-pressure.
pub type ToWestendXcmRouterInstance = pallet_xcm_bridge_hub_router::Instance3;
impl pallet_xcm_bridge_hub_router::Config<ToWestendXcmRouterInstance> for Runtime {
type WeightInfo = weights::pallet_xcm_bridge_hub_router_to_westend::WeightInfo<Runtime>;
type UniversalLocation = xcm_config::UniversalLocation;
type BridgedNetworkId = xcm_config::bridging::to_westend::WestendNetwork;
type Bridges = xcm_config::bridging::NetworkExportTable;
#[cfg(not(feature = "runtime-benchmarks"))]
type BridgeHubOrigin = EnsureXcm<Equals<xcm_config::bridging::SiblingBridgeHub>>;
#[cfg(feature = "runtime-benchmarks")]
type BridgeHubOrigin = EitherOfDiverse<
// for running benchmarks
EnsureRoot<AccountId>,
// for running tests with `--feature runtime-benchmarks`
EnsureXcm<Equals<xcm_config::bridging::SiblingBridgeHub>>,
>;
type ToBridgeHubSender = XcmpQueue;
type WithBridgeHubChannel =
cumulus_pallet_xcmp_queue::bridging::InAndOutXcmpChannelStatusProvider<
xcm_config::bridging::SiblingBridgeHubParaId,
Runtime,
>;
type ByteFee = xcm_config::bridging::XcmBridgeHubRouterByteFee;
type FeeAsset = xcm_config::bridging::XcmBridgeHubRouterFeeAssetId;
}
// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
pub enum Runtime
@@ -931,6 +962,7 @@ construct_runtime!(
// Bridge utilities.
ToWococoXcmRouter: pallet_xcm_bridge_hub_router::<Instance1>::{Pallet, Storage, Call} = 43,
ToRococoXcmRouter: pallet_xcm_bridge_hub_router::<Instance2>::{Pallet, Storage, Call} = 44,
ToWestendXcmRouter: pallet_xcm_bridge_hub_router::<Instance3>::{Pallet, Storage, Call} = 45,
// The main stage.
Assets: pallet_assets::<Instance1>::{Pallet, Call, Storage, Event<T>} = 50,
@@ -1006,6 +1038,7 @@ mod benches {
[pallet_collator_selection, CollatorSelection]
[cumulus_pallet_xcmp_queue, XcmpQueue]
[pallet_xcm_bridge_hub_router, ToWococo]
[pallet_xcm_bridge_hub_router, ToWestend]
[pallet_xcm_bridge_hub_router, ToRococo]
// XCM
[pallet_xcm, PolkadotXcm]
@@ -1263,6 +1296,7 @@ impl_runtime_apis! {
type Pool = pallet_assets::Pallet::<Runtime, PoolAssetsInstance>;
type ToWococo = XcmBridgeHubRouterBench<Runtime, ToWococoXcmRouterInstance>;
type ToWestend = XcmBridgeHubRouterBench<Runtime, ToWestendXcmRouterInstance>;
type ToRococo = XcmBridgeHubRouterBench<Runtime, ToRococoXcmRouterInstance>;
let mut list = Vec::<BenchmarkList>::new();
@@ -1311,6 +1345,19 @@ impl_runtime_apis! {
xcm_config::bridging::to_wococo::AssetHubWococo::get()
}
}
impl XcmBridgeHubRouterConfig<ToWestendXcmRouterInstance> for Runtime {
fn make_congested() {
cumulus_pallet_xcmp_queue::bridging::suspend_channel_for_benchmarks::<Runtime>(
xcm_config::bridging::SiblingBridgeHubParaId::get().into()
);
}
fn ensure_bridged_target_destination() -> MultiLocation {
ParachainSystem::open_outbound_hrmp_channel_for_benchmarks_or_tests(
xcm_config::bridging::SiblingBridgeHubParaId::get().into()
);
xcm_config::bridging::to_westend::AssetHubWestend::get()
}
}
impl XcmBridgeHubRouterConfig<ToRococoXcmRouterInstance> for Runtime {
fn make_congested() {
cumulus_pallet_xcmp_queue::bridging::suspend_channel_for_benchmarks::<Runtime>(
@@ -1461,6 +1508,7 @@ impl_runtime_apis! {
type Pool = pallet_assets::Pallet::<Runtime, PoolAssetsInstance>;
type ToWococo = XcmBridgeHubRouterBench<Runtime, ToWococoXcmRouterInstance>;
type ToWestend = XcmBridgeHubRouterBench<Runtime, ToWestendXcmRouterInstance>;
type ToRococo = XcmBridgeHubRouterBench<Runtime, ToRococoXcmRouterInstance>;
let whitelist: Vec<TrackedStorageKey> = vec![
@@ -34,6 +34,7 @@ pub mod pallet_uniques;
pub mod pallet_utility;
pub mod pallet_xcm;
pub mod pallet_xcm_bridge_hub_router_to_rococo;
pub mod pallet_xcm_bridge_hub_router_to_westend;
pub mod pallet_xcm_bridge_hub_router_to_wococo;
pub mod paritydb_weights;
pub mod rocksdb_weights;
@@ -17,9 +17,9 @@
//! Autogenerated weights for `pallet_xcm_bridge_hub_router`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-09-19, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2023-10-26, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-guclnr1q-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-vmdtonbz-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
@@ -50,34 +50,36 @@ pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_xcm_bridge_hub_router::WeightInfo for WeightInfo<T> {
/// Storage: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0)
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `XcmpQueue::InboundXcmpStatus` (r:1 w:0)
/// Proof: `XcmpQueue::InboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0)
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ToRococoXcmRouter::Bridge` (r:1 w:1)
/// Proof: `ToRococoXcmRouter::Bridge` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
fn on_initialize_when_non_congested() -> Weight {
// Proof Size summary in bytes:
// Measured: `232`
// Estimated: `3697`
// Minimum execution time: 10_861_000 picoseconds.
Weight::from_parts(11_253_000, 0)
.saturating_add(Weight::from_parts(0, 3697))
// Measured: `265`
// Estimated: `3730`
// Minimum execution time: 9_084_000 picoseconds.
Weight::from_parts(9_441_000, 0)
.saturating_add(Weight::from_parts(0, 3730))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Storage: `XcmpQueue::InboundXcmpStatus` (r:1 w:0)
/// Proof: `XcmpQueue::InboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0)
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
fn on_initialize_when_congested() -> Weight {
// Proof Size summary in bytes:
// Measured: `169`
// Estimated: `3634`
// Minimum execution time: 5_807_000 picoseconds.
Weight::from_parts(6_018_000, 0)
.saturating_add(Weight::from_parts(0, 3634))
.saturating_add(T::DbWeight::get().reads(2))
// Measured: `202`
// Estimated: `3667`
// Minimum execution time: 5_971_000 picoseconds.
Weight::from_parts(6_260_000, 0)
.saturating_add(Weight::from_parts(0, 3667))
.saturating_add(T::DbWeight::get().reads(3))
}
/// Storage: `ToRococoXcmRouter::Bridge` (r:1 w:1)
/// Proof: `ToRococoXcmRouter::Bridge` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
@@ -85,8 +87,8 @@ impl<T: frame_system::Config> pallet_xcm_bridge_hub_router::WeightInfo for Weigh
// Proof Size summary in bytes:
// Measured: `117`
// Estimated: `1502`
// Minimum execution time: 11_479_000 picoseconds.
Weight::from_parts(11_831_000, 0)
// Minimum execution time: 10_231_000 picoseconds.
Weight::from_parts(10_861_000, 0)
.saturating_add(Weight::from_parts(0, 1502))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -99,6 +101,8 @@ impl<T: frame_system::Config> pallet_xcm_bridge_hub_router::WeightInfo for Weigh
/// Proof: UNKNOWN KEY `0x0973fe64c85043ba1c965cbc38eb63c7` (r:1 w:0)
/// Storage: `ToRococoXcmRouter::Bridge` (r:1 w:1)
/// Proof: `ToRococoXcmRouter::Bridge` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
/// Storage: `XcmpQueue::DeliveryFeeFactor` (r:1 w:0)
/// Proof: `XcmpQueue::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
@@ -109,16 +113,18 @@ impl<T: frame_system::Config> pallet_xcm_bridge_hub_router::WeightInfo for Weigh
/// Proof: `ParachainSystem::RelevantMessagingState` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1)
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `XcmpQueue::InboundXcmpStatus` (r:1 w:0)
/// Proof: `XcmpQueue::InboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1)
/// Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn send_message() -> Weight {
// Proof Size summary in bytes:
// Measured: `445`
// Estimated: `3910`
// Minimum execution time: 52_670_000 picoseconds.
Weight::from_parts(54_368_000, 0)
.saturating_add(Weight::from_parts(0, 3910))
.saturating_add(T::DbWeight::get().reads(9))
// Measured: `478`
// Estimated: `3943`
// Minimum execution time: 53_966_000 picoseconds.
Weight::from_parts(55_224_000, 0)
.saturating_add(Weight::from_parts(0, 3943))
.saturating_add(T::DbWeight::get().reads(11))
.saturating_add(T::DbWeight::get().writes(4))
}
}
@@ -0,0 +1,130 @@
// Copyright (C) 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_bridge_hub_router`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-10-26, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-vmdtonbz-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
// target/production/polkadot-parachain
// benchmark
// pallet
// --steps=50
// --repeat=20
// --extrinsic=*
// --wasm-execution=compiled
// --heap-pages=4096
// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json
// --pallet=pallet_xcm_bridge_hub_router
// --chain=asset-hub-rococo-dev
// --header=./cumulus/file_header.txt
// --output=./cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `pallet_xcm_bridge_hub_router`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_xcm_bridge_hub_router::WeightInfo for WeightInfo<T> {
/// Storage: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Storage: `XcmpQueue::InboundXcmpStatus` (r:1 w:0)
/// Proof: `XcmpQueue::InboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0)
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ToWestendXcmRouter::Bridge` (r:1 w:1)
/// Proof: `ToWestendXcmRouter::Bridge` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
fn on_initialize_when_non_congested() -> Weight {
// Proof Size summary in bytes:
// Measured: `193`
// Estimated: `3658`
// Minimum execution time: 8_528_000 picoseconds.
Weight::from_parts(8_886_000, 0)
.saturating_add(Weight::from_parts(0, 3658))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Storage: `XcmpQueue::InboundXcmpStatus` (r:1 w:0)
/// Proof: `XcmpQueue::InboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0)
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
fn on_initialize_when_congested() -> Weight {
// Proof Size summary in bytes:
// Measured: `183`
// Estimated: `3648`
// Minimum execution time: 5_170_000 picoseconds.
Weight::from_parts(5_433_000, 0)
.saturating_add(Weight::from_parts(0, 3648))
.saturating_add(T::DbWeight::get().reads(3))
}
/// Storage: `ToWestendXcmRouter::Bridge` (r:1 w:1)
/// Proof: `ToWestendXcmRouter::Bridge` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
fn report_bridge_status() -> Weight {
// Proof Size summary in bytes:
// Measured: `150`
// Estimated: `1502`
// Minimum execution time: 10_283_000 picoseconds.
Weight::from_parts(10_762_000, 0)
.saturating_add(Weight::from_parts(0, 1502))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
/// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: UNKNOWN KEY `0x0973fe64c85043ba1c965cbc38eb63c7` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x0973fe64c85043ba1c965cbc38eb63c7` (r:1 w:0)
/// Storage: `ToWestendXcmRouter::Bridge` (r:1 w:1)
/// Proof: `ToWestendXcmRouter::Bridge` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
/// Storage: `XcmpQueue::DeliveryFeeFactor` (r:1 w:0)
/// Proof: `XcmpQueue::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
/// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::RelevantMessagingState` (r:1 w:0)
/// Proof: `ParachainSystem::RelevantMessagingState` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1)
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `XcmpQueue::InboundXcmpStatus` (r:1 w:0)
/// Proof: `XcmpQueue::InboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1)
/// Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn send_message() -> Weight {
// Proof Size summary in bytes:
// Measured: `387`
// Estimated: `3852`
// Minimum execution time: 52_040_000 picoseconds.
Weight::from_parts(53_500_000, 0)
.saturating_add(Weight::from_parts(0, 3852))
.saturating_add(T::DbWeight::get().reads(11))
.saturating_add(T::DbWeight::get().writes(4))
}
}
@@ -17,9 +17,9 @@
//! Autogenerated weights for `pallet_xcm_bridge_hub_router`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-09-19, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2023-10-26, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-guclnr1q-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-vmdtonbz-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
@@ -50,34 +50,36 @@ pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_xcm_bridge_hub_router::WeightInfo for WeightInfo<T> {
/// Storage: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0)
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `XcmpQueue::InboundXcmpStatus` (r:1 w:0)
/// Proof: `XcmpQueue::InboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0)
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ToWococoXcmRouter::Bridge` (r:1 w:1)
/// Proof: `ToWococoXcmRouter::Bridge` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
fn on_initialize_when_non_congested() -> Weight {
// Proof Size summary in bytes:
// Measured: `198`
// Estimated: `3663`
// Minimum execution time: 10_936_000 picoseconds.
Weight::from_parts(11_432_000, 0)
.saturating_add(Weight::from_parts(0, 3663))
// Measured: `231`
// Estimated: `3696`
// Minimum execution time: 9_115_000 picoseconds.
Weight::from_parts(9_522_000, 0)
.saturating_add(Weight::from_parts(0, 3696))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Storage: `XcmpQueue::InboundXcmpStatus` (r:1 w:0)
/// Proof: `XcmpQueue::InboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0)
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
fn on_initialize_when_congested() -> Weight {
// Proof Size summary in bytes:
// Measured: `150`
// Estimated: `3615`
// Minimum execution time: 5_165_000 picoseconds.
Weight::from_parts(5_356_000, 0)
.saturating_add(Weight::from_parts(0, 3615))
.saturating_add(T::DbWeight::get().reads(2))
// Measured: `183`
// Estimated: `3648`
// Minimum execution time: 5_207_000 picoseconds.
Weight::from_parts(5_534_000, 0)
.saturating_add(Weight::from_parts(0, 3648))
.saturating_add(T::DbWeight::get().reads(3))
}
/// Storage: `ToWococoXcmRouter::Bridge` (r:1 w:1)
/// Proof: `ToWococoXcmRouter::Bridge` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
@@ -85,8 +87,8 @@ impl<T: frame_system::Config> pallet_xcm_bridge_hub_router::WeightInfo for Weigh
// Proof Size summary in bytes:
// Measured: `83`
// Estimated: `1502`
// Minimum execution time: 11_420_000 picoseconds.
Weight::from_parts(11_946_000, 0)
// Minimum execution time: 10_437_000 picoseconds.
Weight::from_parts(10_956_000, 0)
.saturating_add(Weight::from_parts(0, 1502))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@@ -99,6 +101,8 @@ impl<T: frame_system::Config> pallet_xcm_bridge_hub_router::WeightInfo for Weigh
/// Proof: UNKNOWN KEY `0x0973fe64c85043ba1c965cbc38eb63c7` (r:1 w:0)
/// Storage: `ToWococoXcmRouter::Bridge` (r:1 w:1)
/// Proof: `ToWococoXcmRouter::Bridge` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
/// Storage: `XcmpQueue::DeliveryFeeFactor` (r:1 w:0)
/// Proof: `XcmpQueue::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
@@ -109,16 +113,18 @@ impl<T: frame_system::Config> pallet_xcm_bridge_hub_router::WeightInfo for Weigh
/// Proof: `ParachainSystem::RelevantMessagingState` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1)
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `XcmpQueue::InboundXcmpStatus` (r:1 w:0)
/// Proof: `XcmpQueue::InboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1)
/// Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn send_message() -> Weight {
// Proof Size summary in bytes:
// Measured: `392`
// Estimated: `3857`
// Minimum execution time: 52_129_000 picoseconds.
Weight::from_parts(53_552_000, 0)
.saturating_add(Weight::from_parts(0, 3857))
.saturating_add(T::DbWeight::get().reads(9))
// Measured: `425`
// Estimated: `3890`
// Minimum execution time: 52_176_000 picoseconds.
Weight::from_parts(54_067_000, 0)
.saturating_add(Weight::from_parts(0, 3890))
.saturating_add(T::DbWeight::get().reads(11))
.saturating_add(T::DbWeight::get().writes(4))
}
}
@@ -17,9 +17,9 @@
//! Autogenerated weights for `pallet_xcm_benchmarks::fungible`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-10-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2023-10-26, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-ayothjw6-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-vmdtonbz-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: Compiled, CHAIN: Some("asset-hub-rococo-dev"), DB CACHE: 1024
// Executed Command:
@@ -54,8 +54,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `101`
// Estimated: `3593`
// Minimum execution time: 20_408_000 picoseconds.
Weight::from_parts(21_066_000, 3593)
// Minimum execution time: 20_940_000 picoseconds.
Weight::from_parts(21_453_000, 3593)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@@ -65,8 +65,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `101`
// Estimated: `6196`
// Minimum execution time: 42_449_000 picoseconds.
Weight::from_parts(43_065_000, 6196)
// Minimum execution time: 44_310_000 picoseconds.
Weight::from_parts(44_948_000, 6196)
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
@@ -92,8 +92,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `246`
// Estimated: `8799`
// Minimum execution time: 85_637_000 picoseconds.
Weight::from_parts(86_550_000, 8799)
// Minimum execution time: 87_226_000 picoseconds.
Weight::from_parts(89_399_000, 8799)
.saturating_add(T::DbWeight::get().reads(11))
.saturating_add(T::DbWeight::get().writes(5))
}
@@ -105,8 +105,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `39`
// Estimated: `3504`
// Minimum execution time: 7_006_000 picoseconds.
Weight::from_parts(7_185_000, 3504)
// Minimum execution time: 7_320_000 picoseconds.
Weight::from_parts(7_453_000, 3504)
.saturating_add(T::DbWeight::get().reads(2))
}
// Storage: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
@@ -131,8 +131,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `246`
// Estimated: `6196`
// Minimum execution time: 185_307_000 picoseconds.
Weight::from_parts(189_716_000, 6196)
// Minimum execution time: 183_539_000 picoseconds.
Weight::from_parts(190_968_000, 6196)
.saturating_add(T::DbWeight::get().reads(10))
.saturating_add(T::DbWeight::get().writes(4))
}
@@ -140,8 +140,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_934_000 picoseconds.
Weight::from_parts(3_078_000, 0)
// Minimum execution time: 3_068_000 picoseconds.
Weight::from_parts(3_228_000, 0)
}
// Storage: `System::Account` (r:1 w:1)
// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
@@ -149,8 +149,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 18_701_000 picoseconds.
Weight::from_parts(19_221_000, 3593)
// Minimum execution time: 18_788_000 picoseconds.
Weight::from_parts(19_240_000, 3593)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@@ -176,8 +176,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `145`
// Estimated: `6196`
// Minimum execution time: 57_182_000 picoseconds.
Weight::from_parts(58_877_000, 6196)
// Minimum execution time: 58_577_000 picoseconds.
Weight::from_parts(59_729_000, 6196)
.saturating_add(T::DbWeight::get().reads(10))
.saturating_add(T::DbWeight::get().writes(4))
}
@@ -203,8 +203,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `145`
// Estimated: `3610`
// Minimum execution time: 45_073_000 picoseconds.
Weight::from_parts(45_927_000, 3610)
// Minimum execution time: 45_804_000 picoseconds.
Weight::from_parts(46_702_000, 3610)
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(3))
}
@@ -17,28 +17,26 @@
//! Autogenerated weights for `pallet_xcm_benchmarks::generic`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2023-10-26, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("asset-hub-rococo-dev"), DB CACHE: 1024
//! HOSTNAME: `runner-vmdtonbz-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: Compiled, CHAIN: Some("asset-hub-rococo-dev"), DB CACHE: 1024
// Executed Command:
// ./target/production/polkadot-parachain
// target/production/polkadot-parachain
// benchmark
// pallet
// --template=./templates/xcm-bench-template.hbs
// --chain=asset-hub-rococo-dev
// --wasm-execution=compiled
// --pallet=pallet_xcm_benchmarks::generic
// --no-storage-info
// --no-median-slopes
// --no-min-squares
// --extrinsic=*
// --steps=50
// --repeat=20
// --json
// --header=./file_header.txt
// --output=./parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs
// --extrinsic=*
// --wasm-execution=compiled
// --heap-pages=4096
// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json
// --pallet=pallet_xcm_benchmarks::generic
// --chain=asset-hub-rococo-dev
// --header=./cumulus/file_header.txt
// --template=./cumulus/templates/xcm-bench-template.hbs
// --output=./cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
@@ -50,33 +48,39 @@ 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: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
// Proof: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
// Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0)
// Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `System::Account` (r:2 w:2)
// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
pub fn report_holding() -> Weight {
// Proof Size summary in bytes:
// Measured: `109`
// Estimated: `3574`
// Minimum execution time: 432_196_000 picoseconds.
Weight::from_parts(438_017_000, 3574)
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(2))
// Measured: `246`
// Estimated: `6196`
// Minimum execution time: 415_688_000 picoseconds.
Weight::from_parts(433_876_000, 6196)
.saturating_add(T::DbWeight::get().reads(10))
.saturating_add(T::DbWeight::get().writes(4))
}
pub fn buy_execution() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 4_223_000 picoseconds.
Weight::from_parts(4_412_000, 0)
// Minimum execution time: 3_209_000 picoseconds.
Weight::from_parts(3_465_000, 0)
}
// Storage: `PolkadotXcm::Queries` (r:1 w:0)
// Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`)
@@ -84,79 +88,85 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `3568`
// Minimum execution time: 11_582_000 picoseconds.
Weight::from_parts(11_830_000, 3568)
// Minimum execution time: 7_940_000 picoseconds.
Weight::from_parts(8_208_000, 3568)
.saturating_add(T::DbWeight::get().reads(1))
}
pub fn transact() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 13_955_000 picoseconds.
Weight::from_parts(14_320_000, 0)
// Minimum execution time: 9_336_000 picoseconds.
Weight::from_parts(9_733_000, 0)
}
pub fn refund_surplus() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 4_423_000 picoseconds.
Weight::from_parts(4_709_000, 0)
// Minimum execution time: 3_368_000 picoseconds.
Weight::from_parts(3_700_000, 0)
}
pub fn set_error_handler() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_028_000 picoseconds.
Weight::from_parts(3_151_000, 0)
// Minimum execution time: 1_868_000 picoseconds.
Weight::from_parts(2_034_000, 0)
}
pub fn set_appendix() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_966_000 picoseconds.
Weight::from_parts(3_076_000, 0)
// Minimum execution time: 1_870_000 picoseconds.
Weight::from_parts(1_972_000, 0)
}
pub fn clear_error() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_971_000 picoseconds.
Weight::from_parts(3_119_000, 0)
// Minimum execution time: 1_890_000 picoseconds.
Weight::from_parts(1_962_000, 0)
}
pub fn descend_origin() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_772_000 picoseconds.
Weight::from_parts(3_853_000, 0)
// Minimum execution time: 2_660_000 picoseconds.
Weight::from_parts(2_744_000, 0)
}
pub fn clear_origin() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_940_000 picoseconds.
Weight::from_parts(3_050_000, 0)
// Minimum execution time: 1_845_000 picoseconds.
Weight::from_parts(1_945_000, 0)
}
// Storage: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
// Proof: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
// Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0)
// Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `System::Account` (r:2 w:2)
// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
pub fn report_error() -> Weight {
// Proof Size summary in bytes:
// Measured: `109`
// Estimated: `3574`
// Minimum execution time: 27_734_000 picoseconds.
Weight::from_parts(28_351_000, 3574)
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(2))
// Measured: `246`
// Estimated: `6196`
// Minimum execution time: 54_283_000 picoseconds.
Weight::from_parts(54_969_000, 6196)
.saturating_add(T::DbWeight::get().reads(10))
.saturating_add(T::DbWeight::get().writes(4))
}
// Storage: `PolkadotXcm::AssetTraps` (r:1 w:1)
// Proof: `PolkadotXcm::AssetTraps` (`max_values`: None, `max_size`: None, mode: `Measured`)
@@ -164,8 +174,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `160`
// Estimated: `3625`
// Minimum execution time: 16_456_000 picoseconds.
Weight::from_parts(16_846_000, 3625)
// Minimum execution time: 11_850_000 picoseconds.
Weight::from_parts(12_328_000, 3625)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@@ -173,11 +183,13 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_974_000 picoseconds.
Weight::from_parts(3_108_000, 0)
// Minimum execution time: 1_891_000 picoseconds.
Weight::from_parts(1_950_000, 0)
}
// Storage: `PolkadotXcm::VersionNotifyTargets` (r:1 w:1)
// Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0)
// Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
@@ -190,11 +202,11 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
pub fn subscribe_version() -> Weight {
// Proof Size summary in bytes:
// Measured: `109`
// Estimated: `3574`
// Minimum execution time: 29_823_000 picoseconds.
Weight::from_parts(30_776_000, 3574)
.saturating_add(T::DbWeight::get().reads(6))
// Measured: `145`
// Estimated: `3610`
// Minimum execution time: 23_644_000 picoseconds.
Weight::from_parts(24_296_000, 3610)
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(3))
}
// Storage: `PolkadotXcm::VersionNotifyTargets` (r:0 w:1)
@@ -203,137 +215,151 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 4_966_000 picoseconds.
Weight::from_parts(5_157_000, 0)
// Minimum execution time: 3_719_000 picoseconds.
Weight::from_parts(3_896_000, 0)
.saturating_add(T::DbWeight::get().writes(1))
}
pub fn burn_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 141_875_000 picoseconds.
Weight::from_parts(144_925_000, 0)
// Minimum execution time: 125_710_000 picoseconds.
Weight::from_parts(132_434_000, 0)
}
pub fn expect_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 13_147_000 picoseconds.
Weight::from_parts(13_420_000, 0)
// Minimum execution time: 11_650_000 picoseconds.
Weight::from_parts(12_277_000, 0)
}
pub fn expect_origin() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_050_000 picoseconds.
Weight::from_parts(3_161_000, 0)
// Minimum execution time: 1_978_000 picoseconds.
Weight::from_parts(2_070_000, 0)
}
pub fn expect_error() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_930_000 picoseconds.
Weight::from_parts(3_077_000, 0)
// Minimum execution time: 1_899_000 picoseconds.
Weight::from_parts(2_002_000, 0)
}
pub fn expect_transact_status() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_188_000 picoseconds.
Weight::from_parts(3_299_000, 0)
// Minimum execution time: 2_133_000 picoseconds.
Weight::from_parts(2_194_000, 0)
}
// Storage: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
// Proof: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
// Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0)
// Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `System::Account` (r:2 w:2)
// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
pub fn query_pallet() -> Weight {
// Proof Size summary in bytes:
// Measured: `109`
// Estimated: `3574`
// Minimum execution time: 31_678_000 picoseconds.
Weight::from_parts(32_462_000, 3574)
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(2))
// Measured: `246`
// Estimated: `6196`
// Minimum execution time: 58_644_000 picoseconds.
Weight::from_parts(60_614_000, 6196)
.saturating_add(T::DbWeight::get().reads(10))
.saturating_add(T::DbWeight::get().writes(4))
}
pub fn expect_pallet() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 5_638_000 picoseconds.
Weight::from_parts(5_756_000, 0)
// Minimum execution time: 5_185_000 picoseconds.
Weight::from_parts(5_366_000, 0)
}
// Storage: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
// Proof: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
// Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0)
// Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `System::Account` (r:2 w:2)
// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
pub fn report_transact_status() -> Weight {
// Proof Size summary in bytes:
// Measured: `109`
// Estimated: `3574`
// Minimum execution time: 27_556_000 picoseconds.
Weight::from_parts(28_240_000, 3574)
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(2))
// Measured: `246`
// Estimated: `6196`
// Minimum execution time: 54_443_000 picoseconds.
Weight::from_parts(55_873_000, 6196)
.saturating_add(T::DbWeight::get().reads(10))
.saturating_add(T::DbWeight::get().writes(4))
}
pub fn clear_transact_status() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_932_000 picoseconds.
Weight::from_parts(3_097_000, 0)
// Minimum execution time: 1_909_000 picoseconds.
Weight::from_parts(2_011_000, 0)
}
pub fn set_topic() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_860_000 picoseconds.
Weight::from_parts(2_957_000, 0)
// Minimum execution time: 1_814_000 picoseconds.
Weight::from_parts(1_956_000, 0)
}
pub fn clear_topic() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_886_000 picoseconds.
Weight::from_parts(3_015_000, 0)
// Minimum execution time: 1_875_000 picoseconds.
Weight::from_parts(2_003_000, 0)
}
// Storage: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
// Proof: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
pub fn universal_origin() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `1489`
// Minimum execution time: 5_088_000 picoseconds.
Weight::from_parts(5_253_000, 1489)
.saturating_add(T::DbWeight::get().reads(1))
// Measured: `39`
// Estimated: `3504`
// Minimum execution time: 7_376_000 picoseconds.
Weight::from_parts(7_620_000, 3504)
.saturating_add(T::DbWeight::get().reads(2))
}
pub fn set_fees_mode() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_874_000 picoseconds.
Weight::from_parts(3_060_000, 0)
// Minimum execution time: 1_863_000 picoseconds.
Weight::from_parts(1_964_000, 0)
}
pub fn unpaid_execution() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_029_000 picoseconds.
Weight::from_parts(3_158_000, 0)
// Minimum execution time: 1_956_000 picoseconds.
Weight::from_parts(2_057_000, 0)
}
}
@@ -17,8 +17,8 @@ use super::{
AccountId, AllPalletsWithSystem, Assets, Authorship, Balance, Balances, BaseDeliveryFee,
FeeAssetId, ForeignAssets, ForeignAssetsInstance, ParachainInfo, ParachainSystem, PolkadotXcm,
PoolAssets, Runtime, RuntimeCall, RuntimeEvent, RuntimeFlavor, RuntimeOrigin,
ToRococoXcmRouter, ToWococoXcmRouter, TransactionByteFee, TrustBackedAssetsInstance,
WeightToFee, XcmpQueue,
ToRococoXcmRouter, ToWestendXcmRouter, ToWococoXcmRouter, TransactionByteFee,
TrustBackedAssetsInstance, WeightToFee, XcmpQueue,
};
use assets_common::{
local_and_foreign_assets::MatchesLocalAndForeignAssetsMultiLocation,
@@ -44,16 +44,16 @@ use rococo_runtime_constants::system_parachain;
use sp_runtime::traits::{AccountIdConversion, ConvertInto};
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllAssets, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter,
DenyReserveTransferToRelayChain, DenyThenTry, DescribeAllTerminal, DescribeFamily,
EnsureXcmOrigin, FungiblesAdapter, GlobalConsensusParachainConvertsFor, HashedDescription,
IsConcrete, LocalMint, LocationWithAssetFilters, NetworkExportTableItem, NoChecking,
ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
SovereignSignedViaLocation, StartsWith, StartsWithExplicitGlobalConsensus, TakeWeightCredit,
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
XcmFeeManagerFromComponents, XcmFeeToAccount,
IsConcrete, LocalMint, NetworkExportTableItem, NoChecking, ParentAsSuperuser, ParentIsPreset,
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, StartsWith,
StartsWithExplicitGlobalConsensus, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, XcmFeeManagerFromComponents,
XcmFeeToAccount,
};
use xcm_executor::{traits::WithOriginFilter, XcmExecutor};
@@ -260,10 +260,6 @@ match_types! {
MultiLocation { parents: 1, interior: Here } |
MultiLocation { parents: 1, interior: X1(_) }
};
pub type WithParentsZeroOrOne: impl Contains<MultiLocation> = {
MultiLocation { parents: 0, .. } |
MultiLocation { parents: 1, .. }
};
}
/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly
@@ -478,6 +474,8 @@ impl Contains<RuntimeCall> for SafeCallFilter {
pallet_uniques::Call::buy_item { .. }
) | RuntimeCall::ToWococoXcmRouter(
pallet_xcm_bridge_hub_router::Call::report_bridge_status { .. }
) | RuntimeCall::ToWestendXcmRouter(
pallet_xcm_bridge_hub_router::Call::report_bridge_status { .. }
) | RuntimeCall::ToRococoXcmRouter(
pallet_xcm_bridge_hub_router::Call::report_bridge_status { .. }
)
@@ -567,11 +565,13 @@ impl xcm_executor::Config for XcmConfig {
type XcmSender = XcmRouter;
type AssetTransactor = AssetTransactors;
type OriginConverter = XcmOriginToTransactDispatchOrigin;
// Asset Hub trusts only particular configured bridge locations as reserve locations.
// Asset Hub may _act_ as a reserve location for ROC and assets created under `pallet-assets`.
// Users must use teleport where allowed (e.g. ROC with the Relay Chain).
// Asset Hub trusts only particular, pre-configured bridged locations from a different consensus
// as reserve locations (we trust the Bridge Hub to relay the message that a reserve is being
// held). Asset Hub may _act_ as a reserve location for ROC and assets created
// under `pallet-assets`. Users must use teleport where allowed (e.g. ROC with the Relay Chain).
type IsReserve = (
bridging::to_wococo::IsTrustedBridgedReserveLocationForConcreteAsset,
bridging::to_westend::IsTrustedBridgedReserveLocationForConcreteAsset,
bridging::to_rococo::IsTrustedBridgedReserveLocationForConcreteAsset,
);
type IsTeleporter = TrustedTeleporters;
@@ -624,8 +624,11 @@ impl xcm_executor::Config for XcmConfig {
XcmFeeToAccount<Self::AssetTransactor, AccountId, TreasuryAccount>,
>;
type MessageExporter = ();
type UniversalAliases =
(bridging::to_wococo::UniversalAliases, bridging::to_rococo::UniversalAliases);
type UniversalAliases = (
bridging::to_wococo::UniversalAliases,
bridging::to_rococo::UniversalAliases,
bridging::to_westend::UniversalAliases,
);
type CallDispatcher = WithOriginFilter<SafeCallFilter>;
type SafeCallFilter = SafeCallFilter;
type Aliasers = Nothing;
@@ -653,6 +656,9 @@ pub type XcmRouter = WithUniqueTopic<(
// Router which wraps and sends xcm to BridgeHub to be delivered to the Wococo
// GlobalConsensus
ToWococoXcmRouter,
// Router which wraps and sends xcm to BridgeHub to be delivered to the Westend
// GlobalConsensus
ToWestendXcmRouter,
// Router which wraps and sends xcm to BridgeHub to be delivered to the Rococo
// GlobalConsensus
ToRococoXcmRouter,
@@ -675,14 +681,7 @@ impl pallet_xcm::Config for Runtime {
type XcmExecuteFilter = Nothing;
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything;
// Allow reserve based transfer to everywhere except for bridging, here we strictly check what
// assets are allowed.
type XcmReserveTransferFilter = (
LocationWithAssetFilters<WithParentsZeroOrOne, AllAssets>,
bridging::to_rococo::AllowedReserveTransferAssets,
bridging::to_wococo::AllowedReserveTransferAssets,
);
type XcmReserveTransferFilter = Everything;
type Weigher = WeightInfoBounds<
crate::weights::xcm::AssetHubRococoXcmWeight<RuntimeCall>,
RuntimeCall,
@@ -775,6 +774,7 @@ pub mod bridging {
pub BridgeTable: sp_std::vec::Vec<NetworkExportTableItem> =
sp_std::vec::Vec::new().into_iter()
.chain(to_wococo::BridgeTable::get())
.chain(to_westend::BridgeTable::get())
.chain(to_rococo::BridgeTable::get())
.collect();
}
@@ -819,13 +819,6 @@ pub mod bridging {
)
];
/// Allowed assets for reserve transfer to `AssetHubWococo`.
pub AllowedReserveTransferAssetsToAssetHubWococo: sp_std::vec::Vec<MultiAssetFilter> = sp_std::vec![
// allow send only ROC
Wild(AllOf { fun: WildFungible, id: Concrete(TokenLocation::get()) }),
// and nothing else
];
/// Universal aliases
pub UniversalAliases: BTreeSet<(MultiLocation, Junction)> = BTreeSet::from_iter(
sp_std::vec![
@@ -852,12 +845,6 @@ pub mod bridging {
),
>;
/// Allows to reserve transfer assets to `AssetHubWococo`.
pub type AllowedReserveTransferAssets = LocationWithAssetFilters<
Equals<AssetHubWococo>,
AllowedReserveTransferAssetsToAssetHubWococo,
>;
impl Contains<RuntimeCall> for ToWococoXcmRouter {
fn contains(call: &RuntimeCall) -> bool {
matches!(
@@ -870,6 +857,82 @@ pub mod bridging {
}
}
pub mod to_westend {
use super::*;
parameter_types! {
pub SiblingBridgeHubWithBridgeHubWestendInstance: MultiLocation = MultiLocation::new(
1,
X2(
Parachain(SiblingBridgeHubParaId::get()),
PalletInstance(bp_bridge_hub_rococo::WITH_BRIDGE_ROCOCO_TO_WESTEND_MESSAGES_PALLET_INDEX)
)
);
pub const WestendNetwork: NetworkId = NetworkId::Westend;
pub AssetHubWestend: MultiLocation = MultiLocation::new(2, X2(GlobalConsensus(WestendNetwork::get()), Parachain(bp_asset_hub_westend::ASSET_HUB_WESTEND_PARACHAIN_ID)));
pub WndLocation: MultiLocation = MultiLocation::new(2, X1(GlobalConsensus(WestendNetwork::get())));
pub WndFromAssetHubWestend: (MultiAssetFilter, MultiLocation) = (
Wild(AllOf { fun: WildFungible, id: Concrete(WndLocation::get()) }),
AssetHubWestend::get()
);
/// Set up exporters configuration.
/// `Option<MultiAsset>` represents static "base fee" which is used for total delivery fee calculation.
pub BridgeTable: sp_std::vec::Vec<NetworkExportTableItem> = sp_std::vec![
NetworkExportTableItem::new(
WestendNetwork::get(),
Some(sp_std::vec![
AssetHubWestend::get().interior.split_global().expect("invalid configuration for AssetHubWestend").1,
]),
SiblingBridgeHub::get(),
// base delivery fee to local `BridgeHub`
Some((
XcmBridgeHubRouterFeeAssetId::get(),
bp_asset_hub_rococo::BridgeHubRococoBaseFeeInRocs::get(),
).into())
)
];
/// Universal aliases
pub UniversalAliases: BTreeSet<(MultiLocation, Junction)> = BTreeSet::from_iter(
sp_std::vec![
(SiblingBridgeHubWithBridgeHubWestendInstance::get(), GlobalConsensus(WestendNetwork::get()))
]
);
}
impl Contains<(MultiLocation, Junction)> for UniversalAliases {
fn contains(alias: &(MultiLocation, Junction)) -> bool {
UniversalAliases::get().contains(alias)
}
}
/// Trusted reserve locations filter for `xcm_executor::Config::IsReserve`.
/// Locations from which the runtime accepts reserved assets.
pub type IsTrustedBridgedReserveLocationForConcreteAsset =
matching::IsTrustedBridgedReserveLocationForConcreteAsset<
UniversalLocation,
(
// allow receive WND from AssetHubWestend
xcm_builder::Case<WndFromAssetHubWestend>,
// and nothing else
),
>;
impl Contains<RuntimeCall> for ToWestendXcmRouter {
fn contains(call: &RuntimeCall) -> bool {
matches!(
call,
RuntimeCall::ToWestendXcmRouter(
pallet_xcm_bridge_hub_router::Call::report_bridge_status { .. }
)
)
}
}
}
pub mod to_rococo {
use super::*;
@@ -908,13 +971,6 @@ pub mod bridging {
)
];
/// Allowed assets for reserve transfer to `AssetHubWococo`.
pub AllowedReserveTransferAssetsToAssetHubRococo: sp_std::vec::Vec<MultiAssetFilter> = sp_std::vec![
// allow send only WOC
Wild(AllOf { fun: WildFungible, id: Concrete(TokenLocation::get()) }),
// and nothing else
];
/// Universal aliases
pub UniversalAliases: BTreeSet<(MultiLocation, Junction)> = BTreeSet::from_iter(
sp_std::vec![
@@ -941,12 +997,6 @@ pub mod bridging {
),
>;
/// Allows to reserve transfer assets to `AssetHubRococo`.
pub type AllowedReserveTransferAssets = LocationWithAssetFilters<
Equals<AssetHubRococo>,
AllowedReserveTransferAssetsToAssetHubRococo,
>;
impl Contains<RuntimeCall> for ToRococoXcmRouter {
fn contains(call: &RuntimeCall) -> bool {
matches!(
@@ -967,15 +1017,17 @@ pub mod bridging {
impl BridgingBenchmarksHelper {
pub fn prepare_universal_alias() -> Option<(MultiLocation, Junction)> {
let alias =
to_wococo::UniversalAliases::get().into_iter().find_map(|(location, junction)| {
match to_wococo::SiblingBridgeHubWithBridgeHubWococoInstance::get()
.eq(&location)
{
true => Some((location, junction)),
false => None,
}
});
assert!(alias.is_some(), "we expect here BridgeHubRococo to Polkadot mapping at least");
to_westend::UniversalAliases::get()
.into_iter()
.find_map(|(location, junction)| {
match to_westend::SiblingBridgeHubWithBridgeHubWestendInstance::get()
.eq(&location)
{
true => Some((location, junction)),
false => None,
}
});
assert!(alias.is_some(), "we expect here BridgeHubRococo to Westend mapping at least");
Some(alias.unwrap())
}
}
@@ -29,14 +29,16 @@ pub use asset_hub_rococo_runtime::{
AllPalletsWithoutSystem, AssetDeposit, Assets, Balances, ExistentialDeposit, ForeignAssets,
ForeignAssetsInstance, MetadataDepositBase, MetadataDepositPerByte, ParachainSystem, Runtime,
RuntimeCall, RuntimeEvent, RuntimeFlavor, SessionKeys, System, ToRococoXcmRouterInstance,
ToWococoXcmRouterInstance, TrustBackedAssetsInstance, XcmpQueue,
ToWestendXcmRouterInstance, ToWococoXcmRouterInstance, TrustBackedAssetsInstance, XcmpQueue,
};
use asset_test_utils::{
test_cases_over_bridge::TestBridgingConfig, CollatorSessionKey, CollatorSessionKeys, ExtBuilder,
};
use asset_test_utils::{CollatorSessionKey, CollatorSessionKeys, ExtBuilder};
use codec::{Decode, Encode};
use cumulus_primitives_utility::ChargeWeightInFungibles;
use frame_support::{
assert_noop, assert_ok,
traits::{fungibles::InspectEnumerable, Contains},
traits::fungibles::InspectEnumerable,
weights::{Weight, WeightToFee as WeightToFeeT},
};
use parachains_common::{
@@ -642,11 +644,43 @@ asset_test_utils::include_create_and_manage_foreign_assets_for_local_consensus_p
})
);
fn limited_reserve_transfer_assets_for_native_asset_over_bridge_works(
bridging_configuration: fn() -> TestBridgingConfig,
) {
asset_test_utils::test_cases_over_bridge::limited_reserve_transfer_assets_for_native_asset_works::<
Runtime,
AllPalletsWithoutSystem,
XcmConfig,
ParachainSystem,
XcmpQueue,
LocationToAccountId,
>(
collator_session_keys(),
ExistentialDeposit::get(),
AccountId::from(ALICE),
Box::new(|runtime_event_encoded: Vec<u8>| {
match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) {
Ok(RuntimeEvent::PolkadotXcm(event)) => Some(event),
_ => None,
}
}),
Box::new(|runtime_event_encoded: Vec<u8>| {
match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) {
Ok(RuntimeEvent::XcmpQueue(event)) => Some(event),
_ => None,
}
}),
bridging_configuration,
WeightLimit::Unlimited,
Some(xcm_config::bridging::XcmBridgeHubRouterFeeAssetId::get()),
Some(xcm_config::TreasuryAccount::get()),
)
}
mod asset_hub_rococo_tests {
use super::*;
fn bridging_to_asset_hub_wococo() -> asset_test_utils::test_cases_over_bridge::TestBridgingConfig
{
fn bridging_to_asset_hub_wococo() -> TestBridgingConfig {
asset_test_utils::test_cases_over_bridge::TestBridgingConfig {
bridged_network: bridging::to_wococo::WococoNetwork::get(),
local_bridge_hub_para_id: bridging::SiblingBridgeHubParaId::get(),
@@ -655,35 +689,26 @@ mod asset_hub_rococo_tests {
}
}
fn bridging_to_asset_hub_westend() -> TestBridgingConfig {
asset_test_utils::test_cases_over_bridge::TestBridgingConfig {
bridged_network: bridging::to_westend::WestendNetwork::get(),
local_bridge_hub_para_id: bridging::SiblingBridgeHubParaId::get(),
local_bridge_hub_location: bridging::SiblingBridgeHub::get(),
bridged_target_location: bridging::to_westend::AssetHubWestend::get(),
}
}
#[test]
fn limited_reserve_transfer_assets_for_native_asset_over_bridge_works() {
asset_test_utils::test_cases_over_bridge::limited_reserve_transfer_assets_for_native_asset_works::<
Runtime,
AllPalletsWithoutSystem,
XcmConfig,
ParachainSystem,
XcmpQueue,
LocationToAccountId,
>(
collator_session_keys(),
ExistentialDeposit::get(),
AccountId::from(ALICE),
Box::new(|runtime_event_encoded: Vec<u8>| {
match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) {
Ok(RuntimeEvent::PolkadotXcm(event)) => Some(event),
_ => None,
}
}),
Box::new(|runtime_event_encoded: Vec<u8>| {
match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) {
Ok(RuntimeEvent::XcmpQueue(event)) => Some(event),
_ => None,
}
}),
fn limited_reserve_transfer_assets_for_native_asset_to_asset_hub_wococo_works() {
limited_reserve_transfer_assets_for_native_asset_over_bridge_works(
bridging_to_asset_hub_wococo,
WeightLimit::Unlimited,
Some(xcm_config::bridging::XcmBridgeHubRouterFeeAssetId::get()),
Some(xcm_config::TreasuryAccount::get()),
)
}
#[test]
fn limited_reserve_transfer_assets_for_native_asset_to_asset_hub_westend_works() {
limited_reserve_transfer_assets_for_native_asset_over_bridge_works(
bridging_to_asset_hub_westend,
)
}
@@ -713,7 +738,32 @@ mod asset_hub_rococo_tests {
}
#[test]
fn report_bridge_status_from_xcm_bridge_router_works() {
fn receive_reserve_asset_deposited_wnd_from_asset_hub_westend_works() {
const BLOCK_AUTHOR_ACCOUNT: [u8; 32] = [13; 32];
asset_test_utils::test_cases_over_bridge::receive_reserve_asset_deposited_from_different_consensus_works::<
Runtime,
AllPalletsWithoutSystem,
XcmConfig,
LocationToAccountId,
ForeignAssetsInstance,
>(
collator_session_keys().add(collator_session_key(BLOCK_AUTHOR_ACCOUNT)),
ExistentialDeposit::get(),
AccountId::from([73; 32]),
AccountId::from(BLOCK_AUTHOR_ACCOUNT),
// receiving WNDs
(MultiLocation { parents: 2, interior: X1(GlobalConsensus(Westend)) }, 1000000000000, 1_000_000_000),
bridging_to_asset_hub_westend,
(
X1(PalletInstance(bp_bridge_hub_rococo::WITH_BRIDGE_ROCOCO_TO_WESTEND_MESSAGES_PALLET_INDEX)),
GlobalConsensus(Westend),
X1(Parachain(1000))
)
)
}
#[test]
fn report_bridge_status_from_xcm_bridge_router_for_wococo_works() {
asset_test_utils::test_cases_over_bridge::report_bridge_status_from_xcm_bridge_router_works::<
Runtime,
AllPalletsWithoutSystem,
@@ -764,6 +814,58 @@ mod asset_hub_rococo_tests {
)
}
#[test]
fn report_bridge_status_from_xcm_bridge_router_for_westend_works() {
asset_test_utils::test_cases_over_bridge::report_bridge_status_from_xcm_bridge_router_works::<
Runtime,
AllPalletsWithoutSystem,
XcmConfig,
LocationToAccountId,
ToWestendXcmRouterInstance,
>(
collator_session_keys(),
bridging_to_asset_hub_westend,
|| {
sp_std::vec![
UnpaidExecution { weight_limit: Unlimited, check_origin: None },
Transact {
origin_kind: OriginKind::Xcm,
require_weight_at_most:
bp_asset_hub_rococo::XcmBridgeHubRouterTransactCallMaxWeight::get(),
call: bp_asset_hub_rococo::Call::ToWestendXcmRouter(
bp_asset_hub_rococo::XcmBridgeHubRouterCall::report_bridge_status {
bridge_id: Default::default(),
is_congested: true,
}
)
.encode()
.into(),
}
]
.into()
},
|| {
sp_std::vec![
UnpaidExecution { weight_limit: Unlimited, check_origin: None },
Transact {
origin_kind: OriginKind::Xcm,
require_weight_at_most:
bp_asset_hub_rococo::XcmBridgeHubRouterTransactCallMaxWeight::get(),
call: bp_asset_hub_rococo::Call::ToWestendXcmRouter(
bp_asset_hub_rococo::XcmBridgeHubRouterCall::report_bridge_status {
bridge_id: Default::default(),
is_congested: false,
}
)
.encode()
.into(),
}
]
.into()
},
)
}
#[test]
fn test_report_bridge_status_call_compatibility() {
// if this test fails, make sure `bp_asset_hub_rococo` has valid encoding
@@ -782,14 +884,43 @@ mod asset_hub_rococo_tests {
}
)
.encode()
)
);
assert_eq!(
RuntimeCall::ToWestendXcmRouter(
pallet_xcm_bridge_hub_router::Call::report_bridge_status {
bridge_id: Default::default(),
is_congested: true,
}
)
.encode(),
bp_asset_hub_rococo::Call::ToWestendXcmRouter(
bp_asset_hub_rococo::XcmBridgeHubRouterCall::report_bridge_status {
bridge_id: Default::default(),
is_congested: true,
}
)
.encode()
);
}
#[test]
fn check_sane_weight_report_bridge_status() {
fn check_sane_weight_report_bridge_status_for_wococo() {
use pallet_xcm_bridge_hub_router::WeightInfo;
let actual = <Runtime as pallet_xcm_bridge_hub_router::Config<ToWococoXcmRouterInstance>>::WeightInfo::report_bridge_status();
let max_weight = bp_asset_hub_rococo::XcmBridgeHubRouterTransactCallMaxWeight::get();
assert!(
actual.all_lte(max_weight),
"max_weight: {:?} should be adjusted to actual {:?}",
max_weight,
actual
);
}
#[test]
fn check_sane_weight_report_bridge_status_for_westend() {
use pallet_xcm_bridge_hub_router::WeightInfo;
let actual = <Runtime as pallet_xcm_bridge_hub_router::Config<
ToWococoXcmRouterInstance,
ToWestendXcmRouterInstance,
>>::WeightInfo::report_bridge_status();
let max_weight = bp_asset_hub_rococo::XcmBridgeHubRouterTransactCallMaxWeight::get();
assert!(
@@ -804,9 +935,8 @@ mod asset_hub_rococo_tests {
mod asset_hub_wococo_tests {
use super::*;
fn bridging_to_asset_hub_rococo() -> asset_test_utils::test_cases_over_bridge::TestBridgingConfig
{
asset_test_utils::test_cases_over_bridge::TestBridgingConfig {
fn bridging_to_asset_hub_rococo() -> TestBridgingConfig {
TestBridgingConfig {
bridged_network: bridging::to_rococo::RococoNetwork::get(),
local_bridge_hub_para_id: bridging::SiblingBridgeHubParaId::get(),
local_bridge_hub_location: bridging::SiblingBridgeHub::get(),
@@ -837,41 +967,15 @@ mod asset_hub_wococo_tests {
assert_eq!(flavor, xcm_config::Flavor::get());
}
fn with_wococo_flavor_bridging_to_asset_hub_rococo(
) -> asset_test_utils::test_cases_over_bridge::TestBridgingConfig {
fn with_wococo_flavor_bridging_to_asset_hub_rococo() -> TestBridgingConfig {
set_wococo_flavor();
bridging_to_asset_hub_rococo()
}
#[test]
fn limited_reserve_transfer_assets_for_native_asset_over_bridge_works() {
asset_test_utils::test_cases_over_bridge::limited_reserve_transfer_assets_for_native_asset_works::<
Runtime,
AllPalletsWithoutSystem,
XcmConfig,
ParachainSystem,
XcmpQueue,
LocationToAccountId,
>(
collator_session_keys(),
ExistentialDeposit::get(),
AccountId::from(ALICE),
Box::new(|runtime_event_encoded: Vec<u8>| {
match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) {
Ok(RuntimeEvent::PolkadotXcm(event)) => Some(event),
_ => None,
}
}),
Box::new(|runtime_event_encoded: Vec<u8>| {
match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) {
Ok(RuntimeEvent::XcmpQueue(event)) => Some(event),
_ => None,
}
}),
fn limited_reserve_transfer_assets_for_native_asset_to_asset_hub_rococo_works() {
limited_reserve_transfer_assets_for_native_asset_over_bridge_works(
with_wococo_flavor_bridging_to_asset_hub_rococo,
WeightLimit::Unlimited,
Some(xcm_config::bridging::XcmBridgeHubRouterFeeAssetId::get()),
Some(xcm_config::TreasuryAccount::get()),
)
}
@@ -989,113 +1093,6 @@ mod asset_hub_wococo_tests {
}
}
/// Tests expected configuration of isolated `pallet_xcm::Config::XcmReserveTransferFilter`.
#[test]
fn xcm_reserve_transfer_filter_works() {
// prepare assets
let only_native_assets = || vec![MultiAsset::from((TokenLocation::get(), 1000))];
let only_trust_backed_assets = || {
vec![MultiAsset::from((
AssetIdForTrustBackedAssetsConvert::convert_back(&12345).unwrap(),
2000,
))]
};
let only_sibling_foreign_assets =
|| vec![MultiAsset::from((MultiLocation::new(1, X1(Parachain(12345))), 3000))];
let only_different_global_consensus_foreign_assets = || {
vec![MultiAsset::from((
MultiLocation::new(2, X2(GlobalConsensus(Wococo), Parachain(12345))),
4000,
))]
};
// prepare destinations
let relaychain = MultiLocation::parent();
let sibling_parachain = MultiLocation::new(1, X1(Parachain(54321)));
let different_global_consensus_parachain_other_than_asset_hub_wococo =
MultiLocation::new(2, X2(GlobalConsensus(Kusama), Parachain(12345)));
let bridged_asset_hub_wococo = bridging::to_wococo::AssetHubWococo::get();
let bridged_asset_hub_rococo = bridging::to_rococo::AssetHubRococo::get();
// prepare expected test data sets: (destination, assets, expected_result)
let test_data = vec![
(relaychain, only_native_assets(), true),
(relaychain, only_trust_backed_assets(), true),
(relaychain, only_sibling_foreign_assets(), true),
(relaychain, only_different_global_consensus_foreign_assets(), true),
(sibling_parachain, only_native_assets(), true),
(sibling_parachain, only_trust_backed_assets(), true),
(sibling_parachain, only_sibling_foreign_assets(), true),
(sibling_parachain, only_different_global_consensus_foreign_assets(), true),
(
different_global_consensus_parachain_other_than_asset_hub_wococo,
only_native_assets(),
false,
),
(
different_global_consensus_parachain_other_than_asset_hub_wococo,
only_trust_backed_assets(),
false,
),
(
different_global_consensus_parachain_other_than_asset_hub_wococo,
only_sibling_foreign_assets(),
false,
),
(
different_global_consensus_parachain_other_than_asset_hub_wococo,
only_different_global_consensus_foreign_assets(),
false,
),
];
let additional_test_data_for_rococo_flavor = vec![
(bridged_asset_hub_wococo, only_native_assets(), true),
(bridged_asset_hub_wococo, only_trust_backed_assets(), false),
(bridged_asset_hub_wococo, only_sibling_foreign_assets(), false),
(bridged_asset_hub_wococo, only_different_global_consensus_foreign_assets(), false),
];
let additional_test_data_for_wococo_flavor = vec![
(bridged_asset_hub_rococo, only_native_assets(), true),
(bridged_asset_hub_rococo, only_trust_backed_assets(), false),
(bridged_asset_hub_rococo, only_sibling_foreign_assets(), false),
(bridged_asset_hub_rococo, only_different_global_consensus_foreign_assets(), false),
];
// lets test filter with test data
ExtBuilder::<Runtime>::default()
.with_collators(collator_session_keys().collators())
.with_session_keys(collator_session_keys().session_keys())
.with_tracing()
.build()
.execute_with(|| {
type XcmReserveTransferFilter =
<Runtime as pallet_xcm::Config>::XcmReserveTransferFilter;
fn do_test(data: Vec<(MultiLocation, Vec<MultiAsset>, bool)>) {
for (dest, assets, expected_result) in data {
assert_eq!(
expected_result,
XcmReserveTransferFilter::contains(&(dest, assets.clone())),
"expected_result: {} for dest: {:?} and assets: {:?}",
expected_result,
dest,
assets
);
}
}
// check for Rococo flavor
do_test(test_data.clone());
do_test(additional_test_data_for_rococo_flavor);
// check for Wococo flavor
asset_hub_wococo_tests::set_wococo_flavor();
do_test(test_data);
do_test(additional_test_data_for_wococo_flavor);
})
}
#[test]
fn change_xcm_bridge_hub_router_byte_fee_by_governance_works() {
asset_test_utils::test_cases::change_storage_constant_by_governance_works::<