mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-16 23: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:
@@ -21,22 +21,27 @@
|
||||
|
||||
use super::*;
|
||||
|
||||
use frame_system::RawOrigin;
|
||||
use frame_benchmarking::{benchmarks, impl_benchmark_test_suite};
|
||||
use sp_core::OpaquePeerId;
|
||||
use sp_core::offchain::OpaqueMultiaddr;
|
||||
use sp_runtime::traits::{ValidateUnsigned, Zero};
|
||||
use sp_runtime::transaction_validity::TransactionSource;
|
||||
use frame_support::traits::UnfilteredDispatchable;
|
||||
use frame_system::RawOrigin;
|
||||
use sp_core::{offchain::OpaqueMultiaddr, OpaquePeerId};
|
||||
use sp_runtime::{
|
||||
traits::{ValidateUnsigned, Zero},
|
||||
transaction_validity::TransactionSource,
|
||||
};
|
||||
|
||||
use crate::Pallet as ImOnline;
|
||||
|
||||
const MAX_KEYS: u32 = 1000;
|
||||
const MAX_EXTERNAL_ADDRESSES: u32 = 100;
|
||||
|
||||
pub fn create_heartbeat<T: Config>(k: u32, e: u32) ->
|
||||
Result<(crate::Heartbeat<T::BlockNumber>, <T::AuthorityId as RuntimeAppPublic>::Signature), &'static str>
|
||||
{
|
||||
pub fn create_heartbeat<T: Config>(
|
||||
k: u32,
|
||||
e: u32,
|
||||
) -> Result<
|
||||
(crate::Heartbeat<T::BlockNumber>, <T::AuthorityId as RuntimeAppPublic>::Signature),
|
||||
&'static str,
|
||||
> {
|
||||
let mut keys = Vec::new();
|
||||
for _ in 0..k {
|
||||
keys.push(T::AuthorityId::generate_pair(None));
|
||||
@@ -51,12 +56,12 @@ pub fn create_heartbeat<T: Config>(k: u32, e: u32) ->
|
||||
block_number: T::BlockNumber::zero(),
|
||||
network_state,
|
||||
session_index: 0,
|
||||
authority_index: k-1,
|
||||
authority_index: k - 1,
|
||||
validators_len: keys.len() as u32,
|
||||
};
|
||||
|
||||
let encoded_heartbeat = input_heartbeat.encode();
|
||||
let authority_id = keys.get((k-1) as usize).ok_or("out of range")?;
|
||||
let authority_id = keys.get((k - 1) as usize).ok_or("out of range")?;
|
||||
let signature = authority_id.sign(&encoded_heartbeat).ok_or("couldn't make signature")?;
|
||||
|
||||
Ok((input_heartbeat, signature))
|
||||
@@ -91,9 +96,4 @@ benchmarks! {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
impl_benchmark_test_suite!(
|
||||
ImOnline,
|
||||
crate::mock::new_test_ext(),
|
||||
crate::mock::Runtime,
|
||||
);
|
||||
impl_benchmark_test_suite!(ImOnline, crate::mock::new_test_ext(), crate::mock::Runtime,);
|
||||
|
||||
Reference in New Issue
Block a user