Skip to content

Commit

Permalink
WIP: add empty migration and TODO (at least runtimes compile)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkontur committed Jul 17, 2024
1 parent 52d5cb6 commit cc9e609
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use crate::{
};
use bp_messages::{
source_chain::FromBridgedChainMessagesDeliveryProof,
target_chain::FromBridgedChainMessagesProof, LaneId,
target_chain::FromBridgedChainMessagesProof,
};
use bp_runtime::Chain;
use bridge_hub_common::xcm_version::XcmVersionOfDestAndRemoteBridge;
Expand Down Expand Up @@ -224,3 +224,59 @@ mod tests {
assert_eq!(BridgeRococoToRococoBulletinMessagesPalletInstance::get(), expected,);
}
}

// TODO:(bridges-v2) - migration from static to dynamic lanes - FAIL-CI
pub mod migration_for_bridges_v2 {
use super::*;

// /// A pair of sending chain location and message lane, used by this chain to send messages
// /// over the bridge.
// #[cfg_attr(feature = "std", derive(Debug, Eq, PartialEq))]
// pub struct SenderAndLane {
// /// Sending chain relative location.
// pub location: Location,
// /// Message lane, used by the sending chain.
// pub lane: LaneId,
// }
//
// impl SenderAndLane {
// /// Create new object using provided location and lane.
// pub fn new(location: Location, lane: LaneId) -> Self {
// SenderAndLane { location, lane }
// }
// }
//
// pub const XCM_LANE_FOR_ROCOCO_PEOPLE_TO_ROCOCO_BULLETIN: LaneId = LaneId([0, 0, 0, 0]);
//
// parameter_types! {
// pub RococoPeopleParaId: cumulus_primitives_core::ParaId = rococo_runtime_constants::system_parachain::PEOPLE_ID.into();
// // Lanes
// /// All active lanes that the current bridge supports.
// pub ActiveOutboundLanesToRococoBulletin: &'static [bp_messages::LaneId]
// = &[XCM_LANE_FOR_ROCOCO_PEOPLE_TO_ROCOCO_BULLETIN];
// /// Lane identifier, used to connect Rococo People and Rococo Bulletin chain.
// pub const RococoPeopleToRococoBulletinMessagesLane: bp_messages::LaneId
// = XCM_LANE_FOR_ROCOCO_PEOPLE_TO_ROCOCO_BULLETIN;
// /// Identifier of the sibling Rococo People parachain.
// /// A route (XCM location and bridge lane) that the Rococo People Chain -> Rococo Bulletin Chain
// /// message is following.
// pub FromRococoPeopleToRococoBulletinRoute: SenderAndLane = SenderAndLane::new(
// ParentThen(Parachain(RococoPeopleParaId::get().into()).into()).into(),
// XCM_LANE_FOR_ROCOCO_PEOPLE_TO_ROCOCO_BULLETIN,
// );
// /// All active routes and their destinations.
// pub ActiveLanes: alloc::vec::Vec<(SenderAndLane, (NetworkId, InteriorLocation))> = alloc::vec![
// (
// FromRococoPeopleToRococoBulletinRoute::get(),
// (RococoBulletinGlobalConsensusNetwork::get(), Here)
// )
// ];
// }

pub struct StaticToDynamicLanes;
impl frame_support::traits::OnRuntimeUpgrade for StaticToDynamicLanes {
fn on_runtime_upgrade() -> Weight {
todo!()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::{
};
use bp_messages::{
source_chain::FromBridgedChainMessagesDeliveryProof,
target_chain::FromBridgedChainMessagesProof, LaneId,
target_chain::FromBridgedChainMessagesProof,
};
use bp_runtime::Chain;
use bridge_hub_common::xcm_version::XcmVersionOfDestAndRemoteBridge;
Expand Down Expand Up @@ -274,3 +274,52 @@ mod tests {
assert_eq!(BridgeRococoToWestendMessagesPalletInstance::get(), expected,);
}
}

// TODO:(bridges-v2) - migration from static to dynamic lanes - FAIL-CI
pub mod migration_for_bridges_v2 {
use super::*;

// /// A pair of sending chain location and message lane, used by this chain to send messages
// /// over the bridge.
// #[cfg_attr(feature = "std", derive(Debug, Eq, PartialEq))]
// pub struct SenderAndLane {
// /// Sending chain relative location.
// pub location: Location,
// /// Message lane, used by the sending chain.
// pub lane: LaneId,
// }
//
// impl SenderAndLane {
// /// Create new object using provided location and lane.
// pub fn new(location: Location, lane: LaneId) -> Self {
// SenderAndLane { location, lane }
// }
// }
//
// pub const XCM_LANE_FOR_ASSET_HUB_ROCOCO_TO_ASSET_HUB_WESTEND: LaneId = LaneId([0, 0, 0, 2]);
// parameter_types! {
// pub AssetHubRococoParaId: cumulus_primitives_core::ParaId = bp_asset_hub_rococo::ASSET_HUB_ROCOCO_PARACHAIN_ID.into();
// pub AssetHubWestendParaId: cumulus_primitives_core::ParaId = bp_asset_hub_westend::ASSET_HUB_WESTEND_PARACHAIN_ID.into();
//
// // Lanes
// pub ActiveOutboundLanesToBridgeHubWestend: &'static [bp_messages::LaneId] = &[XCM_LANE_FOR_ASSET_HUB_ROCOCO_TO_ASSET_HUB_WESTEND];
// pub const AssetHubRococoToAssetHubWestendMessagesLane: bp_messages::LaneId = XCM_LANE_FOR_ASSET_HUB_ROCOCO_TO_ASSET_HUB_WESTEND;
// pub FromAssetHubRococoToAssetHubWestendRoute: SenderAndLane = SenderAndLane::new(
// ParentThen([Parachain(AssetHubRococoParaId::get().into())].into()).into(),
// XCM_LANE_FOR_ASSET_HUB_ROCOCO_TO_ASSET_HUB_WESTEND,
// );
// pub ActiveLanes: alloc::vec::Vec<(SenderAndLane, (NetworkId, InteriorLocation))> = alloc::vec![
// (
// FromAssetHubRococoToAssetHubWestendRoute::get(),
// (WestendGlobalConsensusNetwork::get(), [Parachain(AssetHubWestendParaId::get().into())].into())
// )
// ];
// }

pub struct StaticToDynamicLanes;
impl frame_support::traits::OnRuntimeUpgrade for StaticToDynamicLanes {
fn on_runtime_upgrade() -> Weight {
todo!()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ pub type Migrations = (
ConstU32<BRIDGE_HUB_ID>,
ConstU32<ASSET_HUB_ID>,
>,
bridge_to_westend_config::migration_for_bridges_v2::StaticToDynamicLanes,
bridge_to_bulletin_config::migration_for_bridges_v2::StaticToDynamicLanes,
// permanent
pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::{
};
use bp_messages::{
source_chain::FromBridgedChainMessagesDeliveryProof,
target_chain::FromBridgedChainMessagesProof, LaneId,
target_chain::FromBridgedChainMessagesProof,
};
use bp_parachains::SingleParaStoredHeaderDataBuilder;
use bp_runtime::Chain;
Expand Down Expand Up @@ -304,3 +304,52 @@ mod tests {
);
}
}

// TODO:(bridges-v2) - migration from static to dynamic lanes - FAIL-CI
pub mod migration_for_bridges_v2 {
use super::*;

// /// A pair of sending chain location and message lane, used by this chain to send messages
// /// over the bridge.
// #[cfg_attr(feature = "std", derive(Debug, Eq, PartialEq))]
// pub struct SenderAndLane {
// /// Sending chain relative location.
// pub location: Location,
// /// Message lane, used by the sending chain.
// pub lane: LaneId,
// }
//
// impl SenderAndLane {
// /// Create new object using provided location and lane.
// pub fn new(location: Location, lane: LaneId) -> Self {
// SenderAndLane { location, lane }
// }
// }
//
// pub const XCM_LANE_FOR_ASSET_HUB_WESTEND_TO_ASSET_HUB_ROCOCO: LaneId = LaneId([0, 0, 0, 2]);
// parameter_types! {
// 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([Parachain(AssetHubWestendParaId::get().into())].into()).into(),
// XCM_LANE_FOR_ASSET_HUB_WESTEND_TO_ASSET_HUB_ROCOCO,
// );
// pub ActiveLanes: alloc::vec::Vec<(SenderAndLane, (NetworkId, InteriorLocation))> = alloc::vec![
// (
// FromAssetHubWestendToAssetHubRococoRoute::get(),
// (RococoGlobalConsensusNetwork::get(), [Parachain(AssetHubRococoParaId::get().into())].into())
// )
// ];
// }

pub struct StaticToDynamicLanes;
impl frame_support::traits::OnRuntimeUpgrade for StaticToDynamicLanes {
fn on_runtime_upgrade() -> Weight {
todo!()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ pub type Migrations = (
// unreleased
cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4<Runtime>,
cumulus_pallet_xcmp_queue::migration::v5::MigrateV4ToV5<Runtime>,
bridge_to_rococo_config::migration_for_bridges_v2::StaticToDynamicLanes,
// permanent
pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,
);
Expand Down

0 comments on commit cc9e609

Please sign in to comment.