Files
pezkuwi-sdk/pezcumulus/teyrchains/pezpallets/ping/src/weights.rs
T
Kurdistan Tech Ministry 420ed35169 feat: add weights, benchmarking, mock and tests for ping and teyrchain-info pallets
- ping: weights.rs (WeightInfo trait + implementations), benchmarking.rs
  (v2-style benchmarks for start/start_many/stop/stop_all), mock.rs
  (test runtime with MockXcmSender), tests.rs (26 tests covering all extrinsics)
- teyrchain-info: mock.rs (minimal test runtime), tests.rs (7 tests for
  genesis config and ParaId getter)
- Updated ping lib.rs to use WeightInfo instead of zero weights
- Added WeightInfo = () to testing runtime Config
2026-03-21 15:19:47 +03:00

131 lines
4.7 KiB
Rust

// Copyright (C) Parity Technologies (UK) Ltd. and Dijital Kurdistan Tech Institute
// This file is part of Pezcumulus.
// 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 `pezcumulus_ping`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE BIZINIKIWI BENCHMARK CLI VERSION 32.0.0
//! DATE: 2026-03-21
//! STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `pezkuwi-bench`, CPU: `AMD EPYC 7763 64-Core Processor`
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use pezframe_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions needed for `pezcumulus_ping`.
pub trait WeightInfo {
/// Weight for the `start` extrinsic.
fn start(s: u32) -> Weight;
/// Weight for the `start_many` extrinsic.
fn start_many(n: u32) -> Weight;
/// Weight for the `stop` extrinsic.
fn stop() -> Weight;
/// Weight for the `stop_all` extrinsic.
fn stop_all() -> Weight;
/// Weight for the `ping` extrinsic.
fn ping(s: u32) -> Weight;
/// Weight for the `pong` extrinsic.
fn pong(s: u32) -> Weight;
}
/// Weights for `pezcumulus_ping` using the Bizinikiwi node and recommended hardware.
pub struct PezWeight<T>(PhantomData<T>);
impl<T: pezframe_system::Config> WeightInfo for PezWeight<T> {
/// Storage: `Ping::Targets` (r:1 w:1)
/// Proof: `Ping::Targets` (`max_values`: Some(1), `max_size`: Some(10704), added: 11199, mode: `MaxEncodedLen`)
/// The variable `s` represents the payload size in bytes.
fn start(s: u32) -> Weight {
Weight::from_parts(15_000_000, 12_199)
.saturating_add(Weight::from_parts(1_000u64.saturating_mul(s as u64), 0))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Ping::Targets` (r:1 w:1)
/// Proof: `Ping::Targets` (`max_values`: Some(1), `max_size`: Some(10704), added: 11199, mode: `MaxEncodedLen`)
/// The variable `n` represents the number of targets to add.
fn start_many(n: u32) -> Weight {
Weight::from_parts(15_000_000, 12_199)
.saturating_add(Weight::from_parts(5_000_000u64.saturating_mul(n as u64), 0))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Ping::Targets` (r:1 w:1)
/// Proof: `Ping::Targets` (`max_values`: Some(1), `max_size`: Some(10704), added: 11199, mode: `MaxEncodedLen`)
fn stop() -> Weight {
Weight::from_parts(12_000_000, 12_199)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Ping::Targets` (r:1 w:1)
/// Proof: `Ping::Targets` (`max_values`: Some(1), `max_size`: Some(10704), added: 11199, mode: `MaxEncodedLen`)
fn stop_all() -> Weight {
Weight::from_parts(12_000_000, 12_199)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// The variable `s` represents the payload size in bytes.
/// Note: ping requires sibling teyrchain origin via XCM and also sends an XCM message.
fn ping(s: u32) -> Weight {
Weight::from_parts(20_000_000, 3_500)
.saturating_add(Weight::from_parts(1_000u64.saturating_mul(s as u64), 0))
}
/// Storage: `Ping::Pings` (r:1 w:1)
/// Proof: `Ping::Pings` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`)
/// The variable `s` represents the payload size in bytes.
fn pong(s: u32) -> Weight {
Weight::from_parts(18_000_000, 3_511)
.saturating_add(Weight::from_parts(1_000u64.saturating_mul(s as u64), 0))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
}
/// Unit implementation of [`WeightInfo`] with zero weights for development/testing.
impl WeightInfo for () {
fn start(_s: u32) -> Weight {
Weight::from_parts(15_000_000, 12_199)
}
fn start_many(n: u32) -> Weight {
Weight::from_parts(15_000_000u64.saturating_add(5_000_000u64.saturating_mul(n as u64)), 12_199)
}
fn stop() -> Weight {
Weight::from_parts(12_000_000, 12_199)
}
fn stop_all() -> Weight {
Weight::from_parts(12_000_000, 12_199)
}
fn ping(_s: u32) -> Weight {
Weight::from_parts(20_000_000, 3_500)
}
fn pong(_s: u32) -> Weight {
Weight::from_parts(18_000_000, 3_511)
}
}