From 86bb5cb5068463f006fda3a4ac4236686c989b86 Mon Sep 17 00:00:00 2001
From: Ron <yrong1997@gmail.com>
Date: Fri, 20 Sep 2024 14:45:48 +0800
Subject: [PATCH] Add Snowbridge initialize migration on Westend (#5747)

# Description

Fix https://github.com/paritytech/polkadot-sdk/pull/5074 which missed
the runtime migration to initialize channels of the bridge.

---------

Co-authored-by: Adrian Catangiu <adrian@parity.io>
---
 Cargo.lock                                          |  2 +-
 .../bridge-hubs/bridge-hub-westend/Cargo.toml       |  2 +-
 .../bridge-hubs/bridge-hub-westend/src/lib.rs       |  9 ++++++++-
 prdoc/pr_5747.prdoc                                 | 13 +++++++++++++
 4 files changed, 23 insertions(+), 3 deletions(-)
 create mode 100644 prdoc/pr_5747.prdoc

diff --git a/Cargo.lock b/Cargo.lock
index 5e85570055b..7b3e54ff1fc 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2419,7 +2419,7 @@ dependencies = [
 
 [[package]]
 name = "bridge-hub-westend-runtime"
-version = "0.2.0"
+version = "0.3.0"
 dependencies = [
  "bp-asset-hub-rococo",
  "bp-asset-hub-westend",
diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml
index 67d4eff0f7f..e0ad1acc047 100644
--- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml
+++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "bridge-hub-westend-runtime"
-version = "0.2.0"
+version = "0.3.0"
 authors.workspace = true
 edition.workspace = true
 description = "Westend's BridgeHub parachain runtime"
diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs
index ddd40dbf60e..bdac664ee43 100644
--- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs
+++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs
@@ -100,6 +100,8 @@ use snowbridge_core::{
 use testnet_parachains_constants::westend::{consensus::*, currency::*, fee::WeightToFee, time::*};
 use xcm::VersionedLocation;
 
+use westend_runtime_constants::system_parachain::{ASSET_HUB_ID, BRIDGE_HUB_ID};
+
 /// The address format for describing accounts.
 pub type Address = MultiAddress<AccountId, ()>;
 
@@ -152,6 +154,11 @@ pub type Migrations = (
 	>,
 	// permanent
 	pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,
+	snowbridge_pallet_system::migration::v0::InitializeOnUpgrade<
+		Runtime,
+		ConstU32<BRIDGE_HUB_ID>,
+		ConstU32<ASSET_HUB_ID>,
+	>,
 );
 
 parameter_types! {
@@ -209,7 +216,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
 	spec_name: create_runtime_str!("bridge-hub-westend"),
 	impl_name: create_runtime_str!("bridge-hub-westend"),
 	authoring_version: 1,
-	spec_version: 1_016_000,
+	spec_version: 1_016_001,
 	impl_version: 0,
 	apis: RUNTIME_API_VERSIONS,
 	transaction_version: 5,
diff --git a/prdoc/pr_5747.prdoc b/prdoc/pr_5747.prdoc
new file mode 100644
index 00000000000..ee786db658c
--- /dev/null
+++ b/prdoc/pr_5747.prdoc
@@ -0,0 +1,13 @@
+title: "Snowbridge runtime migration on Westend"
+
+doc:
+  - audience: Runtime Dev
+    description: |
+      This is a backport for https://github.com/paritytech/polkadot-sdk/pull/5074 which missed 
+      the runtime migration to initialize channels of the bridge.
+
+crates:
+  - name: bridge-hub-westend-runtime
+    bump: patch
+  
+
-- 
GitLab