From 0fcbd4e990433b33393e551b26d7b20e382db4c0 Mon Sep 17 00:00:00 2001
From: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Date: Mon, 13 May 2024 10:24:29 +0200
Subject: [PATCH] Remove `substrate-frame-cli` (#4403)

Library `substrate-frame-cli` seems unused.

Last non-dependabot update to the folder was over [two years
ago](https://github.com/paritytech/polkadot-sdk/commits/master/substrate/utils/frame/frame-utilities-cli).

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
---
 Cargo.lock                                    | 13 ---
 Cargo.toml                                    |  1 -
 substrate/bin/node/cli/Cargo.toml             |  2 -
 .../frame/frame-utilities-cli/Cargo.toml      | 25 ------
 .../utils/frame/frame-utilities-cli/README.md |  3 -
 .../frame/frame-utilities-cli/src/lib.rs      | 22 -----
 .../frame-utilities-cli/src/pallet_id.rs      | 88 -------------------
 7 files changed, 154 deletions(-)
 delete mode 100644 substrate/utils/frame/frame-utilities-cli/Cargo.toml
 delete mode 100644 substrate/utils/frame/frame-utilities-cli/README.md
 delete mode 100644 substrate/utils/frame/frame-utilities-cli/src/lib.rs
 delete mode 100644 substrate/utils/frame/frame-utilities-cli/src/pallet_id.rs

diff --git a/Cargo.lock b/Cargo.lock
index d43088704b5..5d5fcb00803 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -20198,7 +20198,6 @@ dependencies = [
  "staging-node-inspect",
  "substrate-build-script-utils",
  "substrate-cli-test-utils",
- "substrate-frame-cli",
  "substrate-rpc-client",
  "tempfile",
  "tokio",
@@ -20526,18 +20525,6 @@ dependencies = [
  "tokio",
 ]
 
-[[package]]
-name = "substrate-frame-cli"
-version = "32.0.0"
-dependencies = [
- "clap 4.5.3",
- "frame-support",
- "frame-system",
- "sc-cli",
- "sp-core",
- "sp-runtime",
-]
-
 [[package]]
 name = "substrate-frame-rpc-support"
 version = "29.0.0"
diff --git a/Cargo.toml b/Cargo.toml
index 1d3f3d8e9ec..1440c2d497d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -500,7 +500,6 @@ members = [
 	"substrate/utils/build-script-utils",
 	"substrate/utils/fork-tree",
 	"substrate/utils/frame/benchmarking-cli",
-	"substrate/utils/frame/frame-utilities-cli",
 	"substrate/utils/frame/generate-bags",
 	"substrate/utils/frame/generate-bags/node-runtime",
 	"substrate/utils/frame/omni-bencher",
diff --git a/substrate/bin/node/cli/Cargo.toml b/substrate/bin/node/cli/Cargo.toml
index 050004acc78..323afa56696 100644
--- a/substrate/bin/node/cli/Cargo.toml
+++ b/substrate/bin/node/cli/Cargo.toml
@@ -170,7 +170,6 @@ clap_complete = { version = "4.0.2", optional = true }
 node-inspect = { package = "staging-node-inspect", path = "../inspect", optional = true }
 frame-benchmarking-cli = { path = "../../../utils/frame/benchmarking-cli", optional = true }
 substrate-build-script-utils = { path = "../../../utils/build-script-utils", optional = true }
-substrate-frame-cli = { path = "../../../utils/frame/frame-utilities-cli", optional = true }
 sc-cli = { path = "../../../client/cli", optional = true }
 pallet-balances = { path = "../../../frame/balances" }
 sc-storage-monitor = { path = "../../../client/storage-monitor" }
@@ -185,7 +184,6 @@ cli = [
 	"sc-cli",
 	"sc-service/rocksdb",
 	"substrate-build-script-utils",
-	"substrate-frame-cli",
 ]
 runtime-benchmarks = [
 	"frame-benchmarking-cli/runtime-benchmarks",
diff --git a/substrate/utils/frame/frame-utilities-cli/Cargo.toml b/substrate/utils/frame/frame-utilities-cli/Cargo.toml
deleted file mode 100644
index 3952c9fd219..00000000000
--- a/substrate/utils/frame/frame-utilities-cli/Cargo.toml
+++ /dev/null
@@ -1,25 +0,0 @@
-[package]
-name = "substrate-frame-cli"
-version = "32.0.0"
-authors.workspace = true
-edition.workspace = true
-license = "Apache-2.0"
-homepage = "https://substrate.io"
-repository.workspace = true
-description = "cli interface for FRAME"
-documentation = "https://docs.rs/substrate-frame-cli"
-readme = "README.md"
-
-[lints]
-workspace = true
-
-[dependencies]
-clap = { version = "4.5.3", features = ["derive"] }
-frame-support = { path = "../../../frame/support" }
-frame-system = { path = "../../../frame/system" }
-sc-cli = { path = "../../../client/cli" }
-sp-core = { path = "../../../primitives/core" }
-sp-runtime = { path = "../../../primitives/runtime" }
-
-[features]
-default = []
diff --git a/substrate/utils/frame/frame-utilities-cli/README.md b/substrate/utils/frame/frame-utilities-cli/README.md
deleted file mode 100644
index 54467a3ad77..00000000000
--- a/substrate/utils/frame/frame-utilities-cli/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-frame-system CLI utilities
-
-License: Apache-2.0
diff --git a/substrate/utils/frame/frame-utilities-cli/src/lib.rs b/substrate/utils/frame/frame-utilities-cli/src/lib.rs
deleted file mode 100644
index 97129e36f7e..00000000000
--- a/substrate/utils/frame/frame-utilities-cli/src/lib.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-// This file is part of Substrate.
-
-// Copyright (C) Parity Technologies (UK) Ltd.
-// SPDX-License-Identifier: Apache-2.0
-
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// 	http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//! frame-system CLI utilities
-
-mod pallet_id;
-
-pub use pallet_id::PalletIdCmd;
diff --git a/substrate/utils/frame/frame-utilities-cli/src/pallet_id.rs b/substrate/utils/frame/frame-utilities-cli/src/pallet_id.rs
deleted file mode 100644
index abc0cdb3ff5..00000000000
--- a/substrate/utils/frame/frame-utilities-cli/src/pallet_id.rs
+++ /dev/null
@@ -1,88 +0,0 @@
-// This file is part of Substrate.
-
-// Copyright (C) Parity Technologies (UK) Ltd.
-// SPDX-License-Identifier: Apache-2.0
-
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// 	http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//! Implementation of the `palletid` subcommand
-
-use clap::Parser;
-use frame_support::PalletId;
-use sc_cli::{
-	utils::print_from_uri, with_crypto_scheme, CryptoSchemeFlag, Error, KeystoreParams,
-	OutputTypeFlag,
-};
-use sp_core::crypto::{unwrap_or_default_ss58_version, Ss58AddressFormat, Ss58Codec};
-use sp_runtime::traits::AccountIdConversion;
-
-/// The `palletid` command
-#[derive(Debug, Parser)]
-#[command(name = "palletid", about = "Inspect a module ID address")]
-pub struct PalletIdCmd {
-	/// The module ID used to derive the account
-	id: String,
-
-	/// network address format
-	#[arg(
-		long,
-		value_name = "NETWORK",
-		value_parser = sc_cli::parse_ss58_address_format,
-		ignore_case = true,
-	)]
-	pub network: Option<Ss58AddressFormat>,
-
-	#[allow(missing_docs)]
-	#[command(flatten)]
-	pub output_scheme: OutputTypeFlag,
-
-	#[allow(missing_docs)]
-	#[command(flatten)]
-	pub crypto_scheme: CryptoSchemeFlag,
-
-	#[allow(missing_docs)]
-	#[command(flatten)]
-	pub keystore_params: KeystoreParams,
-}
-
-impl PalletIdCmd {
-	/// runs the command
-	pub fn run<R>(&self) -> Result<(), Error>
-	where
-		R: frame_system::Config,
-		R::AccountId: Ss58Codec,
-	{
-		if self.id.len() != 8 {
-			return Err("a module id must be a string of 8 characters".into())
-		}
-		let password = self.keystore_params.read_password()?;
-
-		let id_fixed_array: [u8; 8] = self.id.as_bytes().try_into().map_err(|_| {
-			"Cannot convert argument to palletid: argument should be 8-character string"
-		})?;
-
-		let account_id: R::AccountId = PalletId(id_fixed_array).into_account_truncating();
-
-		with_crypto_scheme!(
-			self.crypto_scheme.scheme,
-			print_from_uri(
-				&account_id.to_ss58check_with_version(unwrap_or_default_ss58_version(self.network)),
-				password,
-				self.network,
-				self.output_scheme.output_type
-			)
-		);
-
-		Ok(())
-	}
-}
-- 
GitLab