mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 05:47:58 +00:00
Run cargo fmt on the whole code base (#9394)
* Run cargo fmt on the whole code base * Second run * Add CI check * Fix compilation * More unnecessary braces * Handle weights * Use --all * Use correct attributes... * Fix UI tests * AHHHHHHHHH * 🤦 * Docs * Fix compilation * 🤷 * Please stop * 🤦 x 2 * More * make rustfmt.toml consistent with polkadot Co-authored-by: André Silva <andrerfosilva@gmail.com>
This commit is contained in:
@@ -18,9 +18,8 @@
|
||||
//! Implementation of the `inspect-node-key` subcommand
|
||||
|
||||
use crate::{Error, NetworkSchemeFlag};
|
||||
use std::fs;
|
||||
use libp2p::identity::{PublicKey, ed25519};
|
||||
use std::path::PathBuf;
|
||||
use libp2p::identity::{ed25519, PublicKey};
|
||||
use std::{fs, path::PathBuf};
|
||||
use structopt::StructOpt;
|
||||
|
||||
/// The `inspect-node-key` command
|
||||
@@ -42,10 +41,10 @@ pub struct InspectNodeKeyCmd {
|
||||
impl InspectNodeKeyCmd {
|
||||
/// runs the command
|
||||
pub fn run(&self) -> Result<(), Error> {
|
||||
let mut file_content = hex::decode(fs::read(&self.file)?)
|
||||
.map_err(|_| "failed to decode secret as hex")?;
|
||||
let secret = ed25519::SecretKey::from_bytes(&mut file_content)
|
||||
.map_err(|_| "Bad node key file")?;
|
||||
let mut file_content =
|
||||
hex::decode(fs::read(&self.file)?).map_err(|_| "failed to decode secret as hex")?;
|
||||
let secret =
|
||||
ed25519::SecretKey::from_bytes(&mut file_content).map_err(|_| "Bad node key file")?;
|
||||
|
||||
let keypair = ed25519::Keypair::from(secret);
|
||||
let peer_id = PublicKey::Ed25519(keypair.public()).into_peer_id();
|
||||
@@ -58,8 +57,7 @@ impl InspectNodeKeyCmd {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use super::super::GenerateNodeKeyCmd;
|
||||
use super::{super::GenerateNodeKeyCmd, *};
|
||||
|
||||
#[test]
|
||||
fn inspect_node_key() {
|
||||
|
||||
Reference in New Issue
Block a user