pallet_capacity/weights.rs
1
2//! Autogenerated weights for `pallet_capacity`
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_capacity
15// --extrinsic
16// *
17// --heap-pages=4096
18// --steps=20
19// --repeat=10
20// --output=./scripts/../pallets/capacity/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_capacity`.
35pub trait WeightInfo {
36 fn stake() -> Weight;
37 fn withdraw_unstaked() -> Weight;
38 fn start_new_epoch_if_needed() -> Weight;
39 fn start_new_reward_era_if_needed() -> Weight;
40 fn unstake() -> Weight;
41 fn set_epoch_length() -> Weight;
42 fn change_staking_target() -> Weight;
43 fn provider_boost() -> Weight;
44 fn claim_staking_rewards() -> Weight;
45}
46
47/// Weights for `pallet_capacity` using the Substrate node and recommended hardware.
48pub struct SubstrateWeight<T>(PhantomData<T>);
49impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
50 /// Storage: `Msa::ProviderToRegistryEntry` (r:1 w:0)
51 /// Proof: `Msa::ProviderToRegistryEntry` (`max_values`: None, `max_size`: Some(33), added: 2508, mode: `MaxEncodedLen`)
52 /// Storage: `Capacity::StakingAccountLedger` (r:1 w:1)
53 /// Proof: `Capacity::StakingAccountLedger` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
54 /// Storage: `Capacity::UnstakeUnlocks` (r:1 w:0)
55 /// Proof: `Capacity::UnstakeUnlocks` (`max_values`: None, `max_size`: Some(121), added: 2596, mode: `MaxEncodedLen`)
56 /// Storage: `Capacity::StakingTargetLedger` (r:1 w:1)
57 /// Proof: `Capacity::StakingTargetLedger` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
58 /// Storage: `Capacity::CapacityLedger` (r:1 w:1)
59 /// Proof: `Capacity::CapacityLedger` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
60 /// Storage: `Balances::Freezes` (r:1 w:1)
61 /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`)
62 /// Storage: `Balances::Locks` (r:1 w:0)
63 /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
64 fn stake() -> Weight {
65 // Proof Size summary in bytes:
66 // Measured: `106`
67 // Estimated: `5259`
68 // Minimum execution time: 50_689_000 picoseconds.
69 Weight::from_parts(52_140_000, 5259)
70 .saturating_add(T::DbWeight::get().reads(7_u64))
71 .saturating_add(T::DbWeight::get().writes(4_u64))
72 }
73 /// Storage: `Capacity::UnstakeUnlocks` (r:1 w:1)
74 /// Proof: `Capacity::UnstakeUnlocks` (`max_values`: None, `max_size`: Some(121), added: 2596, mode: `MaxEncodedLen`)
75 /// Storage: `Capacity::StakingAccountLedger` (r:1 w:0)
76 /// Proof: `Capacity::StakingAccountLedger` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
77 /// Storage: `Balances::Freezes` (r:1 w:1)
78 /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`)
79 /// Storage: `Balances::Locks` (r:1 w:0)
80 /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
81 fn withdraw_unstaked() -> Weight {
82 // Proof Size summary in bytes:
83 // Measured: `155`
84 // Estimated: `5259`
85 // Minimum execution time: 29_050_000 picoseconds.
86 Weight::from_parts(30_085_000, 5259)
87 .saturating_add(T::DbWeight::get().reads(4_u64))
88 .saturating_add(T::DbWeight::get().writes(2_u64))
89 }
90 /// Storage: `Capacity::CurrentEpochInfo` (r:1 w:1)
91 /// Proof: `Capacity::CurrentEpochInfo` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
92 /// Storage: `Capacity::EpochLength` (r:1 w:0)
93 /// Proof: `Capacity::EpochLength` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
94 fn start_new_epoch_if_needed() -> Weight {
95 // Proof Size summary in bytes:
96 // Measured: `0`
97 // Estimated: `1984`
98 // Minimum execution time: 2_708_000 picoseconds.
99 Weight::from_parts(2_916_000, 1984)
100 .saturating_add(T::DbWeight::get().reads(2_u64))
101 .saturating_add(T::DbWeight::get().writes(1_u64))
102 }
103 /// Storage: `Capacity::CurrentEraProviderBoostTotal` (r:1 w:0)
104 /// Proof: `Capacity::CurrentEraProviderBoostTotal` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
105 /// Storage: `Capacity::ProviderBoostRewardPools` (r:1 w:1)
106 /// Proof: `Capacity::ProviderBoostRewardPools` (`max_values`: None, `max_size`: Some(113), added: 2588, mode: `MaxEncodedLen`)
107 fn start_new_reward_era_if_needed() -> Weight {
108 // Proof Size summary in bytes:
109 // Measured: `229`
110 // Estimated: `4073`
111 // Minimum execution time: 8_920_000 picoseconds.
112 Weight::from_parts(9_180_000, 4073)
113 .saturating_add(T::DbWeight::get().reads(2_u64))
114 .saturating_add(T::DbWeight::get().writes(1_u64))
115 }
116 /// Storage: `Capacity::ProviderBoostHistories` (r:1 w:1)
117 /// Proof: `Capacity::ProviderBoostHistories` (`max_values`: None, `max_size`: Some(641), added: 3116, mode: `MaxEncodedLen`)
118 /// Storage: `Capacity::StakingAccountLedger` (r:1 w:1)
119 /// Proof: `Capacity::StakingAccountLedger` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
120 /// Storage: `Capacity::CurrentEraProviderBoostTotal` (r:1 w:1)
121 /// Proof: `Capacity::CurrentEraProviderBoostTotal` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
122 /// Storage: `Capacity::UnstakeUnlocks` (r:1 w:1)
123 /// Proof: `Capacity::UnstakeUnlocks` (`max_values`: None, `max_size`: Some(121), added: 2596, mode: `MaxEncodedLen`)
124 /// Storage: `Capacity::StakingTargetLedger` (r:1 w:1)
125 /// Proof: `Capacity::StakingTargetLedger` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
126 /// Storage: `Capacity::CapacityLedger` (r:1 w:1)
127 /// Proof: `Capacity::CapacityLedger` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
128 fn unstake() -> Weight {
129 // Proof Size summary in bytes:
130 // Measured: `359`
131 // Estimated: `4601`
132 // Minimum execution time: 41_448_000 picoseconds.
133 Weight::from_parts(42_858_000, 4601)
134 .saturating_add(T::DbWeight::get().reads(6_u64))
135 .saturating_add(T::DbWeight::get().writes(6_u64))
136 }
137 /// Storage: `Capacity::EpochLength` (r:0 w:1)
138 /// Proof: `Capacity::EpochLength` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
139 fn set_epoch_length() -> Weight {
140 // Proof Size summary in bytes:
141 // Measured: `0`
142 // Estimated: `0`
143 // Minimum execution time: 5_353_000 picoseconds.
144 Weight::from_parts(5_751_000, 0)
145 .saturating_add(T::DbWeight::get().writes(1_u64))
146 }
147 /// Storage: `Capacity::Retargets` (r:1 w:1)
148 /// Proof: `Capacity::Retargets` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
149 /// Storage: `Msa::ProviderToRegistryEntry` (r:1 w:0)
150 /// Proof: `Msa::ProviderToRegistryEntry` (`max_values`: None, `max_size`: Some(33), added: 2508, mode: `MaxEncodedLen`)
151 /// Storage: `Capacity::StakingAccountLedger` (r:1 w:0)
152 /// Proof: `Capacity::StakingAccountLedger` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
153 /// Storage: `Capacity::StakingTargetLedger` (r:2 w:2)
154 /// Proof: `Capacity::StakingTargetLedger` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
155 /// Storage: `Capacity::CapacityLedger` (r:2 w:2)
156 /// Proof: `Capacity::CapacityLedger` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
157 fn change_staking_target() -> Weight {
158 // Proof Size summary in bytes:
159 // Measured: `353`
160 // Estimated: `6611`
161 // Minimum execution time: 43_021_000 picoseconds.
162 Weight::from_parts(44_736_000, 6611)
163 .saturating_add(T::DbWeight::get().reads(7_u64))
164 .saturating_add(T::DbWeight::get().writes(5_u64))
165 }
166 /// Storage: `Msa::ProviderToRegistryEntry` (r:1 w:0)
167 /// Proof: `Msa::ProviderToRegistryEntry` (`max_values`: None, `max_size`: Some(33), added: 2508, mode: `MaxEncodedLen`)
168 /// Storage: `Capacity::StakingAccountLedger` (r:1 w:1)
169 /// Proof: `Capacity::StakingAccountLedger` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
170 /// Storage: `Capacity::UnstakeUnlocks` (r:1 w:0)
171 /// Proof: `Capacity::UnstakeUnlocks` (`max_values`: None, `max_size`: Some(121), added: 2596, mode: `MaxEncodedLen`)
172 /// Storage: `Balances::Freezes` (r:1 w:1)
173 /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`)
174 /// Storage: `Balances::Locks` (r:1 w:0)
175 /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
176 /// Storage: `Capacity::StakingTargetLedger` (r:1 w:1)
177 /// Proof: `Capacity::StakingTargetLedger` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
178 /// Storage: `Capacity::CapacityLedger` (r:1 w:1)
179 /// Proof: `Capacity::CapacityLedger` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
180 /// Storage: `Capacity::ProviderBoostHistories` (r:1 w:1)
181 /// Proof: `Capacity::ProviderBoostHistories` (`max_values`: None, `max_size`: Some(641), added: 3116, mode: `MaxEncodedLen`)
182 /// Storage: `Capacity::CurrentEraProviderBoostTotal` (r:1 w:1)
183 /// Proof: `Capacity::CurrentEraProviderBoostTotal` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
184 fn provider_boost() -> Weight {
185 // Proof Size summary in bytes:
186 // Measured: `143`
187 // Estimated: `5259`
188 // Minimum execution time: 56_595_000 picoseconds.
189 Weight::from_parts(58_170_000, 5259)
190 .saturating_add(T::DbWeight::get().reads(9_u64))
191 .saturating_add(T::DbWeight::get().writes(6_u64))
192 }
193 /// Storage: `Capacity::ProviderBoostHistories` (r:1 w:1)
194 /// Proof: `Capacity::ProviderBoostHistories` (`max_values`: None, `max_size`: Some(641), added: 3116, mode: `MaxEncodedLen`)
195 /// Storage: `Capacity::ProviderBoostRewardPools` (r:6 w:0)
196 /// Proof: `Capacity::ProviderBoostRewardPools` (`max_values`: None, `max_size`: Some(113), added: 2588, mode: `MaxEncodedLen`)
197 fn claim_staking_rewards() -> Weight {
198 // Proof Size summary in bytes:
199 // Measured: `1516`
200 // Estimated: `17013`
201 // Minimum execution time: 130_236_000 picoseconds.
202 Weight::from_parts(135_218_000, 17013)
203 .saturating_add(T::DbWeight::get().reads(7_u64))
204 .saturating_add(T::DbWeight::get().writes(1_u64))
205 }
206}
207
208// For backwards compatibility and tests.
209impl WeightInfo for () {
210 /// Storage: `Msa::ProviderToRegistryEntry` (r:1 w:0)
211 /// Proof: `Msa::ProviderToRegistryEntry` (`max_values`: None, `max_size`: Some(33), added: 2508, mode: `MaxEncodedLen`)
212 /// Storage: `Capacity::StakingAccountLedger` (r:1 w:1)
213 /// Proof: `Capacity::StakingAccountLedger` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
214 /// Storage: `Capacity::UnstakeUnlocks` (r:1 w:0)
215 /// Proof: `Capacity::UnstakeUnlocks` (`max_values`: None, `max_size`: Some(121), added: 2596, mode: `MaxEncodedLen`)
216 /// Storage: `Capacity::StakingTargetLedger` (r:1 w:1)
217 /// Proof: `Capacity::StakingTargetLedger` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
218 /// Storage: `Capacity::CapacityLedger` (r:1 w:1)
219 /// Proof: `Capacity::CapacityLedger` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
220 /// Storage: `Balances::Freezes` (r:1 w:1)
221 /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`)
222 /// Storage: `Balances::Locks` (r:1 w:0)
223 /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
224 fn stake() -> Weight {
225 // Proof Size summary in bytes:
226 // Measured: `106`
227 // Estimated: `5259`
228 // Minimum execution time: 50_689_000 picoseconds.
229 Weight::from_parts(52_140_000, 5259)
230 .saturating_add(RocksDbWeight::get().reads(7_u64))
231 .saturating_add(RocksDbWeight::get().writes(4_u64))
232 }
233 /// Storage: `Capacity::UnstakeUnlocks` (r:1 w:1)
234 /// Proof: `Capacity::UnstakeUnlocks` (`max_values`: None, `max_size`: Some(121), added: 2596, mode: `MaxEncodedLen`)
235 /// Storage: `Capacity::StakingAccountLedger` (r:1 w:0)
236 /// Proof: `Capacity::StakingAccountLedger` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
237 /// Storage: `Balances::Freezes` (r:1 w:1)
238 /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`)
239 /// Storage: `Balances::Locks` (r:1 w:0)
240 /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
241 fn withdraw_unstaked() -> Weight {
242 // Proof Size summary in bytes:
243 // Measured: `155`
244 // Estimated: `5259`
245 // Minimum execution time: 29_050_000 picoseconds.
246 Weight::from_parts(30_085_000, 5259)
247 .saturating_add(RocksDbWeight::get().reads(4_u64))
248 .saturating_add(RocksDbWeight::get().writes(2_u64))
249 }
250 /// Storage: `Capacity::CurrentEpochInfo` (r:1 w:1)
251 /// Proof: `Capacity::CurrentEpochInfo` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
252 /// Storage: `Capacity::EpochLength` (r:1 w:0)
253 /// Proof: `Capacity::EpochLength` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
254 fn start_new_epoch_if_needed() -> Weight {
255 // Proof Size summary in bytes:
256 // Measured: `0`
257 // Estimated: `1984`
258 // Minimum execution time: 2_708_000 picoseconds.
259 Weight::from_parts(2_916_000, 1984)
260 .saturating_add(RocksDbWeight::get().reads(2_u64))
261 .saturating_add(RocksDbWeight::get().writes(1_u64))
262 }
263 /// Storage: `Capacity::CurrentEraProviderBoostTotal` (r:1 w:0)
264 /// Proof: `Capacity::CurrentEraProviderBoostTotal` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
265 /// Storage: `Capacity::ProviderBoostRewardPools` (r:1 w:1)
266 /// Proof: `Capacity::ProviderBoostRewardPools` (`max_values`: None, `max_size`: Some(113), added: 2588, mode: `MaxEncodedLen`)
267 fn start_new_reward_era_if_needed() -> Weight {
268 // Proof Size summary in bytes:
269 // Measured: `229`
270 // Estimated: `4073`
271 // Minimum execution time: 8_920_000 picoseconds.
272 Weight::from_parts(9_180_000, 4073)
273 .saturating_add(RocksDbWeight::get().reads(2_u64))
274 .saturating_add(RocksDbWeight::get().writes(1_u64))
275 }
276 /// Storage: `Capacity::ProviderBoostHistories` (r:1 w:1)
277 /// Proof: `Capacity::ProviderBoostHistories` (`max_values`: None, `max_size`: Some(641), added: 3116, mode: `MaxEncodedLen`)
278 /// Storage: `Capacity::StakingAccountLedger` (r:1 w:1)
279 /// Proof: `Capacity::StakingAccountLedger` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
280 /// Storage: `Capacity::CurrentEraProviderBoostTotal` (r:1 w:1)
281 /// Proof: `Capacity::CurrentEraProviderBoostTotal` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
282 /// Storage: `Capacity::UnstakeUnlocks` (r:1 w:1)
283 /// Proof: `Capacity::UnstakeUnlocks` (`max_values`: None, `max_size`: Some(121), added: 2596, mode: `MaxEncodedLen`)
284 /// Storage: `Capacity::StakingTargetLedger` (r:1 w:1)
285 /// Proof: `Capacity::StakingTargetLedger` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
286 /// Storage: `Capacity::CapacityLedger` (r:1 w:1)
287 /// Proof: `Capacity::CapacityLedger` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
288 fn unstake() -> Weight {
289 // Proof Size summary in bytes:
290 // Measured: `359`
291 // Estimated: `4601`
292 // Minimum execution time: 41_448_000 picoseconds.
293 Weight::from_parts(42_858_000, 4601)
294 .saturating_add(RocksDbWeight::get().reads(6_u64))
295 .saturating_add(RocksDbWeight::get().writes(6_u64))
296 }
297 /// Storage: `Capacity::EpochLength` (r:0 w:1)
298 /// Proof: `Capacity::EpochLength` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
299 fn set_epoch_length() -> Weight {
300 // Proof Size summary in bytes:
301 // Measured: `0`
302 // Estimated: `0`
303 // Minimum execution time: 5_353_000 picoseconds.
304 Weight::from_parts(5_751_000, 0)
305 .saturating_add(RocksDbWeight::get().writes(1_u64))
306 }
307 /// Storage: `Capacity::Retargets` (r:1 w:1)
308 /// Proof: `Capacity::Retargets` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
309 /// Storage: `Msa::ProviderToRegistryEntry` (r:1 w:0)
310 /// Proof: `Msa::ProviderToRegistryEntry` (`max_values`: None, `max_size`: Some(33), added: 2508, mode: `MaxEncodedLen`)
311 /// Storage: `Capacity::StakingAccountLedger` (r:1 w:0)
312 /// Proof: `Capacity::StakingAccountLedger` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
313 /// Storage: `Capacity::StakingTargetLedger` (r:2 w:2)
314 /// Proof: `Capacity::StakingTargetLedger` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
315 /// Storage: `Capacity::CapacityLedger` (r:2 w:2)
316 /// Proof: `Capacity::CapacityLedger` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
317 fn change_staking_target() -> Weight {
318 // Proof Size summary in bytes:
319 // Measured: `353`
320 // Estimated: `6611`
321 // Minimum execution time: 43_021_000 picoseconds.
322 Weight::from_parts(44_736_000, 6611)
323 .saturating_add(RocksDbWeight::get().reads(7_u64))
324 .saturating_add(RocksDbWeight::get().writes(5_u64))
325 }
326 /// Storage: `Msa::ProviderToRegistryEntry` (r:1 w:0)
327 /// Proof: `Msa::ProviderToRegistryEntry` (`max_values`: None, `max_size`: Some(33), added: 2508, mode: `MaxEncodedLen`)
328 /// Storage: `Capacity::StakingAccountLedger` (r:1 w:1)
329 /// Proof: `Capacity::StakingAccountLedger` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)
330 /// Storage: `Capacity::UnstakeUnlocks` (r:1 w:0)
331 /// Proof: `Capacity::UnstakeUnlocks` (`max_values`: None, `max_size`: Some(121), added: 2596, mode: `MaxEncodedLen`)
332 /// Storage: `Balances::Freezes` (r:1 w:1)
333 /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`)
334 /// Storage: `Balances::Locks` (r:1 w:0)
335 /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
336 /// Storage: `Capacity::StakingTargetLedger` (r:1 w:1)
337 /// Proof: `Capacity::StakingTargetLedger` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
338 /// Storage: `Capacity::CapacityLedger` (r:1 w:1)
339 /// Proof: `Capacity::CapacityLedger` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
340 /// Storage: `Capacity::ProviderBoostHistories` (r:1 w:1)
341 /// Proof: `Capacity::ProviderBoostHistories` (`max_values`: None, `max_size`: Some(641), added: 3116, mode: `MaxEncodedLen`)
342 /// Storage: `Capacity::CurrentEraProviderBoostTotal` (r:1 w:1)
343 /// Proof: `Capacity::CurrentEraProviderBoostTotal` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
344 fn provider_boost() -> Weight {
345 // Proof Size summary in bytes:
346 // Measured: `143`
347 // Estimated: `5259`
348 // Minimum execution time: 56_595_000 picoseconds.
349 Weight::from_parts(58_170_000, 5259)
350 .saturating_add(RocksDbWeight::get().reads(9_u64))
351 .saturating_add(RocksDbWeight::get().writes(6_u64))
352 }
353 /// Storage: `Capacity::ProviderBoostHistories` (r:1 w:1)
354 /// Proof: `Capacity::ProviderBoostHistories` (`max_values`: None, `max_size`: Some(641), added: 3116, mode: `MaxEncodedLen`)
355 /// Storage: `Capacity::ProviderBoostRewardPools` (r:6 w:0)
356 /// Proof: `Capacity::ProviderBoostRewardPools` (`max_values`: None, `max_size`: Some(113), added: 2588, mode: `MaxEncodedLen`)
357 fn claim_staking_rewards() -> Weight {
358 // Proof Size summary in bytes:
359 // Measured: `1516`
360 // Estimated: `17013`
361 // Minimum execution time: 130_236_000 picoseconds.
362 Weight::from_parts(135_218_000, 17013)
363 .saturating_add(RocksDbWeight::get().reads(7_u64))
364 .saturating_add(RocksDbWeight::get().writes(1_u64))
365 }
366}
367
368
369#[cfg(test)]
370mod tests {
371 use frame_support::{traits::Get, weights::Weight, dispatch::DispatchClass};
372 use common_runtime::constants::{MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO};
373 use common_runtime::weights::extrinsic_weights::ExtrinsicBaseWeight;
374
375 #[allow(dead_code)]
376 struct BlockWeights;
377 impl Get<frame_system::limits::BlockWeights> for BlockWeights {
378 fn get() -> frame_system::limits::BlockWeights {
379 frame_system::limits::BlockWeights::builder()
380 .base_block(Weight::zero())
381 .for_class(DispatchClass::all(), |weights| {
382 weights.base_extrinsic = ExtrinsicBaseWeight::get();
383 })
384 .for_class(DispatchClass::non_mandatory(), |weights| {
385 weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
386 })
387 .build_or_panic()
388 }
389 }
390
391 #[test]
392 fn test_stake() {
393 assert!(
394 BlockWeights::get()
395 .per_class
396 .get(frame_support::dispatch::DispatchClass::Normal)
397 .max_extrinsic
398 .unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
399 .proof_size()
400 > 5259
401 );
402 }
403 #[test]
404 fn test_withdraw_unstaked() {
405 assert!(
406 BlockWeights::get()
407 .per_class
408 .get(frame_support::dispatch::DispatchClass::Normal)
409 .max_extrinsic
410 .unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
411 .proof_size()
412 > 5259
413 );
414 }
415 #[test]
416 fn test_start_new_epoch_if_needed() {
417 assert!(
418 BlockWeights::get()
419 .per_class
420 .get(frame_support::dispatch::DispatchClass::Normal)
421 .max_extrinsic
422 .unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
423 .proof_size()
424 > 1984
425 );
426 }
427 #[test]
428 fn test_start_new_reward_era_if_needed() {
429 assert!(
430 BlockWeights::get()
431 .per_class
432 .get(frame_support::dispatch::DispatchClass::Normal)
433 .max_extrinsic
434 .unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
435 .proof_size()
436 > 4073
437 );
438 }
439 #[test]
440 fn test_unstake() {
441 assert!(
442 BlockWeights::get()
443 .per_class
444 .get(frame_support::dispatch::DispatchClass::Normal)
445 .max_extrinsic
446 .unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
447 .proof_size()
448 > 4601
449 );
450 }
451 #[test]
452 fn test_change_staking_target() {
453 assert!(
454 BlockWeights::get()
455 .per_class
456 .get(frame_support::dispatch::DispatchClass::Normal)
457 .max_extrinsic
458 .unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
459 .proof_size()
460 > 6611
461 );
462 }
463 #[test]
464 fn test_provider_boost() {
465 assert!(
466 BlockWeights::get()
467 .per_class
468 .get(frame_support::dispatch::DispatchClass::Normal)
469 .max_extrinsic
470 .unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
471 .proof_size()
472 > 5259
473 );
474 }
475 #[test]
476 fn test_claim_staking_rewards() {
477 assert!(
478 BlockWeights::get()
479 .per_class
480 .get(frame_support::dispatch::DispatchClass::Normal)
481 .max_extrinsic
482 .unwrap_or_else(<Weight as sp_runtime::traits::Bounded>::max_value)
483 .proof_size()
484 > 17013
485 );
486 }
487}