mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 19:51:02 +00:00
Ensure xcm versions over bridge (on sending chains) (#2481)
## Summary This pull request proposes a solution for improved control of the versioned XCM flow over the bridge (across different consensus chains) and resolves the situation where the sending chain/consensus has already migrated to a higher XCM version than the receiving chain/consensus. ## Problem/Motivation The current flow over the bridge involves a transfer from AssetHubRococo (AHR) to BridgeHubRococo (BHR) to BridgeHubWestend (BHW) and finally to AssetHubWestend (AHW), beginning with a reserve-backed transfer on AHR. In this process: 1. AHR sends XCM `ExportMessage` through `XcmpQueue`, incorporating XCM version checks using the `WrapVersion` feature, influenced by `pallet_xcm::SupportedVersion` (managed by `pallet_xcm::force_xcm_version` or version discovery). 2. BHR handles the `ExportMessage` instruction, utilizing the latest XCM version. The `HaulBlobExporter` converts the inner XCM to [`VersionedXcm::from`](https://github.com/paritytech/polkadot-sdk/blob/63ac2471aa0210f0ac9903bdd7d8f9351f9a635f/polkadot/xcm/xcm-builder/src/universal_exports.rs#L465-L467), also using the latest XCM version. However, challenges arise: - Incompatibility when BHW uses a different version than BHR. For instance, if BHR migrates to **XCMv4** while BHW remains on **XCMv3**, BHR's `VersionedXcm::from` uses `VersionedXcm::V4` variant, causing encoding issues for BHW. ``` /// Just a simulation of possible error, which could happen on BHW /// (this code is based on actual master without XCMv4) let encoded = hex_literal::hex!("0400"); println!("{:?}", VersionedXcm::<()>::decode(&mut &encoded[..])); Err(Error { cause: None, desc: "Could not decode `VersionedXcm`, variant doesn't exist" }) ``` - Similar compatibility issues exist between AHR and AHW. ## Solution This pull request introduces the following solutions: 1. **New trait `CheckVersion`** - added to the `xcm` module and exposing `pallet_xcm::SupportedVersion`. This enhancement allows checking the actual XCM version for desired destinations outside of the `pallet_xcm` module. 2. **Version Check in `HaulBlobExporter`** uses `CheckVersion` to check known/configured destination versions, ensuring compatibility. For example, in the scenario mentioned, BHR can store the version `3` for BHW. If BHR is on XCMv4, it will attempt to downgrade the message to version `3` instead of using the latest version `4`. 3. **Version Check in `pallet-xcm-bridge-hub-router`** - this check ensures compatibility with the real destination's XCM version, preventing the unnecessary sending of messages to the local bridge hub if versions are incompatible. These additions aim to improve the control and compatibility of XCM flows over the bridge and addressing issues related to version mismatches. ## Possible alternative solution _(More investigation is needed, and at the very least, it should extend to XCMv4/5. If this proves to be a viable option, I can open an RFC for XCM.)._ Add the `XcmVersion` attribute to the `ExportMessage` so that the sending chain can determine, based on what is stored in `pallet_xcm::SupportedVersion`, the version the destination is using. This way, we may not need to handle the version in `HaulBlobExporter`. ``` ExportMessage { network: NetworkId, destination: InteriorMultiLocation, xcm: Xcm<()> destination_xcm_version: Version, // <- new attritbute }, ``` ``` pub trait ExportXcm { fn validate( network: NetworkId, channel: u32, universal_source: &mut Option<InteriorMultiLocation>, destination: &mut Option<InteriorMultiLocation>, message: &mut Option<Xcm<()>>, destination_xcm_version: Version, , // <- new attritbute ) -> SendResult<Self::Ticket>; ``` ## Future Directions This PR does not fix version discovery over bridge, further investigation will be conducted here: https://github.com/paritytech/polkadot-sdk/issues/2417. ## TODO - [x] `pallet_xcm` mock for tests uses hard-coded XCM version `2` - change to 3 or lastest? - [x] fix `pallet-xcm-bridge-hub-router` - [x] fix HaulBlobExporter with version determination [here](https://github.com/paritytech/polkadot-sdk/blob/2183669d05f9b510f979a0cc3c7847707bacba2e/polkadot/xcm/xcm-builder/src/universal_exports.rs#L465) - [x] add unit-tests to the runtimes - [x] run benchmarks for `ExportMessage` - [x] extend local run scripts about `force_xcm_version(dest, version)` - [ ] when merged, prepare governance calls for Rococo/Westend - [ ] add PRDoc Part of: https://github.com/paritytech/parity-bridges-common/issues/2719 --------- Co-authored-by: command-bot <>
This commit is contained in:
Generated
+2
@@ -1883,6 +1883,7 @@ dependencies = [
|
|||||||
"parachains-common",
|
"parachains-common",
|
||||||
"parity-scale-codec",
|
"parity-scale-codec",
|
||||||
"rococo-westend-system-emulated-network",
|
"rococo-westend-system-emulated-network",
|
||||||
|
"sp-runtime",
|
||||||
"staging-xcm",
|
"staging-xcm",
|
||||||
"staging-xcm-executor",
|
"staging-xcm-executor",
|
||||||
]
|
]
|
||||||
@@ -2048,6 +2049,7 @@ dependencies = [
|
|||||||
"parachains-common",
|
"parachains-common",
|
||||||
"parity-scale-codec",
|
"parity-scale-codec",
|
||||||
"rococo-westend-system-emulated-network",
|
"rococo-westend-system-emulated-network",
|
||||||
|
"sp-runtime",
|
||||||
"staging-xcm",
|
"staging-xcm",
|
||||||
"staging-xcm-executor",
|
"staging-xcm-executor",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -309,6 +309,28 @@ impl<H: XcmBlobHauler> LocalXcmQueueManager<H> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Adapter for the implementation of `GetVersion`, which attempts to find the minimal
|
||||||
|
/// configured XCM version between the destination `dest` and the bridge hub location provided as
|
||||||
|
/// `Get<Location>`.
|
||||||
|
pub struct XcmVersionOfDestAndRemoteBridge<Version, RemoteBridge>(
|
||||||
|
sp_std::marker::PhantomData<(Version, RemoteBridge)>,
|
||||||
|
);
|
||||||
|
impl<Version: GetVersion, RemoteBridge: Get<MultiLocation>> GetVersion
|
||||||
|
for XcmVersionOfDestAndRemoteBridge<Version, RemoteBridge>
|
||||||
|
{
|
||||||
|
fn get_version_for(dest: &MultiLocation) -> Option<XcmVersion> {
|
||||||
|
let dest_version = Version::get_version_for(dest);
|
||||||
|
let bridge_hub_version = Version::get_version_for(&RemoteBridge::get());
|
||||||
|
|
||||||
|
match (dest_version, bridge_hub_version) {
|
||||||
|
(Some(dv), Some(bhv)) => Some(sp_std::cmp::min(dv, bhv)),
|
||||||
|
(Some(dv), None) => Some(dv),
|
||||||
|
(None, Some(bhv)) => Some(bhv),
|
||||||
|
(None, None) => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
use crate::{Bridge, Call};
|
use crate::{Bridge, Call};
|
||||||
|
|
||||||
use bp_xcm_bridge_hub_router::{BridgeState, MINIMAL_DELIVERY_FEE_FACTOR};
|
use bp_xcm_bridge_hub_router::{BridgeState, MINIMAL_DELIVERY_FEE_FACTOR};
|
||||||
use frame_benchmarking::benchmarks_instance_pallet;
|
use frame_benchmarking::{benchmarks_instance_pallet, BenchmarkError};
|
||||||
use frame_support::traits::{EnsureOrigin, Get, Hooks, UnfilteredDispatchable};
|
use frame_support::traits::{EnsureOrigin, Get, Hooks, UnfilteredDispatchable};
|
||||||
use sp_runtime::traits::Zero;
|
use sp_runtime::traits::Zero;
|
||||||
use xcm::prelude::*;
|
use xcm::prelude::*;
|
||||||
@@ -37,11 +37,11 @@ pub trait Config<I: 'static>: crate::Config<I> {
|
|||||||
/// Returns destination which is valid for this router instance.
|
/// Returns destination which is valid for this router instance.
|
||||||
/// (Needs to pass `T::Bridges`)
|
/// (Needs to pass `T::Bridges`)
|
||||||
/// Make sure that `SendXcm` will pass.
|
/// Make sure that `SendXcm` will pass.
|
||||||
fn ensure_bridged_target_destination() -> MultiLocation {
|
fn ensure_bridged_target_destination() -> Result<MultiLocation, BenchmarkError> {
|
||||||
MultiLocation::new(
|
Ok(MultiLocation::new(
|
||||||
Self::UniversalLocation::get().len() as u8,
|
Self::UniversalLocation::get().len() as u8,
|
||||||
X1(GlobalConsensus(Self::BridgedNetworkId::get().unwrap())),
|
X1(GlobalConsensus(Self::BridgedNetworkId::get().unwrap())),
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ benchmarks_instance_pallet! {
|
|||||||
delivery_fee_factor: MINIMAL_DELIVERY_FEE_FACTOR + MINIMAL_DELIVERY_FEE_FACTOR,
|
delivery_fee_factor: MINIMAL_DELIVERY_FEE_FACTOR + MINIMAL_DELIVERY_FEE_FACTOR,
|
||||||
});
|
});
|
||||||
|
|
||||||
let _ = T::ensure_bridged_target_destination();
|
let _ = T::ensure_bridged_target_destination()?;
|
||||||
T::make_congested();
|
T::make_congested();
|
||||||
}: {
|
}: {
|
||||||
crate::Pallet::<T, I>::on_initialize(Zero::zero())
|
crate::Pallet::<T, I>::on_initialize(Zero::zero())
|
||||||
@@ -81,7 +81,7 @@ benchmarks_instance_pallet! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
send_message {
|
send_message {
|
||||||
let dest = T::ensure_bridged_target_destination();
|
let dest = T::ensure_bridged_target_destination()?;
|
||||||
let xcm = sp_std::vec![].into();
|
let xcm = sp_std::vec![].into();
|
||||||
|
|
||||||
// make local queue congested, because it means additional db write
|
// make local queue congested, because it means additional db write
|
||||||
|
|||||||
@@ -89,6 +89,8 @@ pub mod pallet {
|
|||||||
/// **possible fee**. Allows to externalize better control over allowed **bridged
|
/// **possible fee**. Allows to externalize better control over allowed **bridged
|
||||||
/// networks/locations**.
|
/// networks/locations**.
|
||||||
type Bridges: ExporterFor;
|
type Bridges: ExporterFor;
|
||||||
|
/// Checks the XCM version for the destination.
|
||||||
|
type DestinationVersion: GetVersion;
|
||||||
|
|
||||||
/// Origin of the sibling bridge hub that is allowed to report bridge status.
|
/// Origin of the sibling bridge hub that is allowed to report bridge status.
|
||||||
type BridgeHubOrigin: EnsureOrigin<Self::RuntimeOrigin>;
|
type BridgeHubOrigin: EnsureOrigin<Self::RuntimeOrigin>;
|
||||||
@@ -319,12 +321,13 @@ impl<T: Config<I>, I: 'static> SendXcm for Pallet<T, I> {
|
|||||||
dest: &mut Option<MultiLocation>,
|
dest: &mut Option<MultiLocation>,
|
||||||
xcm: &mut Option<Xcm<()>>,
|
xcm: &mut Option<Xcm<()>>,
|
||||||
) -> SendResult<Self::Ticket> {
|
) -> SendResult<Self::Ticket> {
|
||||||
// we won't have an access to `dest` and `xcm` in the `delvier` method, so precompute
|
// `dest` and `xcm` are required here
|
||||||
|
let dest_ref = dest.as_ref().ok_or(SendError::MissingArgument)?;
|
||||||
|
let xcm_ref = xcm.as_ref().ok_or(SendError::MissingArgument)?;
|
||||||
|
|
||||||
|
// we won't have an access to `dest` and `xcm` in the `deliver` method, so precompute
|
||||||
// everything required here
|
// everything required here
|
||||||
let message_size = xcm
|
let message_size = xcm_ref.encoded_size() as _;
|
||||||
.as_ref()
|
|
||||||
.map(|xcm| xcm.encoded_size() as _)
|
|
||||||
.ok_or(SendError::MissingArgument)?;
|
|
||||||
|
|
||||||
// bridge doesn't support oversized/overweight messages now. So it is better to drop such
|
// bridge doesn't support oversized/overweight messages now. So it is better to drop such
|
||||||
// messages here than at the bridge hub. Let's check the message size.
|
// messages here than at the bridge hub. Let's check the message size.
|
||||||
@@ -332,6 +335,18 @@ impl<T: Config<I>, I: 'static> SendXcm for Pallet<T, I> {
|
|||||||
return Err(SendError::ExceedsMaxMessageSize)
|
return Err(SendError::ExceedsMaxMessageSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to ensure that the known `dest`'s XCM version can comprehend the current `xcm`
|
||||||
|
// program. This may seem like an additional, unnecessary check, but it is not. A similar
|
||||||
|
// check is probably performed by the `ViaBridgeHubExporter`, which attempts to send a
|
||||||
|
// versioned message to the sibling bridge hub. However, the local bridge hub may have a
|
||||||
|
// higher XCM version than the remote `dest`. Once again, it is better to discard such
|
||||||
|
// messages here than at the bridge hub (e.g., to avoid losing funds).
|
||||||
|
let destination_version = T::DestinationVersion::get_version_for(dest_ref)
|
||||||
|
.ok_or(SendError::DestinationUnsupported)?;
|
||||||
|
let _ = VersionedXcm::from(xcm_ref.clone())
|
||||||
|
.into_version(destination_version)
|
||||||
|
.map_err(|()| SendError::DestinationUnsupported)?;
|
||||||
|
|
||||||
// just use exporter to validate destination and insert instructions to pay message fee
|
// just use exporter to validate destination and insert instructions to pay message fee
|
||||||
// at the sibling/child bridge hub
|
// at the sibling/child bridge hub
|
||||||
//
|
//
|
||||||
@@ -358,6 +373,7 @@ impl<T: Config<I>, I: 'static> SendXcm for Pallet<T, I> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use frame_support::assert_ok;
|
||||||
use mock::*;
|
use mock::*;
|
||||||
|
|
||||||
use frame_support::traits::Hooks;
|
use frame_support::traits::Hooks;
|
||||||
@@ -451,6 +467,19 @@ mod tests {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn destination_unsupported_if_wrap_version_fails() {
|
||||||
|
run_test(|| {
|
||||||
|
assert_eq!(
|
||||||
|
send_xcm::<XcmBridgeHubRouter>(
|
||||||
|
UnknownXcmVersionLocation::get(),
|
||||||
|
vec![ClearOrigin].into(),
|
||||||
|
),
|
||||||
|
Err(SendError::DestinationUnsupported),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn returns_proper_delivery_price() {
|
fn returns_proper_delivery_price() {
|
||||||
run_test(|| {
|
run_test(|| {
|
||||||
@@ -488,17 +517,14 @@ mod tests {
|
|||||||
fn sent_message_doesnt_increase_factor_if_xcm_channel_is_uncongested() {
|
fn sent_message_doesnt_increase_factor_if_xcm_channel_is_uncongested() {
|
||||||
run_test(|| {
|
run_test(|| {
|
||||||
let old_bridge = XcmBridgeHubRouter::bridge();
|
let old_bridge = XcmBridgeHubRouter::bridge();
|
||||||
assert_eq!(
|
assert_ok!(send_xcm::<XcmBridgeHubRouter>(
|
||||||
send_xcm::<XcmBridgeHubRouter>(
|
MultiLocation::new(
|
||||||
MultiLocation::new(
|
2,
|
||||||
2,
|
X2(GlobalConsensus(BridgedNetworkId::get()), Parachain(1000))
|
||||||
X2(GlobalConsensus(BridgedNetworkId::get()), Parachain(1000))
|
),
|
||||||
),
|
vec![ClearOrigin].into(),
|
||||||
vec![ClearOrigin].into(),
|
)
|
||||||
)
|
.map(drop));
|
||||||
.map(drop),
|
|
||||||
Ok(()),
|
|
||||||
);
|
|
||||||
|
|
||||||
assert!(TestToBridgeHubSender::is_message_sent());
|
assert!(TestToBridgeHubSender::is_message_sent());
|
||||||
assert_eq!(old_bridge, XcmBridgeHubRouter::bridge());
|
assert_eq!(old_bridge, XcmBridgeHubRouter::bridge());
|
||||||
@@ -511,17 +537,14 @@ mod tests {
|
|||||||
TestWithBridgeHubChannel::make_congested();
|
TestWithBridgeHubChannel::make_congested();
|
||||||
|
|
||||||
let old_bridge = XcmBridgeHubRouter::bridge();
|
let old_bridge = XcmBridgeHubRouter::bridge();
|
||||||
assert_eq!(
|
assert_ok!(send_xcm::<XcmBridgeHubRouter>(
|
||||||
send_xcm::<XcmBridgeHubRouter>(
|
MultiLocation::new(
|
||||||
MultiLocation::new(
|
2,
|
||||||
2,
|
X2(GlobalConsensus(BridgedNetworkId::get()), Parachain(1000))
|
||||||
X2(GlobalConsensus(BridgedNetworkId::get()), Parachain(1000))
|
),
|
||||||
),
|
vec![ClearOrigin].into(),
|
||||||
vec![ClearOrigin].into(),
|
)
|
||||||
)
|
.map(drop));
|
||||||
.map(drop),
|
|
||||||
Ok(()),
|
|
||||||
);
|
|
||||||
|
|
||||||
assert!(TestToBridgeHubSender::is_message_sent());
|
assert!(TestToBridgeHubSender::is_message_sent());
|
||||||
assert!(
|
assert!(
|
||||||
@@ -536,17 +559,14 @@ mod tests {
|
|||||||
Bridge::<TestRuntime, ()>::put(congested_bridge(MINIMAL_DELIVERY_FEE_FACTOR));
|
Bridge::<TestRuntime, ()>::put(congested_bridge(MINIMAL_DELIVERY_FEE_FACTOR));
|
||||||
|
|
||||||
let old_bridge = XcmBridgeHubRouter::bridge();
|
let old_bridge = XcmBridgeHubRouter::bridge();
|
||||||
assert_eq!(
|
assert_ok!(send_xcm::<XcmBridgeHubRouter>(
|
||||||
send_xcm::<XcmBridgeHubRouter>(
|
MultiLocation::new(
|
||||||
MultiLocation::new(
|
2,
|
||||||
2,
|
X2(GlobalConsensus(BridgedNetworkId::get()), Parachain(1000))
|
||||||
X2(GlobalConsensus(BridgedNetworkId::get()), Parachain(1000))
|
),
|
||||||
),
|
vec![ClearOrigin].into(),
|
||||||
vec![ClearOrigin].into(),
|
)
|
||||||
)
|
.map(drop));
|
||||||
.map(drop),
|
|
||||||
Ok(()),
|
|
||||||
);
|
|
||||||
|
|
||||||
assert!(TestToBridgeHubSender::is_message_sent());
|
assert!(TestToBridgeHubSender::is_message_sent());
|
||||||
assert!(
|
assert!(
|
||||||
|
|||||||
@@ -19,7 +19,10 @@
|
|||||||
use crate as pallet_xcm_bridge_hub_router;
|
use crate as pallet_xcm_bridge_hub_router;
|
||||||
|
|
||||||
use bp_xcm_bridge_hub_router::XcmChannelStatusProvider;
|
use bp_xcm_bridge_hub_router::XcmChannelStatusProvider;
|
||||||
use frame_support::{construct_runtime, derive_impl, parameter_types};
|
use frame_support::{
|
||||||
|
construct_runtime, derive_impl, parameter_types,
|
||||||
|
traits::{Contains, Equals},
|
||||||
|
};
|
||||||
use frame_system::EnsureRoot;
|
use frame_system::EnsureRoot;
|
||||||
use sp_runtime::{traits::ConstU128, BuildStorage};
|
use sp_runtime::{traits::ConstU128, BuildStorage};
|
||||||
use xcm::prelude::*;
|
use xcm::prelude::*;
|
||||||
@@ -58,6 +61,7 @@ parameter_types! {
|
|||||||
Some((BridgeFeeAsset::get(), BASE_FEE).into())
|
Some((BridgeFeeAsset::get(), BASE_FEE).into())
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
|
pub UnknownXcmVersionLocation: MultiLocation = MultiLocation::new(2, X2(GlobalConsensus(BridgedNetworkId::get()), Parachain(9999)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
|
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
|
||||||
@@ -71,6 +75,8 @@ impl pallet_xcm_bridge_hub_router::Config<()> for TestRuntime {
|
|||||||
type UniversalLocation = UniversalLocation;
|
type UniversalLocation = UniversalLocation;
|
||||||
type BridgedNetworkId = BridgedNetworkId;
|
type BridgedNetworkId = BridgedNetworkId;
|
||||||
type Bridges = NetworkExportTable<BridgeTable>;
|
type Bridges = NetworkExportTable<BridgeTable>;
|
||||||
|
type DestinationVersion =
|
||||||
|
LatestOrNoneForLocationVersionChecker<Equals<UnknownXcmVersionLocation>>;
|
||||||
|
|
||||||
type BridgeHubOrigin = EnsureRoot<AccountId>;
|
type BridgeHubOrigin = EnsureRoot<AccountId>;
|
||||||
type ToBridgeHubSender = TestToBridgeHubSender;
|
type ToBridgeHubSender = TestToBridgeHubSender;
|
||||||
@@ -80,6 +86,18 @@ impl pallet_xcm_bridge_hub_router::Config<()> for TestRuntime {
|
|||||||
type FeeAsset = BridgeFeeAsset;
|
type FeeAsset = BridgeFeeAsset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct LatestOrNoneForLocationVersionChecker<Location>(sp_std::marker::PhantomData<Location>);
|
||||||
|
impl<Location: Contains<MultiLocation>> GetVersion
|
||||||
|
for LatestOrNoneForLocationVersionChecker<Location>
|
||||||
|
{
|
||||||
|
fn get_version_for(dest: &MultiLocation) -> Option<XcmVersion> {
|
||||||
|
if Location::contains(dest) {
|
||||||
|
return None
|
||||||
|
}
|
||||||
|
Some(XCM_VERSION)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub struct TestToBridgeHubSender;
|
pub struct TestToBridgeHubSender;
|
||||||
|
|
||||||
impl TestToBridgeHubSender {
|
impl TestToBridgeHubSender {
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ use xcm_executor::traits::ExportXcm;
|
|||||||
/// An easy way to access `HaulBlobExporter`.
|
/// An easy way to access `HaulBlobExporter`.
|
||||||
pub type PalletAsHaulBlobExporter<T, I> = HaulBlobExporter<
|
pub type PalletAsHaulBlobExporter<T, I> = HaulBlobExporter<
|
||||||
DummyHaulBlob,
|
DummyHaulBlob,
|
||||||
<T as Config<I>>::BridgedNetworkId,
|
<T as Config<I>>::BridgedNetwork,
|
||||||
|
<T as Config<I>>::DestinationVersion,
|
||||||
<T as Config<I>>::MessageExportPrice,
|
<T as Config<I>>::MessageExportPrice,
|
||||||
>;
|
>;
|
||||||
/// An easy way to access associated messages pallet.
|
/// An easy way to access associated messages pallet.
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ pub mod pallet {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use bridge_runtime_common::messages_xcm_extension::SenderAndLane;
|
use bridge_runtime_common::messages_xcm_extension::SenderAndLane;
|
||||||
use frame_support::pallet_prelude::*;
|
use frame_support::pallet_prelude::*;
|
||||||
|
use frame_system::pallet_prelude::BlockNumberFor;
|
||||||
|
|
||||||
#[pallet::config]
|
#[pallet::config]
|
||||||
#[pallet::disable_frame_system_supertrait_check]
|
#[pallet::disable_frame_system_supertrait_check]
|
||||||
@@ -48,15 +49,17 @@ pub mod pallet {
|
|||||||
// TODO: https://github.com/paritytech/parity-bridges-common/issues/1666 remove `ChainId` and
|
// TODO: https://github.com/paritytech/parity-bridges-common/issues/1666 remove `ChainId` and
|
||||||
// replace it with the `NetworkId` - then we'll be able to use
|
// replace it with the `NetworkId` - then we'll be able to use
|
||||||
// `T as pallet_bridge_messages::Config<T::BridgeMessagesPalletInstance>::BridgedChain::NetworkId`
|
// `T as pallet_bridge_messages::Config<T::BridgeMessagesPalletInstance>::BridgedChain::NetworkId`
|
||||||
/// Bridged network id.
|
/// Bridged network as relative location of bridged `GlobalConsensus`.
|
||||||
#[pallet::constant]
|
#[pallet::constant]
|
||||||
type BridgedNetworkId: Get<NetworkId>;
|
type BridgedNetwork: Get<MultiLocation>;
|
||||||
/// Associated messages pallet instance that bridges us with the
|
/// Associated messages pallet instance that bridges us with the
|
||||||
/// `BridgedNetworkId` consensus.
|
/// `BridgedNetworkId` consensus.
|
||||||
type BridgeMessagesPalletInstance: 'static;
|
type BridgeMessagesPalletInstance: 'static;
|
||||||
|
|
||||||
/// Price of single message export to the bridged consensus (`Self::BridgedNetworkId`).
|
/// Price of single message export to the bridged consensus (`Self::BridgedNetworkId`).
|
||||||
type MessageExportPrice: Get<MultiAssets>;
|
type MessageExportPrice: Get<MultiAssets>;
|
||||||
|
/// Checks the XCM version for the destination.
|
||||||
|
type DestinationVersion: GetVersion;
|
||||||
|
|
||||||
/// Get point-to-point links with bridged consensus (`Self::BridgedNetworkId`).
|
/// Get point-to-point links with bridged consensus (`Self::BridgedNetworkId`).
|
||||||
/// (this will be replaced with dynamic on-chain bridges - `Bridges V2`)
|
/// (this will be replaced with dynamic on-chain bridges - `Bridges V2`)
|
||||||
@@ -69,6 +72,17 @@ pub mod pallet {
|
|||||||
#[pallet::pallet]
|
#[pallet::pallet]
|
||||||
pub struct Pallet<T, I = ()>(PhantomData<(T, I)>);
|
pub struct Pallet<T, I = ()>(PhantomData<(T, I)>);
|
||||||
|
|
||||||
|
#[pallet::hooks]
|
||||||
|
impl<T: Config<I>, I: 'static> Hooks<BlockNumberFor<T>> for Pallet<T, I> {
|
||||||
|
fn integrity_test() {
|
||||||
|
assert!(
|
||||||
|
Self::bridged_network_id().is_some(),
|
||||||
|
"Configured `T::BridgedNetwork`: {:?} does not contain `GlobalConsensus` junction with `NetworkId`",
|
||||||
|
T::BridgedNetwork::get()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||||
/// Returns dedicated/configured lane identifier.
|
/// Returns dedicated/configured lane identifier.
|
||||||
pub(crate) fn lane_for(
|
pub(crate) fn lane_for(
|
||||||
@@ -83,7 +97,7 @@ pub mod pallet {
|
|||||||
.find_map(|(lane_source, (lane_dest_network, lane_dest))| {
|
.find_map(|(lane_source, (lane_dest_network, lane_dest))| {
|
||||||
if lane_source.location == source &&
|
if lane_source.location == source &&
|
||||||
&lane_dest_network == dest.0 &&
|
&lane_dest_network == dest.0 &&
|
||||||
&T::BridgedNetworkId::get() == dest.0 &&
|
Self::bridged_network_id().as_ref() == Some(dest.0) &&
|
||||||
&lane_dest == dest.1
|
&lane_dest == dest.1
|
||||||
{
|
{
|
||||||
Some(lane_source)
|
Some(lane_source)
|
||||||
@@ -92,5 +106,13 @@ pub mod pallet {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns some `NetworkId` if contains `GlobalConsensus` junction.
|
||||||
|
fn bridged_network_id() -> Option<NetworkId> {
|
||||||
|
match T::BridgedNetwork::get().take_first_interior() {
|
||||||
|
Some(GlobalConsensus(network)) => Some(network),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,6 +170,10 @@ impl pallet_bridge_messages::WeightInfoExt for TestMessagesWeights {
|
|||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const RelayNetwork: NetworkId = NetworkId::Kusama;
|
pub const RelayNetwork: NetworkId = NetworkId::Kusama;
|
||||||
pub const BridgedRelayNetwork: NetworkId = NetworkId::Polkadot;
|
pub const BridgedRelayNetwork: NetworkId = NetworkId::Polkadot;
|
||||||
|
pub const BridgedRelayNetworkLocation: MultiLocation = MultiLocation {
|
||||||
|
parents: 1,
|
||||||
|
interior: X1(GlobalConsensus(BridgedRelayNetwork::get()))
|
||||||
|
};
|
||||||
pub const NonBridgedRelayNetwork: NetworkId = NetworkId::Rococo;
|
pub const NonBridgedRelayNetwork: NetworkId = NetworkId::Rococo;
|
||||||
pub const BridgeReserve: Balance = 100_000;
|
pub const BridgeReserve: Balance = 100_000;
|
||||||
pub UniversalLocation: InteriorMultiLocation = X2(
|
pub UniversalLocation: InteriorMultiLocation = X2(
|
||||||
@@ -181,10 +185,12 @@ parameter_types! {
|
|||||||
|
|
||||||
impl pallet_xcm_bridge_hub::Config for TestRuntime {
|
impl pallet_xcm_bridge_hub::Config for TestRuntime {
|
||||||
type UniversalLocation = UniversalLocation;
|
type UniversalLocation = UniversalLocation;
|
||||||
type BridgedNetworkId = BridgedRelayNetwork;
|
type BridgedNetwork = BridgedRelayNetworkLocation;
|
||||||
type BridgeMessagesPalletInstance = ();
|
type BridgeMessagesPalletInstance = ();
|
||||||
|
|
||||||
type MessageExportPrice = ();
|
type MessageExportPrice = ();
|
||||||
|
type DestinationVersion = AlwaysLatest;
|
||||||
|
|
||||||
type Lanes = TestLanes;
|
type Lanes = TestLanes;
|
||||||
type LanesSupport = TestXcmBlobHauler;
|
type LanesSupport = TestXcmBlobHauler;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -21,8 +21,8 @@ use frame_support::traits::OnInitialize;
|
|||||||
// Cumulus
|
// Cumulus
|
||||||
use emulated_integration_tests_common::{
|
use emulated_integration_tests_common::{
|
||||||
impl_accounts_helpers_for_parachain, impl_assert_events_helpers_for_parachain,
|
impl_accounts_helpers_for_parachain, impl_assert_events_helpers_for_parachain,
|
||||||
impl_assets_helpers_for_parachain, impl_foreign_assets_helpers_for_parachain, impls::Parachain,
|
impl_assets_helpers_for_parachain, impl_foreign_assets_helpers_for_parachain,
|
||||||
xcm_emulator::decl_test_parachains,
|
impl_xcm_helpers_for_parachain, impls::Parachain, xcm_emulator::decl_test_parachains,
|
||||||
};
|
};
|
||||||
use rococo_emulated_chain::Rococo;
|
use rococo_emulated_chain::Rococo;
|
||||||
|
|
||||||
@@ -55,3 +55,4 @@ impl_accounts_helpers_for_parachain!(AssetHubRococo);
|
|||||||
impl_assert_events_helpers_for_parachain!(AssetHubRococo);
|
impl_assert_events_helpers_for_parachain!(AssetHubRococo);
|
||||||
impl_assets_helpers_for_parachain!(AssetHubRococo, Rococo);
|
impl_assets_helpers_for_parachain!(AssetHubRococo, Rococo);
|
||||||
impl_foreign_assets_helpers_for_parachain!(AssetHubRococo, Rococo);
|
impl_foreign_assets_helpers_for_parachain!(AssetHubRococo, Rococo);
|
||||||
|
impl_xcm_helpers_for_parachain!(AssetHubRococo);
|
||||||
|
|||||||
+3
-2
@@ -21,8 +21,8 @@ use frame_support::traits::OnInitialize;
|
|||||||
// Cumulus
|
// Cumulus
|
||||||
use emulated_integration_tests_common::{
|
use emulated_integration_tests_common::{
|
||||||
impl_accounts_helpers_for_parachain, impl_assert_events_helpers_for_parachain,
|
impl_accounts_helpers_for_parachain, impl_assert_events_helpers_for_parachain,
|
||||||
impl_assets_helpers_for_parachain, impl_foreign_assets_helpers_for_parachain, impls::Parachain,
|
impl_assets_helpers_for_parachain, impl_foreign_assets_helpers_for_parachain,
|
||||||
xcm_emulator::decl_test_parachains,
|
impl_xcm_helpers_for_parachain, impls::Parachain, xcm_emulator::decl_test_parachains,
|
||||||
};
|
};
|
||||||
use westend_emulated_chain::Westend;
|
use westend_emulated_chain::Westend;
|
||||||
|
|
||||||
@@ -55,3 +55,4 @@ impl_accounts_helpers_for_parachain!(AssetHubWestend);
|
|||||||
impl_assert_events_helpers_for_parachain!(AssetHubWestend);
|
impl_assert_events_helpers_for_parachain!(AssetHubWestend);
|
||||||
impl_assets_helpers_for_parachain!(AssetHubWestend, Westend);
|
impl_assets_helpers_for_parachain!(AssetHubWestend, Westend);
|
||||||
impl_foreign_assets_helpers_for_parachain!(AssetHubWestend, Westend);
|
impl_foreign_assets_helpers_for_parachain!(AssetHubWestend, Westend);
|
||||||
|
impl_xcm_helpers_for_parachain!(AssetHubWestend);
|
||||||
|
|||||||
+2
-1
@@ -21,7 +21,7 @@ use frame_support::traits::OnInitialize;
|
|||||||
// Cumulus
|
// Cumulus
|
||||||
use emulated_integration_tests_common::{
|
use emulated_integration_tests_common::{
|
||||||
impl_accounts_helpers_for_parachain, impl_assert_events_helpers_for_parachain,
|
impl_accounts_helpers_for_parachain, impl_assert_events_helpers_for_parachain,
|
||||||
impls::Parachain, xcm_emulator::decl_test_parachains,
|
impl_xcm_helpers_for_parachain, impls::Parachain, xcm_emulator::decl_test_parachains,
|
||||||
};
|
};
|
||||||
|
|
||||||
// BridgeHubRococo Parachain declaration
|
// BridgeHubRococo Parachain declaration
|
||||||
@@ -47,3 +47,4 @@ decl_test_parachains! {
|
|||||||
// BridgeHubRococo implementation
|
// BridgeHubRococo implementation
|
||||||
impl_accounts_helpers_for_parachain!(BridgeHubRococo);
|
impl_accounts_helpers_for_parachain!(BridgeHubRococo);
|
||||||
impl_assert_events_helpers_for_parachain!(BridgeHubRococo);
|
impl_assert_events_helpers_for_parachain!(BridgeHubRococo);
|
||||||
|
impl_xcm_helpers_for_parachain!(BridgeHubRococo);
|
||||||
|
|||||||
+2
-1
@@ -21,7 +21,7 @@ use frame_support::traits::OnInitialize;
|
|||||||
// Cumulus
|
// Cumulus
|
||||||
use emulated_integration_tests_common::{
|
use emulated_integration_tests_common::{
|
||||||
impl_accounts_helpers_for_parachain, impl_assert_events_helpers_for_parachain,
|
impl_accounts_helpers_for_parachain, impl_assert_events_helpers_for_parachain,
|
||||||
impls::Parachain, xcm_emulator::decl_test_parachains,
|
impl_xcm_helpers_for_parachain, impls::Parachain, xcm_emulator::decl_test_parachains,
|
||||||
};
|
};
|
||||||
|
|
||||||
// BridgeHubWestend Parachain declaration
|
// BridgeHubWestend Parachain declaration
|
||||||
@@ -47,3 +47,4 @@ decl_test_parachains! {
|
|||||||
// BridgeHubWestend implementation
|
// BridgeHubWestend implementation
|
||||||
impl_accounts_helpers_for_parachain!(BridgeHubWestend);
|
impl_accounts_helpers_for_parachain!(BridgeHubWestend);
|
||||||
impl_assert_events_helpers_for_parachain!(BridgeHubWestend);
|
impl_assert_events_helpers_for_parachain!(BridgeHubWestend);
|
||||||
|
impl_xcm_helpers_for_parachain!(BridgeHubWestend);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ pub use polkadot_runtime_parachains::{
|
|||||||
inclusion::{AggregateMessageOrigin, UmpQueueId},
|
inclusion::{AggregateMessageOrigin, UmpQueueId},
|
||||||
};
|
};
|
||||||
pub use xcm::{
|
pub use xcm::{
|
||||||
prelude::{MultiLocation, OriginKind, Outcome, VersionedXcm},
|
prelude::{MultiLocation, OriginKind, Outcome, VersionedXcm, XcmVersion},
|
||||||
v3::Error,
|
v3::Error,
|
||||||
DoubleEncoded,
|
DoubleEncoded,
|
||||||
};
|
};
|
||||||
@@ -173,10 +173,14 @@ macro_rules! impl_accounts_helpers_for_relay_chain {
|
|||||||
pub fn fund_accounts(accounts: Vec<($crate::impls::AccountId, $crate::impls::Balance)>) {
|
pub fn fund_accounts(accounts: Vec<($crate::impls::AccountId, $crate::impls::Balance)>) {
|
||||||
<Self as $crate::impls::TestExt>::execute_with(|| {
|
<Self as $crate::impls::TestExt>::execute_with(|| {
|
||||||
for account in accounts {
|
for account in accounts {
|
||||||
|
let who = account.0;
|
||||||
|
let actual = <Self as [<$chain RelayPallet>]>::Balances::free_balance(&who);
|
||||||
|
let actual = actual.saturating_add(<Self as [<$chain RelayPallet>]>::Balances::reserved_balance(&who));
|
||||||
|
|
||||||
$crate::impls::assert_ok!(<Self as [<$chain RelayPallet>]>::Balances::force_set_balance(
|
$crate::impls::assert_ok!(<Self as [<$chain RelayPallet>]>::Balances::force_set_balance(
|
||||||
<Self as $crate::impls::Chain>::RuntimeOrigin::root(),
|
<Self as $crate::impls::Chain>::RuntimeOrigin::root(),
|
||||||
account.0.into(),
|
who.into(),
|
||||||
account.1,
|
actual.saturating_add(account.1),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -386,15 +390,26 @@ macro_rules! impl_accounts_helpers_for_parachain {
|
|||||||
pub fn fund_accounts(accounts: Vec<($crate::impls::AccountId, $crate::impls::Balance)>) {
|
pub fn fund_accounts(accounts: Vec<($crate::impls::AccountId, $crate::impls::Balance)>) {
|
||||||
<Self as $crate::impls::TestExt>::execute_with(|| {
|
<Self as $crate::impls::TestExt>::execute_with(|| {
|
||||||
for account in accounts {
|
for account in accounts {
|
||||||
|
let who = account.0;
|
||||||
|
let actual = <Self as [<$chain ParaPallet>]>::Balances::free_balance(&who);
|
||||||
|
let actual = actual.saturating_add(<Self as [<$chain ParaPallet>]>::Balances::reserved_balance(&who));
|
||||||
|
|
||||||
$crate::impls::assert_ok!(<Self as [<$chain ParaPallet>]>::Balances::force_set_balance(
|
$crate::impls::assert_ok!(<Self as [<$chain ParaPallet>]>::Balances::force_set_balance(
|
||||||
<Self as $crate::impls::Chain>::RuntimeOrigin::root(),
|
<Self as $crate::impls::Chain>::RuntimeOrigin::root(),
|
||||||
account.0.into(),
|
who.into(),
|
||||||
account.1,
|
actual.saturating_add(account.1),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Fund a sovereign account of sibling para.
|
||||||
|
pub fn fund_para_sovereign(sibling_para_id: $crate::impls::ParaId, balance: $crate::impls::Balance) {
|
||||||
|
let sibling_location = Self::sibling_location_of(sibling_para_id);
|
||||||
|
let sovereign_account = Self::sovereign_account_id_of(sibling_location);
|
||||||
|
Self::fund_accounts(vec![(sovereign_account.into(), balance)])
|
||||||
|
}
|
||||||
|
|
||||||
/// Return local sovereign account of `para_id` on other `network_id`
|
/// Return local sovereign account of `para_id` on other `network_id`
|
||||||
pub fn sovereign_account_of_parachain_on_other_global_consensus(
|
pub fn sovereign_account_of_parachain_on_other_global_consensus(
|
||||||
network_id: $crate::impls::NetworkId,
|
network_id: $crate::impls::NetworkId,
|
||||||
@@ -790,3 +805,33 @@ macro_rules! impl_foreign_assets_helpers_for_parachain {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! impl_xcm_helpers_for_parachain {
|
||||||
|
( $chain:ident ) => {
|
||||||
|
$crate::impls::paste::paste! {
|
||||||
|
impl<N: $crate::impls::Network> $chain<N> {
|
||||||
|
/// Set XCM version for destination.
|
||||||
|
pub fn force_xcm_version(dest: $crate::impls::MultiLocation, version: $crate::impls::XcmVersion) {
|
||||||
|
<Self as $crate::impls::TestExt>::execute_with(|| {
|
||||||
|
$crate::impls::assert_ok!(<Self as [<$chain ParaPallet>]>::PolkadotXcm::force_xcm_version(
|
||||||
|
<Self as $crate::impls::Chain>::RuntimeOrigin::root(),
|
||||||
|
$crate::impls::bx!(dest),
|
||||||
|
version,
|
||||||
|
));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Set default/safe XCM version for runtime.
|
||||||
|
pub fn force_default_xcm_version(version: Option<$crate::impls::XcmVersion>) {
|
||||||
|
<Self as $crate::impls::TestExt>::execute_with(|| {
|
||||||
|
$crate::impls::assert_ok!(<Self as [<$chain ParaPallet>]>::PolkadotXcm::force_default_xcm_version(
|
||||||
|
<Self as $crate::impls::Chain>::RuntimeOrigin::root(),
|
||||||
|
version,
|
||||||
|
));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+1
@@ -15,6 +15,7 @@ frame-support = { path = "../../../../../../../substrate/frame/support", default
|
|||||||
pallet-assets = { path = "../../../../../../../substrate/frame/assets", default-features = false }
|
pallet-assets = { path = "../../../../../../../substrate/frame/assets", default-features = false }
|
||||||
pallet-balances = { path = "../../../../../../../substrate/frame/balances", default-features = false }
|
pallet-balances = { path = "../../../../../../../substrate/frame/balances", default-features = false }
|
||||||
pallet-message-queue = { path = "../../../../../../../substrate/frame/message-queue" }
|
pallet-message-queue = { path = "../../../../../../../substrate/frame/message-queue" }
|
||||||
|
sp-runtime = { path = "../../../../../../../substrate/primitives/runtime", default-features = false }
|
||||||
|
|
||||||
# Polkadot
|
# Polkadot
|
||||||
xcm = { package = "staging-xcm", path = "../../../../../../../polkadot/xcm", default-features = false }
|
xcm = { package = "staging-xcm", path = "../../../../../../../polkadot/xcm", default-features = false }
|
||||||
|
|||||||
+3
-1
@@ -14,10 +14,12 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
// Substrate
|
// Substrate
|
||||||
pub use frame_support::assert_ok;
|
pub use frame_support::{assert_err, assert_ok, pallet_prelude::DispatchResult};
|
||||||
|
pub use sp_runtime::DispatchError;
|
||||||
|
|
||||||
// Polkadot
|
// Polkadot
|
||||||
pub use xcm::{
|
pub use xcm::{
|
||||||
|
latest::ParentThen,
|
||||||
prelude::{AccountId32 as AccountId32Junction, *},
|
prelude::{AccountId32 as AccountId32Junction, *},
|
||||||
v3::{
|
v3::{
|
||||||
Error,
|
Error,
|
||||||
|
|||||||
+10
-58
@@ -13,70 +13,22 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
use crate::*;
|
use crate::tests::*;
|
||||||
|
|
||||||
fn send_asset_from_asset_hub_rococo_to_asset_hub_westend(id: MultiLocation, amount: u128) {
|
fn send_asset_from_asset_hub_rococo_to_asset_hub_westend(id: MultiLocation, amount: u128) {
|
||||||
let signed_origin =
|
let destination = asset_hub_westend_location();
|
||||||
<AssetHubRococo as Chain>::RuntimeOrigin::signed(AssetHubRococoSender::get().into());
|
|
||||||
let asset_hub_westend_para_id = AssetHubWestend::para_id().into();
|
|
||||||
let destination = MultiLocation {
|
|
||||||
parents: 2,
|
|
||||||
interior: X2(GlobalConsensus(NetworkId::Westend), Parachain(asset_hub_westend_para_id)),
|
|
||||||
};
|
|
||||||
let beneficiary_id = AssetHubWestendReceiver::get();
|
|
||||||
let beneficiary: MultiLocation =
|
|
||||||
AccountId32Junction { network: None, id: beneficiary_id.into() }.into();
|
|
||||||
let assets: MultiAssets = (id, amount).into();
|
|
||||||
let fee_asset_item = 0;
|
|
||||||
|
|
||||||
// fund the AHR's SA on BHR for paying bridge transport fees
|
// fund the AHR's SA on BHR for paying bridge transport fees
|
||||||
let ahr_as_seen_by_bhr = BridgeHubRococo::sibling_location_of(AssetHubRococo::para_id());
|
BridgeHubRococo::fund_para_sovereign(AssetHubRococo::para_id(), 10_000_000_000_000u128);
|
||||||
let sov_ahr_on_bhr = BridgeHubRococo::sovereign_account_id_of(ahr_as_seen_by_bhr);
|
|
||||||
BridgeHubRococo::fund_accounts(vec![(sov_ahr_on_bhr.into(), 10_000_000_000_000u128)]);
|
|
||||||
|
|
||||||
AssetHubRococo::execute_with(|| {
|
// set XCM versions
|
||||||
assert_ok!(
|
AssetHubRococo::force_xcm_version(destination, XCM_VERSION);
|
||||||
<AssetHubRococo as AssetHubRococoPallet>::PolkadotXcm::limited_reserve_transfer_assets(
|
BridgeHubRococo::force_xcm_version(bridge_hub_westend_location(), XCM_VERSION);
|
||||||
signed_origin,
|
|
||||||
bx!(destination.into()),
|
|
||||||
bx!(beneficiary.into()),
|
|
||||||
bx!(assets.into()),
|
|
||||||
fee_asset_item,
|
|
||||||
WeightLimit::Unlimited,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
BridgeHubRococo::execute_with(|| {
|
// send message over bridge
|
||||||
type RuntimeEvent = <BridgeHubRococo as Chain>::RuntimeEvent;
|
assert_ok!(send_asset_from_asset_hub_rococo(destination, (id, amount)));
|
||||||
assert_expected_events!(
|
assert_bridge_hub_rococo_message_accepted(true);
|
||||||
BridgeHubRococo,
|
assert_bridge_hub_westend_message_received();
|
||||||
vec![
|
|
||||||
// pay for bridge fees
|
|
||||||
RuntimeEvent::Balances(pallet_balances::Event::Withdraw { .. }) => {},
|
|
||||||
// message exported
|
|
||||||
RuntimeEvent::BridgeWestendMessages(
|
|
||||||
pallet_bridge_messages::Event::MessageAccepted { .. }
|
|
||||||
) => {},
|
|
||||||
// message processed successfully
|
|
||||||
RuntimeEvent::MessageQueue(
|
|
||||||
pallet_message_queue::Event::Processed { success: true, .. }
|
|
||||||
) => {},
|
|
||||||
]
|
|
||||||
);
|
|
||||||
});
|
|
||||||
BridgeHubWestend::execute_with(|| {
|
|
||||||
type RuntimeEvent = <BridgeHubWestend as Chain>::RuntimeEvent;
|
|
||||||
assert_expected_events!(
|
|
||||||
BridgeHubWestend,
|
|
||||||
vec![
|
|
||||||
// message dispatched successfully
|
|
||||||
RuntimeEvent::XcmpQueue(
|
|
||||||
cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. }
|
|
||||||
) => {},
|
|
||||||
]
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
+96
@@ -13,6 +13,102 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
mod asset_transfers;
|
mod asset_transfers;
|
||||||
mod send_xcm;
|
mod send_xcm;
|
||||||
mod teleport;
|
mod teleport;
|
||||||
|
|
||||||
|
pub(crate) fn asset_hub_westend_location() -> MultiLocation {
|
||||||
|
MultiLocation {
|
||||||
|
parents: 2,
|
||||||
|
interior: X2(
|
||||||
|
GlobalConsensus(NetworkId::Westend),
|
||||||
|
Parachain(AssetHubWestend::para_id().into()),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn bridge_hub_westend_location() -> MultiLocation {
|
||||||
|
MultiLocation {
|
||||||
|
parents: 2,
|
||||||
|
interior: X2(
|
||||||
|
GlobalConsensus(NetworkId::Westend),
|
||||||
|
Parachain(BridgeHubWestend::para_id().into()),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn send_asset_from_asset_hub_rococo(
|
||||||
|
destination: MultiLocation,
|
||||||
|
(id, amount): (MultiLocation, u128),
|
||||||
|
) -> DispatchResult {
|
||||||
|
let signed_origin =
|
||||||
|
<AssetHubRococo as Chain>::RuntimeOrigin::signed(AssetHubRococoSender::get().into());
|
||||||
|
|
||||||
|
let beneficiary: MultiLocation =
|
||||||
|
AccountId32Junction { network: None, id: AssetHubWestendReceiver::get().into() }.into();
|
||||||
|
|
||||||
|
let assets: MultiAssets = (id, amount).into();
|
||||||
|
let fee_asset_item = 0;
|
||||||
|
|
||||||
|
AssetHubRococo::execute_with(|| {
|
||||||
|
<AssetHubRococo as AssetHubRococoPallet>::PolkadotXcm::limited_reserve_transfer_assets(
|
||||||
|
signed_origin,
|
||||||
|
bx!(destination.into()),
|
||||||
|
bx!(beneficiary.into()),
|
||||||
|
bx!(assets.into()),
|
||||||
|
fee_asset_item,
|
||||||
|
WeightLimit::Unlimited,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn assert_bridge_hub_rococo_message_accepted(expected_processed: bool) {
|
||||||
|
BridgeHubRococo::execute_with(|| {
|
||||||
|
type RuntimeEvent = <BridgeHubRococo as Chain>::RuntimeEvent;
|
||||||
|
|
||||||
|
if expected_processed {
|
||||||
|
assert_expected_events!(
|
||||||
|
BridgeHubRococo,
|
||||||
|
vec![
|
||||||
|
// pay for bridge fees
|
||||||
|
RuntimeEvent::Balances(pallet_balances::Event::Withdraw { .. }) => {},
|
||||||
|
// message exported
|
||||||
|
RuntimeEvent::BridgeWestendMessages(
|
||||||
|
pallet_bridge_messages::Event::MessageAccepted { .. }
|
||||||
|
) => {},
|
||||||
|
// message processed successfully
|
||||||
|
RuntimeEvent::MessageQueue(
|
||||||
|
pallet_message_queue::Event::Processed { success: true, .. }
|
||||||
|
) => {},
|
||||||
|
]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
assert_expected_events!(
|
||||||
|
BridgeHubRococo,
|
||||||
|
vec![
|
||||||
|
RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed {
|
||||||
|
success: false,
|
||||||
|
..
|
||||||
|
}) => {},
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn assert_bridge_hub_westend_message_received() {
|
||||||
|
BridgeHubWestend::execute_with(|| {
|
||||||
|
type RuntimeEvent = <BridgeHubWestend as Chain>::RuntimeEvent;
|
||||||
|
assert_expected_events!(
|
||||||
|
BridgeHubWestend,
|
||||||
|
vec![
|
||||||
|
// message sent to destination
|
||||||
|
RuntimeEvent::XcmpQueue(
|
||||||
|
cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. }
|
||||||
|
) => {},
|
||||||
|
]
|
||||||
|
);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
+114
-8
@@ -13,7 +13,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
use crate::*;
|
use crate::tests::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn send_xcm_from_rococo_relay_to_westend_asset_hub_should_fail_on_not_applicable() {
|
fn send_xcm_from_rococo_relay_to_westend_asset_hub_should_fail_on_not_applicable() {
|
||||||
@@ -55,17 +55,123 @@ fn send_xcm_from_rococo_relay_to_westend_asset_hub_should_fail_on_not_applicable
|
|||||||
});
|
});
|
||||||
// Receive XCM message in Bridge Hub source Parachain, it should fail, because we don't have
|
// Receive XCM message in Bridge Hub source Parachain, it should fail, because we don't have
|
||||||
// opened bridge/lane.
|
// opened bridge/lane.
|
||||||
BridgeHubRococo::execute_with(|| {
|
assert_bridge_hub_rococo_message_accepted(false);
|
||||||
type RuntimeEvent = <BridgeHubRococo as Chain>::RuntimeEvent;
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn send_xcm_through_opened_lane_with_different_xcm_version_on_hops_works() {
|
||||||
|
// Initially set only default version on all runtimes
|
||||||
|
AssetHubRococo::force_default_xcm_version(Some(xcm::v2::prelude::XCM_VERSION));
|
||||||
|
BridgeHubRococo::force_default_xcm_version(Some(xcm::v2::prelude::XCM_VERSION));
|
||||||
|
BridgeHubWestend::force_default_xcm_version(Some(xcm::v2::prelude::XCM_VERSION));
|
||||||
|
AssetHubWestend::force_default_xcm_version(Some(xcm::v2::prelude::XCM_VERSION));
|
||||||
|
|
||||||
|
// prepare data
|
||||||
|
let destination = asset_hub_westend_location();
|
||||||
|
let native_token = MultiLocation::parent();
|
||||||
|
let amount = ASSET_HUB_ROCOCO_ED * 1_000;
|
||||||
|
|
||||||
|
// fund the AHR's SA on BHR for paying bridge transport fees
|
||||||
|
BridgeHubRococo::fund_para_sovereign(AssetHubRococo::para_id(), 10_000_000_000_000u128);
|
||||||
|
// fund sender
|
||||||
|
AssetHubRococo::fund_accounts(vec![(AssetHubRococoSender::get().into(), amount * 10)]);
|
||||||
|
|
||||||
|
// send XCM from AssetHubRococo - fails - destination version not known
|
||||||
|
assert_err!(
|
||||||
|
send_asset_from_asset_hub_rococo(destination, (native_token, amount)),
|
||||||
|
DispatchError::Module(sp_runtime::ModuleError {
|
||||||
|
index: 31,
|
||||||
|
error: [1, 0, 0, 0],
|
||||||
|
message: Some("SendFailure")
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
// set destination version
|
||||||
|
AssetHubRococo::force_xcm_version(destination, xcm::v3::prelude::XCM_VERSION);
|
||||||
|
|
||||||
|
// TODO: remove this block, when removing `xcm:v2`
|
||||||
|
{
|
||||||
|
// send XCM from AssetHubRococo - fails - AssetHubRococo is set to the default/safe `2`
|
||||||
|
// version, which does not have the `ExportMessage` instruction. If the default `2` is
|
||||||
|
// changed to `3`, then this assert can go away"
|
||||||
|
assert_err!(
|
||||||
|
send_asset_from_asset_hub_rococo(destination, (native_token, amount)),
|
||||||
|
DispatchError::Module(sp_runtime::ModuleError {
|
||||||
|
index: 31,
|
||||||
|
error: [1, 0, 0, 0],
|
||||||
|
message: Some("SendFailure")
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
// set exact version for BridgeHubWestend to `2` without `ExportMessage` instruction
|
||||||
|
AssetHubRococo::force_xcm_version(
|
||||||
|
ParentThen(Parachain(BridgeHubRococo::para_id().into()).into()).into(),
|
||||||
|
xcm::v2::prelude::XCM_VERSION,
|
||||||
|
);
|
||||||
|
// send XCM from AssetHubRococo - fails - `ExportMessage` is not in `2`
|
||||||
|
assert_err!(
|
||||||
|
send_asset_from_asset_hub_rococo(destination, (native_token, amount)),
|
||||||
|
DispatchError::Module(sp_runtime::ModuleError {
|
||||||
|
index: 31,
|
||||||
|
error: [1, 0, 0, 0],
|
||||||
|
message: Some("SendFailure")
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// set version with `ExportMessage` for BridgeHubRococo
|
||||||
|
AssetHubRococo::force_xcm_version(
|
||||||
|
ParentThen(Parachain(BridgeHubRococo::para_id().into()).into()).into(),
|
||||||
|
xcm::v3::prelude::XCM_VERSION,
|
||||||
|
);
|
||||||
|
// send XCM from AssetHubRococo - ok
|
||||||
|
assert_ok!(send_asset_from_asset_hub_rococo(destination, (native_token, amount)));
|
||||||
|
|
||||||
|
// `ExportMessage` on local BridgeHub - fails - remote BridgeHub version not known
|
||||||
|
assert_bridge_hub_rococo_message_accepted(false);
|
||||||
|
|
||||||
|
// set version for remote BridgeHub on BridgeHubRococo
|
||||||
|
BridgeHubRococo::force_xcm_version(
|
||||||
|
bridge_hub_westend_location(),
|
||||||
|
xcm::v3::prelude::XCM_VERSION,
|
||||||
|
);
|
||||||
|
// set version for AssetHubWestend on BridgeHubWestend
|
||||||
|
BridgeHubWestend::force_xcm_version(
|
||||||
|
ParentThen(Parachain(AssetHubWestend::para_id().into()).into()).into(),
|
||||||
|
xcm::v3::prelude::XCM_VERSION,
|
||||||
|
);
|
||||||
|
|
||||||
|
// send XCM from AssetHubRococo - ok
|
||||||
|
assert_ok!(send_asset_from_asset_hub_rococo(destination, (native_token, amount)));
|
||||||
|
assert_bridge_hub_rococo_message_accepted(true);
|
||||||
|
assert_bridge_hub_westend_message_received();
|
||||||
|
// message delivered and processed at destination
|
||||||
|
AssetHubWestend::execute_with(|| {
|
||||||
|
type RuntimeEvent = <AssetHubWestend as Chain>::RuntimeEvent;
|
||||||
assert_expected_events!(
|
assert_expected_events!(
|
||||||
BridgeHubRococo,
|
AssetHubWestend,
|
||||||
vec![
|
vec![
|
||||||
RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed {
|
// message processed with failure, but for this scenario it is ok, important is that was delivered
|
||||||
success: false,
|
RuntimeEvent::MessageQueue(
|
||||||
..
|
pallet_message_queue::Event::Processed { success: false, .. }
|
||||||
}) => {},
|
) => {},
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: remove this block, when removing `xcm:v2`
|
||||||
|
{
|
||||||
|
// set `2` version for remote BridgeHub on BridgeHubRococo, which does not have
|
||||||
|
// `UniversalOrigin` and `DescendOrigin`
|
||||||
|
BridgeHubRococo::force_xcm_version(
|
||||||
|
bridge_hub_westend_location(),
|
||||||
|
xcm::v2::prelude::XCM_VERSION,
|
||||||
|
);
|
||||||
|
|
||||||
|
// send XCM from AssetHubRococo - ok
|
||||||
|
assert_ok!(send_asset_from_asset_hub_rococo(destination, (native_token, amount)));
|
||||||
|
// message is not accepted on the local BridgeHub (`DestinationUnsupported`) because we
|
||||||
|
// cannot add `UniversalOrigin` and `DescendOrigin`
|
||||||
|
assert_bridge_hub_rococo_message_accepted(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -15,6 +15,7 @@ frame-support = { path = "../../../../../../../substrate/frame/support", default
|
|||||||
pallet-assets = { path = "../../../../../../../substrate/frame/assets", default-features = false }
|
pallet-assets = { path = "../../../../../../../substrate/frame/assets", default-features = false }
|
||||||
pallet-balances = { path = "../../../../../../../substrate/frame/balances", default-features = false }
|
pallet-balances = { path = "../../../../../../../substrate/frame/balances", default-features = false }
|
||||||
pallet-message-queue = { path = "../../../../../../../substrate/frame/message-queue" }
|
pallet-message-queue = { path = "../../../../../../../substrate/frame/message-queue" }
|
||||||
|
sp-runtime = { path = "../../../../../../../substrate/primitives/runtime", default-features = false }
|
||||||
|
|
||||||
# Polkadot
|
# Polkadot
|
||||||
xcm = { package = "staging-xcm", path = "../../../../../../../polkadot/xcm", default-features = false }
|
xcm = { package = "staging-xcm", path = "../../../../../../../polkadot/xcm", default-features = false }
|
||||||
|
|||||||
+3
-1
@@ -14,10 +14,12 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
// Substrate
|
// Substrate
|
||||||
pub use frame_support::assert_ok;
|
pub use frame_support::{assert_err, assert_ok, pallet_prelude::DispatchResult};
|
||||||
|
pub use sp_runtime::DispatchError;
|
||||||
|
|
||||||
// Polkadot
|
// Polkadot
|
||||||
pub use xcm::{
|
pub use xcm::{
|
||||||
|
latest::ParentThen,
|
||||||
prelude::{AccountId32 as AccountId32Junction, *},
|
prelude::{AccountId32 as AccountId32Junction, *},
|
||||||
v3::{
|
v3::{
|
||||||
Error,
|
Error,
|
||||||
|
|||||||
+10
-58
@@ -12,70 +12,22 @@
|
|||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
use crate::*;
|
use crate::tests::*;
|
||||||
|
|
||||||
fn send_asset_from_asset_hub_westend_to_asset_hub_rococo(id: MultiLocation, amount: u128) {
|
fn send_asset_from_asset_hub_westend_to_asset_hub_rococo(id: MultiLocation, amount: u128) {
|
||||||
let signed_origin =
|
let destination = asset_hub_rococo_location();
|
||||||
<AssetHubWestend as Chain>::RuntimeOrigin::signed(AssetHubWestendSender::get().into());
|
|
||||||
let asset_hub_rococo_para_id = AssetHubRococo::para_id().into();
|
|
||||||
let destination = MultiLocation {
|
|
||||||
parents: 2,
|
|
||||||
interior: X2(GlobalConsensus(NetworkId::Rococo), Parachain(asset_hub_rococo_para_id)),
|
|
||||||
};
|
|
||||||
let beneficiary_id = AssetHubRococoReceiver::get();
|
|
||||||
let beneficiary: MultiLocation =
|
|
||||||
AccountId32Junction { network: None, id: beneficiary_id.into() }.into();
|
|
||||||
let assets: MultiAssets = (id, amount).into();
|
|
||||||
let fee_asset_item = 0;
|
|
||||||
|
|
||||||
// fund the AHW's SA on BHW for paying bridge transport fees
|
// fund the AHW's SA on BHW for paying bridge transport fees
|
||||||
let ahw_as_seen_by_bhw = BridgeHubWestend::sibling_location_of(AssetHubWestend::para_id());
|
BridgeHubWestend::fund_para_sovereign(AssetHubWestend::para_id(), 10_000_000_000_000u128);
|
||||||
let sov_ahw_on_bhw = BridgeHubWestend::sovereign_account_id_of(ahw_as_seen_by_bhw);
|
|
||||||
BridgeHubWestend::fund_accounts(vec![(sov_ahw_on_bhw.into(), 10_000_000_000_000u128)]);
|
|
||||||
|
|
||||||
AssetHubWestend::execute_with(|| {
|
// set XCM versions
|
||||||
assert_ok!(
|
AssetHubWestend::force_xcm_version(destination, XCM_VERSION);
|
||||||
<AssetHubWestend as AssetHubWestendPallet>::PolkadotXcm::limited_reserve_transfer_assets(
|
BridgeHubWestend::force_xcm_version(bridge_hub_rococo_location(), XCM_VERSION);
|
||||||
signed_origin,
|
|
||||||
bx!(destination.into()),
|
|
||||||
bx!(beneficiary.into()),
|
|
||||||
bx!(assets.into()),
|
|
||||||
fee_asset_item,
|
|
||||||
WeightLimit::Unlimited,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
BridgeHubWestend::execute_with(|| {
|
// send message over bridge
|
||||||
type RuntimeEvent = <BridgeHubWestend as Chain>::RuntimeEvent;
|
assert_ok!(send_asset_from_asset_hub_westend(destination, (id, amount)));
|
||||||
assert_expected_events!(
|
assert_bridge_hub_westend_message_accepted(true);
|
||||||
BridgeHubWestend,
|
assert_bridge_hub_rococo_message_received();
|
||||||
vec![
|
|
||||||
// pay for bridge fees
|
|
||||||
RuntimeEvent::Balances(pallet_balances::Event::Withdraw { .. }) => {},
|
|
||||||
// message exported
|
|
||||||
RuntimeEvent::BridgeRococoMessages(
|
|
||||||
pallet_bridge_messages::Event::MessageAccepted { .. }
|
|
||||||
) => {},
|
|
||||||
// message processed successfully
|
|
||||||
RuntimeEvent::MessageQueue(
|
|
||||||
pallet_message_queue::Event::Processed { success: true, .. }
|
|
||||||
) => {},
|
|
||||||
]
|
|
||||||
);
|
|
||||||
});
|
|
||||||
BridgeHubRococo::execute_with(|| {
|
|
||||||
type RuntimeEvent = <BridgeHubRococo as Chain>::RuntimeEvent;
|
|
||||||
assert_expected_events!(
|
|
||||||
BridgeHubRococo,
|
|
||||||
vec![
|
|
||||||
// message dispatched successfully
|
|
||||||
RuntimeEvent::XcmpQueue(
|
|
||||||
cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. }
|
|
||||||
) => {},
|
|
||||||
]
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
+96
@@ -13,6 +13,102 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
mod asset_transfers;
|
mod asset_transfers;
|
||||||
mod send_xcm;
|
mod send_xcm;
|
||||||
mod teleport;
|
mod teleport;
|
||||||
|
|
||||||
|
pub(crate) fn asset_hub_rococo_location() -> MultiLocation {
|
||||||
|
MultiLocation {
|
||||||
|
parents: 2,
|
||||||
|
interior: X2(
|
||||||
|
GlobalConsensus(NetworkId::Rococo),
|
||||||
|
Parachain(AssetHubRococo::para_id().into()),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn bridge_hub_rococo_location() -> MultiLocation {
|
||||||
|
MultiLocation {
|
||||||
|
parents: 2,
|
||||||
|
interior: X2(
|
||||||
|
GlobalConsensus(NetworkId::Rococo),
|
||||||
|
Parachain(BridgeHubRococo::para_id().into()),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn send_asset_from_asset_hub_westend(
|
||||||
|
destination: MultiLocation,
|
||||||
|
(id, amount): (MultiLocation, u128),
|
||||||
|
) -> DispatchResult {
|
||||||
|
let signed_origin =
|
||||||
|
<AssetHubWestend as Chain>::RuntimeOrigin::signed(AssetHubWestendSender::get().into());
|
||||||
|
|
||||||
|
let beneficiary: MultiLocation =
|
||||||
|
AccountId32Junction { network: None, id: AssetHubRococoReceiver::get().into() }.into();
|
||||||
|
|
||||||
|
let assets: MultiAssets = (id, amount).into();
|
||||||
|
let fee_asset_item = 0;
|
||||||
|
|
||||||
|
AssetHubWestend::execute_with(|| {
|
||||||
|
<AssetHubWestend as AssetHubWestendPallet>::PolkadotXcm::limited_reserve_transfer_assets(
|
||||||
|
signed_origin,
|
||||||
|
bx!(destination.into()),
|
||||||
|
bx!(beneficiary.into()),
|
||||||
|
bx!(assets.into()),
|
||||||
|
fee_asset_item,
|
||||||
|
WeightLimit::Unlimited,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn assert_bridge_hub_westend_message_accepted(expected_processed: bool) {
|
||||||
|
BridgeHubWestend::execute_with(|| {
|
||||||
|
type RuntimeEvent = <BridgeHubWestend as Chain>::RuntimeEvent;
|
||||||
|
|
||||||
|
if expected_processed {
|
||||||
|
assert_expected_events!(
|
||||||
|
BridgeHubWestend,
|
||||||
|
vec![
|
||||||
|
// pay for bridge fees
|
||||||
|
RuntimeEvent::Balances(pallet_balances::Event::Withdraw { .. }) => {},
|
||||||
|
// message exported
|
||||||
|
RuntimeEvent::BridgeRococoMessages(
|
||||||
|
pallet_bridge_messages::Event::MessageAccepted { .. }
|
||||||
|
) => {},
|
||||||
|
// message processed successfully
|
||||||
|
RuntimeEvent::MessageQueue(
|
||||||
|
pallet_message_queue::Event::Processed { success: true, .. }
|
||||||
|
) => {},
|
||||||
|
]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
assert_expected_events!(
|
||||||
|
BridgeHubWestend,
|
||||||
|
vec![
|
||||||
|
RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed {
|
||||||
|
success: false,
|
||||||
|
..
|
||||||
|
}) => {},
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn assert_bridge_hub_rococo_message_received() {
|
||||||
|
BridgeHubRococo::execute_with(|| {
|
||||||
|
type RuntimeEvent = <BridgeHubRococo as Chain>::RuntimeEvent;
|
||||||
|
assert_expected_events!(
|
||||||
|
BridgeHubRococo,
|
||||||
|
vec![
|
||||||
|
// message sent to destination
|
||||||
|
RuntimeEvent::XcmpQueue(
|
||||||
|
cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. }
|
||||||
|
) => {},
|
||||||
|
]
|
||||||
|
);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
+114
-8
@@ -13,7 +13,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
use crate::*;
|
use crate::tests::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn send_xcm_from_westend_relay_to_rococo_asset_hub_should_fail_on_not_applicable() {
|
fn send_xcm_from_westend_relay_to_rococo_asset_hub_should_fail_on_not_applicable() {
|
||||||
@@ -55,17 +55,123 @@ fn send_xcm_from_westend_relay_to_rococo_asset_hub_should_fail_on_not_applicable
|
|||||||
});
|
});
|
||||||
// Receive XCM message in Bridge Hub source Parachain, it should fail, because we don't have
|
// Receive XCM message in Bridge Hub source Parachain, it should fail, because we don't have
|
||||||
// opened bridge/lane.
|
// opened bridge/lane.
|
||||||
BridgeHubWestend::execute_with(|| {
|
assert_bridge_hub_westend_message_accepted(false);
|
||||||
type RuntimeEvent = <BridgeHubWestend as Chain>::RuntimeEvent;
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn send_xcm_through_opened_lane_with_different_xcm_version_on_hops_works() {
|
||||||
|
// Initially set only default version on all runtimes
|
||||||
|
AssetHubRococo::force_default_xcm_version(Some(xcm::v2::prelude::XCM_VERSION));
|
||||||
|
BridgeHubRococo::force_default_xcm_version(Some(xcm::v2::prelude::XCM_VERSION));
|
||||||
|
BridgeHubWestend::force_default_xcm_version(Some(xcm::v2::prelude::XCM_VERSION));
|
||||||
|
AssetHubWestend::force_default_xcm_version(Some(xcm::v2::prelude::XCM_VERSION));
|
||||||
|
|
||||||
|
// prepare data
|
||||||
|
let destination = asset_hub_rococo_location();
|
||||||
|
let native_token = MultiLocation::parent();
|
||||||
|
let amount = ASSET_HUB_WESTEND_ED * 1_000;
|
||||||
|
|
||||||
|
// fund the AHR's SA on BHR for paying bridge transport fees
|
||||||
|
BridgeHubWestend::fund_para_sovereign(AssetHubWestend::para_id(), 10_000_000_000_000u128);
|
||||||
|
// fund sender
|
||||||
|
AssetHubWestend::fund_accounts(vec![(AssetHubWestendSender::get().into(), amount * 10)]);
|
||||||
|
|
||||||
|
// send XCM from AssetHubWestend - fails - destination version not known
|
||||||
|
assert_err!(
|
||||||
|
send_asset_from_asset_hub_westend(destination, (native_token, amount)),
|
||||||
|
DispatchError::Module(sp_runtime::ModuleError {
|
||||||
|
index: 31,
|
||||||
|
error: [1, 0, 0, 0],
|
||||||
|
message: Some("SendFailure")
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
// set destination version
|
||||||
|
AssetHubWestend::force_xcm_version(destination, xcm::v3::prelude::XCM_VERSION);
|
||||||
|
|
||||||
|
// TODO: remove this block, when removing `xcm:v2`
|
||||||
|
{
|
||||||
|
// send XCM from AssetHubRococo - fails - AssetHubRococo is set to the default/safe `2`
|
||||||
|
// version, which does not have the `ExportMessage` instruction. If the default `2` is
|
||||||
|
// changed to `3`, then this assert can go away"
|
||||||
|
assert_err!(
|
||||||
|
send_asset_from_asset_hub_westend(destination, (native_token, amount)),
|
||||||
|
DispatchError::Module(sp_runtime::ModuleError {
|
||||||
|
index: 31,
|
||||||
|
error: [1, 0, 0, 0],
|
||||||
|
message: Some("SendFailure")
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
// set exact version for BridgeHubWestend to `2` without `ExportMessage` instruction
|
||||||
|
AssetHubWestend::force_xcm_version(
|
||||||
|
ParentThen(Parachain(BridgeHubWestend::para_id().into()).into()).into(),
|
||||||
|
xcm::v2::prelude::XCM_VERSION,
|
||||||
|
);
|
||||||
|
// send XCM from AssetHubWestend - fails - `ExportMessage` is not in `2`
|
||||||
|
assert_err!(
|
||||||
|
send_asset_from_asset_hub_westend(destination, (native_token, amount)),
|
||||||
|
DispatchError::Module(sp_runtime::ModuleError {
|
||||||
|
index: 31,
|
||||||
|
error: [1, 0, 0, 0],
|
||||||
|
message: Some("SendFailure")
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// set version with `ExportMessage` for BridgeHubWestend
|
||||||
|
AssetHubWestend::force_xcm_version(
|
||||||
|
ParentThen(Parachain(BridgeHubWestend::para_id().into()).into()).into(),
|
||||||
|
xcm::v3::prelude::XCM_VERSION,
|
||||||
|
);
|
||||||
|
// send XCM from AssetHubWestend - ok
|
||||||
|
assert_ok!(send_asset_from_asset_hub_westend(destination, (native_token, amount)));
|
||||||
|
|
||||||
|
// `ExportMessage` on local BridgeHub - fails - remote BridgeHub version not known
|
||||||
|
assert_bridge_hub_westend_message_accepted(false);
|
||||||
|
|
||||||
|
// set version for remote BridgeHub on BridgeHubWestend
|
||||||
|
BridgeHubWestend::force_xcm_version(
|
||||||
|
bridge_hub_rococo_location(),
|
||||||
|
xcm::v3::prelude::XCM_VERSION,
|
||||||
|
);
|
||||||
|
// set version for AssetHubRococo on BridgeHubRococo
|
||||||
|
BridgeHubRococo::force_xcm_version(
|
||||||
|
ParentThen(Parachain(AssetHubRococo::para_id().into()).into()).into(),
|
||||||
|
xcm::v3::prelude::XCM_VERSION,
|
||||||
|
);
|
||||||
|
|
||||||
|
// send XCM from AssetHubWestend - ok
|
||||||
|
assert_ok!(send_asset_from_asset_hub_westend(destination, (native_token, amount)));
|
||||||
|
assert_bridge_hub_westend_message_accepted(true);
|
||||||
|
assert_bridge_hub_rococo_message_received();
|
||||||
|
// message delivered and processed at destination
|
||||||
|
AssetHubRococo::execute_with(|| {
|
||||||
|
type RuntimeEvent = <AssetHubRococo as Chain>::RuntimeEvent;
|
||||||
assert_expected_events!(
|
assert_expected_events!(
|
||||||
BridgeHubWestend,
|
AssetHubRococo,
|
||||||
vec![
|
vec![
|
||||||
RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed {
|
// message processed with failure, but for this scenario it is ok, important is that was delivered
|
||||||
success: false,
|
RuntimeEvent::MessageQueue(
|
||||||
..
|
pallet_message_queue::Event::Processed { success: false, .. }
|
||||||
}) => {},
|
) => {},
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: remove this block, when removing `xcm:v2`
|
||||||
|
{
|
||||||
|
// set `2` version for remote BridgeHub on BridgeHubRococo, which does not have
|
||||||
|
// `UniversalOrigin` and `DescendOrigin`
|
||||||
|
BridgeHubWestend::force_xcm_version(
|
||||||
|
bridge_hub_rococo_location(),
|
||||||
|
xcm::v2::prelude::XCM_VERSION,
|
||||||
|
);
|
||||||
|
|
||||||
|
// send XCM from AssetHubWestend - ok
|
||||||
|
assert_ok!(send_asset_from_asset_hub_westend(destination, (native_token, amount)));
|
||||||
|
// message is not accepted on the local BridgeHub (`DestinationUnsupported`) because we
|
||||||
|
// cannot add `UniversalOrigin` and `DescendOrigin`
|
||||||
|
assert_bridge_hub_westend_message_accepted(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -846,6 +846,7 @@ impl pallet_xcm_bridge_hub_router::Config<ToWestendXcmRouterInstance> for Runtim
|
|||||||
type UniversalLocation = xcm_config::UniversalLocation;
|
type UniversalLocation = xcm_config::UniversalLocation;
|
||||||
type BridgedNetworkId = xcm_config::bridging::to_westend::WestendNetwork;
|
type BridgedNetworkId = xcm_config::bridging::to_westend::WestendNetwork;
|
||||||
type Bridges = xcm_config::bridging::NetworkExportTable;
|
type Bridges = xcm_config::bridging::NetworkExportTable;
|
||||||
|
type DestinationVersion = PolkadotXcm;
|
||||||
|
|
||||||
#[cfg(not(feature = "runtime-benchmarks"))]
|
#[cfg(not(feature = "runtime-benchmarks"))]
|
||||||
type BridgeHubOrigin = EnsureXcm<Equals<xcm_config::bridging::SiblingBridgeHub>>;
|
type BridgeHubOrigin = EnsureXcm<Equals<xcm_config::bridging::SiblingBridgeHub>>;
|
||||||
@@ -1416,11 +1417,26 @@ impl_runtime_apis! {
|
|||||||
xcm_config::bridging::SiblingBridgeHubParaId::get().into()
|
xcm_config::bridging::SiblingBridgeHubParaId::get().into()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
fn ensure_bridged_target_destination() -> MultiLocation {
|
fn ensure_bridged_target_destination() -> Result<MultiLocation, BenchmarkError> {
|
||||||
ParachainSystem::open_outbound_hrmp_channel_for_benchmarks_or_tests(
|
ParachainSystem::open_outbound_hrmp_channel_for_benchmarks_or_tests(
|
||||||
xcm_config::bridging::SiblingBridgeHubParaId::get().into()
|
xcm_config::bridging::SiblingBridgeHubParaId::get().into()
|
||||||
);
|
);
|
||||||
xcm_config::bridging::to_westend::AssetHubWestend::get()
|
let bridged_asset_hub = xcm_config::bridging::to_westend::AssetHubWestend::get();
|
||||||
|
let _ = PolkadotXcm::force_xcm_version(
|
||||||
|
RuntimeOrigin::root(),
|
||||||
|
Box::new(bridged_asset_hub),
|
||||||
|
XCM_VERSION,
|
||||||
|
).map_err(|e| {
|
||||||
|
log::error!(
|
||||||
|
"Failed to dispatch `force_xcm_version({:?}, {:?}, {:?})`, error: {:?}",
|
||||||
|
RuntimeOrigin::root(),
|
||||||
|
bridged_asset_hub,
|
||||||
|
XCM_VERSION,
|
||||||
|
e
|
||||||
|
);
|
||||||
|
BenchmarkError::Stop("XcmVersion was not stored!")
|
||||||
|
})?;
|
||||||
|
Ok(bridged_asset_hub)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1439,7 +1455,7 @@ impl_runtime_apis! {
|
|||||||
type XcmConfig = xcm_config::XcmConfig;
|
type XcmConfig = xcm_config::XcmConfig;
|
||||||
type AccountIdConverter = xcm_config::LocationToAccountId;
|
type AccountIdConverter = xcm_config::LocationToAccountId;
|
||||||
type DeliveryHelper = cumulus_primitives_utility::ToParentDeliveryHelper<
|
type DeliveryHelper = cumulus_primitives_utility::ToParentDeliveryHelper<
|
||||||
xcm_config::XcmConfig,
|
xcm_config::XcmConfig,
|
||||||
ExistentialDepositMultiAsset,
|
ExistentialDepositMultiAsset,
|
||||||
xcm_config::PriceForParentDelivery,
|
xcm_config::PriceForParentDelivery,
|
||||||
>;
|
>;
|
||||||
|
|||||||
+16
-16
@@ -17,9 +17,9 @@
|
|||||||
//! Autogenerated weights for `pallet_xcm_bridge_hub_router`
|
//! Autogenerated weights for `pallet_xcm_bridge_hub_router`
|
||||||
//!
|
//!
|
||||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||||
//! DATE: 2023-11-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
//! DATE: 2023-11-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||||
//! WORST CASE MAP SIZE: `1000000`
|
//! WORST CASE MAP SIZE: `1000000`
|
||||||
//! HOSTNAME: `runner-yprdrvc7-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
|
//! HOSTNAME: `runner-r43aesjn-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
|
||||||
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
|
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
|
||||||
|
|
||||||
// Executed Command:
|
// Executed Command:
|
||||||
@@ -58,8 +58,8 @@ impl<T: frame_system::Config> pallet_xcm_bridge_hub_router::WeightInfo for Weigh
|
|||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `154`
|
// Measured: `154`
|
||||||
// Estimated: `1639`
|
// Estimated: `1639`
|
||||||
// Minimum execution time: 7_924_000 picoseconds.
|
// Minimum execution time: 8_110_000 picoseconds.
|
||||||
Weight::from_parts(8_199_000, 0)
|
Weight::from_parts(8_373_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 1639))
|
.saturating_add(Weight::from_parts(0, 1639))
|
||||||
.saturating_add(T::DbWeight::get().reads(3))
|
.saturating_add(T::DbWeight::get().reads(3))
|
||||||
.saturating_add(T::DbWeight::get().writes(1))
|
.saturating_add(T::DbWeight::get().writes(1))
|
||||||
@@ -72,8 +72,8 @@ impl<T: frame_system::Config> pallet_xcm_bridge_hub_router::WeightInfo for Weigh
|
|||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `144`
|
// Measured: `144`
|
||||||
// Estimated: `1629`
|
// Estimated: `1629`
|
||||||
// Minimum execution time: 4_265_000 picoseconds.
|
// Minimum execution time: 4_459_000 picoseconds.
|
||||||
Weight::from_parts(4_417_000, 0)
|
Weight::from_parts(4_663_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 1629))
|
.saturating_add(Weight::from_parts(0, 1629))
|
||||||
.saturating_add(T::DbWeight::get().reads(2))
|
.saturating_add(T::DbWeight::get().reads(2))
|
||||||
}
|
}
|
||||||
@@ -83,12 +83,14 @@ impl<T: frame_system::Config> pallet_xcm_bridge_hub_router::WeightInfo for Weigh
|
|||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `150`
|
// Measured: `150`
|
||||||
// Estimated: `1502`
|
// Estimated: `1502`
|
||||||
// Minimum execution time: 10_292_000 picoseconds.
|
// Minimum execution time: 10_153_000 picoseconds.
|
||||||
Weight::from_parts(10_797_000, 0)
|
Weight::from_parts(10_737_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 1502))
|
.saturating_add(Weight::from_parts(0, 1502))
|
||||||
.saturating_add(T::DbWeight::get().reads(1))
|
.saturating_add(T::DbWeight::get().reads(1))
|
||||||
.saturating_add(T::DbWeight::get().writes(1))
|
.saturating_add(T::DbWeight::get().writes(1))
|
||||||
}
|
}
|
||||||
|
/// Storage: `PolkadotXcm::SupportedVersion` (r:2 w:0)
|
||||||
|
/// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||||
/// Storage: `ParachainInfo::ParachainId` (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`)
|
/// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||||
/// Storage: UNKNOWN KEY `0x3302afcb67e838a3f960251b417b9a4f` (r:1 w:0)
|
/// Storage: UNKNOWN KEY `0x3302afcb67e838a3f960251b417b9a4f` (r:1 w:0)
|
||||||
@@ -99,8 +101,6 @@ impl<T: frame_system::Config> pallet_xcm_bridge_hub_router::WeightInfo for Weigh
|
|||||||
/// Proof: `ToWestendXcmRouter::Bridge` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
|
/// Proof: `ToWestendXcmRouter::Bridge` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `XcmpQueue::DeliveryFeeFactor` (r:1 w:0)
|
/// Storage: `XcmpQueue::DeliveryFeeFactor` (r:1 w:0)
|
||||||
/// Proof: `XcmpQueue::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
/// 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)
|
/// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
|
||||||
/// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
/// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||||
/// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
|
/// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
|
||||||
@@ -115,12 +115,12 @@ impl<T: frame_system::Config> pallet_xcm_bridge_hub_router::WeightInfo for Weigh
|
|||||||
/// Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
/// Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||||
fn send_message() -> Weight {
|
fn send_message() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `387`
|
// Measured: `448`
|
||||||
// Estimated: `3852`
|
// Estimated: `6388`
|
||||||
// Minimum execution time: 61_995_000 picoseconds.
|
// Minimum execution time: 61_258_000 picoseconds.
|
||||||
Weight::from_parts(65_137_000, 0)
|
Weight::from_parts(63_679_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 3852))
|
.saturating_add(Weight::from_parts(0, 6388))
|
||||||
.saturating_add(T::DbWeight::get().reads(11))
|
.saturating_add(T::DbWeight::get().reads(12))
|
||||||
.saturating_add(T::DbWeight::get().writes(4))
|
.saturating_add(T::DbWeight::get().writes(4))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -673,9 +673,16 @@ fn limited_reserve_transfer_assets_for_native_asset_over_bridge_works(
|
|||||||
|
|
||||||
mod asset_hub_rococo_tests {
|
mod asset_hub_rococo_tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use asset_hub_rococo_runtime::{PolkadotXcm, RuntimeOrigin};
|
||||||
|
|
||||||
fn bridging_to_asset_hub_westend() -> TestBridgingConfig {
|
fn bridging_to_asset_hub_westend() -> TestBridgingConfig {
|
||||||
asset_test_utils::test_cases_over_bridge::TestBridgingConfig {
|
let _ = PolkadotXcm::force_xcm_version(
|
||||||
|
RuntimeOrigin::root(),
|
||||||
|
Box::new(bridging::to_westend::AssetHubWestend::get()),
|
||||||
|
XCM_VERSION,
|
||||||
|
)
|
||||||
|
.expect("version saved!");
|
||||||
|
TestBridgingConfig {
|
||||||
bridged_network: bridging::to_westend::WestendNetwork::get(),
|
bridged_network: bridging::to_westend::WestendNetwork::get(),
|
||||||
local_bridge_hub_para_id: bridging::SiblingBridgeHubParaId::get(),
|
local_bridge_hub_para_id: bridging::SiblingBridgeHubParaId::get(),
|
||||||
local_bridge_hub_location: bridging::SiblingBridgeHub::get(),
|
local_bridge_hub_location: bridging::SiblingBridgeHub::get(),
|
||||||
|
|||||||
@@ -822,6 +822,7 @@ impl pallet_xcm_bridge_hub_router::Config<ToRococoXcmRouterInstance> for Runtime
|
|||||||
type UniversalLocation = xcm_config::UniversalLocation;
|
type UniversalLocation = xcm_config::UniversalLocation;
|
||||||
type BridgedNetworkId = xcm_config::bridging::to_rococo::RococoNetwork;
|
type BridgedNetworkId = xcm_config::bridging::to_rococo::RococoNetwork;
|
||||||
type Bridges = xcm_config::bridging::NetworkExportTable;
|
type Bridges = xcm_config::bridging::NetworkExportTable;
|
||||||
|
type DestinationVersion = PolkadotXcm;
|
||||||
|
|
||||||
#[cfg(not(feature = "runtime-benchmarks"))]
|
#[cfg(not(feature = "runtime-benchmarks"))]
|
||||||
type BridgeHubOrigin = EnsureXcm<Equals<xcm_config::bridging::SiblingBridgeHub>>;
|
type BridgeHubOrigin = EnsureXcm<Equals<xcm_config::bridging::SiblingBridgeHub>>;
|
||||||
@@ -1493,11 +1494,26 @@ impl_runtime_apis! {
|
|||||||
xcm_config::bridging::SiblingBridgeHubParaId::get().into()
|
xcm_config::bridging::SiblingBridgeHubParaId::get().into()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
fn ensure_bridged_target_destination() -> MultiLocation {
|
fn ensure_bridged_target_destination() -> Result<MultiLocation, BenchmarkError> {
|
||||||
ParachainSystem::open_outbound_hrmp_channel_for_benchmarks_or_tests(
|
ParachainSystem::open_outbound_hrmp_channel_for_benchmarks_or_tests(
|
||||||
xcm_config::bridging::SiblingBridgeHubParaId::get().into()
|
xcm_config::bridging::SiblingBridgeHubParaId::get().into()
|
||||||
);
|
);
|
||||||
xcm_config::bridging::to_rococo::AssetHubRococo::get()
|
let bridged_asset_hub = xcm_config::bridging::to_rococo::AssetHubRococo::get();
|
||||||
|
let _ = PolkadotXcm::force_xcm_version(
|
||||||
|
RuntimeOrigin::root(),
|
||||||
|
Box::new(bridged_asset_hub),
|
||||||
|
XCM_VERSION,
|
||||||
|
).map_err(|e| {
|
||||||
|
log::error!(
|
||||||
|
"Failed to dispatch `force_xcm_version({:?}, {:?}, {:?})`, error: {:?}",
|
||||||
|
RuntimeOrigin::root(),
|
||||||
|
bridged_asset_hub,
|
||||||
|
XCM_VERSION,
|
||||||
|
e
|
||||||
|
);
|
||||||
|
BenchmarkError::Stop("XcmVersion was not stored!")
|
||||||
|
})?;
|
||||||
|
Ok(bridged_asset_hub)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+24
-22
@@ -17,9 +17,9 @@
|
|||||||
//! Autogenerated weights for `pallet_xcm_bridge_hub_router`
|
//! Autogenerated weights for `pallet_xcm_bridge_hub_router`
|
||||||
//!
|
//!
|
||||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
//! 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: `[]`
|
//! DATE: 2023-11-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||||
//! WORST CASE MAP SIZE: `1000000`
|
//! WORST CASE MAP SIZE: `1000000`
|
||||||
//! HOSTNAME: `runner-vmdtonbz-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
|
//! HOSTNAME: `runner-r43aesjn-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
|
||||||
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-westend-dev")`, DB CACHE: 1024
|
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-westend-dev")`, DB CACHE: 1024
|
||||||
|
|
||||||
// Executed Command:
|
// Executed Command:
|
||||||
@@ -48,8 +48,8 @@ use core::marker::PhantomData;
|
|||||||
/// Weight functions for `pallet_xcm_bridge_hub_router`.
|
/// Weight functions for `pallet_xcm_bridge_hub_router`.
|
||||||
pub struct WeightInfo<T>(PhantomData<T>);
|
pub struct WeightInfo<T>(PhantomData<T>);
|
||||||
impl<T: frame_system::Config> pallet_xcm_bridge_hub_router::WeightInfo for WeightInfo<T> {
|
impl<T: frame_system::Config> pallet_xcm_bridge_hub_router::WeightInfo for WeightInfo<T> {
|
||||||
/// Storage: `XcmpQueue::InboundXcmpStatus` (r:1 w:0)
|
/// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0)
|
||||||
/// Proof: `XcmpQueue::InboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
/// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||||
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0)
|
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0)
|
||||||
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||||
/// Storage: `ToRococoXcmRouter::Bridge` (r:1 w:1)
|
/// Storage: `ToRococoXcmRouter::Bridge` (r:1 w:1)
|
||||||
@@ -58,22 +58,22 @@ impl<T: frame_system::Config> pallet_xcm_bridge_hub_router::WeightInfo for Weigh
|
|||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `193`
|
// Measured: `193`
|
||||||
// Estimated: `1678`
|
// Estimated: `1678`
|
||||||
// Minimum execution time: 8_157_000 picoseconds.
|
// Minimum execution time: 8_460_000 picoseconds.
|
||||||
Weight::from_parts(8_481_000, 0)
|
Weight::from_parts(8_730_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 1678))
|
.saturating_add(Weight::from_parts(0, 1678))
|
||||||
.saturating_add(T::DbWeight::get().reads(3))
|
.saturating_add(T::DbWeight::get().reads(3))
|
||||||
.saturating_add(T::DbWeight::get().writes(1))
|
.saturating_add(T::DbWeight::get().writes(1))
|
||||||
}
|
}
|
||||||
/// Storage: `XcmpQueue::InboundXcmpStatus` (r:1 w:0)
|
/// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0)
|
||||||
/// Proof: `XcmpQueue::InboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
/// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||||
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0)
|
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0)
|
||||||
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||||
fn on_initialize_when_congested() -> Weight {
|
fn on_initialize_when_congested() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `111`
|
// Measured: `111`
|
||||||
// Estimated: `1596`
|
// Estimated: `1596`
|
||||||
// Minimum execution time: 3_319_000 picoseconds.
|
// Minimum execution time: 3_469_000 picoseconds.
|
||||||
Weight::from_parts(3_445_000, 0)
|
Weight::from_parts(3_696_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 1596))
|
.saturating_add(Weight::from_parts(0, 1596))
|
||||||
.saturating_add(T::DbWeight::get().reads(2))
|
.saturating_add(T::DbWeight::get().reads(2))
|
||||||
}
|
}
|
||||||
@@ -83,22 +83,24 @@ impl<T: frame_system::Config> pallet_xcm_bridge_hub_router::WeightInfo for Weigh
|
|||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `117`
|
// Measured: `117`
|
||||||
// Estimated: `1502`
|
// Estimated: `1502`
|
||||||
// Minimum execution time: 10_396_000 picoseconds.
|
// Minimum execution time: 10_315_000 picoseconds.
|
||||||
Weight::from_parts(10_914_000, 0)
|
Weight::from_parts(10_651_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 1502))
|
.saturating_add(Weight::from_parts(0, 1502))
|
||||||
.saturating_add(T::DbWeight::get().reads(1))
|
.saturating_add(T::DbWeight::get().reads(1))
|
||||||
.saturating_add(T::DbWeight::get().writes(1))
|
.saturating_add(T::DbWeight::get().writes(1))
|
||||||
}
|
}
|
||||||
|
/// Storage: `PolkadotXcm::SupportedVersion` (r:2 w:0)
|
||||||
|
/// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||||
/// Storage: `ParachainInfo::ParachainId` (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`)
|
/// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||||
|
/// Storage: UNKNOWN KEY `0x3302afcb67e838a3f960251b417b9a4f` (r:1 w:0)
|
||||||
|
/// Proof: UNKNOWN KEY `0x3302afcb67e838a3f960251b417b9a4f` (r:1 w:0)
|
||||||
/// Storage: UNKNOWN KEY `0x0973fe64c85043ba1c965cbc38eb63c7` (r:1 w:0)
|
/// Storage: UNKNOWN KEY `0x0973fe64c85043ba1c965cbc38eb63c7` (r:1 w:0)
|
||||||
/// Proof: UNKNOWN KEY `0x0973fe64c85043ba1c965cbc38eb63c7` (r:1 w:0)
|
/// Proof: UNKNOWN KEY `0x0973fe64c85043ba1c965cbc38eb63c7` (r:1 w:0)
|
||||||
/// Storage: `ToRococoXcmRouter::Bridge` (r:1 w:1)
|
/// Storage: `ToRococoXcmRouter::Bridge` (r:1 w:1)
|
||||||
/// Proof: `ToRococoXcmRouter::Bridge` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
|
/// Proof: `ToRococoXcmRouter::Bridge` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
|
||||||
/// Storage: `XcmpQueue::DeliveryFeeFactor` (r:1 w:0)
|
/// Storage: `XcmpQueue::DeliveryFeeFactor` (r:1 w:0)
|
||||||
/// Proof: `XcmpQueue::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
/// 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)
|
/// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
|
||||||
/// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
/// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||||
/// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
|
/// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
|
||||||
@@ -107,18 +109,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`)
|
/// Proof: `ParachainSystem::RelevantMessagingState` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||||
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1)
|
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1)
|
||||||
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||||
/// Storage: `XcmpQueue::InboundXcmpStatus` (r:1 w:0)
|
/// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0)
|
||||||
/// Proof: `XcmpQueue::InboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
/// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||||
/// Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1)
|
/// Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1)
|
||||||
/// Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
/// Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||||
fn send_message() -> Weight {
|
fn send_message() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `426`
|
// Measured: `487`
|
||||||
// Estimated: `3891`
|
// Estimated: `6427`
|
||||||
// Minimum execution time: 45_902_000 picoseconds.
|
// Minimum execution time: 64_532_000 picoseconds.
|
||||||
Weight::from_parts(46_887_000, 0)
|
Weight::from_parts(66_901_000, 0)
|
||||||
.saturating_add(Weight::from_parts(0, 3891))
|
.saturating_add(Weight::from_parts(0, 6427))
|
||||||
.saturating_add(T::DbWeight::get().reads(10))
|
.saturating_add(T::DbWeight::get().reads(12))
|
||||||
.saturating_add(T::DbWeight::get().writes(4))
|
.saturating_add(T::DbWeight::get().writes(4))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ use asset_hub_westend_runtime::{
|
|||||||
WestendLocation, XcmConfig,
|
WestendLocation, XcmConfig,
|
||||||
},
|
},
|
||||||
AllPalletsWithoutSystem, AssetDeposit, Assets, Balances, ExistentialDeposit, ForeignAssets,
|
AllPalletsWithoutSystem, AssetDeposit, Assets, Balances, ExistentialDeposit, ForeignAssets,
|
||||||
ForeignAssetsInstance, MetadataDepositBase, MetadataDepositPerByte, ParachainSystem, Runtime,
|
ForeignAssetsInstance, MetadataDepositBase, MetadataDepositPerByte, ParachainSystem,
|
||||||
RuntimeCall, RuntimeEvent, SessionKeys, ToRococoXcmRouterInstance, TrustBackedAssetsInstance,
|
PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, SessionKeys,
|
||||||
XcmpQueue,
|
ToRococoXcmRouterInstance, TrustBackedAssetsInstance, XcmpQueue,
|
||||||
};
|
};
|
||||||
use asset_test_utils::{
|
use asset_test_utils::{
|
||||||
test_cases_over_bridge::TestBridgingConfig, CollatorSessionKey, CollatorSessionKeys, ExtBuilder,
|
test_cases_over_bridge::TestBridgingConfig, CollatorSessionKey, CollatorSessionKeys, ExtBuilder,
|
||||||
@@ -635,6 +635,12 @@ asset_test_utils::include_create_and_manage_foreign_assets_for_local_consensus_p
|
|||||||
);
|
);
|
||||||
|
|
||||||
fn bridging_to_asset_hub_rococo() -> TestBridgingConfig {
|
fn bridging_to_asset_hub_rococo() -> TestBridgingConfig {
|
||||||
|
let _ = PolkadotXcm::force_xcm_version(
|
||||||
|
RuntimeOrigin::root(),
|
||||||
|
Box::new(bridging::to_rococo::AssetHubRococo::get()),
|
||||||
|
XCM_VERSION,
|
||||||
|
)
|
||||||
|
.expect("version saved!");
|
||||||
TestBridgingConfig {
|
TestBridgingConfig {
|
||||||
bridged_network: bridging::to_rococo::RococoNetwork::get(),
|
bridged_network: bridging::to_rococo::RococoNetwork::get(),
|
||||||
local_bridge_hub_para_id: bridging::SiblingBridgeHubParaId::get(),
|
local_bridge_hub_para_id: bridging::SiblingBridgeHubParaId::get(),
|
||||||
|
|||||||
+17
-4
@@ -20,7 +20,7 @@ use crate::{
|
|||||||
bridge_common_config::{BridgeParachainWestendInstance, DeliveryRewardInBalance},
|
bridge_common_config::{BridgeParachainWestendInstance, DeliveryRewardInBalance},
|
||||||
weights,
|
weights,
|
||||||
xcm_config::UniversalLocation,
|
xcm_config::UniversalLocation,
|
||||||
AccountId, BridgeWestendMessages, Runtime, RuntimeEvent, RuntimeOrigin,
|
AccountId, BridgeWestendMessages, PolkadotXcm, Runtime, RuntimeEvent, RuntimeOrigin,
|
||||||
XcmOverBridgeHubWestend, XcmRouter,
|
XcmOverBridgeHubWestend, XcmRouter,
|
||||||
};
|
};
|
||||||
use bp_messages::LaneId;
|
use bp_messages::LaneId;
|
||||||
@@ -33,7 +33,7 @@ use bridge_runtime_common::{
|
|||||||
},
|
},
|
||||||
messages_xcm_extension::{
|
messages_xcm_extension::{
|
||||||
SenderAndLane, XcmAsPlainPayload, XcmBlobHauler, XcmBlobHaulerAdapter,
|
SenderAndLane, XcmAsPlainPayload, XcmBlobHauler, XcmBlobHaulerAdapter,
|
||||||
XcmBlobMessageDispatch,
|
XcmBlobMessageDispatch, XcmVersionOfDestAndRemoteBridge,
|
||||||
},
|
},
|
||||||
refund_relayer_extension::{
|
refund_relayer_extension::{
|
||||||
ActualFeeRefund, RefundBridgedParachainMessages, RefundSignedExtensionAdapter,
|
ActualFeeRefund, RefundBridgedParachainMessages, RefundSignedExtensionAdapter,
|
||||||
@@ -58,6 +58,10 @@ parameter_types! {
|
|||||||
pub const BridgeHubWestendChainId: bp_runtime::ChainId = bp_runtime::BRIDGE_HUB_WESTEND_CHAIN_ID;
|
pub const BridgeHubWestendChainId: bp_runtime::ChainId = bp_runtime::BRIDGE_HUB_WESTEND_CHAIN_ID;
|
||||||
pub BridgeRococoToWestendMessagesPalletInstance: InteriorMultiLocation = X1(PalletInstance(<BridgeWestendMessages as PalletInfoAccess>::index() as u8));
|
pub BridgeRococoToWestendMessagesPalletInstance: InteriorMultiLocation = X1(PalletInstance(<BridgeWestendMessages as PalletInfoAccess>::index() as u8));
|
||||||
pub WestendGlobalConsensusNetwork: NetworkId = NetworkId::Westend;
|
pub WestendGlobalConsensusNetwork: NetworkId = NetworkId::Westend;
|
||||||
|
pub WestendGlobalConsensusNetworkLocation: MultiLocation = MultiLocation {
|
||||||
|
parents: 2,
|
||||||
|
interior: X1(GlobalConsensus(WestendGlobalConsensusNetwork::get()))
|
||||||
|
};
|
||||||
// see the `FEE_BOOST_PER_MESSAGE` constant to get the meaning of this value
|
// see the `FEE_BOOST_PER_MESSAGE` constant to get the meaning of this value
|
||||||
pub PriorityBoostPerMessage: u64 = 182_044_444_444_444;
|
pub PriorityBoostPerMessage: u64 = 182_044_444_444_444;
|
||||||
|
|
||||||
@@ -80,6 +84,14 @@ parameter_types! {
|
|||||||
|
|
||||||
pub CongestedMessage: Xcm<()> = build_congestion_message(true).into();
|
pub CongestedMessage: Xcm<()> = build_congestion_message(true).into();
|
||||||
pub UncongestedMessage: Xcm<()> = build_congestion_message(false).into();
|
pub UncongestedMessage: Xcm<()> = build_congestion_message(false).into();
|
||||||
|
|
||||||
|
pub BridgeHubWestendLocation: MultiLocation = MultiLocation {
|
||||||
|
parents: 2,
|
||||||
|
interior: X2(
|
||||||
|
GlobalConsensus(WestendGlobalConsensusNetwork::get()),
|
||||||
|
Parachain(<bp_bridge_hub_westend::BridgeHubWestend as bp_runtime::Parachain>::PARACHAIN_ID)
|
||||||
|
)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
pub const XCM_LANE_FOR_ASSET_HUB_ROCOCO_TO_ASSET_HUB_WESTEND: LaneId = LaneId([0, 0, 0, 2]);
|
pub const XCM_LANE_FOR_ASSET_HUB_ROCOCO_TO_ASSET_HUB_WESTEND: LaneId = LaneId([0, 0, 0, 2]);
|
||||||
|
|
||||||
@@ -120,7 +132,6 @@ pub struct ToBridgeHubWestendXcmBlobHauler;
|
|||||||
impl XcmBlobHauler for ToBridgeHubWestendXcmBlobHauler {
|
impl XcmBlobHauler for ToBridgeHubWestendXcmBlobHauler {
|
||||||
type Runtime = Runtime;
|
type Runtime = Runtime;
|
||||||
type MessagesInstance = WithBridgeHubWestendMessagesInstance;
|
type MessagesInstance = WithBridgeHubWestendMessagesInstance;
|
||||||
|
|
||||||
type ToSourceChainSender = XcmRouter;
|
type ToSourceChainSender = XcmRouter;
|
||||||
type CongestedMessage = CongestedMessage;
|
type CongestedMessage = CongestedMessage;
|
||||||
type UncongestedMessage = UncongestedMessage;
|
type UncongestedMessage = UncongestedMessage;
|
||||||
@@ -234,9 +245,11 @@ impl pallet_bridge_messages::Config<WithBridgeHubWestendMessagesInstance> for Ru
|
|||||||
pub type XcmOverBridgeHubWestendInstance = pallet_xcm_bridge_hub::Instance1;
|
pub type XcmOverBridgeHubWestendInstance = pallet_xcm_bridge_hub::Instance1;
|
||||||
impl pallet_xcm_bridge_hub::Config<XcmOverBridgeHubWestendInstance> for Runtime {
|
impl pallet_xcm_bridge_hub::Config<XcmOverBridgeHubWestendInstance> for Runtime {
|
||||||
type UniversalLocation = UniversalLocation;
|
type UniversalLocation = UniversalLocation;
|
||||||
type BridgedNetworkId = WestendGlobalConsensusNetwork;
|
type BridgedNetwork = WestendGlobalConsensusNetworkLocation;
|
||||||
type BridgeMessagesPalletInstance = WithBridgeHubWestendMessagesInstance;
|
type BridgeMessagesPalletInstance = WithBridgeHubWestendMessagesInstance;
|
||||||
type MessageExportPrice = ();
|
type MessageExportPrice = ();
|
||||||
|
type DestinationVersion =
|
||||||
|
XcmVersionOfDestAndRemoteBridge<PolkadotXcm, BridgeHubWestendLocation>;
|
||||||
type Lanes = ActiveLanes;
|
type Lanes = ActiveLanes;
|
||||||
type LanesSupport = ToBridgeHubWestendXcmBlobHauler;
|
type LanesSupport = ToBridgeHubWestendXcmBlobHauler;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -853,7 +853,7 @@ impl_runtime_apis! {
|
|||||||
type XcmConfig = xcm_config::XcmConfig;
|
type XcmConfig = xcm_config::XcmConfig;
|
||||||
type AccountIdConverter = xcm_config::LocationToAccountId;
|
type AccountIdConverter = xcm_config::LocationToAccountId;
|
||||||
type DeliveryHelper = cumulus_primitives_utility::ToParentDeliveryHelper<
|
type DeliveryHelper = cumulus_primitives_utility::ToParentDeliveryHelper<
|
||||||
xcm_config::XcmConfig,
|
xcm_config::XcmConfig,
|
||||||
ExistentialDepositMultiAsset,
|
ExistentialDepositMultiAsset,
|
||||||
xcm_config::PriceForParentDelivery,
|
xcm_config::PriceForParentDelivery,
|
||||||
>;
|
>;
|
||||||
@@ -933,6 +933,21 @@ impl_runtime_apis! {
|
|||||||
|
|
||||||
fn export_message_origin_and_destination(
|
fn export_message_origin_and_destination(
|
||||||
) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> {
|
) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> {
|
||||||
|
// save XCM version for remote bridge hub
|
||||||
|
let _ = PolkadotXcm::force_xcm_version(
|
||||||
|
RuntimeOrigin::root(),
|
||||||
|
Box::new(bridge_to_westend_config::BridgeHubWestendLocation::get()),
|
||||||
|
XCM_VERSION,
|
||||||
|
).map_err(|e| {
|
||||||
|
log::error!(
|
||||||
|
"Failed to dispatch `force_xcm_version({:?}, {:?}, {:?})`, error: {:?}",
|
||||||
|
RuntimeOrigin::root(),
|
||||||
|
bridge_to_westend_config::BridgeHubWestendLocation::get(),
|
||||||
|
XCM_VERSION,
|
||||||
|
e
|
||||||
|
);
|
||||||
|
BenchmarkError::Stop("XcmVersion was not stored!")
|
||||||
|
})?;
|
||||||
Ok(
|
Ok(
|
||||||
(
|
(
|
||||||
bridge_to_westend_config::FromAssetHubRococoToAssetHubWestendRoute::get().location,
|
bridge_to_westend_config::FromAssetHubRococoToAssetHubWestendRoute::get().location,
|
||||||
|
|||||||
+70
-66
@@ -17,9 +17,9 @@
|
|||||||
//! Autogenerated weights for `pallet_xcm_benchmarks::generic`
|
//! Autogenerated weights for `pallet_xcm_benchmarks::generic`
|
||||||
//!
|
//!
|
||||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||||
//! DATE: 2023-11-14, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
//! DATE: 2023-11-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||||
//! WORST CASE MAP SIZE: `1000000`
|
//! WORST CASE MAP SIZE: `1000000`
|
||||||
//! HOSTNAME: `runner-yprdrvc7-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
|
//! HOSTNAME: `runner-r43aesjn-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
|
||||||
//! WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024
|
//! WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024
|
||||||
|
|
||||||
// Executed Command:
|
// Executed Command:
|
||||||
@@ -68,8 +68,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
|||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `171`
|
// Measured: `171`
|
||||||
// Estimated: `6196`
|
// Estimated: `6196`
|
||||||
// Minimum execution time: 63_453_000 picoseconds.
|
// Minimum execution time: 61_049_000 picoseconds.
|
||||||
Weight::from_parts(64_220_000, 6196)
|
Weight::from_parts(62_672_000, 6196)
|
||||||
.saturating_add(T::DbWeight::get().reads(9))
|
.saturating_add(T::DbWeight::get().reads(9))
|
||||||
.saturating_add(T::DbWeight::get().writes(4))
|
.saturating_add(T::DbWeight::get().writes(4))
|
||||||
}
|
}
|
||||||
@@ -77,8 +77,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
|||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 2_238_000 picoseconds.
|
// Minimum execution time: 1_972_000 picoseconds.
|
||||||
Weight::from_parts(2_351_000, 0)
|
Weight::from_parts(2_095_000, 0)
|
||||||
}
|
}
|
||||||
// Storage: `PolkadotXcm::Queries` (r:1 w:0)
|
// Storage: `PolkadotXcm::Queries` (r:1 w:0)
|
||||||
// Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
// Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||||
@@ -86,58 +86,58 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
|||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `32`
|
// Measured: `32`
|
||||||
// Estimated: `3497`
|
// Estimated: `3497`
|
||||||
// Minimum execution time: 7_953_000 picoseconds.
|
// Minimum execution time: 7_541_000 picoseconds.
|
||||||
Weight::from_parts(8_162_000, 3497)
|
Weight::from_parts(7_875_000, 3497)
|
||||||
.saturating_add(T::DbWeight::get().reads(1))
|
.saturating_add(T::DbWeight::get().reads(1))
|
||||||
}
|
}
|
||||||
pub fn transact() -> Weight {
|
pub fn transact() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 9_080_000 picoseconds.
|
// Minimum execution time: 8_467_000 picoseconds.
|
||||||
Weight::from_parts(9_333_000, 0)
|
Weight::from_parts(8_653_000, 0)
|
||||||
}
|
}
|
||||||
pub fn refund_surplus() -> Weight {
|
pub fn refund_surplus() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 2_415_000 picoseconds.
|
// Minimum execution time: 2_141_000 picoseconds.
|
||||||
Weight::from_parts(2_519_000, 0)
|
Weight::from_parts(2_231_000, 0)
|
||||||
}
|
}
|
||||||
pub fn set_error_handler() -> Weight {
|
pub fn set_error_handler() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 2_045_000 picoseconds.
|
// Minimum execution time: 1_881_000 picoseconds.
|
||||||
Weight::from_parts(2_184_000, 0)
|
Weight::from_parts(1_941_000, 0)
|
||||||
}
|
}
|
||||||
pub fn set_appendix() -> Weight {
|
pub fn set_appendix() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 2_065_000 picoseconds.
|
// Minimum execution time: 1_846_000 picoseconds.
|
||||||
Weight::from_parts(2_125_000, 0)
|
Weight::from_parts(1_916_000, 0)
|
||||||
}
|
}
|
||||||
pub fn clear_error() -> Weight {
|
pub fn clear_error() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 2_077_000 picoseconds.
|
// Minimum execution time: 1_857_000 picoseconds.
|
||||||
Weight::from_parts(2_164_000, 0)
|
Weight::from_parts(1_910_000, 0)
|
||||||
}
|
}
|
||||||
pub fn descend_origin() -> Weight {
|
pub fn descend_origin() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 2_868_000 picoseconds.
|
// Minimum execution time: 2_493_000 picoseconds.
|
||||||
Weight::from_parts(2_933_000, 0)
|
Weight::from_parts(2_570_000, 0)
|
||||||
}
|
}
|
||||||
pub fn clear_origin() -> Weight {
|
pub fn clear_origin() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 2_058_000 picoseconds.
|
// Minimum execution time: 1_857_000 picoseconds.
|
||||||
Weight::from_parts(2_164_000, 0)
|
Weight::from_parts(1_930_000, 0)
|
||||||
}
|
}
|
||||||
// Storage: `ParachainInfo::ParachainId` (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`)
|
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||||
@@ -159,8 +159,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
|||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `171`
|
// Measured: `171`
|
||||||
// Estimated: `6196`
|
// Estimated: `6196`
|
||||||
// Minimum execution time: 55_971_000 picoseconds.
|
// Minimum execution time: 54_805_000 picoseconds.
|
||||||
Weight::from_parts(56_869_000, 6196)
|
Weight::from_parts(55_690_000, 6196)
|
||||||
.saturating_add(T::DbWeight::get().reads(9))
|
.saturating_add(T::DbWeight::get().reads(9))
|
||||||
.saturating_add(T::DbWeight::get().writes(4))
|
.saturating_add(T::DbWeight::get().writes(4))
|
||||||
}
|
}
|
||||||
@@ -170,8 +170,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
|||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `90`
|
// Measured: `90`
|
||||||
// Estimated: `3555`
|
// Estimated: `3555`
|
||||||
// Minimum execution time: 11_382_000 picoseconds.
|
// Minimum execution time: 11_062_000 picoseconds.
|
||||||
Weight::from_parts(11_672_000, 3555)
|
Weight::from_parts(11_505_000, 3555)
|
||||||
.saturating_add(T::DbWeight::get().reads(1))
|
.saturating_add(T::DbWeight::get().reads(1))
|
||||||
.saturating_add(T::DbWeight::get().writes(1))
|
.saturating_add(T::DbWeight::get().writes(1))
|
||||||
}
|
}
|
||||||
@@ -179,8 +179,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
|||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 2_071_000 picoseconds.
|
// Minimum execution time: 1_873_000 picoseconds.
|
||||||
Weight::from_parts(2_193_000, 0)
|
Weight::from_parts(1_962_000, 0)
|
||||||
}
|
}
|
||||||
// Storage: `PolkadotXcm::VersionNotifyTargets` (r:1 w:1)
|
// Storage: `PolkadotXcm::VersionNotifyTargets` (r:1 w:1)
|
||||||
// Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
// Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||||
@@ -200,8 +200,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
|||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `38`
|
// Measured: `38`
|
||||||
// Estimated: `3503`
|
// Estimated: `3503`
|
||||||
// Minimum execution time: 22_573_000 picoseconds.
|
// Minimum execution time: 22_356_000 picoseconds.
|
||||||
Weight::from_parts(23_423_000, 3503)
|
Weight::from_parts(23_066_000, 3503)
|
||||||
.saturating_add(T::DbWeight::get().reads(7))
|
.saturating_add(T::DbWeight::get().reads(7))
|
||||||
.saturating_add(T::DbWeight::get().writes(3))
|
.saturating_add(T::DbWeight::get().writes(3))
|
||||||
}
|
}
|
||||||
@@ -211,44 +211,44 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
|||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 3_870_000 picoseconds.
|
// Minimum execution time: 3_819_000 picoseconds.
|
||||||
Weight::from_parts(3_993_000, 0)
|
Weight::from_parts(3_992_000, 0)
|
||||||
.saturating_add(T::DbWeight::get().writes(1))
|
.saturating_add(T::DbWeight::get().writes(1))
|
||||||
}
|
}
|
||||||
pub fn burn_asset() -> Weight {
|
pub fn burn_asset() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 3_483_000 picoseconds.
|
// Minimum execution time: 3_033_000 picoseconds.
|
||||||
Weight::from_parts(3_598_000, 0)
|
Weight::from_parts(3_157_000, 0)
|
||||||
}
|
}
|
||||||
pub fn expect_asset() -> Weight {
|
pub fn expect_asset() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 2_241_000 picoseconds.
|
// Minimum execution time: 1_994_000 picoseconds.
|
||||||
Weight::from_parts(2_297_000, 0)
|
Weight::from_parts(2_056_000, 0)
|
||||||
}
|
}
|
||||||
pub fn expect_origin() -> Weight {
|
pub fn expect_origin() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 2_230_000 picoseconds.
|
// Minimum execution time: 1_978_000 picoseconds.
|
||||||
Weight::from_parts(2_318_000, 0)
|
Weight::from_parts(2_069_000, 0)
|
||||||
}
|
}
|
||||||
pub fn expect_error() -> Weight {
|
pub fn expect_error() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 2_051_000 picoseconds.
|
// Minimum execution time: 1_894_000 picoseconds.
|
||||||
Weight::from_parts(2_153_000, 0)
|
Weight::from_parts(1_977_000, 0)
|
||||||
}
|
}
|
||||||
pub fn expect_transact_status() -> Weight {
|
pub fn expect_transact_status() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 2_306_000 picoseconds.
|
// Minimum execution time: 2_114_000 picoseconds.
|
||||||
Weight::from_parts(2_380_000, 0)
|
Weight::from_parts(2_223_000, 0)
|
||||||
}
|
}
|
||||||
// Storage: `ParachainInfo::ParachainId` (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`)
|
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||||
@@ -270,8 +270,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
|||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `171`
|
// Measured: `171`
|
||||||
// Estimated: `6196`
|
// Estimated: `6196`
|
||||||
// Minimum execution time: 60_201_000 picoseconds.
|
// Minimum execution time: 58_704_000 picoseconds.
|
||||||
Weight::from_parts(61_132_000, 6196)
|
Weight::from_parts(59_677_000, 6196)
|
||||||
.saturating_add(T::DbWeight::get().reads(9))
|
.saturating_add(T::DbWeight::get().reads(9))
|
||||||
.saturating_add(T::DbWeight::get().writes(4))
|
.saturating_add(T::DbWeight::get().writes(4))
|
||||||
}
|
}
|
||||||
@@ -279,8 +279,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
|||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 4_554_000 picoseconds.
|
// Minimum execution time: 4_506_000 picoseconds.
|
||||||
Weight::from_parts(4_704_000, 0)
|
Weight::from_parts(4_672_000, 0)
|
||||||
}
|
}
|
||||||
// Storage: `ParachainInfo::ParachainId` (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`)
|
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||||
@@ -302,8 +302,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
|||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `171`
|
// Measured: `171`
|
||||||
// Estimated: `6196`
|
// Estimated: `6196`
|
||||||
// Minimum execution time: 56_071_000 picoseconds.
|
// Minimum execution time: 54_896_000 picoseconds.
|
||||||
Weight::from_parts(56_889_000, 6196)
|
Weight::from_parts(56_331_000, 6196)
|
||||||
.saturating_add(T::DbWeight::get().reads(9))
|
.saturating_add(T::DbWeight::get().reads(9))
|
||||||
.saturating_add(T::DbWeight::get().writes(4))
|
.saturating_add(T::DbWeight::get().writes(4))
|
||||||
}
|
}
|
||||||
@@ -311,25 +311,29 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
|||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 2_093_000 picoseconds.
|
// Minimum execution time: 1_946_000 picoseconds.
|
||||||
Weight::from_parts(2_169_000, 0)
|
Weight::from_parts(2_002_000, 0)
|
||||||
}
|
}
|
||||||
pub fn set_topic() -> Weight {
|
pub fn set_topic() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 2_027_000 picoseconds.
|
// Minimum execution time: 1_898_000 picoseconds.
|
||||||
Weight::from_parts(2_172_000, 0)
|
Weight::from_parts(1_961_000, 0)
|
||||||
}
|
}
|
||||||
pub fn clear_topic() -> Weight {
|
pub fn clear_topic() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 2_035_000 picoseconds.
|
// Minimum execution time: 1_895_000 picoseconds.
|
||||||
Weight::from_parts(2_164_000, 0)
|
Weight::from_parts(1_964_000, 0)
|
||||||
}
|
}
|
||||||
// Storage: `ParachainInfo::ParachainId` (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`)
|
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||||
|
// Storage: `PolkadotXcm::SupportedVersion` (r:2 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: `BridgeWestendMessages::PalletOperatingMode` (r:1 w:0)
|
// Storage: `BridgeWestendMessages::PalletOperatingMode` (r:1 w:0)
|
||||||
// Proof: `BridgeWestendMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`)
|
// Proof: `BridgeWestendMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`)
|
||||||
// Storage: `BridgeWestendMessages::OutboundLanes` (r:1 w:1)
|
// Storage: `BridgeWestendMessages::OutboundLanes` (r:1 w:1)
|
||||||
@@ -341,27 +345,27 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
|||||||
/// The range of component `x` is `[1, 1000]`.
|
/// The range of component `x` is `[1, 1000]`.
|
||||||
pub fn export_message(x: u32, ) -> Weight {
|
pub fn export_message(x: u32, ) -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `96`
|
// Measured: `190`
|
||||||
// Estimated: `1529`
|
// Estimated: `6130`
|
||||||
// Minimum execution time: 25_636_000 picoseconds.
|
// Minimum execution time: 36_547_000 picoseconds.
|
||||||
Weight::from_parts(25_405_640, 1529)
|
Weight::from_parts(37_623_117, 6130)
|
||||||
// Standard Error: 321
|
// Standard Error: 735
|
||||||
.saturating_add(Weight::from_parts(365_002, 0).saturating_mul(x.into()))
|
.saturating_add(Weight::from_parts(315_274, 0).saturating_mul(x.into()))
|
||||||
.saturating_add(T::DbWeight::get().reads(4))
|
.saturating_add(T::DbWeight::get().reads(7))
|
||||||
.saturating_add(T::DbWeight::get().writes(2))
|
.saturating_add(T::DbWeight::get().writes(3))
|
||||||
}
|
}
|
||||||
pub fn set_fees_mode() -> Weight {
|
pub fn set_fees_mode() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 2_036_000 picoseconds.
|
// Minimum execution time: 1_868_000 picoseconds.
|
||||||
Weight::from_parts(2_136_000, 0)
|
Weight::from_parts(1_910_000, 0)
|
||||||
}
|
}
|
||||||
pub fn unpaid_execution() -> Weight {
|
pub fn unpaid_execution() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 2_147_000 picoseconds.
|
// Minimum execution time: 1_998_000 picoseconds.
|
||||||
Weight::from_parts(2_276_000, 0)
|
Weight::from_parts(2_069_000, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ use bridge_hub_rococo_runtime::{
|
|||||||
bridge_common_config, bridge_to_westend_config,
|
bridge_common_config, bridge_to_westend_config,
|
||||||
xcm_config::{RelayNetwork, TokenLocation, XcmConfig},
|
xcm_config::{RelayNetwork, TokenLocation, XcmConfig},
|
||||||
AllPalletsWithoutSystem, BridgeRejectObsoleteHeadersAndMessages, Executive, ExistentialDeposit,
|
AllPalletsWithoutSystem, BridgeRejectObsoleteHeadersAndMessages, Executive, ExistentialDeposit,
|
||||||
ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, SessionKeys, SignedExtra,
|
ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, SessionKeys,
|
||||||
TransactionPayment, UncheckedExtrinsic,
|
SignedExtra, TransactionPayment, UncheckedExtrinsic,
|
||||||
};
|
};
|
||||||
use codec::{Decode, Encode};
|
use codec::{Decode, Encode};
|
||||||
use frame_support::{dispatch::GetDispatchInfo, parameter_types};
|
use frame_support::{dispatch::GetDispatchInfo, parameter_types, traits::ConstU8};
|
||||||
use frame_system::pallet_prelude::HeaderFor;
|
use frame_system::pallet_prelude::HeaderFor;
|
||||||
use parachains_common::{rococo::fee::WeightToFee, AccountId, AuraId, Balance};
|
use parachains_common::{rococo::fee::WeightToFee, AccountId, AuraId, Balance};
|
||||||
use sp_keyring::AccountKeyring::Alice;
|
use sp_keyring::AccountKeyring::Alice;
|
||||||
@@ -104,8 +104,9 @@ mod bridge_hub_rococo_tests {
|
|||||||
RequiredStakeForStakeAndSlash,
|
RequiredStakeForStakeAndSlash,
|
||||||
};
|
};
|
||||||
use bridge_to_westend_config::{
|
use bridge_to_westend_config::{
|
||||||
BridgeHubWestendChainId, WestendGlobalConsensusNetwork, WithBridgeHubWestendMessageBridge,
|
BridgeHubWestendChainId, BridgeHubWestendLocation, WestendGlobalConsensusNetwork,
|
||||||
WithBridgeHubWestendMessagesInstance, XCM_LANE_FOR_ASSET_HUB_ROCOCO_TO_ASSET_HUB_WESTEND,
|
WithBridgeHubWestendMessageBridge, WithBridgeHubWestendMessagesInstance,
|
||||||
|
XCM_LANE_FOR_ASSET_HUB_ROCOCO_TO_ASSET_HUB_WESTEND,
|
||||||
};
|
};
|
||||||
|
|
||||||
bridge_hub_test_utils::test_cases::include_teleports_for_native_asset_works!(
|
bridge_hub_test_utils::test_cases::include_teleports_for_native_asset_works!(
|
||||||
@@ -196,7 +197,7 @@ mod bridge_hub_rococo_tests {
|
|||||||
Some((TokenLocation::get(), ExistentialDeposit::get()).into()),
|
Some((TokenLocation::get(), ExistentialDeposit::get()).into()),
|
||||||
// value should be >= than value generated by `can_calculate_weight_for_paid_export_message_with_reserve_transfer`
|
// value should be >= than value generated by `can_calculate_weight_for_paid_export_message_with_reserve_transfer`
|
||||||
Some((TokenLocation::get(), bp_bridge_hub_rococo::BridgeHubRococoBaseXcmFeeInRocs::get()).into()),
|
Some((TokenLocation::get(), bp_bridge_hub_rococo::BridgeHubRococoBaseXcmFeeInRocs::get()).into()),
|
||||||
|| (),
|
|| PolkadotXcm::force_xcm_version(RuntimeOrigin::root(), Box::new(BridgeHubWestendLocation::get()), XCM_VERSION).expect("version saved!"),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,6 +212,7 @@ mod bridge_hub_rococo_tests {
|
|||||||
WithBridgeHubWestendMessagesInstance,
|
WithBridgeHubWestendMessagesInstance,
|
||||||
RelayNetwork,
|
RelayNetwork,
|
||||||
WestendGlobalConsensusNetwork,
|
WestendGlobalConsensusNetwork,
|
||||||
|
ConstU8<2>,
|
||||||
>(
|
>(
|
||||||
collator_session_keys(),
|
collator_session_keys(),
|
||||||
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
|
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
|
||||||
|
|||||||
+17
-4
@@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
bridge_common_config::DeliveryRewardInBalance, weights, xcm_config::UniversalLocation,
|
bridge_common_config::DeliveryRewardInBalance, weights, xcm_config::UniversalLocation,
|
||||||
AccountId, BridgeRococoMessages, Runtime, RuntimeEvent, RuntimeOrigin, XcmOverBridgeHubRococo,
|
AccountId, BridgeRococoMessages, PolkadotXcm, Runtime, RuntimeEvent, RuntimeOrigin,
|
||||||
XcmRouter,
|
XcmOverBridgeHubRococo, XcmRouter,
|
||||||
};
|
};
|
||||||
use bp_messages::LaneId;
|
use bp_messages::LaneId;
|
||||||
use bp_parachains::SingleParaStoredHeaderDataBuilder;
|
use bp_parachains::SingleParaStoredHeaderDataBuilder;
|
||||||
@@ -32,7 +32,7 @@ use bridge_runtime_common::{
|
|||||||
},
|
},
|
||||||
messages_xcm_extension::{
|
messages_xcm_extension::{
|
||||||
SenderAndLane, XcmAsPlainPayload, XcmBlobHauler, XcmBlobHaulerAdapter,
|
SenderAndLane, XcmAsPlainPayload, XcmBlobHauler, XcmBlobHaulerAdapter,
|
||||||
XcmBlobMessageDispatch,
|
XcmBlobMessageDispatch, XcmVersionOfDestAndRemoteBridge,
|
||||||
},
|
},
|
||||||
refund_relayer_extension::{
|
refund_relayer_extension::{
|
||||||
ActualFeeRefund, RefundBridgedParachainMessages, RefundSignedExtensionAdapter,
|
ActualFeeRefund, RefundBridgedParachainMessages, RefundSignedExtensionAdapter,
|
||||||
@@ -65,6 +65,10 @@ parameter_types! {
|
|||||||
pub const BridgeHubRococoChainId: bp_runtime::ChainId = bp_runtime::BRIDGE_HUB_ROCOCO_CHAIN_ID;
|
pub const BridgeHubRococoChainId: bp_runtime::ChainId = bp_runtime::BRIDGE_HUB_ROCOCO_CHAIN_ID;
|
||||||
pub BridgeWestendToRococoMessagesPalletInstance: InteriorMultiLocation = X1(PalletInstance(<BridgeRococoMessages as PalletInfoAccess>::index() as u8));
|
pub BridgeWestendToRococoMessagesPalletInstance: InteriorMultiLocation = X1(PalletInstance(<BridgeRococoMessages as PalletInfoAccess>::index() as u8));
|
||||||
pub RococoGlobalConsensusNetwork: NetworkId = NetworkId::Rococo;
|
pub RococoGlobalConsensusNetwork: NetworkId = NetworkId::Rococo;
|
||||||
|
pub RococoGlobalConsensusNetworkLocation: MultiLocation = MultiLocation {
|
||||||
|
parents: 2,
|
||||||
|
interior: X1(GlobalConsensus(RococoGlobalConsensusNetwork::get()))
|
||||||
|
};
|
||||||
// see the `FEE_BOOST_PER_MESSAGE` constant to get the meaning of this value
|
// see the `FEE_BOOST_PER_MESSAGE` constant to get the meaning of this value
|
||||||
pub PriorityBoostPerMessage: u64 = 182_044_444_444_444;
|
pub PriorityBoostPerMessage: u64 = 182_044_444_444_444;
|
||||||
|
|
||||||
@@ -87,6 +91,14 @@ parameter_types! {
|
|||||||
|
|
||||||
pub CongestedMessage: Xcm<()> = build_congestion_message(true).into();
|
pub CongestedMessage: Xcm<()> = build_congestion_message(true).into();
|
||||||
pub UncongestedMessage: Xcm<()> = build_congestion_message(false).into();
|
pub UncongestedMessage: Xcm<()> = build_congestion_message(false).into();
|
||||||
|
|
||||||
|
pub BridgeHubRococoLocation: MultiLocation = MultiLocation {
|
||||||
|
parents: 2,
|
||||||
|
interior: X2(
|
||||||
|
GlobalConsensus(RococoGlobalConsensusNetwork::get()),
|
||||||
|
Parachain(<bp_bridge_hub_rococo::BridgeHubRococo as bp_runtime::Parachain>::PARACHAIN_ID)
|
||||||
|
)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
pub const XCM_LANE_FOR_ASSET_HUB_WESTEND_TO_ASSET_HUB_ROCOCO: LaneId = LaneId([0, 0, 0, 2]);
|
pub const XCM_LANE_FOR_ASSET_HUB_WESTEND_TO_ASSET_HUB_ROCOCO: LaneId = LaneId([0, 0, 0, 2]);
|
||||||
|
|
||||||
@@ -260,9 +272,10 @@ impl pallet_bridge_messages::Config<WithBridgeHubRococoMessagesInstance> for Run
|
|||||||
pub type XcmOverBridgeHubRococoInstance = pallet_xcm_bridge_hub::Instance1;
|
pub type XcmOverBridgeHubRococoInstance = pallet_xcm_bridge_hub::Instance1;
|
||||||
impl pallet_xcm_bridge_hub::Config<XcmOverBridgeHubRococoInstance> for Runtime {
|
impl pallet_xcm_bridge_hub::Config<XcmOverBridgeHubRococoInstance> for Runtime {
|
||||||
type UniversalLocation = UniversalLocation;
|
type UniversalLocation = UniversalLocation;
|
||||||
type BridgedNetworkId = RococoGlobalConsensusNetwork;
|
type BridgedNetwork = RococoGlobalConsensusNetworkLocation;
|
||||||
type BridgeMessagesPalletInstance = WithBridgeHubRococoMessagesInstance;
|
type BridgeMessagesPalletInstance = WithBridgeHubRococoMessagesInstance;
|
||||||
type MessageExportPrice = ();
|
type MessageExportPrice = ();
|
||||||
|
type DestinationVersion = XcmVersionOfDestAndRemoteBridge<PolkadotXcm, BridgeHubRococoLocation>;
|
||||||
type Lanes = ActiveLanes;
|
type Lanes = ActiveLanes;
|
||||||
type LanesSupport = ToBridgeHubRococoXcmBlobHauler;
|
type LanesSupport = ToBridgeHubRococoXcmBlobHauler;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -922,6 +922,21 @@ impl_runtime_apis! {
|
|||||||
|
|
||||||
fn export_message_origin_and_destination(
|
fn export_message_origin_and_destination(
|
||||||
) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> {
|
) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> {
|
||||||
|
// save XCM version for remote bridge hub
|
||||||
|
let _ = PolkadotXcm::force_xcm_version(
|
||||||
|
RuntimeOrigin::root(),
|
||||||
|
Box::new(bridge_to_rococo_config::BridgeHubRococoLocation::get()),
|
||||||
|
XCM_VERSION,
|
||||||
|
).map_err(|e| {
|
||||||
|
log::error!(
|
||||||
|
"Failed to dispatch `force_xcm_version({:?}, {:?}, {:?})`, error: {:?}",
|
||||||
|
RuntimeOrigin::root(),
|
||||||
|
bridge_to_rococo_config::BridgeHubRococoLocation::get(),
|
||||||
|
XCM_VERSION,
|
||||||
|
e
|
||||||
|
);
|
||||||
|
BenchmarkError::Stop("XcmVersion was not stored!")
|
||||||
|
})?;
|
||||||
Ok(
|
Ok(
|
||||||
(
|
(
|
||||||
bridge_to_rococo_config::FromAssetHubWestendToAssetHubRococoRoute::get().location,
|
bridge_to_rococo_config::FromAssetHubWestendToAssetHubRococoRoute::get().location,
|
||||||
|
|||||||
+95
-101
@@ -17,10 +17,10 @@
|
|||||||
//! Autogenerated weights for `pallet_xcm_benchmarks::generic`
|
//! Autogenerated weights for `pallet_xcm_benchmarks::generic`
|
||||||
//!
|
//!
|
||||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
//! 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: `[]`
|
//! DATE: 2023-11-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||||
//! WORST CASE MAP SIZE: `1000000`
|
//! WORST CASE MAP SIZE: `1000000`
|
||||||
//! HOSTNAME: `runner-vmdtonbz-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
|
//! HOSTNAME: `runner-r43aesjn-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
|
||||||
//! WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024
|
//! WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-westend-dev"), DB CACHE: 1024
|
||||||
|
|
||||||
// Executed Command:
|
// Executed Command:
|
||||||
// target/production/polkadot-parachain
|
// target/production/polkadot-parachain
|
||||||
@@ -33,10 +33,10 @@
|
|||||||
// --heap-pages=4096
|
// --heap-pages=4096
|
||||||
// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json
|
// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json
|
||||||
// --pallet=pallet_xcm_benchmarks::generic
|
// --pallet=pallet_xcm_benchmarks::generic
|
||||||
// --chain=bridge-hub-rococo-dev
|
// --chain=bridge-hub-westend-dev
|
||||||
// --header=./cumulus/file_header.txt
|
// --header=./cumulus/file_header.txt
|
||||||
// --template=./cumulus/templates/xcm-bench-template.hbs
|
// --template=./cumulus/templates/xcm-bench-template.hbs
|
||||||
// --output=./cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/
|
// --output=./cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/xcm/
|
||||||
|
|
||||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
#![allow(unused_parens)]
|
#![allow(unused_parens)]
|
||||||
@@ -48,8 +48,6 @@ use sp_std::marker::PhantomData;
|
|||||||
/// Weights for `pallet_xcm_benchmarks::generic`.
|
/// Weights for `pallet_xcm_benchmarks::generic`.
|
||||||
pub struct WeightInfo<T>(PhantomData<T>);
|
pub struct WeightInfo<T>(PhantomData<T>);
|
||||||
impl<T: frame_system::Config> WeightInfo<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)
|
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
|
||||||
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||||
// Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0)
|
// Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0)
|
||||||
@@ -68,81 +66,79 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
|||||||
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||||
pub fn report_holding() -> Weight {
|
pub fn report_holding() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `242`
|
// Measured: `171`
|
||||||
// Estimated: `6196`
|
// Estimated: `6196`
|
||||||
// Minimum execution time: 62_732_000 picoseconds.
|
// Minimum execution time: 61_383_000 picoseconds.
|
||||||
Weight::from_parts(64_581_000, 6196)
|
Weight::from_parts(62_382_000, 6196)
|
||||||
.saturating_add(T::DbWeight::get().reads(10))
|
.saturating_add(T::DbWeight::get().reads(9))
|
||||||
.saturating_add(T::DbWeight::get().writes(4))
|
.saturating_add(T::DbWeight::get().writes(4))
|
||||||
}
|
}
|
||||||
pub fn buy_execution() -> Weight {
|
pub fn buy_execution() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 1_987_000 picoseconds.
|
// Minimum execution time: 2_057_000 picoseconds.
|
||||||
Weight::from_parts(2_107_000, 0)
|
Weight::from_parts(2_153_000, 0)
|
||||||
}
|
}
|
||||||
// Storage: `PolkadotXcm::Queries` (r:1 w:0)
|
// Storage: `PolkadotXcm::Queries` (r:1 w:0)
|
||||||
// Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
// Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||||
pub fn query_response() -> Weight {
|
pub fn query_response() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `103`
|
// Measured: `32`
|
||||||
// Estimated: `3568`
|
// Estimated: `3497`
|
||||||
// Minimum execution time: 8_098_000 picoseconds.
|
// Minimum execution time: 7_949_000 picoseconds.
|
||||||
Weight::from_parts(8_564_000, 3568)
|
Weight::from_parts(8_250_000, 3497)
|
||||||
.saturating_add(T::DbWeight::get().reads(1))
|
.saturating_add(T::DbWeight::get().reads(1))
|
||||||
}
|
}
|
||||||
pub fn transact() -> Weight {
|
pub fn transact() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 8_539_000 picoseconds.
|
// Minimum execution time: 8_608_000 picoseconds.
|
||||||
Weight::from_parts(9_085_000, 0)
|
Weight::from_parts(9_086_000, 0)
|
||||||
}
|
}
|
||||||
pub fn refund_surplus() -> Weight {
|
pub fn refund_surplus() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 2_205_000 picoseconds.
|
// Minimum execution time: 2_240_000 picoseconds.
|
||||||
Weight::from_parts(2_369_000, 0)
|
Weight::from_parts(2_348_000, 0)
|
||||||
}
|
}
|
||||||
pub fn set_error_handler() -> Weight {
|
pub fn set_error_handler() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 1_828_000 picoseconds.
|
// Minimum execution time: 1_969_000 picoseconds.
|
||||||
Weight::from_parts(1_994_000, 0)
|
Weight::from_parts(2_017_000, 0)
|
||||||
}
|
}
|
||||||
pub fn set_appendix() -> Weight {
|
pub fn set_appendix() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 1_869_000 picoseconds.
|
// Minimum execution time: 1_907_000 picoseconds.
|
||||||
Weight::from_parts(1_946_000, 0)
|
Weight::from_parts(2_001_000, 0)
|
||||||
}
|
}
|
||||||
pub fn clear_error() -> Weight {
|
pub fn clear_error() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 1_842_000 picoseconds.
|
// Minimum execution time: 1_880_000 picoseconds.
|
||||||
Weight::from_parts(1_949_000, 0)
|
Weight::from_parts(1_975_000, 0)
|
||||||
}
|
}
|
||||||
pub fn descend_origin() -> Weight {
|
pub fn descend_origin() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 2_460_000 picoseconds.
|
// Minimum execution time: 2_549_000 picoseconds.
|
||||||
Weight::from_parts(2_593_000, 0)
|
Weight::from_parts(2_624_000, 0)
|
||||||
}
|
}
|
||||||
pub fn clear_origin() -> Weight {
|
pub fn clear_origin() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 1_868_000 picoseconds.
|
// Minimum execution time: 1_895_000 picoseconds.
|
||||||
Weight::from_parts(2_003_000, 0)
|
Weight::from_parts(1_963_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)
|
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
|
||||||
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||||
// Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0)
|
// Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0)
|
||||||
@@ -161,21 +157,21 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
|||||||
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||||
pub fn report_error() -> Weight {
|
pub fn report_error() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `242`
|
// Measured: `171`
|
||||||
// Estimated: `6196`
|
// Estimated: `6196`
|
||||||
// Minimum execution time: 56_813_000 picoseconds.
|
// Minimum execution time: 54_447_000 picoseconds.
|
||||||
Weight::from_parts(57_728_000, 6196)
|
Weight::from_parts(55_629_000, 6196)
|
||||||
.saturating_add(T::DbWeight::get().reads(10))
|
.saturating_add(T::DbWeight::get().reads(9))
|
||||||
.saturating_add(T::DbWeight::get().writes(4))
|
.saturating_add(T::DbWeight::get().writes(4))
|
||||||
}
|
}
|
||||||
// Storage: `PolkadotXcm::AssetTraps` (r:1 w:1)
|
// Storage: `PolkadotXcm::AssetTraps` (r:1 w:1)
|
||||||
// Proof: `PolkadotXcm::AssetTraps` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
// Proof: `PolkadotXcm::AssetTraps` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||||
pub fn claim_asset() -> Weight {
|
pub fn claim_asset() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `160`
|
// Measured: `90`
|
||||||
// Estimated: `3625`
|
// Estimated: `3555`
|
||||||
// Minimum execution time: 11_364_000 picoseconds.
|
// Minimum execution time: 11_597_000 picoseconds.
|
||||||
Weight::from_parts(11_872_000, 3625)
|
Weight::from_parts(11_809_000, 3555)
|
||||||
.saturating_add(T::DbWeight::get().reads(1))
|
.saturating_add(T::DbWeight::get().reads(1))
|
||||||
.saturating_add(T::DbWeight::get().writes(1))
|
.saturating_add(T::DbWeight::get().writes(1))
|
||||||
}
|
}
|
||||||
@@ -183,8 +179,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
|||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 1_821_000 picoseconds.
|
// Minimum execution time: 1_895_000 picoseconds.
|
||||||
Weight::from_parts(1_936_000, 0)
|
Weight::from_parts(1_977_000, 0)
|
||||||
}
|
}
|
||||||
// Storage: `PolkadotXcm::VersionNotifyTargets` (r:1 w:1)
|
// Storage: `PolkadotXcm::VersionNotifyTargets` (r:1 w:1)
|
||||||
// Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
// Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||||
@@ -202,10 +198,10 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
|||||||
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||||
pub fn subscribe_version() -> Weight {
|
pub fn subscribe_version() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `109`
|
// Measured: `38`
|
||||||
// Estimated: `3574`
|
// Estimated: `3503`
|
||||||
// Minimum execution time: 23_081_000 picoseconds.
|
// Minimum execution time: 23_314_000 picoseconds.
|
||||||
Weight::from_parts(23_512_000, 3574)
|
Weight::from_parts(23_905_000, 3503)
|
||||||
.saturating_add(T::DbWeight::get().reads(7))
|
.saturating_add(T::DbWeight::get().reads(7))
|
||||||
.saturating_add(T::DbWeight::get().writes(3))
|
.saturating_add(T::DbWeight::get().writes(3))
|
||||||
}
|
}
|
||||||
@@ -215,47 +211,45 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
|||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 3_747_000 picoseconds.
|
// Minimum execution time: 3_948_000 picoseconds.
|
||||||
Weight::from_parts(4_068_000, 0)
|
Weight::from_parts(4_084_000, 0)
|
||||||
.saturating_add(T::DbWeight::get().writes(1))
|
.saturating_add(T::DbWeight::get().writes(1))
|
||||||
}
|
}
|
||||||
pub fn burn_asset() -> Weight {
|
pub fn burn_asset() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 3_045_000 picoseconds.
|
// Minimum execution time: 3_196_000 picoseconds.
|
||||||
Weight::from_parts(3_208_000, 0)
|
Weight::from_parts(3_285_000, 0)
|
||||||
}
|
}
|
||||||
pub fn expect_asset() -> Weight {
|
pub fn expect_asset() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 1_962_000 picoseconds.
|
// Minimum execution time: 2_040_000 picoseconds.
|
||||||
Weight::from_parts(2_284_000, 0)
|
Weight::from_parts(2_162_000, 0)
|
||||||
}
|
}
|
||||||
pub fn expect_origin() -> Weight {
|
pub fn expect_origin() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 1_951_000 picoseconds.
|
// Minimum execution time: 1_980_000 picoseconds.
|
||||||
Weight::from_parts(2_026_000, 0)
|
Weight::from_parts(2_082_000, 0)
|
||||||
}
|
}
|
||||||
pub fn expect_error() -> Weight {
|
pub fn expect_error() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 1_837_000 picoseconds.
|
// Minimum execution time: 1_890_000 picoseconds.
|
||||||
Weight::from_parts(2_084_000, 0)
|
Weight::from_parts(1_971_000, 0)
|
||||||
}
|
}
|
||||||
pub fn expect_transact_status() -> Weight {
|
pub fn expect_transact_status() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 2_042_000 picoseconds.
|
// Minimum execution time: 2_131_000 picoseconds.
|
||||||
Weight::from_parts(2_145_000, 0)
|
Weight::from_parts(2_187_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)
|
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
|
||||||
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||||
// Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0)
|
// Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0)
|
||||||
@@ -274,22 +268,20 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
|||||||
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||||
pub fn query_pallet() -> Weight {
|
pub fn query_pallet() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `242`
|
// Measured: `171`
|
||||||
// Estimated: `6196`
|
// Estimated: `6196`
|
||||||
// Minimum execution time: 61_350_000 picoseconds.
|
// Minimum execution time: 59_548_000 picoseconds.
|
||||||
Weight::from_parts(62_440_000, 6196)
|
Weight::from_parts(60_842_000, 6196)
|
||||||
.saturating_add(T::DbWeight::get().reads(10))
|
.saturating_add(T::DbWeight::get().reads(9))
|
||||||
.saturating_add(T::DbWeight::get().writes(4))
|
.saturating_add(T::DbWeight::get().writes(4))
|
||||||
}
|
}
|
||||||
pub fn expect_pallet() -> Weight {
|
pub fn expect_pallet() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 4_993_000 picoseconds.
|
// Minimum execution time: 4_665_000 picoseconds.
|
||||||
Weight::from_parts(5_309_000, 0)
|
Weight::from_parts(4_844_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)
|
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
|
||||||
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||||
// Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0)
|
// Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0)
|
||||||
@@ -308,70 +300,72 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
|||||||
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||||
pub fn report_transact_status() -> Weight {
|
pub fn report_transact_status() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `242`
|
// Measured: `171`
|
||||||
// Estimated: `6196`
|
// Estimated: `6196`
|
||||||
// Minimum execution time: 57_133_000 picoseconds.
|
// Minimum execution time: 55_044_000 picoseconds.
|
||||||
Weight::from_parts(58_100_000, 6196)
|
Weight::from_parts(56_103_000, 6196)
|
||||||
.saturating_add(T::DbWeight::get().reads(10))
|
.saturating_add(T::DbWeight::get().reads(9))
|
||||||
.saturating_add(T::DbWeight::get().writes(4))
|
.saturating_add(T::DbWeight::get().writes(4))
|
||||||
}
|
}
|
||||||
pub fn clear_transact_status() -> Weight {
|
pub fn clear_transact_status() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 1_899_000 picoseconds.
|
// Minimum execution time: 1_904_000 picoseconds.
|
||||||
Weight::from_parts(2_153_000, 0)
|
Weight::from_parts(1_984_000, 0)
|
||||||
}
|
}
|
||||||
pub fn set_topic() -> Weight {
|
pub fn set_topic() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 1_880_000 picoseconds.
|
// Minimum execution time: 1_889_000 picoseconds.
|
||||||
Weight::from_parts(1_960_000, 0)
|
Weight::from_parts(1_950_000, 0)
|
||||||
}
|
}
|
||||||
pub fn clear_topic() -> Weight {
|
pub fn clear_topic() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 1_825_000 picoseconds.
|
// Minimum execution time: 1_878_000 picoseconds.
|
||||||
Weight::from_parts(1_960_000, 0)
|
Weight::from_parts(1_963_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)
|
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
|
||||||
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||||
// Storage: `BridgeRococoToWococoMessages::PalletOperatingMode` (r:1 w:0)
|
// Storage: `PolkadotXcm::SupportedVersion` (r:2 w:0)
|
||||||
// Proof: `BridgeRococoToWococoMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`)
|
// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||||
// Storage: `BridgeRococoToWococoMessages::OutboundLanes` (r:1 w:1)
|
// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
|
||||||
// Proof: `BridgeRococoToWococoMessages::OutboundLanes` (`max_values`: Some(1), `max_size`: Some(44), added: 539, mode: `MaxEncodedLen`)
|
// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||||
// Storage: `BridgeRococoToWococoMessages::OutboundLanesCongestedSignals` (r:1 w:0)
|
// Storage: `BridgeRococoMessages::PalletOperatingMode` (r:1 w:0)
|
||||||
// Proof: `BridgeRococoToWococoMessages::OutboundLanesCongestedSignals` (`max_values`: Some(1), `max_size`: Some(21), added: 516, mode: `MaxEncodedLen`)
|
// Proof: `BridgeRococoMessages::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(2), added: 497, mode: `MaxEncodedLen`)
|
||||||
// Storage: `BridgeRococoToWococoMessages::OutboundMessages` (r:0 w:1)
|
// Storage: `BridgeRococoMessages::OutboundLanes` (r:1 w:1)
|
||||||
// Proof: `BridgeRococoToWococoMessages::OutboundMessages` (`max_values`: None, `max_size`: Some(2621472), added: 2623947, mode: `MaxEncodedLen`)
|
// Proof: `BridgeRococoMessages::OutboundLanes` (`max_values`: Some(1), `max_size`: Some(44), added: 539, mode: `MaxEncodedLen`)
|
||||||
|
// Storage: `BridgeRococoMessages::OutboundLanesCongestedSignals` (r:1 w:0)
|
||||||
|
// Proof: `BridgeRococoMessages::OutboundLanesCongestedSignals` (`max_values`: Some(1), `max_size`: Some(21), added: 516, mode: `MaxEncodedLen`)
|
||||||
|
// Storage: `BridgeRococoMessages::OutboundMessages` (r:0 w:1)
|
||||||
|
// Proof: `BridgeRococoMessages::OutboundMessages` (`max_values`: None, `max_size`: Some(2621472), added: 2623947, mode: `MaxEncodedLen`)
|
||||||
/// The range of component `x` is `[1, 1000]`.
|
/// The range of component `x` is `[1, 1000]`.
|
||||||
pub fn export_message(x: u32, ) -> Weight {
|
pub fn export_message(x: u32, ) -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `139`
|
// Measured: `188`
|
||||||
// Estimated: `3604`
|
// Estimated: `6128`
|
||||||
// Minimum execution time: 28_419_000 picoseconds.
|
// Minimum execution time: 36_960_000 picoseconds.
|
||||||
Weight::from_parts(29_387_791, 3604)
|
Weight::from_parts(38_104_333, 6128)
|
||||||
// Standard Error: 552
|
// Standard Error: 510
|
||||||
.saturating_add(Weight::from_parts(316_277, 0).saturating_mul(x.into()))
|
.saturating_add(Weight::from_parts(316_499, 0).saturating_mul(x.into()))
|
||||||
.saturating_add(T::DbWeight::get().reads(5))
|
.saturating_add(T::DbWeight::get().reads(7))
|
||||||
.saturating_add(T::DbWeight::get().writes(2))
|
.saturating_add(T::DbWeight::get().writes(3))
|
||||||
}
|
}
|
||||||
pub fn set_fees_mode() -> Weight {
|
pub fn set_fees_mode() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 1_903_000 picoseconds.
|
// Minimum execution time: 1_833_000 picoseconds.
|
||||||
Weight::from_parts(2_023_000, 0)
|
Weight::from_parts(1_950_000, 0)
|
||||||
}
|
}
|
||||||
pub fn unpaid_execution() -> Weight {
|
pub fn unpaid_execution() -> Weight {
|
||||||
// Proof Size summary in bytes:
|
// Proof Size summary in bytes:
|
||||||
// Measured: `0`
|
// Measured: `0`
|
||||||
// Estimated: `0`
|
// Estimated: `0`
|
||||||
// Minimum execution time: 1_963_000 picoseconds.
|
// Minimum execution time: 1_980_000 picoseconds.
|
||||||
Weight::from_parts(2_143_000, 0)
|
Weight::from_parts(2_065_000, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,16 +22,16 @@ use bridge_hub_westend_runtime::{
|
|||||||
bridge_common_config, bridge_to_rococo_config,
|
bridge_common_config, bridge_to_rococo_config,
|
||||||
xcm_config::{RelayNetwork, WestendLocation, XcmConfig},
|
xcm_config::{RelayNetwork, WestendLocation, XcmConfig},
|
||||||
AllPalletsWithoutSystem, BridgeRejectObsoleteHeadersAndMessages, Executive, ExistentialDeposit,
|
AllPalletsWithoutSystem, BridgeRejectObsoleteHeadersAndMessages, Executive, ExistentialDeposit,
|
||||||
ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, SessionKeys, SignedExtra,
|
ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, SessionKeys,
|
||||||
TransactionPayment, UncheckedExtrinsic,
|
SignedExtra, TransactionPayment, UncheckedExtrinsic,
|
||||||
};
|
};
|
||||||
use bridge_to_rococo_config::{
|
use bridge_to_rococo_config::{
|
||||||
BridgeGrandpaRococoInstance, BridgeHubRococoChainId, BridgeParachainRococoInstance,
|
BridgeGrandpaRococoInstance, BridgeHubRococoChainId, BridgeHubRococoLocation,
|
||||||
WithBridgeHubRococoMessageBridge, WithBridgeHubRococoMessagesInstance,
|
BridgeParachainRococoInstance, WithBridgeHubRococoMessageBridge,
|
||||||
XCM_LANE_FOR_ASSET_HUB_WESTEND_TO_ASSET_HUB_ROCOCO,
|
WithBridgeHubRococoMessagesInstance, XCM_LANE_FOR_ASSET_HUB_WESTEND_TO_ASSET_HUB_ROCOCO,
|
||||||
};
|
};
|
||||||
use codec::{Decode, Encode};
|
use codec::{Decode, Encode};
|
||||||
use frame_support::{dispatch::GetDispatchInfo, parameter_types};
|
use frame_support::{dispatch::GetDispatchInfo, parameter_types, traits::ConstU8};
|
||||||
use frame_system::pallet_prelude::HeaderFor;
|
use frame_system::pallet_prelude::HeaderFor;
|
||||||
use parachains_common::{westend::fee::WeightToFee, AccountId, AuraId, Balance};
|
use parachains_common::{westend::fee::WeightToFee, AccountId, AuraId, Balance};
|
||||||
use sp_keyring::AccountKeyring::Alice;
|
use sp_keyring::AccountKeyring::Alice;
|
||||||
@@ -184,7 +184,7 @@ fn handle_export_message_from_system_parachain_add_to_outbound_queue_works() {
|
|||||||
Some((WestendLocation::get(), ExistentialDeposit::get()).into()),
|
Some((WestendLocation::get(), ExistentialDeposit::get()).into()),
|
||||||
// value should be >= than value generated by `can_calculate_weight_for_paid_export_message_with_reserve_transfer`
|
// value should be >= than value generated by `can_calculate_weight_for_paid_export_message_with_reserve_transfer`
|
||||||
Some((WestendLocation::get(), bp_bridge_hub_westend::BridgeHubWestendBaseXcmFeeInWnds::get()).into()),
|
Some((WestendLocation::get(), bp_bridge_hub_westend::BridgeHubWestendBaseXcmFeeInWnds::get()).into()),
|
||||||
|| (),
|
|| PolkadotXcm::force_xcm_version(RuntimeOrigin::root(), Box::new(BridgeHubRococoLocation::get()), XCM_VERSION).expect("version saved!"),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,6 +198,7 @@ fn message_dispatch_routing_works() {
|
|||||||
WithBridgeHubRococoMessagesInstance,
|
WithBridgeHubRococoMessagesInstance,
|
||||||
RelayNetwork,
|
RelayNetwork,
|
||||||
bridge_to_rococo_config::RococoGlobalConsensusNetwork,
|
bridge_to_rococo_config::RococoGlobalConsensusNetwork,
|
||||||
|
ConstU8<2>,
|
||||||
>(
|
>(
|
||||||
collator_session_keys(),
|
collator_session_keys(),
|
||||||
bp_bridge_hub_westend::BRIDGE_HUB_WESTEND_PARACHAIN_ID,
|
bp_bridge_hub_westend::BRIDGE_HUB_WESTEND_PARACHAIN_ID,
|
||||||
|
|||||||
@@ -55,7 +55,10 @@ use sp_runtime::{
|
|||||||
traits::{Header as HeaderT, Zero},
|
traits::{Header as HeaderT, Zero},
|
||||||
AccountId32,
|
AccountId32,
|
||||||
};
|
};
|
||||||
use xcm::latest::prelude::*;
|
use xcm::{
|
||||||
|
latest::prelude::*,
|
||||||
|
prelude::{AlwaysLatest, GetVersion},
|
||||||
|
};
|
||||||
use xcm_builder::DispatchBlobError;
|
use xcm_builder::DispatchBlobError;
|
||||||
use xcm_executor::{
|
use xcm_executor::{
|
||||||
traits::{TransactAsset, WeightBounds},
|
traits::{TransactAsset, WeightBounds},
|
||||||
@@ -258,6 +261,7 @@ pub fn message_dispatch_routing_works<
|
|||||||
MessagesPalletInstance,
|
MessagesPalletInstance,
|
||||||
RuntimeNetwork,
|
RuntimeNetwork,
|
||||||
BridgedNetwork,
|
BridgedNetwork,
|
||||||
|
NetworkDistanceAsParentCount,
|
||||||
>(
|
>(
|
||||||
collator_session_key: CollatorSessionKeys<Runtime>,
|
collator_session_key: CollatorSessionKeys<Runtime>,
|
||||||
runtime_para_id: u32,
|
runtime_para_id: u32,
|
||||||
@@ -291,13 +295,19 @@ pub fn message_dispatch_routing_works<
|
|||||||
HrmpChannelOpener: frame_support::inherent::ProvideInherent<
|
HrmpChannelOpener: frame_support::inherent::ProvideInherent<
|
||||||
Call = cumulus_pallet_parachain_system::Call<Runtime>,
|
Call = cumulus_pallet_parachain_system::Call<Runtime>,
|
||||||
>,
|
>,
|
||||||
// MessageDispatcher: MessageDispatch<AccountIdOf<Runtime>, DispatchLevelResult =
|
|
||||||
// XcmBlobMessageDispatchResult, DispatchPayload = XcmAsPlainPayload>,
|
|
||||||
RuntimeNetwork: Get<NetworkId>,
|
RuntimeNetwork: Get<NetworkId>,
|
||||||
BridgedNetwork: Get<NetworkId>,
|
BridgedNetwork: Get<NetworkId>,
|
||||||
|
NetworkDistanceAsParentCount: Get<u8>,
|
||||||
{
|
{
|
||||||
assert_ne!(runtime_para_id, sibling_parachain_id);
|
assert_ne!(runtime_para_id, sibling_parachain_id);
|
||||||
|
|
||||||
|
struct NetworkWithParentCount<N, C>(core::marker::PhantomData<(N, C)>);
|
||||||
|
impl<N: Get<NetworkId>, C: Get<u8>> Get<MultiLocation> for NetworkWithParentCount<N, C> {
|
||||||
|
fn get() -> MultiLocation {
|
||||||
|
MultiLocation { parents: C::get(), interior: X1(GlobalConsensus(N::get())) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ExtBuilder::<Runtime>::default()
|
ExtBuilder::<Runtime>::default()
|
||||||
.with_collators(collator_session_key.collators())
|
.with_collators(collator_session_key.collators())
|
||||||
.with_session_keys(collator_session_key.session_keys())
|
.with_session_keys(collator_session_key.session_keys())
|
||||||
@@ -317,7 +327,11 @@ pub fn message_dispatch_routing_works<
|
|||||||
);
|
);
|
||||||
// 1. this message is sent from other global consensus with destination of this Runtime relay chain (UMP)
|
// 1. this message is sent from other global consensus with destination of this Runtime relay chain (UMP)
|
||||||
let bridging_message =
|
let bridging_message =
|
||||||
test_data::simulate_message_exporter_on_bridged_chain::<BridgedNetwork, RuntimeNetwork>(
|
test_data::simulate_message_exporter_on_bridged_chain::<
|
||||||
|
BridgedNetwork,
|
||||||
|
NetworkWithParentCount<RuntimeNetwork, NetworkDistanceAsParentCount>,
|
||||||
|
AlwaysLatest,
|
||||||
|
>(
|
||||||
(RuntimeNetwork::get(), Here)
|
(RuntimeNetwork::get(), Here)
|
||||||
);
|
);
|
||||||
let result = <<Runtime as pallet_bridge_messages::Config<MessagesPalletInstance>>::MessageDispatch>::dispatch(
|
let result = <<Runtime as pallet_bridge_messages::Config<MessagesPalletInstance>>::MessageDispatch>::dispatch(
|
||||||
@@ -335,7 +349,11 @@ pub fn message_dispatch_routing_works<
|
|||||||
|
|
||||||
// 2. this message is sent from other global consensus with destination of this Runtime sibling parachain (HRMP)
|
// 2. this message is sent from other global consensus with destination of this Runtime sibling parachain (HRMP)
|
||||||
let bridging_message =
|
let bridging_message =
|
||||||
test_data::simulate_message_exporter_on_bridged_chain::<BridgedNetwork, RuntimeNetwork>(
|
test_data::simulate_message_exporter_on_bridged_chain::<
|
||||||
|
BridgedNetwork,
|
||||||
|
NetworkWithParentCount<RuntimeNetwork, NetworkDistanceAsParentCount>,
|
||||||
|
AlwaysLatest,
|
||||||
|
>(
|
||||||
(RuntimeNetwork::get(), X1(Parachain(sibling_parachain_id))),
|
(RuntimeNetwork::get(), X1(Parachain(sibling_parachain_id))),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1524,7 +1542,8 @@ pub mod test_data {
|
|||||||
/// which are transferred over bridge.
|
/// which are transferred over bridge.
|
||||||
pub(crate) fn simulate_message_exporter_on_bridged_chain<
|
pub(crate) fn simulate_message_exporter_on_bridged_chain<
|
||||||
SourceNetwork: Get<NetworkId>,
|
SourceNetwork: Get<NetworkId>,
|
||||||
DestinationNetwork: Get<NetworkId>,
|
DestinationNetwork: Get<MultiLocation>,
|
||||||
|
DestinationVersion: GetVersion,
|
||||||
>(
|
>(
|
||||||
(destination_network, destination_junctions): (NetworkId, Junctions),
|
(destination_network, destination_junctions): (NetworkId, Junctions),
|
||||||
) -> Vec<u8> {
|
) -> Vec<u8> {
|
||||||
@@ -1536,23 +1555,28 @@ pub mod test_data {
|
|||||||
let channel = 1_u32;
|
let channel = 1_u32;
|
||||||
|
|
||||||
// simulate XCM message export
|
// simulate XCM message export
|
||||||
let (ticket, fee) =
|
let (ticket, fee) = validate_export::<
|
||||||
validate_export::<HaulBlobExporter<GrabbingHaulBlob, DestinationNetwork, ()>>(
|
HaulBlobExporter<GrabbingHaulBlob, DestinationNetwork, DestinationVersion, ()>,
|
||||||
destination_network,
|
>(
|
||||||
channel,
|
destination_network,
|
||||||
universal_source_on_bridged_chain,
|
channel,
|
||||||
destination_junctions,
|
universal_source_on_bridged_chain,
|
||||||
dummy_xcm(),
|
destination_junctions,
|
||||||
)
|
dummy_xcm(),
|
||||||
.expect("validate_export to pass");
|
)
|
||||||
|
.expect("validate_export to pass");
|
||||||
log::info!(
|
log::info!(
|
||||||
target: "simulate_message_exporter_on_bridged_chain",
|
target: "simulate_message_exporter_on_bridged_chain",
|
||||||
"HaulBlobExporter::validate fee: {:?}",
|
"HaulBlobExporter::validate fee: {:?}",
|
||||||
fee
|
fee
|
||||||
);
|
);
|
||||||
let xcm_hash =
|
let xcm_hash = HaulBlobExporter::<
|
||||||
HaulBlobExporter::<GrabbingHaulBlob, DestinationNetwork, ()>::deliver(ticket)
|
GrabbingHaulBlob,
|
||||||
.expect("deliver to pass");
|
DestinationNetwork,
|
||||||
|
DestinationVersion,
|
||||||
|
(),
|
||||||
|
>::deliver(ticket)
|
||||||
|
.expect("deliver to pass");
|
||||||
log::info!(
|
log::info!(
|
||||||
target: "simulate_message_exporter_on_bridged_chain",
|
target: "simulate_message_exporter_on_bridged_chain",
|
||||||
"HaulBlobExporter::deliver xcm_hash: {:?}",
|
"HaulBlobExporter::deliver xcm_hash: {:?}",
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ pub struct ExtBuilder<
|
|||||||
collators: Vec<AccountIdOf<Runtime>>,
|
collators: Vec<AccountIdOf<Runtime>>,
|
||||||
// keys added to pallet session
|
// keys added to pallet session
|
||||||
keys: Vec<(AccountIdOf<Runtime>, ValidatorIdOf<Runtime>, SessionKeysOf<Runtime>)>,
|
keys: Vec<(AccountIdOf<Runtime>, ValidatorIdOf<Runtime>, SessionKeysOf<Runtime>)>,
|
||||||
// safe xcm version for pallet_xcm
|
// safe XCM version for pallet_xcm
|
||||||
safe_xcm_version: Option<XcmVersion>,
|
safe_xcm_version: Option<XcmVersion>,
|
||||||
// para id
|
// para id
|
||||||
para_id: Option<ParaId>,
|
para_id: Option<ParaId>,
|
||||||
|
|||||||
@@ -187,23 +187,25 @@ function open_hrmp_channels() {
|
|||||||
${max_message_size}
|
${max_message_size}
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_storage() {
|
function force_xcm_version() {
|
||||||
local relay_url=$1
|
local relay_url=$1
|
||||||
local relay_chain_seed=$2
|
local relay_chain_seed=$2
|
||||||
local runtime_para_id=$3
|
local runtime_para_id=$3
|
||||||
local runtime_para_endpoint=$4
|
local runtime_para_endpoint=$4
|
||||||
local items=$5
|
local dest=$5
|
||||||
echo " calling set_storage:"
|
local xcm_version=$6
|
||||||
|
echo " calling force_xcm_version:"
|
||||||
echo " relay_url: ${relay_url}"
|
echo " relay_url: ${relay_url}"
|
||||||
echo " relay_chain_seed: ${relay_chain_seed}"
|
echo " relay_chain_seed: ${relay_chain_seed}"
|
||||||
echo " runtime_para_id: ${runtime_para_id}"
|
echo " runtime_para_id: ${runtime_para_id}"
|
||||||
echo " runtime_para_endpoint: ${runtime_para_endpoint}"
|
echo " runtime_para_endpoint: ${runtime_para_endpoint}"
|
||||||
echo " items: ${items}"
|
echo " dest: ${dest}"
|
||||||
|
echo " xcm_version: ${xcm_version}"
|
||||||
echo " params:"
|
echo " params:"
|
||||||
|
|
||||||
# 1. generate data for Transact (System::set_storage)
|
# 1. generate data for Transact (PolkadotXcm::force_xcm_version)
|
||||||
local tmp_output_file=$(mktemp)
|
local tmp_output_file=$(mktemp)
|
||||||
generate_hex_encoded_call_data "set-storage" "${runtime_para_endpoint}" "${tmp_output_file}" "$items"
|
generate_hex_encoded_call_data "force-xcm-version" "${runtime_para_endpoint}" "${tmp_output_file}" "$dest" "$xcm_version"
|
||||||
local hex_encoded_data=$(cat $tmp_output_file)
|
local hex_encoded_data=$(cat $tmp_output_file)
|
||||||
|
|
||||||
# 2. trigger governance call
|
# 2. trigger governance call
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ ON_BRIDGE_HUB_WESTEND_SOVEREIGN_ACCOUNT_FOR_LANE_00000002_bhro_ThisChain="5EHnXa
|
|||||||
ON_BRIDGE_HUB_WESTEND_SOVEREIGN_ACCOUNT_FOR_LANE_00000002_bhro_BridgedChain="5EHnXaT5BhiSGP5h9RgQci1txJ2BDbp7KBRE9k8xty3BMUSi"
|
ON_BRIDGE_HUB_WESTEND_SOVEREIGN_ACCOUNT_FOR_LANE_00000002_bhro_BridgedChain="5EHnXaT5BhiSGP5h9RgQci1txJ2BDbp7KBRE9k8xty3BMUSi"
|
||||||
|
|
||||||
LANE_ID="00000002"
|
LANE_ID="00000002"
|
||||||
|
XCM_VERSION=3
|
||||||
|
|
||||||
function init_ro_wnd() {
|
function init_ro_wnd() {
|
||||||
ensure_relayer
|
ensure_relayer
|
||||||
@@ -215,6 +216,14 @@ case "$1" in
|
|||||||
"ws://127.0.0.1:9942" \
|
"ws://127.0.0.1:9942" \
|
||||||
"//Alice" \
|
"//Alice" \
|
||||||
1013 1000 4 524288
|
1013 1000 4 524288
|
||||||
|
# set XCM version of remote AssetHubWestend
|
||||||
|
force_xcm_version \
|
||||||
|
"ws://127.0.0.1:9942" \
|
||||||
|
"//Alice" \
|
||||||
|
1000 \
|
||||||
|
"ws://127.0.0.1:9910" \
|
||||||
|
"$(jq --null-input '{ "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Westend" }, { "Parachain": 1000 } ] } }')" \
|
||||||
|
$XCM_VERSION
|
||||||
;;
|
;;
|
||||||
init-bridge-hub-rococo-local)
|
init-bridge-hub-rococo-local)
|
||||||
ensure_polkadot_js_api
|
ensure_polkadot_js_api
|
||||||
@@ -236,6 +245,14 @@ case "$1" in
|
|||||||
"//Alice" \
|
"//Alice" \
|
||||||
"$ON_BRIDGE_HUB_ROCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000002_bhwd_BridgedChain" \
|
"$ON_BRIDGE_HUB_ROCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000002_bhwd_BridgedChain" \
|
||||||
$((1000000000000 + 2000000000000))
|
$((1000000000000 + 2000000000000))
|
||||||
|
# set XCM version of remote BridgeHubWestend
|
||||||
|
force_xcm_version \
|
||||||
|
"ws://127.0.0.1:9942" \
|
||||||
|
"//Alice" \
|
||||||
|
1013 \
|
||||||
|
"ws://127.0.0.1:8943" \
|
||||||
|
"$(jq --null-input '{ "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Westend" }, { "Parachain": 1002 } ] } }')" \
|
||||||
|
$XCM_VERSION
|
||||||
;;
|
;;
|
||||||
init-asset-hub-westend-local)
|
init-asset-hub-westend-local)
|
||||||
ensure_polkadot_js_api
|
ensure_polkadot_js_api
|
||||||
@@ -264,6 +281,14 @@ case "$1" in
|
|||||||
"ws://127.0.0.1:9945" \
|
"ws://127.0.0.1:9945" \
|
||||||
"//Alice" \
|
"//Alice" \
|
||||||
1002 1000 4 524288
|
1002 1000 4 524288
|
||||||
|
# set XCM version of remote AssetHubRococo
|
||||||
|
force_xcm_version \
|
||||||
|
"ws://127.0.0.1:9945" \
|
||||||
|
"//Alice" \
|
||||||
|
1000 \
|
||||||
|
"ws://127.0.0.1:9010" \
|
||||||
|
"$(jq --null-input '{ "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Rococo" }, { "Parachain": 1000 } ] } }')" \
|
||||||
|
$XCM_VERSION
|
||||||
;;
|
;;
|
||||||
init-bridge-hub-westend-local)
|
init-bridge-hub-westend-local)
|
||||||
# SA of sibling asset hub pays for the execution
|
# SA of sibling asset hub pays for the execution
|
||||||
@@ -284,6 +309,14 @@ case "$1" in
|
|||||||
"//Alice" \
|
"//Alice" \
|
||||||
"$ON_BRIDGE_HUB_WESTEND_SOVEREIGN_ACCOUNT_FOR_LANE_00000002_bhro_BridgedChain" \
|
"$ON_BRIDGE_HUB_WESTEND_SOVEREIGN_ACCOUNT_FOR_LANE_00000002_bhro_BridgedChain" \
|
||||||
$((1000000000000000 + 2000000000000))
|
$((1000000000000000 + 2000000000000))
|
||||||
|
# set XCM version of remote BridgeHubRococo
|
||||||
|
force_xcm_version \
|
||||||
|
"ws://127.0.0.1:9945" \
|
||||||
|
"//Alice" \
|
||||||
|
1002 \
|
||||||
|
"ws://127.0.0.1:8945" \
|
||||||
|
"$(jq --null-input '{ "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Rococo" }, { "Parachain": 1013 } ] } }')" \
|
||||||
|
$XCM_VERSION
|
||||||
;;
|
;;
|
||||||
reserve-transfer-assets-from-asset-hub-rococo-local)
|
reserve-transfer-assets-from-asset-hub-rococo-local)
|
||||||
ensure_polkadot_js_api
|
ensure_polkadot_js_api
|
||||||
|
|||||||
@@ -106,11 +106,11 @@ function forceCreateAsset(endpoint, outputFile, assetId, assetOwnerAccountId, is
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function setStorage(endpoint, outputFile, items) {
|
function forceXcmVersion(endpoint, outputFile, dest, xcm_version) {
|
||||||
console.log(`Generating setStorage from RPC endpoint: ${endpoint} to outputFile: ${outputFile}, items: ${items}`);
|
console.log(`Generating forceXcmVersion from RPC endpoint: ${endpoint} to outputFile: ${outputFile}, dest: ${dest}, xcm_version: ${xcm_version}`);
|
||||||
connect(endpoint)
|
connect(endpoint)
|
||||||
.then((api) => {
|
.then((api) => {
|
||||||
const call = api.tx.system.setStorage(JSON.parse(items));
|
const call = api.tx.polkadotXcm.forceXcmVersion(JSON.parse(dest), xcm_version);
|
||||||
writeHexEncodedBytesToOutput(call.method, outputFile);
|
writeHexEncodedBytesToOutput(call.method, outputFile);
|
||||||
exit(0);
|
exit(0);
|
||||||
})
|
})
|
||||||
@@ -154,8 +154,8 @@ switch (type) {
|
|||||||
case 'force-create-asset':
|
case 'force-create-asset':
|
||||||
forceCreateAsset(rpcEnpoint, output, inputArgs[0], inputArgs[1], inputArgs[2], inputArgs[3]);
|
forceCreateAsset(rpcEnpoint, output, inputArgs[0], inputArgs[1], inputArgs[2], inputArgs[3]);
|
||||||
break;
|
break;
|
||||||
case 'set-storage':
|
case 'force-xcm-version':
|
||||||
setStorage(rpcEnpoint, output, inputArgs[0]);
|
forceXcmVersion(rpcEnpoint, output, inputArgs[0], inputArgs[1]);
|
||||||
break;
|
break;
|
||||||
case 'check':
|
case 'check':
|
||||||
console.log(`Checking nodejs installation, if you see this everything is ready!`);
|
console.log(`Checking nodejs installation, if you see this everything is ready!`);
|
||||||
|
|||||||
@@ -2591,7 +2591,7 @@ impl<T: Config> WrapVersion for Pallet<T> {
|
|||||||
dest: &MultiLocation,
|
dest: &MultiLocation,
|
||||||
xcm: impl Into<VersionedXcm<RuntimeCall>>,
|
xcm: impl Into<VersionedXcm<RuntimeCall>>,
|
||||||
) -> Result<VersionedXcm<RuntimeCall>, ()> {
|
) -> Result<VersionedXcm<RuntimeCall>, ()> {
|
||||||
SupportedVersion::<T>::get(XCM_VERSION, LatestVersionedMultiLocation(dest))
|
Self::get_version_for(dest)
|
||||||
.or_else(|| {
|
.or_else(|| {
|
||||||
Self::note_unknown_version(dest);
|
Self::note_unknown_version(dest);
|
||||||
SafeXcmVersion::<T>::get()
|
SafeXcmVersion::<T>::get()
|
||||||
@@ -2608,6 +2608,12 @@ impl<T: Config> WrapVersion for Pallet<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T: Config> GetVersion for Pallet<T> {
|
||||||
|
fn get_version_for(dest: &MultiLocation) -> Option<XcmVersion> {
|
||||||
|
SupportedVersion::<T>::get(XCM_VERSION, LatestVersionedMultiLocation(dest))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<T: Config> VersionChangeNotifier for Pallet<T> {
|
impl<T: Config> VersionChangeNotifier for Pallet<T> {
|
||||||
/// Start notifying `location` should the XCM version of this chain change.
|
/// Start notifying `location` should the XCM version of this chain change.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -655,6 +655,17 @@ pub(crate) fn buy_limited_execution<C>(
|
|||||||
|
|
||||||
pub(crate) fn new_test_ext_with_balances(
|
pub(crate) fn new_test_ext_with_balances(
|
||||||
balances: Vec<(AccountId, Balance)>,
|
balances: Vec<(AccountId, Balance)>,
|
||||||
|
) -> sp_io::TestExternalities {
|
||||||
|
new_test_ext_with_balances_and_xcm_version(
|
||||||
|
balances,
|
||||||
|
// By default set actual latest XCM version
|
||||||
|
Some(XCM_VERSION),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn new_test_ext_with_balances_and_xcm_version(
|
||||||
|
balances: Vec<(AccountId, Balance)>,
|
||||||
|
safe_xcm_version: Option<XcmVersion>,
|
||||||
) -> sp_io::TestExternalities {
|
) -> sp_io::TestExternalities {
|
||||||
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||||
|
|
||||||
@@ -662,7 +673,7 @@ pub(crate) fn new_test_ext_with_balances(
|
|||||||
.assimilate_storage(&mut t)
|
.assimilate_storage(&mut t)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
pallet_xcm::GenesisConfig::<Test> { safe_xcm_version: Some(2), ..Default::default() }
|
pallet_xcm::GenesisConfig::<Test> { safe_xcm_version, ..Default::default() }
|
||||||
.assimilate_storage(&mut t)
|
.assimilate_storage(&mut t)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
|||||||
@@ -774,12 +774,13 @@ fn subscription_side_upgrades_work_without_notify() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn subscriber_side_subscription_works() {
|
fn subscriber_side_subscription_works() {
|
||||||
new_test_ext_with_balances(vec![]).execute_with(|| {
|
new_test_ext_with_balances_and_xcm_version(vec![], Some(XCM_VERSION)).execute_with(|| {
|
||||||
let remote: MultiLocation = Parachain(1000).into();
|
let remote: MultiLocation = Parachain(1000).into();
|
||||||
assert_ok!(XcmPallet::force_subscribe_version_notify(
|
assert_ok!(XcmPallet::force_subscribe_version_notify(
|
||||||
RuntimeOrigin::root(),
|
RuntimeOrigin::root(),
|
||||||
Box::new(remote.into()),
|
Box::new(remote.into()),
|
||||||
));
|
));
|
||||||
|
assert_eq!(XcmPallet::get_version_for(&remote), None);
|
||||||
take_sent_xcm();
|
take_sent_xcm();
|
||||||
|
|
||||||
// Assume subscription target is working ok.
|
// Assume subscription target is working ok.
|
||||||
@@ -798,6 +799,7 @@ fn subscriber_side_subscription_works() {
|
|||||||
let r = XcmExecutor::<XcmConfig>::execute_xcm(remote, message, hash, weight);
|
let r = XcmExecutor::<XcmConfig>::execute_xcm(remote, message, hash, weight);
|
||||||
assert_eq!(r, Outcome::Complete(weight));
|
assert_eq!(r, Outcome::Complete(weight));
|
||||||
assert_eq!(take_sent_xcm(), vec![]);
|
assert_eq!(take_sent_xcm(), vec![]);
|
||||||
|
assert_eq!(XcmPallet::get_version_for(&remote), Some(1));
|
||||||
|
|
||||||
// This message cannot be sent to a v2 remote.
|
// This message cannot be sent to a v2 remote.
|
||||||
let v2_msg = xcm::v2::Xcm::<()>(vec![xcm::v2::Instruction::Trap(0)]);
|
let v2_msg = xcm::v2::Xcm::<()>(vec![xcm::v2::Instruction::Trap(0)]);
|
||||||
@@ -815,6 +817,8 @@ fn subscriber_side_subscription_works() {
|
|||||||
let hash = fake_message_hash(&message);
|
let hash = fake_message_hash(&message);
|
||||||
let r = XcmExecutor::<XcmConfig>::execute_xcm(remote, message, hash, weight);
|
let r = XcmExecutor::<XcmConfig>::execute_xcm(remote, message, hash, weight);
|
||||||
assert_eq!(r, Outcome::Complete(weight));
|
assert_eq!(r, Outcome::Complete(weight));
|
||||||
|
assert_eq!(take_sent_xcm(), vec![]);
|
||||||
|
assert_eq!(XcmPallet::get_version_for(&remote), Some(2));
|
||||||
|
|
||||||
// This message can now be sent to remote as it's v2.
|
// This message can now be sent to remote as it's v2.
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@@ -827,7 +831,7 @@ fn subscriber_side_subscription_works() {
|
|||||||
/// We should auto-subscribe when we don't know the remote's version.
|
/// We should auto-subscribe when we don't know the remote's version.
|
||||||
#[test]
|
#[test]
|
||||||
fn auto_subscription_works() {
|
fn auto_subscription_works() {
|
||||||
new_test_ext_with_balances(vec![]).execute_with(|| {
|
new_test_ext_with_balances_and_xcm_version(vec![], None).execute_with(|| {
|
||||||
let remote_v2: MultiLocation = Parachain(1000).into();
|
let remote_v2: MultiLocation = Parachain(1000).into();
|
||||||
let remote_v3: MultiLocation = Parachain(1001).into();
|
let remote_v3: MultiLocation = Parachain(1001).into();
|
||||||
|
|
||||||
@@ -995,3 +999,68 @@ fn subscription_side_upgrades_work_with_multistage_notify() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn get_and_wrap_version_works() {
|
||||||
|
new_test_ext_with_balances_and_xcm_version(vec![], None).execute_with(|| {
|
||||||
|
let remote_a: MultiLocation = Parachain(1000).into();
|
||||||
|
let remote_b: MultiLocation = Parachain(1001).into();
|
||||||
|
let remote_c: MultiLocation = Parachain(1002).into();
|
||||||
|
|
||||||
|
// no `safe_xcm_version` version at `GenesisConfig`
|
||||||
|
assert_eq!(XcmPallet::get_version_for(&remote_a), None);
|
||||||
|
assert_eq!(XcmPallet::get_version_for(&remote_b), None);
|
||||||
|
assert_eq!(XcmPallet::get_version_for(&remote_c), None);
|
||||||
|
assert_eq!(VersionDiscoveryQueue::<Test>::get().into_inner(), vec![]);
|
||||||
|
|
||||||
|
// set default XCM version (a.k.a. `safe_xcm_version`)
|
||||||
|
assert_ok!(XcmPallet::force_default_xcm_version(RuntimeOrigin::root(), Some(1)));
|
||||||
|
assert_eq!(XcmPallet::get_version_for(&remote_a), None);
|
||||||
|
assert_eq!(XcmPallet::get_version_for(&remote_b), None);
|
||||||
|
assert_eq!(XcmPallet::get_version_for(&remote_c), None);
|
||||||
|
assert_eq!(VersionDiscoveryQueue::<Test>::get().into_inner(), vec![]);
|
||||||
|
|
||||||
|
// set XCM version only for `remote_a`
|
||||||
|
assert_ok!(XcmPallet::force_xcm_version(
|
||||||
|
RuntimeOrigin::root(),
|
||||||
|
Box::new(remote_a),
|
||||||
|
XCM_VERSION
|
||||||
|
));
|
||||||
|
assert_eq!(XcmPallet::get_version_for(&remote_a), Some(XCM_VERSION));
|
||||||
|
assert_eq!(XcmPallet::get_version_for(&remote_b), None);
|
||||||
|
assert_eq!(XcmPallet::get_version_for(&remote_c), None);
|
||||||
|
assert_eq!(VersionDiscoveryQueue::<Test>::get().into_inner(), vec![]);
|
||||||
|
|
||||||
|
let xcm = Xcm::<()>::default();
|
||||||
|
|
||||||
|
// wrap version - works because remote_a has `XCM_VERSION`
|
||||||
|
assert_eq!(
|
||||||
|
XcmPallet::wrap_version(&remote_a, xcm.clone()),
|
||||||
|
Ok(VersionedXcm::from(xcm.clone()))
|
||||||
|
);
|
||||||
|
// does not work because remote_b has unknown version and default is set to 1, and
|
||||||
|
// `XCM_VERSION` cannot be wrapped to the `1`
|
||||||
|
assert_eq!(XcmPallet::wrap_version(&remote_b, xcm.clone()), Err(()));
|
||||||
|
assert_eq!(VersionDiscoveryQueue::<Test>::get().into_inner(), vec![(remote_b.into(), 1)]);
|
||||||
|
|
||||||
|
// set default to the `XCM_VERSION`
|
||||||
|
assert_ok!(XcmPallet::force_default_xcm_version(RuntimeOrigin::root(), Some(XCM_VERSION)));
|
||||||
|
assert_eq!(XcmPallet::get_version_for(&remote_b), None);
|
||||||
|
assert_eq!(XcmPallet::get_version_for(&remote_c), None);
|
||||||
|
|
||||||
|
// now works, because default is `XCM_VERSION`
|
||||||
|
assert_eq!(
|
||||||
|
XcmPallet::wrap_version(&remote_b, xcm.clone()),
|
||||||
|
Ok(VersionedXcm::from(xcm.clone()))
|
||||||
|
);
|
||||||
|
assert_eq!(VersionDiscoveryQueue::<Test>::get().into_inner(), vec![(remote_b.into(), 2)]);
|
||||||
|
|
||||||
|
// change remote_c to `1`
|
||||||
|
assert_ok!(XcmPallet::force_xcm_version(RuntimeOrigin::root(), Box::new(remote_c), 1));
|
||||||
|
|
||||||
|
// does not work because remote_c has `1` and default is `XCM_VERSION` which cannot be
|
||||||
|
// wrapped to the `1`
|
||||||
|
assert_eq!(XcmPallet::wrap_version(&remote_c, xcm.clone()), Err(()));
|
||||||
|
assert_eq!(VersionDiscoveryQueue::<Test>::get().into_inner(), vec![(remote_b.into(), 2)]);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
+18
-2
@@ -373,6 +373,12 @@ pub trait WrapVersion {
|
|||||||
) -> Result<VersionedXcm<RuntimeCall>, ()>;
|
) -> Result<VersionedXcm<RuntimeCall>, ()>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Check and return the `Version` that should be used for the `Xcm` datum for the destination
|
||||||
|
/// `MultiLocation`, which will interpret it.
|
||||||
|
pub trait GetVersion {
|
||||||
|
fn get_version_for(dest: &latest::MultiLocation) -> Option<Version>;
|
||||||
|
}
|
||||||
|
|
||||||
/// `()` implementation does nothing with the XCM, just sending with whatever version it was
|
/// `()` implementation does nothing with the XCM, just sending with whatever version it was
|
||||||
/// authored as.
|
/// authored as.
|
||||||
impl WrapVersion for () {
|
impl WrapVersion for () {
|
||||||
@@ -395,6 +401,11 @@ impl WrapVersion for AlwaysV2 {
|
|||||||
Ok(VersionedXcm::<RuntimeCall>::V2(xcm.into().try_into()?))
|
Ok(VersionedXcm::<RuntimeCall>::V2(xcm.into().try_into()?))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl GetVersion for AlwaysV2 {
|
||||||
|
fn get_version_for(_dest: &latest::MultiLocation) -> Option<Version> {
|
||||||
|
Some(v2::VERSION)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// `WrapVersion` implementation which attempts to always convert the XCM to version 3 before
|
/// `WrapVersion` implementation which attempts to always convert the XCM to version 3 before
|
||||||
/// wrapping it.
|
/// wrapping it.
|
||||||
@@ -407,6 +418,11 @@ impl WrapVersion for AlwaysV3 {
|
|||||||
Ok(VersionedXcm::<Call>::V3(xcm.into().try_into()?))
|
Ok(VersionedXcm::<Call>::V3(xcm.into().try_into()?))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl GetVersion for AlwaysV3 {
|
||||||
|
fn get_version_for(_dest: &latest::MultiLocation) -> Option<Version> {
|
||||||
|
Some(v3::VERSION)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// `WrapVersion` implementation which attempts to always convert the XCM to the latest version
|
/// `WrapVersion` implementation which attempts to always convert the XCM to the latest version
|
||||||
/// before wrapping it.
|
/// before wrapping it.
|
||||||
@@ -418,8 +434,8 @@ pub type AlwaysLts = AlwaysV3;
|
|||||||
|
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
pub use super::{
|
pub use super::{
|
||||||
latest::prelude::*, AlwaysLatest, AlwaysLts, AlwaysV2, AlwaysV3, IntoVersion, Unsupported,
|
latest::prelude::*, AlwaysLatest, AlwaysLts, AlwaysV2, AlwaysV3, GetVersion, IntoVersion,
|
||||||
Version as XcmVersion, VersionedAssetId, VersionedInteriorMultiLocation,
|
Unsupported, Version as XcmVersion, VersionedAssetId, VersionedInteriorMultiLocation,
|
||||||
VersionedMultiAsset, VersionedMultiAssets, VersionedMultiLocation, VersionedResponse,
|
VersionedMultiAsset, VersionedMultiAssets, VersionedMultiLocation, VersionedResponse,
|
||||||
VersionedXcm, WrapVersion,
|
VersionedXcm, WrapVersion,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -23,11 +23,16 @@ use super::*;
|
|||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub UniversalLocation: Junctions = X2(GlobalConsensus(Local::get()), Parachain(1));
|
pub UniversalLocation: Junctions = X2(GlobalConsensus(Local::get()), Parachain(1));
|
||||||
pub RemoteUniversalLocation: Junctions = X2(GlobalConsensus(Remote::get()), Parachain(1));
|
pub RemoteUniversalLocation: Junctions = X2(GlobalConsensus(Remote::get()), Parachain(1));
|
||||||
|
pub RemoteNetwork: MultiLocation = AncestorThen(2, GlobalConsensus(Remote::get())).into();
|
||||||
}
|
}
|
||||||
type TheBridge =
|
type TheBridge =
|
||||||
TestBridge<BridgeBlobDispatcher<TestRemoteIncomingRouter, RemoteUniversalLocation, ()>>;
|
TestBridge<BridgeBlobDispatcher<TestRemoteIncomingRouter, RemoteUniversalLocation, ()>>;
|
||||||
type Router =
|
type Router = TestTopic<
|
||||||
TestTopic<UnpaidLocalExporter<HaulBlobExporter<TheBridge, Remote, Price>, UniversalLocation>>;
|
UnpaidLocalExporter<
|
||||||
|
HaulBlobExporter<TheBridge, RemoteNetwork, AlwaysLatest, Price>,
|
||||||
|
UniversalLocation,
|
||||||
|
>,
|
||||||
|
>;
|
||||||
|
|
||||||
/// ```nocompile
|
/// ```nocompile
|
||||||
/// local | remote
|
/// local | remote
|
||||||
|
|||||||
@@ -23,11 +23,16 @@ use super::*;
|
|||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub UniversalLocation: Junctions = X1(GlobalConsensus(Local::get()));
|
pub UniversalLocation: Junctions = X1(GlobalConsensus(Local::get()));
|
||||||
pub RemoteUniversalLocation: Junctions = X1(GlobalConsensus(Remote::get()));
|
pub RemoteUniversalLocation: Junctions = X1(GlobalConsensus(Remote::get()));
|
||||||
|
pub RemoteNetwork: MultiLocation = AncestorThen(1, GlobalConsensus(Remote::get())).into();
|
||||||
}
|
}
|
||||||
type TheBridge =
|
type TheBridge =
|
||||||
TestBridge<BridgeBlobDispatcher<TestRemoteIncomingRouter, RemoteUniversalLocation, ()>>;
|
TestBridge<BridgeBlobDispatcher<TestRemoteIncomingRouter, RemoteUniversalLocation, ()>>;
|
||||||
type Router =
|
type Router = TestTopic<
|
||||||
TestTopic<UnpaidLocalExporter<HaulBlobExporter<TheBridge, Remote, Price>, UniversalLocation>>;
|
UnpaidLocalExporter<
|
||||||
|
HaulBlobExporter<TheBridge, RemoteNetwork, AlwaysLatest, Price>,
|
||||||
|
UniversalLocation,
|
||||||
|
>,
|
||||||
|
>;
|
||||||
|
|
||||||
/// ```nocompile
|
/// ```nocompile
|
||||||
/// local | remote
|
/// local | remote
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ use super::mock::*;
|
|||||||
use crate::{universal_exports::*, WithTopicSource};
|
use crate::{universal_exports::*, WithTopicSource};
|
||||||
use frame_support::{parameter_types, traits::Get};
|
use frame_support::{parameter_types, traits::Get};
|
||||||
use std::{cell::RefCell, marker::PhantomData};
|
use std::{cell::RefCell, marker::PhantomData};
|
||||||
|
use xcm::AlwaysLatest;
|
||||||
use xcm_executor::{
|
use xcm_executor::{
|
||||||
traits::{export_xcm, validate_export},
|
traits::{export_xcm, validate_export},
|
||||||
XcmExecutor,
|
XcmExecutor,
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ parameter_types! {
|
|||||||
pub UniversalLocation: Junctions = X2(GlobalConsensus(Local::get()), Parachain(100));
|
pub UniversalLocation: Junctions = X2(GlobalConsensus(Local::get()), Parachain(100));
|
||||||
pub RelayUniversalLocation: Junctions = X1(GlobalConsensus(Local::get()));
|
pub RelayUniversalLocation: Junctions = X1(GlobalConsensus(Local::get()));
|
||||||
pub RemoteUniversalLocation: Junctions = X1(GlobalConsensus(Remote::get()));
|
pub RemoteUniversalLocation: Junctions = X1(GlobalConsensus(Remote::get()));
|
||||||
|
pub RemoteNetwork: MultiLocation = AncestorThen(1, GlobalConsensus(Remote::get())).into();
|
||||||
pub BridgeTable: Vec<NetworkExportTableItem> = vec![
|
pub BridgeTable: Vec<NetworkExportTableItem> = vec![
|
||||||
NetworkExportTableItem::new(
|
NetworkExportTableItem::new(
|
||||||
Remote::get(),
|
Remote::get(),
|
||||||
@@ -41,7 +42,7 @@ parameter_types! {
|
|||||||
}
|
}
|
||||||
type TheBridge =
|
type TheBridge =
|
||||||
TestBridge<BridgeBlobDispatcher<TestRemoteIncomingRouter, RemoteUniversalLocation, ()>>;
|
TestBridge<BridgeBlobDispatcher<TestRemoteIncomingRouter, RemoteUniversalLocation, ()>>;
|
||||||
type RelayExporter = HaulBlobExporter<TheBridge, Remote, Price>;
|
type RelayExporter = HaulBlobExporter<TheBridge, RemoteNetwork, AlwaysLatest, Price>;
|
||||||
type LocalInnerRouter = ExecutingRouter<UniversalLocation, RelayUniversalLocation, RelayExporter>;
|
type LocalInnerRouter = ExecutingRouter<UniversalLocation, RelayUniversalLocation, RelayExporter>;
|
||||||
type LocalBridgeRouter = SovereignPaidRemoteExporter<
|
type LocalBridgeRouter = SovereignPaidRemoteExporter<
|
||||||
NetworkExportTable<BridgeTable>,
|
NetworkExportTable<BridgeTable>,
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ parameter_types! {
|
|||||||
pub UniversalLocation: Junctions = X2(GlobalConsensus(Local::get()), Parachain(1000));
|
pub UniversalLocation: Junctions = X2(GlobalConsensus(Local::get()), Parachain(1000));
|
||||||
pub ParaBridgeUniversalLocation: Junctions = X2(GlobalConsensus(Local::get()), Parachain(1));
|
pub ParaBridgeUniversalLocation: Junctions = X2(GlobalConsensus(Local::get()), Parachain(1));
|
||||||
pub RemoteParaBridgeUniversalLocation: Junctions = X2(GlobalConsensus(Remote::get()), Parachain(1));
|
pub RemoteParaBridgeUniversalLocation: Junctions = X2(GlobalConsensus(Remote::get()), Parachain(1));
|
||||||
|
pub RemoteNetwork: MultiLocation = AncestorThen(2, GlobalConsensus(Remote::get())).into();
|
||||||
pub BridgeTable: Vec<NetworkExportTableItem> = vec![
|
pub BridgeTable: Vec<NetworkExportTableItem> = vec![
|
||||||
NetworkExportTableItem::new(
|
NetworkExportTableItem::new(
|
||||||
Remote::get(),
|
Remote::get(),
|
||||||
@@ -36,7 +37,7 @@ parameter_types! {
|
|||||||
type TheBridge = TestBridge<
|
type TheBridge = TestBridge<
|
||||||
BridgeBlobDispatcher<TestRemoteIncomingRouter, RemoteParaBridgeUniversalLocation, ()>,
|
BridgeBlobDispatcher<TestRemoteIncomingRouter, RemoteParaBridgeUniversalLocation, ()>,
|
||||||
>;
|
>;
|
||||||
type RelayExporter = HaulBlobExporter<TheBridge, Remote, ()>;
|
type RelayExporter = HaulBlobExporter<TheBridge, RemoteNetwork, AlwaysLatest, ()>;
|
||||||
type LocalInnerRouter =
|
type LocalInnerRouter =
|
||||||
UnpaidExecutingRouter<UniversalLocation, ParaBridgeUniversalLocation, RelayExporter>;
|
UnpaidExecutingRouter<UniversalLocation, ParaBridgeUniversalLocation, RelayExporter>;
|
||||||
type LocalBridgingRouter =
|
type LocalBridgingRouter =
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ parameter_types! {
|
|||||||
pub UniversalLocation: Junctions = X1(GlobalConsensus(Local::get()));
|
pub UniversalLocation: Junctions = X1(GlobalConsensus(Local::get()));
|
||||||
pub ParaBridgeUniversalLocation: Junctions = X2(GlobalConsensus(Local::get()), Parachain(1));
|
pub ParaBridgeUniversalLocation: Junctions = X2(GlobalConsensus(Local::get()), Parachain(1));
|
||||||
pub RemoteParaBridgeUniversalLocation: Junctions = X2(GlobalConsensus(Remote::get()), Parachain(1));
|
pub RemoteParaBridgeUniversalLocation: Junctions = X2(GlobalConsensus(Remote::get()), Parachain(1));
|
||||||
|
pub RemoteNetwork: MultiLocation = AncestorThen(2, GlobalConsensus(Remote::get())).into();
|
||||||
pub BridgeTable: Vec<NetworkExportTableItem> = vec![
|
pub BridgeTable: Vec<NetworkExportTableItem> = vec![
|
||||||
NetworkExportTableItem::new(
|
NetworkExportTableItem::new(
|
||||||
Remote::get(),
|
Remote::get(),
|
||||||
@@ -36,7 +37,7 @@ parameter_types! {
|
|||||||
type TheBridge = TestBridge<
|
type TheBridge = TestBridge<
|
||||||
BridgeBlobDispatcher<TestRemoteIncomingRouter, RemoteParaBridgeUniversalLocation, ()>,
|
BridgeBlobDispatcher<TestRemoteIncomingRouter, RemoteParaBridgeUniversalLocation, ()>,
|
||||||
>;
|
>;
|
||||||
type RelayExporter = HaulBlobExporter<TheBridge, Remote, ()>;
|
type RelayExporter = HaulBlobExporter<TheBridge, RemoteNetwork, AlwaysLatest, ()>;
|
||||||
type LocalInnerRouter =
|
type LocalInnerRouter =
|
||||||
UnpaidExecutingRouter<UniversalLocation, ParaBridgeUniversalLocation, RelayExporter>;
|
UnpaidExecutingRouter<UniversalLocation, ParaBridgeUniversalLocation, RelayExporter>;
|
||||||
type LocalBridgingRouter =
|
type LocalBridgingRouter =
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ parameter_types! {
|
|||||||
pub UniversalLocation: Junctions = X2(GlobalConsensus(Local::get()), Parachain(1000));
|
pub UniversalLocation: Junctions = X2(GlobalConsensus(Local::get()), Parachain(1000));
|
||||||
pub RelayUniversalLocation: Junctions = X1(GlobalConsensus(Local::get()));
|
pub RelayUniversalLocation: Junctions = X1(GlobalConsensus(Local::get()));
|
||||||
pub RemoteUniversalLocation: Junctions = X1(GlobalConsensus(Remote::get()));
|
pub RemoteUniversalLocation: Junctions = X1(GlobalConsensus(Remote::get()));
|
||||||
|
pub RemoteNetwork: MultiLocation = AncestorThen(1, GlobalConsensus(Remote::get())).into();
|
||||||
pub BridgeTable: Vec<NetworkExportTableItem> = vec![
|
pub BridgeTable: Vec<NetworkExportTableItem> = vec![
|
||||||
NetworkExportTableItem::new(
|
NetworkExportTableItem::new(
|
||||||
Remote::get(),
|
Remote::get(),
|
||||||
@@ -35,7 +36,7 @@ parameter_types! {
|
|||||||
}
|
}
|
||||||
type TheBridge =
|
type TheBridge =
|
||||||
TestBridge<BridgeBlobDispatcher<TestRemoteIncomingRouter, RemoteUniversalLocation, ()>>;
|
TestBridge<BridgeBlobDispatcher<TestRemoteIncomingRouter, RemoteUniversalLocation, ()>>;
|
||||||
type RelayExporter = HaulBlobExporter<TheBridge, Remote, ()>;
|
type RelayExporter = HaulBlobExporter<TheBridge, RemoteNetwork, AlwaysLatest, ()>;
|
||||||
type LocalInnerRouter =
|
type LocalInnerRouter =
|
||||||
UnpaidExecutingRouter<UniversalLocation, RelayUniversalLocation, RelayExporter>;
|
UnpaidExecutingRouter<UniversalLocation, RelayUniversalLocation, RelayExporter>;
|
||||||
type LocalBridgeRouter =
|
type LocalBridgeRouter =
|
||||||
|
|||||||
@@ -422,11 +422,25 @@ impl<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct HaulBlobExporter<Bridge, BridgedNetwork, Price>(
|
pub struct HaulBlobExporter<Bridge, BridgedNetwork, DestinationVersion, Price>(
|
||||||
PhantomData<(Bridge, BridgedNetwork, Price)>,
|
PhantomData<(Bridge, BridgedNetwork, DestinationVersion, Price)>,
|
||||||
);
|
);
|
||||||
impl<Bridge: HaulBlob, BridgedNetwork: Get<NetworkId>, Price: Get<MultiAssets>> ExportXcm
|
/// `ExportXcm` implementation for `HaulBlobExporter`.
|
||||||
for HaulBlobExporter<Bridge, BridgedNetwork, Price>
|
///
|
||||||
|
/// # Type Parameters
|
||||||
|
///
|
||||||
|
/// ```text
|
||||||
|
/// - Bridge: Implements `HaulBlob`.
|
||||||
|
/// - BridgedNetwork: The relative location of the bridged consensus system with the expected `GlobalConsensus` junction.
|
||||||
|
/// - DestinationVersion: Implements `GetVersion` for retrieving XCM version for the destination.
|
||||||
|
/// - Price: potential fees for exporting.
|
||||||
|
/// ```
|
||||||
|
impl<
|
||||||
|
Bridge: HaulBlob,
|
||||||
|
BridgedNetwork: Get<MultiLocation>,
|
||||||
|
DestinationVersion: GetVersion,
|
||||||
|
Price: Get<MultiAssets>,
|
||||||
|
> ExportXcm for HaulBlobExporter<Bridge, BridgedNetwork, DestinationVersion, Price>
|
||||||
{
|
{
|
||||||
type Ticket = (Vec<u8>, XcmHash);
|
type Ticket = (Vec<u8>, XcmHash);
|
||||||
|
|
||||||
@@ -437,17 +451,35 @@ impl<Bridge: HaulBlob, BridgedNetwork: Get<NetworkId>, Price: Get<MultiAssets>>
|
|||||||
destination: &mut Option<InteriorMultiLocation>,
|
destination: &mut Option<InteriorMultiLocation>,
|
||||||
message: &mut Option<Xcm<()>>,
|
message: &mut Option<Xcm<()>>,
|
||||||
) -> Result<((Vec<u8>, XcmHash), MultiAssets), SendError> {
|
) -> Result<((Vec<u8>, XcmHash), MultiAssets), SendError> {
|
||||||
let bridged_network = BridgedNetwork::get();
|
let (bridged_network, bridged_network_location_parents) = {
|
||||||
|
let MultiLocation { parents, interior: mut junctions } = BridgedNetwork::get();
|
||||||
|
match junctions.take_first() {
|
||||||
|
Some(GlobalConsensus(network)) => (network, parents),
|
||||||
|
_ => return Err(SendError::NotApplicable),
|
||||||
|
}
|
||||||
|
};
|
||||||
ensure!(&network == &bridged_network, SendError::NotApplicable);
|
ensure!(&network == &bridged_network, SendError::NotApplicable);
|
||||||
// We don't/can't use the `channel` for this adapter.
|
// We don't/can't use the `channel` for this adapter.
|
||||||
let dest = destination.take().ok_or(SendError::MissingArgument)?;
|
let dest = destination.take().ok_or(SendError::MissingArgument)?;
|
||||||
let universal_dest = match dest.pushed_front_with(GlobalConsensus(bridged_network)) {
|
|
||||||
Ok(d) => d.into(),
|
// Let's resolve the known/supported XCM version for the destination because we don't know
|
||||||
Err((dest, _)) => {
|
// if it supports the same/latest version.
|
||||||
*destination = Some(dest);
|
let (universal_dest, version) =
|
||||||
return Err(SendError::NotApplicable)
|
match dest.pushed_front_with(GlobalConsensus(bridged_network)) {
|
||||||
},
|
Ok(d) => {
|
||||||
};
|
let version = DestinationVersion::get_version_for(&MultiLocation::from(
|
||||||
|
AncestorThen(bridged_network_location_parents, d),
|
||||||
|
))
|
||||||
|
.ok_or(SendError::DestinationUnsupported)?;
|
||||||
|
(d, version)
|
||||||
|
},
|
||||||
|
Err((dest, _)) => {
|
||||||
|
*destination = Some(dest);
|
||||||
|
return Err(SendError::NotApplicable)
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// Let's adjust XCM with `UniversalOrigin`, `DescendOrigin` and`SetTopic`.
|
||||||
let (local_net, local_sub) = universal_source
|
let (local_net, local_sub) = universal_source
|
||||||
.take()
|
.take()
|
||||||
.ok_or(SendError::MissingArgument)?
|
.ok_or(SendError::MissingArgument)?
|
||||||
@@ -462,7 +494,17 @@ impl<Bridge: HaulBlob, BridgedNetwork: Get<NetworkId>, Price: Get<MultiAssets>>
|
|||||||
if local_sub != Here {
|
if local_sub != Here {
|
||||||
message.0.insert(1, DescendOrigin(local_sub));
|
message.0.insert(1, DescendOrigin(local_sub));
|
||||||
}
|
}
|
||||||
let message = VersionedXcm::from(message);
|
|
||||||
|
// We cannot use the latest `Versioned` because we don't know if the target chain already
|
||||||
|
// supports the same version. Therefore, we better control the destination version with best
|
||||||
|
// efforts.
|
||||||
|
let message = VersionedXcm::from(message)
|
||||||
|
.into_version(version)
|
||||||
|
.map_err(|()| SendError::DestinationUnsupported)?;
|
||||||
|
let universal_dest = VersionedInteriorMultiLocation::from(universal_dest)
|
||||||
|
.into_version(version)
|
||||||
|
.map_err(|()| SendError::DestinationUnsupported)?;
|
||||||
|
|
||||||
let id = maybe_id.unwrap_or_else(|| message.using_encoded(sp_io::hashing::blake2_256));
|
let id = maybe_id.unwrap_or_else(|| message.using_encoded(sp_io::hashing::blake2_256));
|
||||||
let blob = BridgeMessage { universal_dest, message }.encode();
|
let blob = BridgeMessage { universal_dest, message }.encode();
|
||||||
Ok(((blob, id), Price::get()))
|
Ok(((blob, id), Price::get()))
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
|
||||||
|
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json
|
||||||
|
|
||||||
|
title: "xcm-builder: `HaulBlobExporter` with improved XCM version check."
|
||||||
|
|
||||||
|
doc:
|
||||||
|
- audience: Runtime Dev
|
||||||
|
description: |
|
||||||
|
Version check in `HaulBlobExporter` uses new trait `CheckVersion` to check known/configured destination versions,
|
||||||
|
ensuring compatibility. `HaulBlobExporter` will attempt to downgrade the message to destination's known version
|
||||||
|
instead of using the latest version.
|
||||||
|
|
||||||
|
crates: [ ]
|
||||||
Reference in New Issue
Block a user