Subkey should not import the entire world. (#7845)

There is no reason for subkey to import the default Substrate node to
support a feature that would only be usable for the Substrate node.
Subkey itself should be more the default key management binary for
Substrate related chains. If certain chains require some special
functionality, they can easily stick together their own "my-chain-key".
This commit is contained in:
Bastian Köcher
2021-01-07 13:14:42 +01:00
committed by GitHub
parent 8cdb5c01b6
commit 94bb119ef9
4 changed files with 10 additions and 37 deletions
+9 -21
View File
@@ -21,8 +21,6 @@ use sc_cli::{
Error, VanityCmd, SignCmd, VerifyCmd, GenerateNodeKeyCmd, GenerateCmd, InspectKeyCmd,
InspectNodeKeyCmd
};
use substrate_frame_cli::ModuleIdCmd;
use sp_core::crypto::Ss58Codec;
#[derive(Debug, StructOpt)]
#[structopt(
@@ -44,9 +42,6 @@ pub enum Subkey {
/// Print the peer ID corresponding to the node key in the given file
InspectNodeKey(InspectNodeKeyCmd),
/// Inspect a module ID address
ModuleId(ModuleIdCmd),
/// Sign a message, with a given (secret) key.
Sign(SignCmd),
@@ -58,21 +53,14 @@ pub enum Subkey {
}
/// Run the subkey command, given the apropriate runtime.
pub fn run<R>() -> Result<(), Error>
where
R: frame_system::Config,
R::AccountId: Ss58Codec
{
pub fn run() -> Result<(), Error> {
match Subkey::from_args() {
Subkey::GenerateNodeKey(cmd) => cmd.run()?,
Subkey::Generate(cmd) => cmd.run()?,
Subkey::Inspect(cmd) => cmd.run()?,
Subkey::InspectNodeKey(cmd) => cmd.run()?,
Subkey::ModuleId(cmd) => cmd.run::<R>()?,
Subkey::Vanity(cmd) => cmd.run()?,
Subkey::Verify(cmd) => cmd.run()?,
Subkey::Sign(cmd) => cmd.run()?,
};
Ok(())
Subkey::GenerateNodeKey(cmd) => cmd.run(),
Subkey::Generate(cmd) => cmd.run(),
Subkey::Inspect(cmd) => cmd.run(),
Subkey::InspectNodeKey(cmd) => cmd.run(),
Subkey::Vanity(cmd) => cmd.run(),
Subkey::Verify(cmd) => cmd.run(),
Subkey::Sign(cmd) => cmd.run(),
}
}
+1 -3
View File
@@ -18,8 +18,6 @@
//! Subkey utility, based on node_runtime.
use node_runtime::Runtime;
fn main() -> Result<(), sc_cli::Error> {
subkey::run::<Runtime>()
subkey::run()
}