mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 15:41:02 +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:
@@ -25,12 +25,11 @@ extern crate alloc;
|
||||
#[cfg(feature = "std")]
|
||||
use serde::Serialize;
|
||||
|
||||
use codec::{Encode, Decode, Input, Codec};
|
||||
use sp_runtime::{ConsensusEngineId, RuntimeDebug, traits::NumberFor};
|
||||
use sp_std::borrow::Cow;
|
||||
use sp_std::vec::Vec;
|
||||
use codec::{Codec, Decode, Encode, Input};
|
||||
#[cfg(feature = "std")]
|
||||
use sp_keystore::{SyncCryptoStorePtr, SyncCryptoStore};
|
||||
use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr};
|
||||
use sp_runtime::{traits::NumberFor, ConsensusEngineId, RuntimeDebug};
|
||||
use sp_std::{borrow::Cow, vec::Vec};
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use log::debug;
|
||||
@@ -39,7 +38,7 @@ use log::debug;
|
||||
pub const KEY_TYPE: sp_core::crypto::KeyTypeId = sp_application_crypto::key_types::GRANDPA;
|
||||
|
||||
mod app {
|
||||
use sp_application_crypto::{app_crypto, key_types::GRANDPA, ed25519};
|
||||
use sp_application_crypto::{app_crypto, ed25519, key_types::GRANDPA};
|
||||
app_crypto!(ed25519, GRANDPA);
|
||||
}
|
||||
|
||||
@@ -181,10 +180,7 @@ impl<H, N> EquivocationProof<H, N> {
|
||||
/// Create a new `EquivocationProof` for the given set id and using the
|
||||
/// given equivocation as proof.
|
||||
pub fn new(set_id: SetId, equivocation: Equivocation<H, N>) -> Self {
|
||||
EquivocationProof {
|
||||
set_id,
|
||||
equivocation,
|
||||
}
|
||||
EquivocationProof { set_id, equivocation }
|
||||
}
|
||||
|
||||
/// Returns the set id at which the equivocation occurred.
|
||||
@@ -277,7 +273,7 @@ where
|
||||
if $equivocation.first.0.target_hash == $equivocation.second.0.target_hash &&
|
||||
$equivocation.first.0.target_number == $equivocation.second.0.target_number
|
||||
{
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
|
||||
// check signatures on both votes are valid
|
||||
@@ -297,17 +293,17 @@ where
|
||||
report.set_id,
|
||||
);
|
||||
|
||||
return valid_first && valid_second;
|
||||
return valid_first && valid_second
|
||||
};
|
||||
}
|
||||
|
||||
match report.equivocation {
|
||||
Equivocation::Prevote(equivocation) => {
|
||||
check!(equivocation, grandpa::Message::Prevote);
|
||||
}
|
||||
},
|
||||
Equivocation::Precommit(equivocation) => {
|
||||
check!(equivocation, grandpa::Message::Precommit);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,8 +386,8 @@ where
|
||||
H: Encode,
|
||||
N: Encode,
|
||||
{
|
||||
use sp_core::crypto::Public;
|
||||
use sp_application_crypto::AppKey;
|
||||
use sp_core::crypto::Public;
|
||||
use sp_std::convert::TryInto;
|
||||
|
||||
let encoded = localized_payload(round, set_id, &message);
|
||||
@@ -400,13 +396,13 @@ where
|
||||
AuthorityId::ID,
|
||||
&public.to_public_crypto_pair(),
|
||||
&encoded[..],
|
||||
).ok().flatten()?.try_into().ok()?;
|
||||
)
|
||||
.ok()
|
||||
.flatten()?
|
||||
.try_into()
|
||||
.ok()?;
|
||||
|
||||
Some(grandpa::SignedMessage {
|
||||
message,
|
||||
signature,
|
||||
id: public,
|
||||
})
|
||||
Some(grandpa::SignedMessage { message, signature, id: public })
|
||||
}
|
||||
|
||||
/// WASM function call to check for pending changes.
|
||||
@@ -457,7 +453,7 @@ impl<'a> Decode for VersionedAuthorityList<'a> {
|
||||
fn decode<I: Input>(value: &mut I) -> Result<Self, codec::Error> {
|
||||
let (version, authorities): (u8, AuthorityList) = Decode::decode(value)?;
|
||||
if version != AUTHORITIES_VERSION {
|
||||
return Err("unknown Grandpa authorities version".into());
|
||||
return Err("unknown Grandpa authorities version".into())
|
||||
}
|
||||
Ok(authorities.into())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user