Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
dharjeezy committed Dec 25, 2024
1 parent 213fcd1 commit ad9d342
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 31 deletions.
32 changes: 11 additions & 21 deletions modules/ismp/clients/parachain/client/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<ParachainData> = (0..n)
.map(|i| {
ParachainData {
id: i,
slot_duration: 6000u64,
}
})
.collect();
let parachains: Vec<ParachainData> =
(0..n).map(|i| ParachainData { id: i, slot_duration: 6000u64 }).collect();

#[block]
{
Expand All @@ -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<ParachainData> = (0..n)
.map(|i| {
ParachainData {
id: i,
slot_duration: 6000u64,
}
})
.collect();
let parachains: Vec<ParachainData> =
(0..n).map(|i| ParachainData { id: i, slot_duration: 6000u64 }).collect();

#[block]
{
Expand Down Expand Up @@ -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::<T>::put(validation_data);
Expand Down
19 changes: 9 additions & 10 deletions modules/ismp/clients/parachain/client/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
/// 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;
}

0 comments on commit ad9d342

Please sign in to comment.