pallet_messages/
weights.rs

1
2//! Autogenerated weights for `pallet_messages`
3//!
4//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 49.1.0
5//! DATE: 2025-08-20, STEPS: `20`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]`
6//! WORST CASE MAP SIZE: `1000000`
7//! HOSTNAME: `ip-10-173-5-194`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
8//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024`
9
10// Executed Command:
11// ./scripts/../target/release/frequency
12// benchmark
13// pallet
14// --pallet=pallet_messages
15// --extrinsic
16// *
17// --heap-pages=4096
18// --steps=20
19// --repeat=10
20// --output=./scripts/../pallets/messages/src/weights.rs
21// --template=./scripts/../.maintain/frame-weight-template.hbs
22// --additional-trie-layers=3
23// --runtime=./scripts/../target/release/wbuild/frequency-runtime/frequency_runtime.wasm
24// --genesis-builder=runtime
25
26#![cfg_attr(rustfmt, rustfmt_skip)]
27#![allow(unused_parens)]
28#![allow(unused_imports)]
29#![allow(missing_docs)]
30
31use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
32use core::marker::PhantomData;
33
34/// Weight functions needed for `pallet_messages`.
35pub trait WeightInfo {
36	fn add_onchain_message(n: u32, ) -> Weight;
37	fn add_ipfs_message() -> Weight;
38}
39
40/// Weights for `pallet_messages` using the Substrate node and recommended hardware.
41pub struct SubstrateWeight<T>(PhantomData<T>);
42impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
43	/// Storage: `Schemas::SchemaInfos` (r:1 w:0)
44	/// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(15), added: 2490, mode: `MaxEncodedLen`)
45	/// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0)
46	/// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
47	/// Storage: `Msa::DelegatorAndProviderToDelegation` (r:1 w:0)
48	/// Proof: `Msa::DelegatorAndProviderToDelegation` (`max_values`: None, `max_size`: Some(217), added: 2692, mode: `MaxEncodedLen`)
49	/// Storage: `Messages::MessagesV2` (r:0 w:1)
50	/// Proof: `Messages::MessagesV2` (`max_values`: None, `max_size`: Some(3123), added: 5598, mode: `MaxEncodedLen`)
51	/// The range of component `n` is `[0, 3071]`.
52	fn add_onchain_message(n: u32, ) -> Weight {
53		// Proof Size summary in bytes:
54		//  Measured:  `776`
55		//  Estimated: `4177`
56		// Minimum execution time: 40_125_000 picoseconds.
57		Weight::from_parts(42_038_155, 4177)
58			// Standard Error: 152
59			.saturating_add(Weight::from_parts(455, 0).saturating_mul(n.into()))
60			.saturating_add(T::DbWeight::get().reads(3_u64))
61			.saturating_add(T::DbWeight::get().writes(1_u64))
62	}
63	/// Storage: `Schemas::SchemaInfos` (r:1 w:0)
64	/// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(15), added: 2490, mode: `MaxEncodedLen`)
65	/// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0)
66	/// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
67	/// Storage: `Messages::MessagesV2` (r:0 w:1)
68	/// Proof: `Messages::MessagesV2` (`max_values`: None, `max_size`: Some(3123), added: 5598, mode: `MaxEncodedLen`)
69	fn add_ipfs_message() -> Weight {
70		// Proof Size summary in bytes:
71		//  Measured:  `709`
72		//  Estimated: `4008`
73		// Minimum execution time: 34_896_000 picoseconds.
74		Weight::from_parts(35_314_000, 4008)
75			.saturating_add(T::DbWeight::get().reads(2_u64))
76			.saturating_add(T::DbWeight::get().writes(1_u64))
77	}
78}
79
80// For backwards compatibility and tests.
81impl WeightInfo for () {
82	/// Storage: `Schemas::SchemaInfos` (r:1 w:0)
83	/// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(15), added: 2490, mode: `MaxEncodedLen`)
84	/// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0)
85	/// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
86	/// Storage: `Msa::DelegatorAndProviderToDelegation` (r:1 w:0)
87	/// Proof: `Msa::DelegatorAndProviderToDelegation` (`max_values`: None, `max_size`: Some(217), added: 2692, mode: `MaxEncodedLen`)
88	/// Storage: `Messages::MessagesV2` (r:0 w:1)
89	/// Proof: `Messages::MessagesV2` (`max_values`: None, `max_size`: Some(3123), added: 5598, mode: `MaxEncodedLen`)
90	/// The range of component `n` is `[0, 3071]`.
91	fn add_onchain_message(n: u32, ) -> Weight {
92		// Proof Size summary in bytes:
93		//  Measured:  `776`
94		//  Estimated: `4177`
95		// Minimum execution time: 40_125_000 picoseconds.
96		Weight::from_parts(42_038_155, 4177)
97			// Standard Error: 152
98			.saturating_add(Weight::from_parts(455, 0).saturating_mul(n.into()))
99			.saturating_add(RocksDbWeight::get().reads(3_u64))
100			.saturating_add(RocksDbWeight::get().writes(1_u64))
101	}
102	/// Storage: `Schemas::SchemaInfos` (r:1 w:0)
103	/// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(15), added: 2490, mode: `MaxEncodedLen`)
104	/// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0)
105	/// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
106	/// Storage: `Messages::MessagesV2` (r:0 w:1)
107	/// Proof: `Messages::MessagesV2` (`max_values`: None, `max_size`: Some(3123), added: 5598, mode: `MaxEncodedLen`)
108	fn add_ipfs_message() -> Weight {
109		// Proof Size summary in bytes:
110		//  Measured:  `709`
111		//  Estimated: `4008`
112		// Minimum execution time: 34_896_000 picoseconds.
113		Weight::from_parts(35_314_000, 4008)
114			.saturating_add(RocksDbWeight::get().reads(2_u64))
115			.saturating_add(RocksDbWeight::get().writes(1_u64))
116	}
117}
118
119
120#[cfg(test)]
121mod tests {
122  use frame_support::{traits::Get, weights::Weight, dispatch::DispatchClass};
123  use common_runtime::constants::{MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO};
124  use common_runtime::weights::extrinsic_weights::ExtrinsicBaseWeight;
125
126  #[allow(dead_code)]
127  struct BlockWeights;
128  impl Get<frame_system::limits::BlockWeights> for BlockWeights {
129  	fn get() -> frame_system::limits::BlockWeights {
130  		frame_system::limits::BlockWeights::builder()
131  			.base_block(Weight::zero())
132  			.for_class(DispatchClass::all(), |weights| {
133  				weights.base_extrinsic = ExtrinsicBaseWeight::get();
134  			})
135  			.for_class(DispatchClass::non_mandatory(), |weights| {
136  				weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
137  			})
138  			.build_or_panic()
139  	}
140  }
141
142	#[test]
143	fn test_add_onchain_message() {
144		assert!(
145			BlockWeights::get()
146				.per_class
147				.get(frame_support::dispatch::DispatchClass::Normal)
148				.max_extrinsic
149				.unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
150				.proof_size()
151				> 4177
152		);
153	}
154	#[test]
155	fn test_add_ipfs_message() {
156		assert!(
157			BlockWeights::get()
158				.per_class
159				.get(frame_support::dispatch::DispatchClass::Normal)
160				.max_extrinsic
161				.unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
162				.proof_size()
163				> 4008
164		);
165	}
166}