mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 08:11:03 +00:00
[xcm] BridgeBlobDispatcher - prepend bridge instance discriminator. (#2798)
* [xcm] BridgeBlobDispatcher - prepend bridge instance discriminator.
* PR review fix
* update lockfile for {"polkadot", "substrate"}
---------
Co-authored-by: parity-processbot <>
This commit is contained in:
+9
-5
@@ -17,8 +17,8 @@
|
||||
//! Bridge definitions that are used on Rococo to bridge with Wococo.
|
||||
|
||||
use crate::{
|
||||
BridgeParachainWococoInstance, ParachainInfo, Runtime, WithBridgeHubWococoMessagesInstance,
|
||||
XcmRouter,
|
||||
BridgeParachainWococoInstance, BridgeWococoMessages, ParachainInfo, Runtime,
|
||||
WithBridgeHubWococoMessagesInstance, XcmRouter,
|
||||
};
|
||||
use bp_messages::LaneId;
|
||||
use bridge_runtime_common::{
|
||||
@@ -33,7 +33,7 @@ use bridge_runtime_common::{
|
||||
RefundableParachain,
|
||||
},
|
||||
};
|
||||
use frame_support::{parameter_types, RuntimeDebug};
|
||||
use frame_support::{parameter_types, traits::PalletInfoAccess, RuntimeDebug};
|
||||
use xcm::{
|
||||
latest::prelude::*,
|
||||
prelude::{InteriorMultiLocation, NetworkId},
|
||||
@@ -46,6 +46,7 @@ parameter_types! {
|
||||
pub const MaxUnconfirmedMessagesAtInboundLane: bp_messages::MessageNonce =
|
||||
bp_bridge_hub_rococo::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
||||
pub const BridgeHubWococoChainId: bp_runtime::ChainId = bp_runtime::BRIDGE_HUB_WOCOCO_CHAIN_ID;
|
||||
pub BridgeWococoMessagesPalletInstance: InteriorMultiLocation = X1(PalletInstance(<BridgeWococoMessages as PalletInfoAccess>::index() as u8));
|
||||
pub BridgeHubRococoUniversalLocation: InteriorMultiLocation = X2(GlobalConsensus(Rococo), Parachain(ParachainInfo::parachain_id().into()));
|
||||
pub WococoGlobalConsensusNetwork: NetworkId = NetworkId::Wococo;
|
||||
pub ActiveOutboundLanesToBridgeHubWococo: &'static [bp_messages::LaneId] = &[DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO];
|
||||
@@ -60,8 +61,11 @@ pub type ToWococoBridgeHubMessagesDeliveryProof =
|
||||
FromBridgedChainMessagesDeliveryProof<bp_bridge_hub_wococo::Hash>;
|
||||
|
||||
/// Dispatches received XCM messages from other bridge
|
||||
pub type OnBridgeHubRococoBlobDispatcher =
|
||||
BridgeBlobDispatcher<XcmRouter, BridgeHubRococoUniversalLocation>;
|
||||
pub type OnBridgeHubRococoBlobDispatcher = BridgeBlobDispatcher<
|
||||
XcmRouter,
|
||||
BridgeHubRococoUniversalLocation,
|
||||
BridgeWococoMessagesPalletInstance,
|
||||
>;
|
||||
|
||||
/// Export XCM messages to be relayed to the otherside
|
||||
pub type ToBridgeHubWococoHaulBlobExporter = HaulBlobExporter<
|
||||
|
||||
+9
-5
@@ -17,8 +17,8 @@
|
||||
//! Bridge definitions that are used on Wococo to bridge with Rococo.
|
||||
|
||||
use crate::{
|
||||
BridgeParachainRococoInstance, ParachainInfo, Runtime, WithBridgeHubRococoMessagesInstance,
|
||||
XcmRouter,
|
||||
BridgeParachainRococoInstance, BridgeRococoMessages, ParachainInfo, Runtime,
|
||||
WithBridgeHubRococoMessagesInstance, XcmRouter,
|
||||
};
|
||||
use bp_messages::LaneId;
|
||||
use bridge_runtime_common::{
|
||||
@@ -33,7 +33,7 @@ use bridge_runtime_common::{
|
||||
RefundableParachain,
|
||||
},
|
||||
};
|
||||
use frame_support::{parameter_types, RuntimeDebug};
|
||||
use frame_support::{parameter_types, traits::PalletInfoAccess, RuntimeDebug};
|
||||
use xcm::{
|
||||
latest::prelude::*,
|
||||
prelude::{InteriorMultiLocation, NetworkId},
|
||||
@@ -47,6 +47,7 @@ parameter_types! {
|
||||
bp_bridge_hub_wococo::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
|
||||
pub const BridgeHubRococoChainId: bp_runtime::ChainId = bp_runtime::BRIDGE_HUB_ROCOCO_CHAIN_ID;
|
||||
pub BridgeHubWococoUniversalLocation: InteriorMultiLocation = X2(GlobalConsensus(Wococo), Parachain(ParachainInfo::parachain_id().into()));
|
||||
pub BridgeRococoMessagesPalletInstance: InteriorMultiLocation = X1(PalletInstance(<BridgeRococoMessages as PalletInfoAccess>::index() as u8));
|
||||
pub RococoGlobalConsensusNetwork: NetworkId = NetworkId::Rococo;
|
||||
pub ActiveOutboundLanesToBridgeHubRococo: &'static [bp_messages::LaneId] = &[DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO];
|
||||
pub PriorityBoostPerMessage: u64 = 921_900_294;
|
||||
@@ -60,8 +61,11 @@ pub type ToRococoBridgeHubMessagesDeliveryProof =
|
||||
FromBridgedChainMessagesDeliveryProof<bp_bridge_hub_rococo::Hash>;
|
||||
|
||||
/// Dispatches received XCM messages from other bridge
|
||||
pub type OnBridgeHubWococoBlobDispatcher =
|
||||
BridgeBlobDispatcher<XcmRouter, BridgeHubWococoUniversalLocation>;
|
||||
pub type OnBridgeHubWococoBlobDispatcher = BridgeBlobDispatcher<
|
||||
XcmRouter,
|
||||
BridgeHubWococoUniversalLocation,
|
||||
BridgeRococoMessagesPalletInstance,
|
||||
>;
|
||||
|
||||
/// Export XCM messages to be relayed to the otherside
|
||||
pub type ToBridgeHubRococoHaulBlobExporter = HaulBlobExporter<
|
||||
|
||||
@@ -36,7 +36,7 @@ use bridge_runtime_common::{
|
||||
use codec::Encode;
|
||||
use frame_support::{
|
||||
assert_ok,
|
||||
traits::{Get, OriginTrait},
|
||||
traits::{Get, OriginTrait, PalletInfoAccess},
|
||||
};
|
||||
use pallet_bridge_grandpa::BridgedHeader;
|
||||
use parachains_runtimes_test_utils::{
|
||||
@@ -463,7 +463,18 @@ pub fn relayed_incoming_message_works<Runtime, XcmConfig, HrmpChannelOpener, GPI
|
||||
let relayer_id_on_source: AccountId32 = relayer_at_source.public().into();
|
||||
|
||||
let xcm = vec![xcm::v3::Instruction::<()>::ClearOrigin; 42];
|
||||
let expected_dispatch = xcm::latest::Xcm::<()>(xcm.clone());
|
||||
let expected_dispatch = xcm::latest::Xcm::<()>({
|
||||
let mut expected_instructions = xcm.clone();
|
||||
// dispatch prepends bridge pallet instance
|
||||
expected_instructions.insert(
|
||||
0,
|
||||
DescendOrigin(X1(PalletInstance(
|
||||
<pallet_bridge_messages::Pallet<Runtime, MPI> as PalletInfoAccess>::index()
|
||||
as u8,
|
||||
))),
|
||||
);
|
||||
expected_instructions
|
||||
});
|
||||
// generate bridged relay chain finality, parachain heads and message proofs,
|
||||
// to be submitted by relayer to this chain.
|
||||
let (
|
||||
@@ -672,7 +683,18 @@ pub fn complex_relay_extrinsic_works<Runtime, XcmConfig, HrmpChannelOpener, GPI,
|
||||
let relay_header_number = 1;
|
||||
|
||||
let xcm = vec![xcm::latest::Instruction::<()>::ClearOrigin; 42];
|
||||
let expected_dispatch = xcm::latest::Xcm::<()>(xcm.clone());
|
||||
let expected_dispatch = xcm::latest::Xcm::<()>({
|
||||
let mut expected_instructions = xcm.clone();
|
||||
// dispatch prepends bridge pallet instance
|
||||
expected_instructions.insert(
|
||||
0,
|
||||
DescendOrigin(X1(PalletInstance(
|
||||
<pallet_bridge_messages::Pallet<Runtime, MPI> as PalletInfoAccess>::index()
|
||||
as u8,
|
||||
))),
|
||||
);
|
||||
expected_instructions
|
||||
});
|
||||
// generate bridged relay chain finality, parachain heads and message proofs,
|
||||
// to be submitted by relayer to this chain.
|
||||
let (
|
||||
|
||||
Reference in New Issue
Block a user