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:
@@ -5,7 +5,7 @@
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
@@ -19,7 +19,7 @@
|
||||
//! implementation of the `verify` subcommand
|
||||
|
||||
use crate::{error, utils, with_crypto_scheme, CryptoSchemeFlag};
|
||||
use sp_core::{Public, crypto::Ss58Codec};
|
||||
use sp_core::{crypto::Ss58Codec, Public};
|
||||
use structopt::StructOpt;
|
||||
|
||||
/// The `verify` command
|
||||
@@ -57,32 +57,23 @@ impl VerifyCmd {
|
||||
let message = utils::read_message(self.message.as_ref(), self.hex)?;
|
||||
let sig_data = utils::decode_hex(&self.sig)?;
|
||||
let uri = utils::read_uri(self.uri.as_ref())?;
|
||||
let uri = if uri.starts_with("0x") {
|
||||
&uri[2..]
|
||||
} else {
|
||||
&uri
|
||||
};
|
||||
let uri = if uri.starts_with("0x") { &uri[2..] } else { &uri };
|
||||
|
||||
with_crypto_scheme!(
|
||||
self.crypto_scheme.scheme,
|
||||
verify(sig_data, message, uri)
|
||||
)
|
||||
with_crypto_scheme!(self.crypto_scheme.scheme, verify(sig_data, message, uri))
|
||||
}
|
||||
}
|
||||
|
||||
fn verify<Pair>(sig_data: Vec<u8>, message: Vec<u8>, uri: &str) -> error::Result<()>
|
||||
where
|
||||
Pair: sp_core::Pair,
|
||||
Pair::Signature: Default + AsMut<[u8]>,
|
||||
where
|
||||
Pair: sp_core::Pair,
|
||||
Pair::Signature: Default + AsMut<[u8]>,
|
||||
{
|
||||
let mut signature = Pair::Signature::default();
|
||||
if sig_data.len() != signature.as_ref().len() {
|
||||
return Err(
|
||||
error::Error::SignatureInvalidLength {
|
||||
read: sig_data.len(),
|
||||
expected: signature.as_ref().len(),
|
||||
}
|
||||
);
|
||||
return Err(error::Error::SignatureInvalidLength {
|
||||
read: sig_data.len(),
|
||||
expected: signature.as_ref().len(),
|
||||
})
|
||||
}
|
||||
signature.as_mut().copy_from_slice(&sig_data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user