mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 01:41:03 +00:00
Bridges subtree update (#2602)
## Summary This PR aligns Rococo/Westend bridge with latest Bridges repo development: - https://github.com/paritytech/parity-bridges-common/pull/2727 - https://github.com/paritytech/parity-bridges-common/pull/2728 - https://github.com/paritytech/parity-bridges-common/pull/2729 Part of: https://github.com/paritytech/parity-bridges-common/issues/2452
This commit is contained in:
+30
-19
@@ -17,8 +17,9 @@
|
||||
//! Bridge definitions used on BridgeHub with the Westend flavor.
|
||||
|
||||
use crate::{
|
||||
bridge_common_config::DeliveryRewardInBalance, weights, AccountId, BridgeRococoMessages,
|
||||
ParachainInfo, Runtime, RuntimeEvent, RuntimeOrigin, XcmRouter,
|
||||
bridge_common_config::DeliveryRewardInBalance, weights, xcm_config::UniversalLocation,
|
||||
AccountId, BridgeRococoMessages, Runtime, RuntimeEvent, RuntimeOrigin, XcmOverBridgeHubRococo,
|
||||
XcmRouter,
|
||||
};
|
||||
use bp_messages::LaneId;
|
||||
use bp_parachains::SingleParaStoredHeaderDataBuilder;
|
||||
@@ -48,7 +49,7 @@ use xcm::{
|
||||
latest::prelude::*,
|
||||
prelude::{InteriorMultiLocation, NetworkId},
|
||||
};
|
||||
use xcm_builder::{BridgeBlobDispatcher, HaulBlobExporter};
|
||||
use xcm_builder::BridgeBlobDispatcher;
|
||||
|
||||
parameter_types! {
|
||||
pub const RelayChainHeadersToKeep: u32 = 1024;
|
||||
@@ -62,23 +63,29 @@ parameter_types! {
|
||||
pub const MaxUnconfirmedMessagesAtInboundLane: bp_messages::MessageNonce =
|
||||
bp_bridge_hub_westend::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
||||
pub const BridgeHubRococoChainId: bp_runtime::ChainId = bp_runtime::BRIDGE_HUB_ROCOCO_CHAIN_ID;
|
||||
pub BridgeHubWestendUniversalLocation: InteriorMultiLocation = X2(GlobalConsensus(Westend), Parachain(ParachainInfo::parachain_id().into()));
|
||||
pub BridgeWestendToRococoMessagesPalletInstance: InteriorMultiLocation = X1(PalletInstance(<BridgeRococoMessages as PalletInfoAccess>::index() as u8));
|
||||
pub RococoGlobalConsensusNetwork: NetworkId = NetworkId::Rococo;
|
||||
pub ActiveOutboundLanesToBridgeHubRococo: &'static [bp_messages::LaneId] = &[XCM_LANE_FOR_ASSET_HUB_WESTEND_TO_ASSET_HUB_ROCOCO];
|
||||
pub const AssetHubWestendToAssetHubRococoMessagesLane: bp_messages::LaneId = XCM_LANE_FOR_ASSET_HUB_WESTEND_TO_ASSET_HUB_ROCOCO;
|
||||
// see the `FEE_BOOST_PER_MESSAGE` constant to get the meaning of this value
|
||||
pub PriorityBoostPerMessage: u64 = 182_044_444_444_444;
|
||||
|
||||
pub AssetHubWestendParaId: cumulus_primitives_core::ParaId = bp_asset_hub_westend::ASSET_HUB_WESTEND_PARACHAIN_ID.into();
|
||||
pub AssetHubRococoParaId: cumulus_primitives_core::ParaId = bp_asset_hub_rococo::ASSET_HUB_ROCOCO_PARACHAIN_ID.into();
|
||||
|
||||
// Lanes
|
||||
pub ActiveOutboundLanesToBridgeHubRococo: &'static [bp_messages::LaneId] = &[XCM_LANE_FOR_ASSET_HUB_WESTEND_TO_ASSET_HUB_ROCOCO];
|
||||
pub const AssetHubWestendToAssetHubRococoMessagesLane: bp_messages::LaneId = XCM_LANE_FOR_ASSET_HUB_WESTEND_TO_ASSET_HUB_ROCOCO;
|
||||
pub FromAssetHubWestendToAssetHubRococoRoute: SenderAndLane = SenderAndLane::new(
|
||||
ParentThen(X1(Parachain(AssetHubWestendParaId::get().into()))).into(),
|
||||
XCM_LANE_FOR_ASSET_HUB_WESTEND_TO_ASSET_HUB_ROCOCO,
|
||||
);
|
||||
pub ActiveLanes: sp_std::vec::Vec<(SenderAndLane, (NetworkId, InteriorMultiLocation))> = sp_std::vec![
|
||||
(
|
||||
FromAssetHubWestendToAssetHubRococoRoute::get(),
|
||||
(RococoGlobalConsensusNetwork::get(), X1(Parachain(AssetHubRococoParaId::get().into())))
|
||||
)
|
||||
];
|
||||
|
||||
pub CongestedMessage: Xcm<()> = build_congestion_message(true).into();
|
||||
|
||||
pub UncongestedMessage: Xcm<()> = build_congestion_message(false).into();
|
||||
}
|
||||
pub const XCM_LANE_FOR_ASSET_HUB_WESTEND_TO_ASSET_HUB_ROCOCO: LaneId = LaneId([0, 0, 0, 2]);
|
||||
@@ -110,23 +117,16 @@ pub type ToRococoBridgeHubMessagesDeliveryProof =
|
||||
FromBridgedChainMessagesDeliveryProof<bp_bridge_hub_rococo::Hash>;
|
||||
|
||||
/// Dispatches received XCM messages from other bridge
|
||||
type FromRococoMessageBlobDispatcher = BridgeBlobDispatcher<
|
||||
XcmRouter,
|
||||
BridgeHubWestendUniversalLocation,
|
||||
BridgeWestendToRococoMessagesPalletInstance,
|
||||
>;
|
||||
type FromRococoMessageBlobDispatcher =
|
||||
BridgeBlobDispatcher<XcmRouter, UniversalLocation, BridgeWestendToRococoMessagesPalletInstance>;
|
||||
|
||||
/// Export XCM messages to be relayed to the other side
|
||||
pub type ToBridgeHubRococoHaulBlobExporter = HaulBlobExporter<
|
||||
XcmBlobHaulerAdapter<ToBridgeHubRococoXcmBlobHauler>,
|
||||
RococoGlobalConsensusNetwork,
|
||||
(),
|
||||
>;
|
||||
pub type ToBridgeHubRococoHaulBlobExporter = XcmOverBridgeHubRococo;
|
||||
|
||||
pub struct ToBridgeHubRococoXcmBlobHauler;
|
||||
impl XcmBlobHauler for ToBridgeHubRococoXcmBlobHauler {
|
||||
type Runtime = Runtime;
|
||||
type MessagesInstance = WithBridgeHubRococoMessagesInstance;
|
||||
type SenderAndLane = FromAssetHubWestendToAssetHubRococoRoute;
|
||||
|
||||
type ToSourceChainSender = XcmRouter;
|
||||
type CongestedMessage = CongestedMessage;
|
||||
@@ -134,7 +134,7 @@ impl XcmBlobHauler for ToBridgeHubRococoXcmBlobHauler {
|
||||
}
|
||||
|
||||
/// On messages delivered callback.
|
||||
type OnMessagesDelivered = XcmBlobHaulerAdapter<ToBridgeHubRococoXcmBlobHauler>;
|
||||
type OnMessagesDelivered = XcmBlobHaulerAdapter<ToBridgeHubRococoXcmBlobHauler, ActiveLanes>;
|
||||
|
||||
/// Messaging Bridge configuration for BridgeHubWestend -> BridgeHubRococo
|
||||
pub struct WithBridgeHubRococoMessageBridge;
|
||||
@@ -256,6 +256,17 @@ impl pallet_bridge_messages::Config<WithBridgeHubRococoMessagesInstance> for Run
|
||||
type OnMessagesDelivered = OnMessagesDelivered;
|
||||
}
|
||||
|
||||
/// Add support for the export and dispatch of XCM programs.
|
||||
pub type XcmOverBridgeHubRococoInstance = pallet_xcm_bridge_hub::Instance1;
|
||||
impl pallet_xcm_bridge_hub::Config<XcmOverBridgeHubRococoInstance> for Runtime {
|
||||
type UniversalLocation = UniversalLocation;
|
||||
type BridgedNetworkId = RococoGlobalConsensusNetwork;
|
||||
type BridgeMessagesPalletInstance = WithBridgeHubRococoMessagesInstance;
|
||||
type MessageExportPrice = ();
|
||||
type Lanes = ActiveLanes;
|
||||
type LanesSupport = ToBridgeHubRococoXcmBlobHauler;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@@ -488,6 +488,7 @@ construct_runtime!(
|
||||
BridgeRococoGrandpa: pallet_bridge_grandpa::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>} = 42,
|
||||
BridgeRococoParachains: pallet_bridge_parachains::<Instance1>::{Pallet, Call, Storage, Event<T>} = 43,
|
||||
BridgeRococoMessages: pallet_bridge_messages::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>} = 44,
|
||||
XcmOverBridgeHubRococo: pallet_xcm_bridge_hub::<Instance1>::{Pallet} = 45,
|
||||
|
||||
// Message Queue. Importantly, is registered last so that messages are processed after
|
||||
// the `on_initialize` hooks of bridging pallets.
|
||||
@@ -921,7 +922,13 @@ impl_runtime_apis! {
|
||||
|
||||
fn export_message_origin_and_destination(
|
||||
) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> {
|
||||
Ok((WestendLocation::get(), NetworkId::Rococo, X1(Parachain(100))))
|
||||
Ok(
|
||||
(
|
||||
bridge_to_rococo_config::FromAssetHubWestendToAssetHubRococoRoute::get().location,
|
||||
NetworkId::Rococo,
|
||||
X1(Parachain(bridge_to_rococo_config::AssetHubRococoParaId::get().into()))
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
fn alias_origin() -> Result<(MultiLocation, MultiLocation), BenchmarkError> {
|
||||
|
||||
Reference in New Issue
Block a user