diff --git a/modules/ismp/clients/parachain/client/Cargo.toml b/modules/ismp/clients/parachain/client/Cargo.toml index d727738b1..881a7aed3 100644 --- a/modules/ismp/clients/parachain/client/Cargo.toml +++ b/modules/ismp/clients/parachain/client/Cargo.toml @@ -30,7 +30,6 @@ sp-inherents = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } sp-consensus-aura = { workspace = true } -frame-benchmarking = { workspace = true, optional = true } # cumulus cumulus-pallet-parachain-system = { workspace = true, default-features = false } @@ -62,12 +61,7 @@ std = [ "pallet-ismp/std", "substrate-state-machine/std" ] -runtime-benchmarks = [ - "frame-benchmarking/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "cumulus-pallet-parachain-system/runtime-benchmarks" -] + try-runtime = [ "frame-support/try-runtime", "frame-system/try-runtime", @@ -79,4 +73,5 @@ runtime-benchmarks = [ "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", "pallet-ismp/runtime-benchmarks", + "cumulus-pallet-parachain-system/runtime-benchmarks", ] diff --git a/modules/ismp/clients/parachain/client/src/benchmarking.rs b/modules/ismp/clients/parachain/client/src/benchmarking.rs index 198c33972..85b984b5e 100644 --- a/modules/ismp/clients/parachain/client/src/benchmarking.rs +++ b/modules/ismp/clients/parachain/client/src/benchmarking.rs @@ -28,33 +28,60 @@ mod benchmarks { use super::*; use ismp::messaging::{ConsensusMessage, Message}; + /// Benchmark for add_parachain extrinsic + /// The benchmark creates n parachains and measures the time to add them + /// to the whitelist. + /// + /// Parameters: + /// - `n`: Number of parachains to add in a single call #[benchmark] - fn add_parachain() -> Result<(), BenchmarkError> { - let state_machines: Vec = - (0..10).map(|i| ParachainData { id: i, slot_duration: 6000 }).collect(); + fn add_parachain(n: Linear<1, 100>) -> Result<(), BenchmarkError> { + let parachains: Vec = (0..n) + .map(|i| { + ParachainData { + id: i, + slot_duration: 6000u64, + } + }) + .collect(); #[block] { - Pallet::::add_parachain(RawOrigin::Root.into(), state_machines)?; + Pallet::::add_parachain(RawOrigin::Root.into(), parachains)?; } Ok(()) } + /// Benchmark for remove_parachain extrinsic + /// The benchmark first adds n parachains, then measures the time to remove them + /// from the whitelist. + /// + /// Parameters: + /// - `n`: Number of parachains to remove in a single call #[benchmark] - fn remove_parachain() -> Result<(), BenchmarkError> { - let state_machines: Vec = - (0..10).map(|i| ParachainData { id: i, slot_duration: 6000 }).collect(); + fn remove_parachain(n: Linear<1, 100>) -> Result<(), BenchmarkError> { + let parachains: Vec = (0..n) + .map(|i| { + ParachainData { + id: i, + slot_duration: 6000u64, + } + }) + .collect(); #[block] { - Pallet::::add_parachain(RawOrigin::Root.into(), state_machines)?; + Pallet::::add_parachain(RawOrigin::Root.into(), parachains)?; Pallet::::remove_parachain(RawOrigin::Root.into(), vec![0, 1, 2, 3, 4])?; } Ok(()) } + /// Benchmark for update_parachain_consensus extrinsic + /// The benchmark first insert a Parachain, then sets the ValidationData, + /// afterward proceed to update the parachain consensus. #[benchmark] fn update_parachain_consensus() -> Result<(), BenchmarkError> { let consensus_message = ConsensusMessage { diff --git a/modules/ismp/clients/parachain/client/src/lib.rs b/modules/ismp/clients/parachain/client/src/lib.rs index 9b57f5bb0..38cc7911c 100644 --- a/modules/ismp/clients/parachain/client/src/lib.rs +++ b/modules/ismp/clients/parachain/client/src/lib.rs @@ -25,6 +25,7 @@ mod migration; #[cfg(feature = "runtime-benchmarks")] mod benchmarking; +/// weights trait crate pub mod weights; pub use consensus::*; @@ -37,7 +38,7 @@ use cumulus_pallet_parachain_system::{ use cumulus_primitives_core::relay_chain; use ismp::{handlers, messaging::CreateConsensusState}; pub use pallet::*; -pub use weights::WeightInfoTrait; +pub use weights::WeightInfo; #[frame_support::pallet] pub mod pallet { @@ -68,7 +69,7 @@ pub mod pallet { /// The underlying [`IsmpHost`] implementation type IsmpHost: IsmpHost + Default; /// WeightInfo - type WeightInfo: WeightInfoTrait; + type WeightInfo: WeightInfo; } /// Mapping of relay chain heights to it's state commitment. The state commitment of the parent diff --git a/modules/ismp/clients/parachain/client/src/weights.rs b/modules/ismp/clients/parachain/client/src/weights.rs index 8dd2e17e5..16d1cf4c4 100644 --- a/modules/ismp/clients/parachain/client/src/weights.rs +++ b/modules/ismp/clients/parachain/client/src/weights.rs @@ -13,102 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Autogenerated weights for `ismp_parachain` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 42.0.0 -//! DATE: 2024-12-15, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `Akinloses-MacBook-Pro.local`, CPU: `` -//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 - -// Executed Command: -// frame-omni-bencher -// v1 -// benchmark -// pallet -// --runtime -// /Users/dharjeezy/Documents/polytope/hyperbridge/target/release/wbuild/gargantua-runtime/gargantua_runtime.compact.wasm -// --pallet -// ismp-parachain -// --all -// --steps -// 2 -// --repeat -// 1 -// --output -// ismp-parachain-weight.rs - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use core::marker::PhantomData; - -pub trait WeightInfoTrait { - fn add_parachain() -> Weight; - fn remove_parachain() -> Weight; +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 functions for `ismp_parachain`. -pub struct WeightInfo(PhantomData); - -impl WeightInfoTrait for WeightInfo { - /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) - /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// Storage: `IsmpParachain::Parachains` (r:0 w:10) - /// Proof: `IsmpParachain::Parachains` (`max_values`: None, `max_size`: Some(12), added: 2487, mode: `MaxEncodedLen`) - /// Storage: `Ismp::ChallengePeriod` (r:0 w:10) - /// Proof: `Ismp::ChallengePeriod` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn add_parachain() -> Weight { - // Proof Size summary in bytes: - // Measured: `103` - // Estimated: `1489` - // Minimum execution time: 48_000_000 picoseconds. - Weight::from_parts(48_000_000, 0) - .saturating_add(Weight::from_parts(0, 1489)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(20)) - } - /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) - /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// Storage: `IsmpParachain::Parachains` (r:0 w:10) - /// Proof: `IsmpParachain::Parachains` (`max_values`: None, `max_size`: Some(12), added: 2487, mode: `MaxEncodedLen`) - /// Storage: `Ismp::ChallengePeriod` (r:0 w:10) - /// Proof: `Ismp::ChallengePeriod` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn remove_parachain() -> Weight { - // Proof Size summary in bytes: - // Measured: `103` - // Estimated: `1489` - // Minimum execution time: 58_000_000 picoseconds. - Weight::from_parts(58_000_000, 0) - .saturating_add(Weight::from_parts(0, 1489)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(20)) - } - /// Storage: `IsmpParachain::ConsensusUpdated` (r:1 w:0) - /// Proof: `IsmpParachain::ConsensusUpdated` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) - /// Storage: `Ismp::ConsensusStateClient` (r:1 w:0) - /// Proof: `Ismp::ConsensusStateClient` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Ismp::ConsensusStates` (r:1 w:0) - /// Proof: `Ismp::ConsensusStates` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Ismp::FrozenConsensusClients` (r:1 w:0) - /// Proof: `Ismp::FrozenConsensusClients` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Timestamp::Now` (r:1 w:0) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) - /// Storage: `Ismp::UnbondingPeriod` (r:1 w:0) - /// Proof: `Ismp::UnbondingPeriod` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Ismp::ConsensusClientUpdateTime` (r:1 w:0) - /// Proof: `Ismp::ConsensusClientUpdateTime` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn update_parachain_consensus() -> Weight { - // Proof Size summary in bytes: - // Measured: `333` - // Estimated: `3798` - // Minimum execution time: 42_000_000 picoseconds. - Weight::from_parts(42_000_000, 0) - .saturating_add(Weight::from_parts(0, 3798)) - .saturating_add(T::DbWeight::get().reads(7)) - } -} +} \ No newline at end of file diff --git a/parachain/runtimes/gargantua/src/ismp.rs b/parachain/runtimes/gargantua/src/ismp.rs index d55ceaf36..79cbe489e 100644 --- a/parachain/runtimes/gargantua/src/ismp.rs +++ b/parachain/runtimes/gargantua/src/ismp.rs @@ -142,7 +142,7 @@ impl pallet_call_decompressor::Config for Runtime { impl ismp_parachain::Config for Runtime { type RuntimeEvent = RuntimeEvent; type IsmpHost = Ismp; - type WeightInfo = ismp_parachain::weights::WeightInfo; + type WeightInfo = weights::ismp_parachain::WeightInfo; } impl pallet_fishermen::Config for Runtime { diff --git a/parachain/runtimes/gargantua/src/weights/ismp_parachain.rs b/parachain/runtimes/gargantua/src/weights/ismp_parachain.rs new file mode 100644 index 000000000..bafbb69bb --- /dev/null +++ b/parachain/runtimes/gargantua/src/weights/ismp_parachain.rs @@ -0,0 +1,108 @@ +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Autogenerated weights for `ismp_parachain` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 42.0.0 +//! DATE: 2024-12-15, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `Akinloses-MacBook-Pro.local`, CPU: `` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// /Users/dharjeezy/Documents/polytope/hyperbridge/target/release/wbuild/gargantua-runtime/gargantua_runtime.compact.wasm +// --pallet +// ismp-parachain +// --all +// --steps +// 2 +// --repeat +// 1 +// --output +// ismp-parachain-weight.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; + +/// Weight functions for `ismp_parachain`. +pub struct WeightInfo(PhantomData); + +impl ismp_parachain::WeightInfo for WeightInfo { + /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) + /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `IsmpParachain::Parachains` (r:0 w:10) + /// Proof: `IsmpParachain::Parachains` (`max_values`: None, `max_size`: Some(12), added: 2487, mode: `MaxEncodedLen`) + /// Storage: `Ismp::ChallengePeriod` (r:0 w:10) + /// Proof: `Ismp::ChallengePeriod` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn add_parachain(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `103` + // Estimated: `1489` + // Minimum execution time: 48_000_000 picoseconds. + Weight::from_parts(48_000_000, 0) + .saturating_add(Weight::from_parts(0, 1489)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(20)) + } + /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) + /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `IsmpParachain::Parachains` (r:0 w:10) + /// Proof: `IsmpParachain::Parachains` (`max_values`: None, `max_size`: Some(12), added: 2487, mode: `MaxEncodedLen`) + /// Storage: `Ismp::ChallengePeriod` (r:0 w:10) + /// Proof: `Ismp::ChallengePeriod` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn remove_parachain(n: u32,) -> Weight { + // Proof Size summary in bytes: + // Measured: `103` + // Estimated: `1489` + // Minimum execution time: 58_000_000 picoseconds. + Weight::from_parts(58_000_000, 0) + .saturating_add(Weight::from_parts(0, 1489)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(20)) + } + /// Storage: `IsmpParachain::ConsensusUpdated` (r:1 w:0) + /// Proof: `IsmpParachain::ConsensusUpdated` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `Ismp::ConsensusStateClient` (r:1 w:0) + /// Proof: `Ismp::ConsensusStateClient` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Ismp::ConsensusStates` (r:1 w:0) + /// Proof: `Ismp::ConsensusStates` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Ismp::FrozenConsensusClients` (r:1 w:0) + /// Proof: `Ismp::FrozenConsensusClients` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Ismp::UnbondingPeriod` (r:1 w:0) + /// Proof: `Ismp::UnbondingPeriod` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Ismp::ConsensusClientUpdateTime` (r:1 w:0) + /// Proof: `Ismp::ConsensusClientUpdateTime` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn update_parachain_consensus() -> Weight { + // Proof Size summary in bytes: + // Measured: `333` + // Estimated: `3798` + // Minimum execution time: 42_000_000 picoseconds. + Weight::from_parts(42_000_000, 0) + .saturating_add(Weight::from_parts(0, 3798)) + .saturating_add(T::DbWeight::get().reads(7)) + } +} diff --git a/parachain/runtimes/gargantua/src/weights/mod.rs b/parachain/runtimes/gargantua/src/weights/mod.rs index c312fb487..f42a19108 100644 --- a/parachain/runtimes/gargantua/src/weights/mod.rs +++ b/parachain/runtimes/gargantua/src/weights/mod.rs @@ -27,6 +27,7 @@ pub mod cumulus_pallet_parachain_system; pub mod cumulus_pallet_xcmp_queue; pub mod frame_system; pub mod ismp_grandpa; +pub mod ismp_parachain; pub mod pallet_asset_rate; pub mod pallet_assets; pub mod pallet_balances; diff --git a/parachain/runtimes/messier/src/ismp.rs b/parachain/runtimes/messier/src/ismp.rs index cecf4c14e..79e53c2fd 100644 --- a/parachain/runtimes/messier/src/ismp.rs +++ b/parachain/runtimes/messier/src/ismp.rs @@ -104,7 +104,7 @@ impl pallet_ismp_host_executive::Config for Runtime { impl ismp_parachain::Config for Runtime { type RuntimeEvent = RuntimeEvent; type IsmpHost = Ismp; - type WeightInfo = ismp_parachain::weights::WeightInfo; + type WeightInfo = weights::ismp_parachain::WeightInfo; } impl pallet_call_decompressor::Config for Runtime { diff --git a/parachain/runtimes/messier/src/weights/ismp_parachain.rs b/parachain/runtimes/messier/src/weights/ismp_parachain.rs new file mode 100644 index 000000000..212632d8c --- /dev/null +++ b/parachain/runtimes/messier/src/weights/ismp_parachain.rs @@ -0,0 +1,108 @@ +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Autogenerated weights for `ismp_parachain` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 42.0.0 +//! DATE: 2024-12-15, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `Akinloses-MacBook-Pro.local`, CPU: `` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// /Users/dharjeezy/Documents/polytope/hyperbridge/target/release/wbuild/gargantua-runtime/gargantua_runtime.compact.wasm +// --pallet +// ismp-parachain +// --all +// --steps +// 2 +// --repeat +// 1 +// --output +// ismp-parachain-weight.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; + +/// Weight functions for `ismp_parachain`. +pub struct WeightInfo(PhantomData); + +impl ismp_parachain::WeightInfo for WeightInfo { + /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) + /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `IsmpParachain::Parachains` (r:0 w:10) + /// Proof: `IsmpParachain::Parachains` (`max_values`: None, `max_size`: Some(12), added: 2487, mode: `MaxEncodedLen`) + /// Storage: `Ismp::ChallengePeriod` (r:0 w:10) + /// Proof: `Ismp::ChallengePeriod` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn add_parachain(n: u32,) -> Weight { + // Proof Size summary in bytes: + // Measured: `103` + // Estimated: `1489` + // Minimum execution time: 48_000_000 picoseconds. + Weight::from_parts(48_000_000, 0) + .saturating_add(Weight::from_parts(0, 1489)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(20)) + } + /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) + /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `IsmpParachain::Parachains` (r:0 w:10) + /// Proof: `IsmpParachain::Parachains` (`max_values`: None, `max_size`: Some(12), added: 2487, mode: `MaxEncodedLen`) + /// Storage: `Ismp::ChallengePeriod` (r:0 w:10) + /// Proof: `Ismp::ChallengePeriod` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn remove_parachain(n: u32,) -> Weight { + // Proof Size summary in bytes: + // Measured: `103` + // Estimated: `1489` + // Minimum execution time: 58_000_000 picoseconds. + Weight::from_parts(58_000_000, 0) + .saturating_add(Weight::from_parts(0, 1489)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(20)) + } + /// Storage: `IsmpParachain::ConsensusUpdated` (r:1 w:0) + /// Proof: `IsmpParachain::ConsensusUpdated` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `Ismp::ConsensusStateClient` (r:1 w:0) + /// Proof: `Ismp::ConsensusStateClient` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Ismp::ConsensusStates` (r:1 w:0) + /// Proof: `Ismp::ConsensusStates` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Ismp::FrozenConsensusClients` (r:1 w:0) + /// Proof: `Ismp::FrozenConsensusClients` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Ismp::UnbondingPeriod` (r:1 w:0) + /// Proof: `Ismp::UnbondingPeriod` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Ismp::ConsensusClientUpdateTime` (r:1 w:0) + /// Proof: `Ismp::ConsensusClientUpdateTime` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn update_parachain_consensus() -> Weight { + // Proof Size summary in bytes: + // Measured: `333` + // Estimated: `3798` + // Minimum execution time: 42_000_000 picoseconds. + Weight::from_parts(42_000_000, 0) + .saturating_add(Weight::from_parts(0, 3798)) + .saturating_add(T::DbWeight::get().reads(7)) + } +} diff --git a/parachain/runtimes/messier/src/weights/mod.rs b/parachain/runtimes/messier/src/weights/mod.rs index ef1ab0d1a..8c86ea9d1 100644 --- a/parachain/runtimes/messier/src/weights/mod.rs +++ b/parachain/runtimes/messier/src/weights/mod.rs @@ -21,6 +21,7 @@ pub mod block_weights; pub mod extrinsic_weights; pub mod paritydb_weights; pub mod rocksdb_weights; +pub mod ismp_parachain; pub use block_weights::constants::BlockExecutionWeight; pub use extrinsic_weights::constants::ExtrinsicBaseWeight; diff --git a/parachain/runtimes/nexus/src/ismp.rs b/parachain/runtimes/nexus/src/ismp.rs index 0c0b71266..463117652 100644 --- a/parachain/runtimes/nexus/src/ismp.rs +++ b/parachain/runtimes/nexus/src/ismp.rs @@ -136,7 +136,7 @@ impl pallet_fishermen::Config for Runtime { impl ismp_parachain::Config for Runtime { type RuntimeEvent = RuntimeEvent; type IsmpHost = Ismp; - type WeightInfo = ismp_parachain::weights::WeightInfo; + type WeightInfo = weights::ismp_parachain::WeightInfo; } parameter_types! { diff --git a/parachain/runtimes/nexus/src/weights/ismp_parachain.rs b/parachain/runtimes/nexus/src/weights/ismp_parachain.rs new file mode 100644 index 000000000..212632d8c --- /dev/null +++ b/parachain/runtimes/nexus/src/weights/ismp_parachain.rs @@ -0,0 +1,108 @@ +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Autogenerated weights for `ismp_parachain` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 42.0.0 +//! DATE: 2024-12-15, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `Akinloses-MacBook-Pro.local`, CPU: `` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// /Users/dharjeezy/Documents/polytope/hyperbridge/target/release/wbuild/gargantua-runtime/gargantua_runtime.compact.wasm +// --pallet +// ismp-parachain +// --all +// --steps +// 2 +// --repeat +// 1 +// --output +// ismp-parachain-weight.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; + +/// Weight functions for `ismp_parachain`. +pub struct WeightInfo(PhantomData); + +impl ismp_parachain::WeightInfo for WeightInfo { + /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) + /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `IsmpParachain::Parachains` (r:0 w:10) + /// Proof: `IsmpParachain::Parachains` (`max_values`: None, `max_size`: Some(12), added: 2487, mode: `MaxEncodedLen`) + /// Storage: `Ismp::ChallengePeriod` (r:0 w:10) + /// Proof: `Ismp::ChallengePeriod` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn add_parachain(n: u32,) -> Weight { + // Proof Size summary in bytes: + // Measured: `103` + // Estimated: `1489` + // Minimum execution time: 48_000_000 picoseconds. + Weight::from_parts(48_000_000, 0) + .saturating_add(Weight::from_parts(0, 1489)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(20)) + } + /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) + /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `IsmpParachain::Parachains` (r:0 w:10) + /// Proof: `IsmpParachain::Parachains` (`max_values`: None, `max_size`: Some(12), added: 2487, mode: `MaxEncodedLen`) + /// Storage: `Ismp::ChallengePeriod` (r:0 w:10) + /// Proof: `Ismp::ChallengePeriod` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn remove_parachain(n: u32,) -> Weight { + // Proof Size summary in bytes: + // Measured: `103` + // Estimated: `1489` + // Minimum execution time: 58_000_000 picoseconds. + Weight::from_parts(58_000_000, 0) + .saturating_add(Weight::from_parts(0, 1489)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(20)) + } + /// Storage: `IsmpParachain::ConsensusUpdated` (r:1 w:0) + /// Proof: `IsmpParachain::ConsensusUpdated` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `Ismp::ConsensusStateClient` (r:1 w:0) + /// Proof: `Ismp::ConsensusStateClient` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Ismp::ConsensusStates` (r:1 w:0) + /// Proof: `Ismp::ConsensusStates` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Ismp::FrozenConsensusClients` (r:1 w:0) + /// Proof: `Ismp::FrozenConsensusClients` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Ismp::UnbondingPeriod` (r:1 w:0) + /// Proof: `Ismp::UnbondingPeriod` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Ismp::ConsensusClientUpdateTime` (r:1 w:0) + /// Proof: `Ismp::ConsensusClientUpdateTime` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn update_parachain_consensus() -> Weight { + // Proof Size summary in bytes: + // Measured: `333` + // Estimated: `3798` + // Minimum execution time: 42_000_000 picoseconds. + Weight::from_parts(42_000_000, 0) + .saturating_add(Weight::from_parts(0, 3798)) + .saturating_add(T::DbWeight::get().reads(7)) + } +} diff --git a/parachain/runtimes/nexus/src/weights/mod.rs b/parachain/runtimes/nexus/src/weights/mod.rs index 641f10c75..cf671a6c3 100644 --- a/parachain/runtimes/nexus/src/weights/mod.rs +++ b/parachain/runtimes/nexus/src/weights/mod.rs @@ -26,6 +26,7 @@ pub mod cumulus_pallet_parachain_system; pub mod cumulus_pallet_xcmp_queue; pub mod frame_system; pub mod ismp_grandpa; +pub mod ismp_parachain; pub mod pallet_asset_rate; pub mod pallet_assets; pub mod pallet_balances;