1
// Copyright (C) Moondance Labs Ltd.
2
// This file is part of Tanssi.
3

            
4
// Tanssi is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8

            
9
// Tanssi is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13

            
14
// You should have received a copy of the GNU General Public License
15
// along with Tanssi.  If not, see <http://www.gnu.org/licenses/>
16

            
17

            
18
//! Autogenerated weights for pallet_pooled_staking
19
//!
20
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
21
//! DATE: 2023-10-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
22
//! WORST CASE MAP SIZE: `1000000`
23
//! HOSTNAME: `pop-os`, CPU: `12th Gen Intel(R) Core(TM) i7-1260P`
24
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
25

            
26
// Executed Command:
27
// ./target/release/tanssi-node
28
// benchmark
29
// pallet
30
// --execution=wasm
31
// --wasm-execution=compiled
32
// --pallet
33
// pallet-pooled-staking
34
// --extrinsic
35
// *
36
// --steps
37
// 50
38
// --repeat
39
// 20
40
// --template=./benchmarking/frame-weight-template.hbs
41
// --json-file
42
// raw.json
43
// --output
44
// weights.rs
45

            
46
#![cfg_attr(rustfmt, rustfmt_skip)]
47
#![allow(unused_parens)]
48
#![allow(unused_imports)]
49

            
50
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
51
use sp_std::marker::PhantomData;
52

            
53
/// Weight functions needed for pallet_pooled_staking.
54
pub trait WeightInfo {
55
	fn request_delegate() -> Weight;
56
	fn execute_pending_operations(b: u32, ) -> Weight;
57
	fn request_undelegate() -> Weight;
58
	fn claim_manual_rewards(b: u32, ) -> Weight;
59
	fn rebalance_hold() -> Weight;
60
	fn update_candidate_position(b: u32, ) -> Weight;
61
	fn swap_pool() -> Weight;
62
	fn distribute_rewards() -> Weight;
63
}
64

            
65
/// Weights for pallet_pooled_staking using the Substrate node and recommended hardware.
66
pub struct SubstrateWeight<T>(PhantomData<T>);
67
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
68
	/// Storage: PooledStaking Pools (r:11 w:5)
69
	/// Proof Skipped: PooledStaking Pools (max_values: None, max_size: None, mode: Measured)
70
	/// Storage: System Account (r:1 w:1)
71
	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
72
	/// Storage: Balances Holds (r:1 w:1)
73
	/// Proof: Balances Holds (max_values: None, max_size: Some(66), added: 2541, mode: MaxEncodedLen)
74
	/// Storage: PooledStaking SortedEligibleCandidates (r:1 w:1)
75
	/// Proof Skipped: PooledStaking SortedEligibleCandidates (max_values: Some(1), max_size: None, mode: Measured)
76
	/// Storage: Session NextKeys (r:1 w:0)
77
	/// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured)
78
	/// Storage: Session CurrentIndex (r:1 w:0)
79
	/// Proof Skipped: Session CurrentIndex (max_values: Some(1), max_size: None, mode: Measured)
80
	/// Storage: PooledStaking PendingOperations (r:1 w:1)
81
	/// Proof Skipped: PooledStaking PendingOperations (max_values: None, max_size: None, mode: Measured)
82
	fn request_delegate() -> Weight {
83
		// Proof Size summary in bytes:
84
		//  Measured:  `1321`
85
		//  Estimated: `29536`
86
		// Minimum execution time: 127_339_000 picoseconds.
87
		Weight::from_parts(133_146_000, 29536)
88
			.saturating_add(T::DbWeight::get().reads(17_u64))
89
			.saturating_add(T::DbWeight::get().writes(9_u64))
90
	}
91
	/// Storage: PooledStaking PendingOperations (r:100 w:100)
92
	/// Proof Skipped: PooledStaking PendingOperations (max_values: None, max_size: None, mode: Measured)
93
	/// Storage: Session CurrentIndex (r:1 w:0)
94
	/// Proof Skipped: Session CurrentIndex (max_values: Some(1), max_size: None, mode: Measured)
95
	/// Storage: PooledStaking Pools (r:1000 w:800)
96
	/// Proof Skipped: PooledStaking Pools (max_values: None, max_size: None, mode: Measured)
97
	/// Storage: Balances Holds (r:1 w:1)
98
	/// Proof: Balances Holds (max_values: None, max_size: Some(66), added: 2541, mode: MaxEncodedLen)
99
	/// Storage: System Account (r:1 w:1)
100
	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
101
	/// The range of component `b` is `[1, 100]`.
102
	fn execute_pending_operations(b: u32, ) -> Weight {
103
		// Proof Size summary in bytes:
104
		//  Measured:  `543 + b * (390 ±0)`
105
		//  Estimated: `3593 + b * (25141 ±0)`
106
		// Minimum execution time: 89_544_000 picoseconds.
107
		Weight::from_parts(91_417_000, 3593)
108
			// Standard Error: 630_031
109
			.saturating_add(Weight::from_parts(99_103_944, 0).saturating_mul(b.into()))
110
			.saturating_add(T::DbWeight::get().reads(3_u64))
111
			.saturating_add(T::DbWeight::get().reads((11_u64).saturating_mul(b.into())))
112
			.saturating_add(T::DbWeight::get().writes(2_u64))
113
			.saturating_add(T::DbWeight::get().writes((9_u64).saturating_mul(b.into())))
114
			.saturating_add(Weight::from_parts(0, 25141).saturating_mul(b.into()))
115
	}
116
	/// Storage: PooledStaking Pools (r:13 w:9)
117
	/// Proof Skipped: PooledStaking Pools (max_values: None, max_size: None, mode: Measured)
118
	/// Storage: PooledStaking SortedEligibleCandidates (r:1 w:1)
119
	/// Proof Skipped: PooledStaking SortedEligibleCandidates (max_values: Some(1), max_size: None, mode: Measured)
120
	/// Storage: Session CurrentIndex (r:1 w:0)
121
	/// Proof Skipped: Session CurrentIndex (max_values: Some(1), max_size: None, mode: Measured)
122
	/// Storage: PooledStaking PendingOperations (r:1 w:1)
123
	/// Proof Skipped: PooledStaking PendingOperations (max_values: None, max_size: None, mode: Measured)
124
	fn request_undelegate() -> Weight {
125
		// Proof Size summary in bytes:
126
		//  Measured:  `724`
127
		//  Estimated: `33889`
128
		// Minimum execution time: 111_997_000 picoseconds.
129
		Weight::from_parts(124_683_000, 33889)
130
			.saturating_add(T::DbWeight::get().reads(16_u64))
131
			.saturating_add(T::DbWeight::get().writes(11_u64))
132
	}
133
	/// Storage: PooledStaking Pools (r:300 w:100)
134
	/// Proof Skipped: PooledStaking Pools (max_values: None, max_size: None, mode: Measured)
135
	/// Storage: System Account (r:2 w:2)
136
	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
137
	/// The range of component `b` is `[1, 100]`.
138
	fn claim_manual_rewards(b: u32, ) -> Weight {
139
		// Proof Size summary in bytes:
140
		//  Measured:  `360 + b * (456 ±0)`
141
		//  Estimated: `6196 + b * (7882 ±0)`
142
		// Minimum execution time: 57_580_000 picoseconds.
143
		Weight::from_parts(60_814_000, 6196)
144
			// Standard Error: 421_370
145
			.saturating_add(Weight::from_parts(55_273_020, 0).saturating_mul(b.into()))
146
			.saturating_add(T::DbWeight::get().reads(2_u64))
147
			.saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(b.into())))
148
			.saturating_add(T::DbWeight::get().writes(2_u64))
149
			.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(b.into())))
150
			.saturating_add(Weight::from_parts(0, 7882).saturating_mul(b.into()))
151
	}
152
	/// Storage: PooledStaking Pools (r:4 w:1)
153
	/// Proof Skipped: PooledStaking Pools (max_values: None, max_size: None, mode: Measured)
154
	/// Storage: System Account (r:2 w:2)
155
	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
156
	/// Storage: Balances Holds (r:1 w:1)
157
	/// Proof: Balances Holds (max_values: None, max_size: Some(66), added: 2541, mode: MaxEncodedLen)
158
	fn rebalance_hold() -> Weight {
159
		// Proof Size summary in bytes:
160
		//  Measured:  `980`
161
		//  Estimated: `11870`
162
		// Minimum execution time: 98_014_000 picoseconds.
163
		Weight::from_parts(128_615_000, 11870)
164
			.saturating_add(T::DbWeight::get().reads(7_u64))
165
			.saturating_add(T::DbWeight::get().writes(4_u64))
166
	}
167
	/// Storage: PooledStaking Pools (r:600 w:100)
168
	/// Proof Skipped: PooledStaking Pools (max_values: None, max_size: None, mode: Measured)
169
	/// Storage: PooledStaking SortedEligibleCandidates (r:1 w:1)
170
	/// Proof Skipped: PooledStaking SortedEligibleCandidates (max_values: Some(1), max_size: None, mode: Measured)
171
	/// Storage: Session NextKeys (r:100 w:0)
172
	/// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured)
173
	/// The range of component `b` is `[1, 100]`.
174
	fn update_candidate_position(b: u32, ) -> Weight {
175
		// Proof Size summary in bytes:
176
		//  Measured:  `399 + b * (356 ±0)`
177
		//  Estimated: `1881 + b * (15206 ±0)`
178
		// Minimum execution time: 46_082_000 picoseconds.
179
		Weight::from_parts(60_293_000, 1881)
180
			// Standard Error: 131_937
181
			.saturating_add(Weight::from_parts(35_500_124, 0).saturating_mul(b.into()))
182
			.saturating_add(T::DbWeight::get().reads(1_u64))
183
			.saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(b.into())))
184
			.saturating_add(T::DbWeight::get().writes(1_u64))
185
			.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(b.into())))
186
			.saturating_add(Weight::from_parts(0, 15206).saturating_mul(b.into()))
187
	}
188
	/// Storage: PooledStaking Pools (r:12 w:8)
189
	/// Proof Skipped: PooledStaking Pools (max_values: None, max_size: None, mode: Measured)
190
	fn swap_pool() -> Weight {
191
		// Proof Size summary in bytes:
192
		//  Measured:  `478`
193
		//  Estimated: `31168`
194
		// Minimum execution time: 80_829_000 picoseconds.
195
		Weight::from_parts(97_569_000, 31168)
196
			.saturating_add(T::DbWeight::get().reads(12_u64))
197
			.saturating_add(T::DbWeight::get().writes(8_u64))
198
	}
199
	/// Storage: PooledStaking Pools (r:9 w:5)
200
	/// Proof Skipped: PooledStaking Pools (max_values: None, max_size: None, mode: Measured)
201
	/// Storage: PooledStaking SortedEligibleCandidates (r:1 w:1)
202
	/// Proof Skipped: PooledStaking SortedEligibleCandidates (max_values: Some(1), max_size: None, mode: Measured)
203
	/// Storage: Session NextKeys (r:1 w:0)
204
	/// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured)
205
	/// Storage: System Account (r:2 w:2)
206
	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
207
	fn distribute_rewards() -> Weight {
208
		// Proof Size summary in bytes:
209
		//  Measured:  `1302`
210
		//  Estimated: `24567`
211
		// Minimum execution time: 151_254_000 picoseconds.
212
		Weight::from_parts(178_410_000, 24567)
213
			.saturating_add(T::DbWeight::get().reads(13_u64))
214
			.saturating_add(T::DbWeight::get().writes(8_u64))
215
	}
216
}
217

            
218
// For backwards compatibility and tests
219
impl WeightInfo for () {
220
	/// Storage: PooledStaking Pools (r:11 w:5)
221
	/// Proof Skipped: PooledStaking Pools (max_values: None, max_size: None, mode: Measured)
222
	/// Storage: System Account (r:1 w:1)
223
	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
224
	/// Storage: Balances Holds (r:1 w:1)
225
	/// Proof: Balances Holds (max_values: None, max_size: Some(66), added: 2541, mode: MaxEncodedLen)
226
	/// Storage: PooledStaking SortedEligibleCandidates (r:1 w:1)
227
	/// Proof Skipped: PooledStaking SortedEligibleCandidates (max_values: Some(1), max_size: None, mode: Measured)
228
	/// Storage: Session NextKeys (r:1 w:0)
229
	/// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured)
230
	/// Storage: Session CurrentIndex (r:1 w:0)
231
	/// Proof Skipped: Session CurrentIndex (max_values: Some(1), max_size: None, mode: Measured)
232
	/// Storage: PooledStaking PendingOperations (r:1 w:1)
233
	/// Proof Skipped: PooledStaking PendingOperations (max_values: None, max_size: None, mode: Measured)
234
	fn request_delegate() -> Weight {
235
		// Proof Size summary in bytes:
236
		//  Measured:  `1321`
237
		//  Estimated: `29536`
238
		// Minimum execution time: 127_339_000 picoseconds.
239
		Weight::from_parts(133_146_000, 29536)
240
			.saturating_add(RocksDbWeight::get().reads(17_u64))
241
			.saturating_add(RocksDbWeight::get().writes(9_u64))
242
	}
243
	/// Storage: PooledStaking PendingOperations (r:100 w:100)
244
	/// Proof Skipped: PooledStaking PendingOperations (max_values: None, max_size: None, mode: Measured)
245
	/// Storage: Session CurrentIndex (r:1 w:0)
246
	/// Proof Skipped: Session CurrentIndex (max_values: Some(1), max_size: None, mode: Measured)
247
	/// Storage: PooledStaking Pools (r:1000 w:800)
248
	/// Proof Skipped: PooledStaking Pools (max_values: None, max_size: None, mode: Measured)
249
	/// Storage: Balances Holds (r:1 w:1)
250
	/// Proof: Balances Holds (max_values: None, max_size: Some(66), added: 2541, mode: MaxEncodedLen)
251
	/// Storage: System Account (r:1 w:1)
252
	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
253
	/// The range of component `b` is `[1, 100]`.
254
	fn execute_pending_operations(b: u32, ) -> Weight {
255
		// Proof Size summary in bytes:
256
		//  Measured:  `543 + b * (390 ±0)`
257
		//  Estimated: `3593 + b * (25141 ±0)`
258
		// Minimum execution time: 89_544_000 picoseconds.
259
		Weight::from_parts(91_417_000, 3593)
260
			// Standard Error: 630_031
261
			.saturating_add(Weight::from_parts(99_103_944, 0).saturating_mul(b.into()))
262
			.saturating_add(RocksDbWeight::get().reads(3_u64))
263
			.saturating_add(RocksDbWeight::get().reads((11_u64).saturating_mul(b.into())))
264
			.saturating_add(RocksDbWeight::get().writes(2_u64))
265
			.saturating_add(RocksDbWeight::get().writes((9_u64).saturating_mul(b.into())))
266
			.saturating_add(Weight::from_parts(0, 25141).saturating_mul(b.into()))
267
	}
268
	/// Storage: PooledStaking Pools (r:13 w:9)
269
	/// Proof Skipped: PooledStaking Pools (max_values: None, max_size: None, mode: Measured)
270
	/// Storage: PooledStaking SortedEligibleCandidates (r:1 w:1)
271
	/// Proof Skipped: PooledStaking SortedEligibleCandidates (max_values: Some(1), max_size: None, mode: Measured)
272
	/// Storage: Session CurrentIndex (r:1 w:0)
273
	/// Proof Skipped: Session CurrentIndex (max_values: Some(1), max_size: None, mode: Measured)
274
	/// Storage: PooledStaking PendingOperations (r:1 w:1)
275
	/// Proof Skipped: PooledStaking PendingOperations (max_values: None, max_size: None, mode: Measured)
276
	fn request_undelegate() -> Weight {
277
		// Proof Size summary in bytes:
278
		//  Measured:  `724`
279
		//  Estimated: `33889`
280
		// Minimum execution time: 111_997_000 picoseconds.
281
		Weight::from_parts(124_683_000, 33889)
282
			.saturating_add(RocksDbWeight::get().reads(16_u64))
283
			.saturating_add(RocksDbWeight::get().writes(11_u64))
284
	}
285
	/// Storage: PooledStaking Pools (r:300 w:100)
286
	/// Proof Skipped: PooledStaking Pools (max_values: None, max_size: None, mode: Measured)
287
	/// Storage: System Account (r:2 w:2)
288
	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
289
	/// The range of component `b` is `[1, 100]`.
290
	fn claim_manual_rewards(b: u32, ) -> Weight {
291
		// Proof Size summary in bytes:
292
		//  Measured:  `360 + b * (456 ±0)`
293
		//  Estimated: `6196 + b * (7882 ±0)`
294
		// Minimum execution time: 57_580_000 picoseconds.
295
		Weight::from_parts(60_814_000, 6196)
296
			// Standard Error: 421_370
297
			.saturating_add(Weight::from_parts(55_273_020, 0).saturating_mul(b.into()))
298
			.saturating_add(RocksDbWeight::get().reads(2_u64))
299
			.saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(b.into())))
300
			.saturating_add(RocksDbWeight::get().writes(2_u64))
301
			.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(b.into())))
302
			.saturating_add(Weight::from_parts(0, 7882).saturating_mul(b.into()))
303
	}
304
	/// Storage: PooledStaking Pools (r:4 w:1)
305
	/// Proof Skipped: PooledStaking Pools (max_values: None, max_size: None, mode: Measured)
306
	/// Storage: System Account (r:2 w:2)
307
	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
308
	/// Storage: Balances Holds (r:1 w:1)
309
	/// Proof: Balances Holds (max_values: None, max_size: Some(66), added: 2541, mode: MaxEncodedLen)
310
	fn rebalance_hold() -> Weight {
311
		// Proof Size summary in bytes:
312
		//  Measured:  `980`
313
		//  Estimated: `11870`
314
		// Minimum execution time: 98_014_000 picoseconds.
315
		Weight::from_parts(128_615_000, 11870)
316
			.saturating_add(RocksDbWeight::get().reads(7_u64))
317
			.saturating_add(RocksDbWeight::get().writes(4_u64))
318
	}
319
	/// Storage: PooledStaking Pools (r:600 w:100)
320
	/// Proof Skipped: PooledStaking Pools (max_values: None, max_size: None, mode: Measured)
321
	/// Storage: PooledStaking SortedEligibleCandidates (r:1 w:1)
322
	/// Proof Skipped: PooledStaking SortedEligibleCandidates (max_values: Some(1), max_size: None, mode: Measured)
323
	/// Storage: Session NextKeys (r:100 w:0)
324
	/// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured)
325
	/// The range of component `b` is `[1, 100]`.
326
	fn update_candidate_position(b: u32, ) -> Weight {
327
		// Proof Size summary in bytes:
328
		//  Measured:  `399 + b * (356 ±0)`
329
		//  Estimated: `1881 + b * (15206 ±0)`
330
		// Minimum execution time: 46_082_000 picoseconds.
331
		Weight::from_parts(60_293_000, 1881)
332
			// Standard Error: 131_937
333
			.saturating_add(Weight::from_parts(35_500_124, 0).saturating_mul(b.into()))
334
			.saturating_add(RocksDbWeight::get().reads(1_u64))
335
			.saturating_add(RocksDbWeight::get().reads((7_u64).saturating_mul(b.into())))
336
			.saturating_add(RocksDbWeight::get().writes(1_u64))
337
			.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(b.into())))
338
			.saturating_add(Weight::from_parts(0, 15206).saturating_mul(b.into()))
339
	}
340
	/// Storage: PooledStaking Pools (r:12 w:8)
341
	/// Proof Skipped: PooledStaking Pools (max_values: None, max_size: None, mode: Measured)
342
	fn swap_pool() -> Weight {
343
		// Proof Size summary in bytes:
344
		//  Measured:  `478`
345
		//  Estimated: `31168`
346
		// Minimum execution time: 80_829_000 picoseconds.
347
		Weight::from_parts(97_569_000, 31168)
348
			.saturating_add(RocksDbWeight::get().reads(12_u64))
349
			.saturating_add(RocksDbWeight::get().writes(8_u64))
350
	}
351
	/// Storage: PooledStaking Pools (r:9 w:5)
352
	/// Proof Skipped: PooledStaking Pools (max_values: None, max_size: None, mode: Measured)
353
	/// Storage: PooledStaking SortedEligibleCandidates (r:1 w:1)
354
	/// Proof Skipped: PooledStaking SortedEligibleCandidates (max_values: Some(1), max_size: None, mode: Measured)
355
	/// Storage: Session NextKeys (r:1 w:0)
356
	/// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured)
357
	/// Storage: System Account (r:2 w:2)
358
	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
359
9
	fn distribute_rewards() -> Weight {
360
9
		// Proof Size summary in bytes:
361
9
		//  Measured:  `1302`
362
9
		//  Estimated: `24567`
363
9
		// Minimum execution time: 151_254_000 picoseconds.
364
9
		Weight::from_parts(178_410_000, 24567)
365
9
			.saturating_add(RocksDbWeight::get().reads(13_u64))
366
9
			.saturating_add(RocksDbWeight::get().writes(8_u64))
367
9
	}
368
}