From ececb4cbd68d94d1f73b6ab8e5ad8afed1cc9456 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?D=C3=B3nal=20Murray?= <donal.murray@parity.io>
Date: Wed, 19 Feb 2025 23:48:44 +0000
Subject: [PATCH] Add sudo pallet to coretime-westend (#6960)

Add the sudo pallet to coretime-westend, allowing use in
development/testing. Previously the coretime-rococo runtime was used in
situations like this, but since Rococo is now gone this can be used
instead.

No sudo key is added to Westend storage with this PR, since it's likely
that any updates will continue to be done over XCM. If this is something
that is wanted the key can be set via XCM.

---------

Co-authored-by: command-bot <>
Co-authored-by: Maksym H <1177472+mordamax@users.noreply.github.com>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
---
 Cargo.lock                                               | 1 +
 .../runtimes/coretime/coretime-westend/Cargo.toml        | 4 ++++
 .../runtimes/coretime/coretime-westend/src/lib.rs        | 9 +++++++++
 prdoc/pr_6960.prdoc                                      | 9 +++++++++
 4 files changed, 23 insertions(+)
 create mode 100644 prdoc/pr_6960.prdoc

diff --git a/Cargo.lock b/Cargo.lock
index 1449652b434..3d93e94b4b2 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4249,6 +4249,7 @@ dependencies = [
  "pallet-multisig 28.0.0",
  "pallet-proxy 28.0.0",
  "pallet-session 28.0.0",
+ "pallet-sudo 28.0.0",
  "pallet-timestamp 27.0.0",
  "pallet-transaction-payment 28.0.0",
  "pallet-transaction-payment-rpc-runtime-api 28.0.0",
diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml b/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml
index b0a54b7d620..f00009d712b 100644
--- a/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml
+++ b/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml
@@ -39,6 +39,7 @@ pallet-message-queue = { workspace = true }
 pallet-multisig = { workspace = true }
 pallet-proxy = { workspace = true }
 pallet-session = { workspace = true }
+pallet-sudo = { workspace = true }
 pallet-timestamp = { workspace = true }
 pallet-transaction-payment = { workspace = true }
 pallet-transaction-payment-rpc-runtime-api = { workspace = true }
@@ -118,6 +119,7 @@ std = [
 	"pallet-multisig/std",
 	"pallet-proxy/std",
 	"pallet-session/std",
+	"pallet-sudo/std",
 	"pallet-timestamp/std",
 	"pallet-transaction-payment-rpc-runtime-api/std",
 	"pallet-transaction-payment/std",
@@ -170,6 +172,7 @@ runtime-benchmarks = [
 	"pallet-message-queue/runtime-benchmarks",
 	"pallet-multisig/runtime-benchmarks",
 	"pallet-proxy/runtime-benchmarks",
+	"pallet-sudo/runtime-benchmarks",
 	"pallet-timestamp/runtime-benchmarks",
 	"pallet-transaction-payment/runtime-benchmarks",
 	"pallet-utility/runtime-benchmarks",
@@ -204,6 +207,7 @@ try-runtime = [
 	"pallet-multisig/try-runtime",
 	"pallet-proxy/try-runtime",
 	"pallet-session/try-runtime",
+	"pallet-sudo/try-runtime",
 	"pallet-timestamp/try-runtime",
 	"pallet-transaction-payment/try-runtime",
 	"pallet-utility/try-runtime",
diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs
index 72e6ea893a3..2794e7a902b 100644
--- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs
+++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs
@@ -603,6 +603,12 @@ impl pallet_utility::Config for Runtime {
 	type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>;
 }
 
+impl pallet_sudo::Config for Runtime {
+	type RuntimeCall = RuntimeCall;
+	type RuntimeEvent = RuntimeEvent;
+	type WeightInfo = pallet_sudo::weights::SubstrateWeight<Runtime>;
+}
+
 pub struct BrokerMigrationV4BlockConversion;
 
 impl pallet_broker::migration::v4::BlockToRelayHeightConversion<Runtime>
@@ -657,6 +663,9 @@ construct_runtime!(
 
 		// The main stage.
 		Broker: pallet_broker = 50,
+
+		// Sudo
+		Sudo: pallet_sudo = 100,
 	}
 );
 
diff --git a/prdoc/pr_6960.prdoc b/prdoc/pr_6960.prdoc
new file mode 100644
index 00000000000..3cef34ce00d
--- /dev/null
+++ b/prdoc/pr_6960.prdoc
@@ -0,0 +1,9 @@
+title: Add sudo pallet to coretime-westend
+doc:
+- audience: Runtime Dev
+  description: Add the sudo pallet to coretime-westend, allowing use in development/testing.
+    Previously the coretime-rococo runtime was used in situations like this, but since
+    Rococo is now gone this can be used instead.
+crates:
+- name: coretime-westend-runtime
+  bump: major
-- 
GitLab