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-12-10, 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	fn v2_to_v3_step() -> Weight;
39	fn v2_to_v3_final_step() -> Weight;
40}
41
42/// Weights for `pallet_messages` using the Substrate node and recommended hardware.
43pub struct SubstrateWeight<T>(PhantomData<T>);
44impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
45	/// Storage: `Schemas::SchemaInfos` (r:1 w:0)
46	/// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(17), added: 2492, mode: `MaxEncodedLen`)
47	/// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0)
48	/// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
49	/// Storage: `Msa::DelegatorAndProviderToDelegation` (r:1 w:0)
50	/// Proof: `Msa::DelegatorAndProviderToDelegation` (`max_values`: None, `max_size`: Some(217), added: 2692, mode: `MaxEncodedLen`)
51	/// Storage: `Messages::MessagesV3` (r:0 w:1)
52	/// Proof: `Messages::MessagesV3` (`max_values`: None, `max_size`: Some(3125), added: 5600, mode: `MaxEncodedLen`)
53	/// The range of component `n` is `[0, 3071]`.
54	fn add_onchain_message(n: u32, ) -> Weight {
55		// Proof Size summary in bytes:
56		//  Measured:  `548`
57		//  Estimated: `4177`
58		// Minimum execution time: 37_964_000 picoseconds.
59		Weight::from_parts(39_972_803, 4177)
60			// Standard Error: 198
61			.saturating_add(Weight::from_parts(1_051, 0).saturating_mul(n.into()))
62			.saturating_add(T::DbWeight::get().reads(3_u64))
63			.saturating_add(T::DbWeight::get().writes(1_u64))
64	}
65	/// Storage: `Schemas::SchemaInfos` (r:1 w:0)
66	/// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(17), added: 2492, mode: `MaxEncodedLen`)
67	/// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0)
68	/// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
69	/// Storage: `Messages::MessagesV3` (r:0 w:1)
70	/// Proof: `Messages::MessagesV3` (`max_values`: None, `max_size`: Some(3125), added: 5600, mode: `MaxEncodedLen`)
71	fn add_ipfs_message() -> Weight {
72		// Proof Size summary in bytes:
73		//  Measured:  `471`
74		//  Estimated: `4008`
75		// Minimum execution time: 35_476_000 picoseconds.
76		Weight::from_parts(37_180_000, 4008)
77			.saturating_add(T::DbWeight::get().reads(2_u64))
78			.saturating_add(T::DbWeight::get().writes(1_u64))
79	}
80	/// Storage: UNKNOWN KEY `0x9ea3e2d10fdb9a071f2f534d51b0961f963740dfb0edb77dddcbb1e5542cf4d2` (r:2 w:1)
81	/// Proof: UNKNOWN KEY `0x9ea3e2d10fdb9a071f2f534d51b0961f963740dfb0edb77dddcbb1e5542cf4d2` (r:2 w:1)
82	/// Storage: `Messages::MessagesV3` (r:0 w:1)
83	/// Proof: `Messages::MessagesV3` (`max_values`: None, `max_size`: Some(3125), added: 5600, mode: `MaxEncodedLen`)
84	fn v2_to_v3_step() -> Weight {
85		// Proof Size summary in bytes:
86		//  Measured:  `3113`
87		//  Estimated: `9548`
88		// Minimum execution time: 13_847_000 picoseconds.
89		Weight::from_parts(14_693_000, 9548)
90			.saturating_add(T::DbWeight::get().reads(2_u64))
91			.saturating_add(T::DbWeight::get().writes(2_u64))
92	}
93	/// Storage: UNKNOWN KEY `0x9ea3e2d10fdb9a071f2f534d51b0961f4e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0)
94	/// Proof: UNKNOWN KEY `0x9ea3e2d10fdb9a071f2f534d51b0961f4e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0)
95	/// Storage: UNKNOWN KEY `0x9ea3e2d10fdb9a071f2f534d51b0961f5283149a895d591a158bbac09b3a59af` (r:0 w:1)
96	/// Proof: UNKNOWN KEY `0x9ea3e2d10fdb9a071f2f534d51b0961f5283149a895d591a158bbac09b3a59af` (r:0 w:1)
97	fn v2_to_v3_final_step() -> Weight {
98		// Proof Size summary in bytes:
99		//  Measured:  `0`
100		//  Estimated: `3960`
101		// Minimum execution time: 3_532_000 picoseconds.
102		Weight::from_parts(3_720_000, 3960)
103			.saturating_add(T::DbWeight::get().reads(1_u64))
104			.saturating_add(T::DbWeight::get().writes(1_u64))
105	}
106}
107
108// For backwards compatibility and tests.
109impl WeightInfo for () {
110	/// Storage: `Schemas::SchemaInfos` (r:1 w:0)
111	/// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(17), added: 2492, mode: `MaxEncodedLen`)
112	/// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0)
113	/// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
114	/// Storage: `Msa::DelegatorAndProviderToDelegation` (r:1 w:0)
115	/// Proof: `Msa::DelegatorAndProviderToDelegation` (`max_values`: None, `max_size`: Some(217), added: 2692, mode: `MaxEncodedLen`)
116	/// Storage: `Messages::MessagesV3` (r:0 w:1)
117	/// Proof: `Messages::MessagesV3` (`max_values`: None, `max_size`: Some(3125), added: 5600, mode: `MaxEncodedLen`)
118	/// The range of component `n` is `[0, 3071]`.
119	fn add_onchain_message(n: u32, ) -> Weight {
120		// Proof Size summary in bytes:
121		//  Measured:  `548`
122		//  Estimated: `4177`
123		// Minimum execution time: 37_964_000 picoseconds.
124		Weight::from_parts(39_972_803, 4177)
125			// Standard Error: 198
126			.saturating_add(Weight::from_parts(1_051, 0).saturating_mul(n.into()))
127			.saturating_add(RocksDbWeight::get().reads(3_u64))
128			.saturating_add(RocksDbWeight::get().writes(1_u64))
129	}
130	/// Storage: `Schemas::SchemaInfos` (r:1 w:0)
131	/// Proof: `Schemas::SchemaInfos` (`max_values`: None, `max_size`: Some(17), added: 2492, mode: `MaxEncodedLen`)
132	/// Storage: `Msa::PublicKeyToMsaId` (r:1 w:0)
133	/// Proof: `Msa::PublicKeyToMsaId` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
134	/// Storage: `Messages::MessagesV3` (r:0 w:1)
135	/// Proof: `Messages::MessagesV3` (`max_values`: None, `max_size`: Some(3125), added: 5600, mode: `MaxEncodedLen`)
136	fn add_ipfs_message() -> Weight {
137		// Proof Size summary in bytes:
138		//  Measured:  `471`
139		//  Estimated: `4008`
140		// Minimum execution time: 35_476_000 picoseconds.
141		Weight::from_parts(37_180_000, 4008)
142			.saturating_add(RocksDbWeight::get().reads(2_u64))
143			.saturating_add(RocksDbWeight::get().writes(1_u64))
144	}
145	/// Storage: UNKNOWN KEY `0x9ea3e2d10fdb9a071f2f534d51b0961f963740dfb0edb77dddcbb1e5542cf4d2` (r:2 w:1)
146	/// Proof: UNKNOWN KEY `0x9ea3e2d10fdb9a071f2f534d51b0961f963740dfb0edb77dddcbb1e5542cf4d2` (r:2 w:1)
147	/// Storage: `Messages::MessagesV3` (r:0 w:1)
148	/// Proof: `Messages::MessagesV3` (`max_values`: None, `max_size`: Some(3125), added: 5600, mode: `MaxEncodedLen`)
149	fn v2_to_v3_step() -> Weight {
150		// Proof Size summary in bytes:
151		//  Measured:  `3113`
152		//  Estimated: `9548`
153		// Minimum execution time: 13_847_000 picoseconds.
154		Weight::from_parts(14_693_000, 9548)
155			.saturating_add(RocksDbWeight::get().reads(2_u64))
156			.saturating_add(RocksDbWeight::get().writes(2_u64))
157	}
158	/// Storage: UNKNOWN KEY `0x9ea3e2d10fdb9a071f2f534d51b0961f4e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0)
159	/// Proof: UNKNOWN KEY `0x9ea3e2d10fdb9a071f2f534d51b0961f4e7b9012096b41c4eb3aaf947f6ea429` (r:1 w:0)
160	/// Storage: UNKNOWN KEY `0x9ea3e2d10fdb9a071f2f534d51b0961f5283149a895d591a158bbac09b3a59af` (r:0 w:1)
161	/// Proof: UNKNOWN KEY `0x9ea3e2d10fdb9a071f2f534d51b0961f5283149a895d591a158bbac09b3a59af` (r:0 w:1)
162	fn v2_to_v3_final_step() -> Weight {
163		// Proof Size summary in bytes:
164		//  Measured:  `0`
165		//  Estimated: `3960`
166		// Minimum execution time: 3_532_000 picoseconds.
167		Weight::from_parts(3_720_000, 3960)
168			.saturating_add(RocksDbWeight::get().reads(1_u64))
169			.saturating_add(RocksDbWeight::get().writes(1_u64))
170	}
171}
172
173
174#[cfg(test)]
175mod tests {
176  use frame_support::{traits::Get, weights::Weight, dispatch::DispatchClass};
177  use common_runtime::constants::{MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO};
178  use common_runtime::weights::extrinsic_weights::ExtrinsicBaseWeight;
179
180  #[allow(dead_code)]
181  struct BlockWeights;
182  impl Get<frame_system::limits::BlockWeights> for BlockWeights {
183  	fn get() -> frame_system::limits::BlockWeights {
184  		frame_system::limits::BlockWeights::builder()
185  			.base_block(Weight::zero())
186  			.for_class(DispatchClass::all(), |weights| {
187  				weights.base_extrinsic = ExtrinsicBaseWeight::get();
188  			})
189  			.for_class(DispatchClass::non_mandatory(), |weights| {
190  				weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
191  			})
192  			.build_or_panic()
193  	}
194  }
195
196	#[test]
197	fn test_add_onchain_message() {
198		assert!(
199			BlockWeights::get()
200				.per_class
201				.get(frame_support::dispatch::DispatchClass::Normal)
202				.max_extrinsic
203				.unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
204				.proof_size()
205				> 4177
206		);
207	}
208	#[test]
209	fn test_add_ipfs_message() {
210		assert!(
211			BlockWeights::get()
212				.per_class
213				.get(frame_support::dispatch::DispatchClass::Normal)
214				.max_extrinsic
215				.unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
216				.proof_size()
217				> 4008
218		);
219	}
220	#[test]
221	fn test_v2_to_v3_step() {
222		assert!(
223			BlockWeights::get()
224				.per_class
225				.get(frame_support::dispatch::DispatchClass::Normal)
226				.max_extrinsic
227				.unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
228				.proof_size()
229				> 9548
230		);
231	}
232	#[test]
233	fn test_v2_to_v3_final_step() {
234		assert!(
235			BlockWeights::get()
236				.per_class
237				.get(frame_support::dispatch::DispatchClass::Normal)
238				.max_extrinsic
239				.unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
240				.proof_size()
241				> 3960
242		);
243	}
244}