From ad9d342eba98c2a8769267b68f196acb0e80af14 Mon Sep 17 00:00:00 2001 From: dharjeezy Date: Wed, 25 Dec 2024 15:40:10 +0100 Subject: [PATCH] fmt --- .../parachain/client/src/benchmarking.rs | 32 +++++++------------ .../clients/parachain/client/src/weights.rs | 19 ++++++----- 2 files changed, 20 insertions(+), 31 deletions(-) diff --git a/modules/ismp/clients/parachain/client/src/benchmarking.rs b/modules/ismp/clients/parachain/client/src/benchmarking.rs index 85b984b5..ec2cfc42 100644 --- a/modules/ismp/clients/parachain/client/src/benchmarking.rs +++ b/modules/ismp/clients/parachain/client/src/benchmarking.rs @@ -21,12 +21,11 @@ use frame_system::RawOrigin; #[benchmarks] mod benchmarks { - use cumulus_primitives_core::PersistedValidationData; - use cumulus_primitives_core::relay_chain::HeadData; - use primitive_types::H256; - use sp_trie::StorageProof; use super::*; + use cumulus_primitives_core::{relay_chain::HeadData, PersistedValidationData}; use ismp::messaging::{ConsensusMessage, Message}; + use primitive_types::H256; + use sp_trie::StorageProof; /// Benchmark for add_parachain extrinsic /// The benchmark creates n parachains and measures the time to add them @@ -36,14 +35,8 @@ mod benchmarks { /// - `n`: Number of parachains to add in a single call #[benchmark] fn add_parachain(n: Linear<1, 100>) -> Result<(), BenchmarkError> { - let parachains: Vec = (0..n) - .map(|i| { - ParachainData { - id: i, - slot_duration: 6000u64, - } - }) - .collect(); + let parachains: Vec = + (0..n).map(|i| ParachainData { id: i, slot_duration: 6000u64 }).collect(); #[block] { @@ -61,14 +54,8 @@ mod benchmarks { /// - `n`: Number of parachains to remove in a single call #[benchmark] fn remove_parachain(n: Linear<1, 100>) -> Result<(), BenchmarkError> { - let parachains: Vec = (0..n) - .map(|i| { - ParachainData { - id: i, - slot_duration: 6000u64, - } - }) - .collect(); + let parachains: Vec = + (0..n).map(|i| ParachainData { id: i, slot_duration: 6000u64 }).collect(); #[block] { @@ -98,7 +85,10 @@ mod benchmarks { parent_head, relay_parent_number: 4412290, max_pov_size: 5242880, - relay_parent_storage_root: H256::from_slice(&hex::decode("70af557e788862e2cb91eb6a79e828e8b067ab02082ef72e1dcec55972111f7e").expect("Invalid root")), + relay_parent_storage_root: H256::from_slice( + &hex::decode("70af557e788862e2cb91eb6a79e828e8b067ab02082ef72e1dcec55972111f7e") + .expect("Invalid root"), + ), }; cumulus_pallet_parachain_system::ValidationData::::put(validation_data); diff --git a/modules/ismp/clients/parachain/client/src/weights.rs b/modules/ismp/clients/parachain/client/src/weights.rs index 16d1cf4c..f5f7d3d8 100644 --- a/modules/ismp/clients/parachain/client/src/weights.rs +++ b/modules/ismp/clients/parachain/client/src/weights.rs @@ -16,13 +16,12 @@ use frame_support::weights::Weight; /// The weight information provider trait for dispatchable extrinsics pub trait WeightInfo { - /// Weight for adding parachains, scaled by the number of machines - /// * n: The number of parachains being added - fn add_parachain(n: u32) -> Weight; - /// Weight for removing parachains, scaled by the number of machines - /// * n: The number of parachains being removed - fn remove_parachain(n: u32) -> Weight; - /// Weight for updating a parachain's consensus - fn update_parachain_consensus() -> Weight; - -} \ No newline at end of file + /// Weight for adding parachains, scaled by the number of machines + /// * n: The number of parachains being added + fn add_parachain(n: u32) -> Weight; + /// Weight for removing parachains, scaled by the number of machines + /// * n: The number of parachains being removed + fn remove_parachain(n: u32) -> Weight; + /// Weight for updating a parachain's consensus + fn update_parachain_consensus() -> Weight; +}